コード例 #1
0
        public ResultModel LoadCorpListByContractId(UserModel user, int contractId, bool isSelf)
        {
            ResultModel result = new ResultModel();
            try
            {
                int status = (int)Common.StatusEnum.已生效;
                string cmdText = string.Format("select * from dbo.Con_ContractCorporationDetail ccd where ccd.ContractId =@contractId and ccd.IsInnerCorp =@isInnerCorp and ccd.DetailStatus = {0}", status);
                SqlParameter[] paras = new SqlParameter[2];
                paras[0] = new SqlParameter("@contractId", contractId);
                paras[1] = new SqlParameter("@isInnerCorp", isSelf);

                DataTable dt = SqlHelper.ExecuteDataTable(this.ConnectString, cmdText, paras, CommandType.Text);

                List<ContractCorporationDetail> contractCorporationDetails = new List<ContractCorporationDetail>();

                foreach (DataRow dr in dt.Rows)
                {
                    ContractCorporationDetail contractcorporationdetail = new ContractCorporationDetail();
                    contractcorporationdetail.DetailId = Convert.ToInt32(dr["DetailId"]);

                    if (dr["ContractId"] != DBNull.Value)
                    {
                        contractcorporationdetail.ContractId = Convert.ToInt32(dr["ContractId"]);
                    }
                    //if (dr["TradeDirection"] != DBNull.Value)
                    //{
                    //    contractcorporationdetail.TradeDirection = Convert.ToInt32(dr["TradeDirection"]);
                    //}
                    if (dr["CorpId"] != DBNull.Value)
                    {
                        contractcorporationdetail.CorpId = Convert.ToInt32(dr["CorpId"]);
                    }
                    if (dr["CorpName"] != DBNull.Value)
                    {
                        contractcorporationdetail.CorpName = Convert.ToString(dr["CorpName"]);
                    }
                    if (dr["DeptId"] != DBNull.Value)
                    {
                        contractcorporationdetail.DeptId = Convert.ToInt32(dr["DeptId"]);
                    }
                    if (dr["DeptName"] != DBNull.Value)
                    {
                        contractcorporationdetail.DeptName = Convert.ToString(dr["DeptName"]);
                    }
                    if (dr["DetailStatus"] != DBNull.Value)
                    {
                        contractcorporationdetail.DetailStatus = (Common.StatusEnum)Convert.ToInt32(dr["DetailStatus"]);
                    }
                    if (dr["CreatorId"] != DBNull.Value)
                    {
                        contractcorporationdetail.CreatorId = Convert.ToInt32(dr["CreatorId"]);
                    }
                    if (dr["CreateTime"] != DBNull.Value)
                    {
                        contractcorporationdetail.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
                    }
                    if (dr["LastModifyId"] != DBNull.Value)
                    {
                        contractcorporationdetail.LastModifyId = Convert.ToInt32(dr["LastModifyId"]);
                    }
                    if (dr["LastModifyTime"] != DBNull.Value)
                    {
                        contractcorporationdetail.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
                    }
                    if (dr["IsDefaultCorp"] != DBNull.Value)
                    {
                        contractcorporationdetail.IsDefaultCorp = Convert.ToBoolean(dr["IsDefaultCorp"]);
                    }
                    if (dr["IsInnerCorp"] != DBNull.Value)
                    {
                        contractcorporationdetail.IsInnerCorp = Convert.ToBoolean(dr["IsInnerCorp"]);
                    }
                    contractCorporationDetails.Add(contractcorporationdetail);
                }
                result.AffectCount = dt.Rows.Count;
                result.Message = "获取列表成功";
                result.ResultStatus = 0;
                result.ReturnValue = contractCorporationDetails;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return result;
        }
コード例 #2
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            ContractCorporationDetail contractcorporationdetail = new ContractCorporationDetail();

            int indexDetailId = dr.GetOrdinal("DetailId");
            contractcorporationdetail.DetailId = Convert.ToInt32(dr[indexDetailId]);

            int indexContractId = dr.GetOrdinal("ContractId");
            if (dr["ContractId"] != DBNull.Value)
            {
                contractcorporationdetail.ContractId = Convert.ToInt32(dr[indexContractId]);
            }

            int indexCorpId = dr.GetOrdinal("CorpId");
            if (dr["CorpId"] != DBNull.Value)
            {
                contractcorporationdetail.CorpId = Convert.ToInt32(dr[indexCorpId]);
            }

            int indexCorpName = dr.GetOrdinal("CorpName");
            if (dr["CorpName"] != DBNull.Value)
            {
                contractcorporationdetail.CorpName = Convert.ToString(dr[indexCorpName]);
            }

            int indexDeptId = dr.GetOrdinal("DeptId");
            if (dr["DeptId"] != DBNull.Value)
            {
                contractcorporationdetail.DeptId = Convert.ToInt32(dr[indexDeptId]);
            }

            int indexDeptName = dr.GetOrdinal("DeptName");
            if (dr["DeptName"] != DBNull.Value)
            {
                contractcorporationdetail.DeptName = Convert.ToString(dr[indexDeptName]);
            }

            int indexDetailStatus = dr.GetOrdinal("DetailStatus");
            if (dr["DetailStatus"] != DBNull.Value)
            {
                contractcorporationdetail.DetailStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexDetailStatus]);
            }

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            if (dr["CreatorId"] != DBNull.Value)
            {
                contractcorporationdetail.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
            }

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            if (dr["CreateTime"] != DBNull.Value)
            {
                contractcorporationdetail.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
            }

            int indexLastModifyId = dr.GetOrdinal("LastModifyId");
            if (dr["LastModifyId"] != DBNull.Value)
            {
                contractcorporationdetail.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
            }

            int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
            if (dr["LastModifyTime"] != DBNull.Value)
            {
                contractcorporationdetail.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
            }

            int indexIsDefaultCorp = dr.GetOrdinal("IsDefaultCorp");
            if (dr["IsDefaultCorp"] != DBNull.Value)
            {
                contractcorporationdetail.IsDefaultCorp = Convert.ToBoolean(dr[indexIsDefaultCorp]);
            }

            int indexIsInnerCorp = dr.GetOrdinal("IsInnerCorp");
            if (dr["IsInnerCorp"] != DBNull.Value)
            {
                contractcorporationdetail.IsInnerCorp = Convert.ToBoolean(dr[indexIsInnerCorp]);
            }

            return contractcorporationdetail;
        }