Esempio n. 1
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            CustomsClearanceApply customsclearanceapply = new CustomsClearanceApply();

            int indexCustomsApplyId = dr.GetOrdinal("CustomsApplyId");
            customsclearanceapply.CustomsApplyId = Convert.ToInt32(dr[indexCustomsApplyId]);

            int indexApplyId = dr.GetOrdinal("ApplyId");
            if (dr["ApplyId"] != DBNull.Value)
            {
                customsclearanceapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
            }

            int indexAssetId = dr.GetOrdinal("AssetId");
            if (dr["AssetId"] != DBNull.Value)
            {
                customsclearanceapply.AssetId = Convert.ToInt32(dr[indexAssetId]);
            }

            int indexGrossWeight = dr.GetOrdinal("GrossWeight");
            if (dr["GrossWeight"] != DBNull.Value)
            {
                customsclearanceapply.GrossWeight = Convert.ToDecimal(dr[indexGrossWeight]);
            }

            int indexNetWeight = dr.GetOrdinal("NetWeight");
            if (dr["NetWeight"] != DBNull.Value)
            {
                customsclearanceapply.NetWeight = Convert.ToDecimal(dr[indexNetWeight]);
            }

            int indexUnitId = dr.GetOrdinal("UnitId");
            if (dr["UnitId"] != DBNull.Value)
            {
                customsclearanceapply.UnitId = Convert.ToInt32(dr[indexUnitId]);
            }

            int indexOutCorpId = dr.GetOrdinal("OutCorpId");
            if (dr["OutCorpId"] != DBNull.Value)
            {
                customsclearanceapply.OutCorpId = Convert.ToInt32(dr[indexOutCorpId]);
            }

            int indexInCorpId = dr.GetOrdinal("InCorpId");
            if (dr["InCorpId"] != DBNull.Value)
            {
                customsclearanceapply.InCorpId = Convert.ToInt32(dr[indexInCorpId]);
            }

            int indexCustomsCorpId = dr.GetOrdinal("CustomsCorpId");
            if (dr["CustomsCorpId"] != DBNull.Value)
            {
                customsclearanceapply.CustomsCorpId = Convert.ToInt32(dr[indexCustomsCorpId]);
            }

            int indexCustomsPrice = dr.GetOrdinal("CustomsPrice");
            if (dr["CustomsPrice"] != DBNull.Value)
            {
                customsclearanceapply.CustomsPrice = Convert.ToDecimal(dr[indexCustomsPrice]);
            }

            int indexCurrencyId = dr.GetOrdinal("CurrencyId");
            if (dr["CurrencyId"] != DBNull.Value)
            {
                customsclearanceapply.CurrencyId = Convert.ToInt32(dr[indexCurrencyId]);
            }

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

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

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

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

            return customsclearanceapply;
        }
Esempio n. 2
0
        public ResultModel GetModelByApplyId(UserModel user, int applyId)
        {
            ResultModel result = new ResultModel();

            SqlDataReader dr = null;
            try
            {
                string sql = string.Format("select * from dbo.St_CustomsClearanceApply where ApplyId = {0}", applyId);
                dr = SqlHelper.ExecuteReader(ConnectString, CommandType.Text, sql, null);

                Model.CustomsClearanceApply model = new CustomsClearanceApply();

                if (dr.Read())
                {
                    model = CreateModel(dr) as CustomsClearanceApply;

                    result.AffectCount = 1;
                    result.Message = "读取成功";
                    result.ResultStatus = 0;
                    result.ReturnValue = model;
                }
                else
                {
                    result.Message = "读取失败或无数据";
                    result.AffectCount = 0;
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }
            finally
            {
                if (dr != null)
                    dr.Dispose();
            }
            return result;
        }
Esempio n. 3
0
        public override IModel CreateModel(DataRow dr)
        {
            CustomsClearanceApply customsclearanceapply = new CustomsClearanceApply();

            customsclearanceapply.CustomsApplyId = Convert.ToInt32(dr["CustomsApplyId"]);

            if (dr["ApplyId"] != DBNull.Value)
            {
                customsclearanceapply.ApplyId = Convert.ToInt32(dr["ApplyId"]);
            }

            if (dr["AssetId"] != DBNull.Value)
            {
                customsclearanceapply.AssetId = Convert.ToInt32(dr["AssetId"]);
            }

            if (dr["GrossWeight"] != DBNull.Value)
            {
                customsclearanceapply.GrossWeight = Convert.ToDecimal(dr["GrossWeight"]);
            }

            if (dr["NetWeight"] != DBNull.Value)
            {
                customsclearanceapply.NetWeight = Convert.ToDecimal(dr["NetWeight"]);
            }

            if (dr["UnitId"] != DBNull.Value)
            {
                customsclearanceapply.UnitId = Convert.ToInt32(dr["UnitId"]);
            }

            if (dr["OutCorpId"] != DBNull.Value)
            {
                customsclearanceapply.OutCorpId = Convert.ToInt32(dr["OutCorpId"]);
            }

            if (dr["InCorpId"] != DBNull.Value)
            {
                customsclearanceapply.InCorpId = Convert.ToInt32(dr["InCorpId"]);
            }

            if (dr["CustomsCorpId"] != DBNull.Value)
            {
                customsclearanceapply.CustomsCorpId = Convert.ToInt32(dr["CustomsCorpId"]);
            }

            if (dr["CustomsPrice"] != DBNull.Value)
            {
                customsclearanceapply.CustomsPrice = Convert.ToDecimal(dr["CustomsPrice"]);
            }

            if (dr["CurrencyId"] != DBNull.Value)
            {
                customsclearanceapply.CurrencyId = Convert.ToInt32(dr["CurrencyId"]);
            }

            if (dr["CreatorId"] != DBNull.Value)
            {
                customsclearanceapply.CreatorId = Convert.ToInt32(dr["CreatorId"]);
            }

            if (dr["CreateTime"] != DBNull.Value)
            {
                customsclearanceapply.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
            }

            if (dr["LastModifyId"] != DBNull.Value)
            {
                customsclearanceapply.LastModifyId = Convert.ToInt32(dr["LastModifyId"]);
            }

            if (dr["LastModifyTime"] != DBNull.Value)
            {
                customsclearanceapply.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
            }

            return customsclearanceapply;
        }