using System; using System.Data; using System.Collections.Generic; using System.Text; using DSWeb.MvcShipping.Models.MsCwDesign; using Microsoft.Practices.EnterpriseLibrary.Data; using DSWeb.Areas.CommMng.Models; using HcUtility.Comm; using System.Data.SqlClient; using DSWeb.DataAccess; using HcUtility.Core; using DSWeb.EntityDA; namespace DSWeb.MvcShipping.DAL.MsCwDesignDAL { public class MsCwDesignDAL { #region 查询 static public List GetDataList(string strCondition, string companyid) { var strSql = new StringBuilder(); strSql.Append("SELECT top 1 * from cw_design where 1=1"); if (!string.IsNullOrEmpty(strCondition)) { strSql.Append(" and " + strCondition); } return SetData(strSql); } static public MsCwDesign GetData(string strCondition, string companyid) { //调汇的默认科目 var strSql = new StringBuilder(); strSql.Append("SELECT top 1 * from cw_design where 1=1"); if (!string.IsNullOrEmpty(strCondition)) { strSql.Append(" and " + strCondition); } //期末调汇 var list = SetData(strSql); if (list.Count > 0) return list[0]; return new MsCwDesign(); } private static List SetData(StringBuilder strSql) { var headList = new List(); Database db = DatabaseFactory.CreateDatabase(); using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) { while (reader.Read()) { MsCwDesign data = new MsCwDesign(); #region Set DB data to Object data.GID = (reader["GID"] == null ? "" : Convert.ToString(reader["GID"]));//唯一编码 data.FSOFTCODE = (reader["FSOFTCODE"] == null ? 0 : Convert.ToInt32(reader["FSOFTCODE"]));//财务软件编码 data.TVW = (reader["TVW"] == null ? "" : Convert.ToString(reader["TVW"]));//转帐凭证字 data.CPVW = (reader["CPVW"] == null ? "" : Convert.ToString(reader["CPVW"]));//现金付款凭证字 data.CRTW = (reader["CRTW"] == null ? "" : Convert.ToString(reader["CRTW"]));//现金收款凭证字 data.BPVW = (reader["BPVW"] == null ? "" : Convert.ToString(reader["BPVW"]));//银行付款凭证字 data.BRTW = (reader["BRTW"] == null ? "" : Convert.ToString(reader["BRTW"]));//银行收款凭证字 data.ISTCOIIED = (reader["ISTCOIIED"] == null ? false : Convert.ToBoolean(reader["ISTCOIIED"]));//收入成本是否核算美元 data.ISUAPGE = (reader["ISUAPGE"] == null ? false : Convert.ToBoolean(reader["ISUAPGE"]));//使用核算项目生成分录 data.AMCODE = (reader["AMCODE"] == null ? 0 : Convert.ToInt32(reader["AMCODE"]));//核算办法 data.CANAME = (reader["CANAME"] == null ? "" : Convert.ToString(reader["CANAME"]));//客户核算名称 data.SANAME = (reader["SANAME"] == null ? "" : Convert.ToString(reader["SANAME"]));//供应商核算名称 data.DANAME = (reader["DANAME"] == null ? "" : Convert.ToString(reader["DANAME"]));//部门核算名称 data.PANAEM = (reader["PANAEM"] == null ? "" : Convert.ToString(reader["PANAEM"]));//人员核算名称 data.AFFIXNO = (reader["AFFIXNO"] == null ? 0 : Convert.ToInt32(reader["AFFIXNO"]));//附件数量 data.ISATTNOTCVVGV = (reader["ISATTNOTCVVGV"] == null ? false : Convert.ToBoolean(reader["ISATTNOTCVVGV"]));//根据船名航次生成凭证 data.ISATBGV = (reader["ISATBGV"] == null ? false : Convert.ToBoolean(reader["ISATBGV"]));//根据帐单生成凭证 data.ISMGSC = (reader["ISMGSC"] == null ? false : Convert.ToBoolean(reader["ISMGSC"]));//合并生成结算凭证 data.ISVBM = (reader["ISVBM"] == null ? false : Convert.ToBoolean(reader["ISVBM"]));//凭证禁止修改 data.ISCLIENTNAME = (reader["ISCLIENTNAME"] == null ? false : Convert.ToBoolean(reader["ISCLIENTNAME"]));//是否客户名称 data.ISCOTCODE = (reader["ISCOTCODE"] == null ? false : Convert.ToBoolean(reader["ISCOTCODE"]));//是否业务编号 data.ISCUSTNO = (reader["ISCUSTNO"] == null ? false : Convert.ToBoolean(reader["ISCUSTNO"]));//是否委托编号 data.ISMBLNO = (reader["ISMBLNO"] == null ? false : Convert.ToBoolean(reader["ISMBLNO"]));//是否主提单号 data.ISVESSEL = (reader["ISVESSEL"] == null ? false : Convert.ToBoolean(reader["ISVESSEL"]));//是否船名 data.ISVOYNO = (reader["ISVOYNO"] == null ? false : Convert.ToBoolean(reader["ISVOYNO"]));//是否航次 data.ISETD = (reader["ISETD"] == null ? false : Convert.ToBoolean(reader["ISETD"]));//是否航期 data.ISRPCLIENTNAME = (reader["ISRPCLIENTNAME"] == null ? false : Convert.ToBoolean(reader["ISRPCLIENTNAME"]));//是否收付客户名称 data.ISRPCOTCODE = (reader["ISRPCOTCODE"] == null ? false : Convert.ToBoolean(reader["ISRPCOTCODE"]));//是否收付业务编号 data.ISRPMBLNO = (reader["ISRPMBLNO"] == null ? false : Convert.ToBoolean(reader["ISRPMBLNO"]));//是否收付主提单号 data.ISRPCUSTNO = (reader["ISRPCUSTNO"] == null ? false : Convert.ToBoolean(reader["ISRPCUSTNO"]));//是否收付委托编号 data.ISRPVESSEL = (reader["ISRPVESSEL"] == null ? false : Convert.ToBoolean(reader["ISRPVESSEL"]));//是否收付船名 data.ISRPVOYNO = (reader["ISRPVOYNO"] == null ? false : Convert.ToBoolean(reader["ISRPVOYNO"]));//是否收付航次 data.ISRPETD = (reader["ISRPETD"] == null ? false : Convert.ToBoolean(reader["ISRPETD"]));//是否收付航期 data.AR = (reader["AR"] == null ? "" : Convert.ToString(reader["AR"]));//应收账款 data.ARFC = (reader["ARFC"] == null ? "" : Convert.ToString(reader["ARFC"]));//应收账款外币 data.AP = (reader["AP"] == null ? "" : Convert.ToString(reader["AP"]));//应付账款 data.APFC = (reader["APFC"] == null ? "" : Convert.ToString(reader["APFC"]));//应付账款外币 data.MBINCOME = (reader["MBINCOME"] == null ? "" : Convert.ToString(reader["MBINCOME"]));//主营业务收入 data.MBSPENDING = (reader["MBSPENDING"] == null ? "" : Convert.ToString(reader["MBSPENDING"]));//主营业务支出 data.TMFCI = (reader["TMFCI"] == null ? "" : Convert.ToString(reader["TMFCI"]));//主营收入外币 data.TMSFC = (reader["TMSFC"] == null ? "" : Convert.ToString(reader["TMSFC"]));//主营支出外币 data.AABWI = (reader["AABWI"] == null ? "" : Convert.ToString(reader["AABWI"]));//空运主营业务收入 data.AMBS = (reader["AMBS"] == null ? "" : Convert.ToString(reader["AMBS"]));//空运主营业务支出 data.AMFCI = (reader["AMFCI"] == null ? "" : Convert.ToString(reader["AMFCI"]));//空运主营收入外币 data.AMSFC = (reader["AMSFC"] == null ? "" : Convert.ToString(reader["AMSFC"]));//空运主营支出外币 data.OTHERR = (reader["OTHERR"] == null ? "" : Convert.ToString(reader["OTHERR"]));//其他应收 data.OTHERP = (reader["OTHERP"] == null ? "" : Convert.ToString(reader["OTHERP"]));//其他应付 data.EGOL = (reader["EGOL"] == null ? "" : Convert.ToString(reader["EGOL"]));//汇兑损益 data.FC = (reader["FC"] == null ? "" : Convert.ToString(reader["FC"]));//财务费用 data.MODIFIEDUSER = (reader["MODIFIEDUSER"] == null ? "" : Convert.ToString(reader["MODIFIEDUSER"]));//最后一次更新操作人 data.MODIFIEDUSER = (reader["MODIFIEDUSER"] == null ? "" : Convert.ToString(reader["MODIFIEDUSER"]));//最后一次更新操作人 if (data.MODIFIEDTIME != null) data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]);//更改操作时间 data.APMBSPENDING = (reader["APMBSPENDING"] == null ? "" : Convert.ToString(reader["APMBSPENDING"]));//付费结算借方默认科目代码 data.ISAPMBSPENDING = (reader["ISAPMBSPENDING"] == null ? false : Convert.ToBoolean(reader["ISAPMBSPENDING"]));//是否默认付费结算借方科目代码 data.APTMSFC = (reader["APTMSFC"] == null ? "" : Convert.ToString(reader["APTMSFC"]));//付费结算借方外币默认科目代码 data.ISAPTMSFC = (reader["ISAPTMSFC"] == null ? false : Convert.ToBoolean(reader["ISAPTMSFC"]));//是否默认付费结算借方外币科目代码 data.ISSETTLEMENTS = (reader["ISSETTLEMENTS"] == null ? false : Convert.ToBoolean(reader["ISSETTLEMENTS"]));//是否在结算时自动生成凭证 data.DR = (reader["DR"] == null ? "" : Convert.ToString(reader["DR"]));//预收账款 deposit received data.DRFC = (reader["DRFC"] == null ? "" : Convert.ToString(reader["DRFC"]));//预收账款外币deposit received foreign currency data.CR = (reader["CR"] == null ? "" : Convert.ToString(reader["CR"]));//预付账款 account prepaid data.CRFC = (reader["CRFC"] == null ? "" : Convert.ToString(reader["CRFC"]));//预付账款外币account prepaid foreign currency data.ISBILLNO = (reader["ISBILLNO"] == null ? false : Convert.ToBoolean(reader["ISBILLNO"]));//是否申请单号 data.ISRPBILLNO = (reader["ISRPBILLNO"] == null ? false : Convert.ToBoolean(reader["ISRPBILLNO"]));//是否收付申请单号 data.ISFILLSERIALNO = (reader["ISFILLSERIALNO"] == null ? false : Convert.ToBoolean(reader["ISFILLSERIALNO"]));//是否在生成凭证号时补号 data.ISSETTLEMENTSOPEN = (reader["ISSETTLEMENTSOPEN"] == null ? false : Convert.ToBoolean(reader["ISSETTLEMENTSOPEN"]));//是否在结算自动生成凭证时自动弹出结算凭证 data.ISCUSTOMERNAME = (reader["ISCUSTOMERNAME"] == null ? false : Convert.ToBoolean(reader["ISCUSTOMERNAME"]));//是否委托单位 data.ISRPCUSTOMERNAME = (reader["ISRPCUSTOMERNAME"] == null ? false : Convert.ToBoolean(reader["ISRPCUSTOMERNAME"]));//是否收付委托单位 data.ISEXPLANMODEL = (reader["ISEXPLANMODEL"] == null ? false : Convert.ToBoolean(reader["ISEXPLANMODEL"]));//是否摘要模板 data.ISRPEXPLANMODEL = (reader["ISRPEXPLANMODEL"] == null ? false : Convert.ToBoolean(reader["ISRPEXPLANMODEL"]));//是否收付摘要模板 data.EXPLANAR = (reader["EXPLANAR"] == null ? "" : Convert.ToString(reader["EXPLANAR"]));//挂账应收摘要模板 data.EXPLANAP = (reader["EXPLANAP"] == null ? "" : Convert.ToString(reader["EXPLANAP"]));//挂账应付摘要模板 data.EXPLANMBINCOME = (reader["EXPLANMBINCOME"] == null ? "" : Convert.ToString(reader["EXPLANMBINCOME"]));//主营业务收入摘要模板 data.EXPLANMBSPENDING = (reader["EXPLANMBSPENDING"] == null ? "" : Convert.ToString(reader["EXPLANMBSPENDING"]));//主营业务支出摘要模板 data.RPEXPLANAR = (reader["RPEXPLANAR"] == null ? "" : Convert.ToString(reader["RPEXPLANAR"]));//结算应收摘要模板 data.RPEXPLANAP = (reader["RPEXPLANAP"] == null ? "" : Convert.ToString(reader["RPEXPLANAP"]));//结算应付摘要模板 data.AMAR = (reader["AMAR"] == null ? "" : Convert.ToString(reader["AMAR"]));//空运应收账款 data.AMARFC = (reader["AMARFC"] == null ? "" : Convert.ToString(reader["AMARFC"]));//空运应收账款外币 data.AMAP = (reader["AMAP"] == null ? "" : Convert.ToString(reader["AMAP"]));//空运应付账款 data.AMAPFC = (reader["AMAPFC"] == null ? "" : Convert.ToString(reader["AMAPFC"]));//空运应付账款外币 #endregion headList.Add(data); } reader.Close(); } return headList; } #endregion } }