Пример #1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public void Add(MobileSoft.Model.HSPR.Tb_HSPR_CostItem model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@CostID",         SqlDbType.BigInt,     8),
                new SqlParameter("@CommID",         SqlDbType.Int,        4),
                new SqlParameter("@CostSNum",       SqlDbType.Int,        4),
                new SqlParameter("@CostName",       SqlDbType.NVarChar,  30),
                new SqlParameter("@CostType",       SqlDbType.SmallInt,   2),
                new SqlParameter("@CostGeneType",   SqlDbType.SmallInt,   2),
                new SqlParameter("@CollUnitID",     SqlDbType.BigInt,     8),
                new SqlParameter("@DueDate",        SqlDbType.Int,        4),
                new SqlParameter("@AccountsSign",   SqlDbType.NVarChar,  20),
                new SqlParameter("@AccountsName",   SqlDbType.NVarChar,  30),
                new SqlParameter("@ChargeCycle",    SqlDbType.Int,        4),
                new SqlParameter("@RoundingNum",    SqlDbType.SmallInt,   2),
                new SqlParameter("@IsBank",         SqlDbType.SmallInt,   2),
                new SqlParameter("@DelinDelay",     SqlDbType.Int,        4),
                new SqlParameter("@DelinRates",     SqlDbType.Decimal,    9),
                new SqlParameter("@PreCostSign",    SqlDbType.NVarChar,  20),
                new SqlParameter("@Memo",           SqlDbType.NVarChar, 100),
                new SqlParameter("@IsDelete",       SqlDbType.SmallInt,   2),
                new SqlParameter("@CorpCostID",     SqlDbType.BigInt,     8),
                new SqlParameter("@CostCode",       SqlDbType.NVarChar,  40),
                new SqlParameter("@SysCostSign",    SqlDbType.NVarChar,  20),
                new SqlParameter("@DuePlotDate",    SqlDbType.Int,        4),
                new SqlParameter("@HighCorpCostID", SqlDbType.BigInt,     8),
                new SqlParameter("@CostBigType",    SqlDbType.SmallInt,   2),
                new SqlParameter("@DelinType",      SqlDbType.SmallInt,   2),
                new SqlParameter("@DelinDay",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.CostID;
            parameters[1].Value  = model.CommID;
            parameters[2].Value  = model.CostSNum;
            parameters[3].Value  = model.CostName;
            parameters[4].Value  = model.CostType;
            parameters[5].Value  = model.CostGeneType;
            parameters[6].Value  = model.CollUnitID;
            parameters[7].Value  = model.DueDate;
            parameters[8].Value  = model.AccountsSign;
            parameters[9].Value  = model.AccountsName;
            parameters[10].Value = model.ChargeCycle;
            parameters[11].Value = model.RoundingNum;
            parameters[12].Value = model.IsBank;
            parameters[13].Value = model.DelinDelay;
            parameters[14].Value = model.DelinRates;
            parameters[15].Value = model.PreCostSign;
            parameters[16].Value = model.Memo;
            parameters[17].Value = model.IsDelete;
            parameters[18].Value = model.CorpCostID;
            parameters[19].Value = model.CostCode;
            parameters[20].Value = model.SysCostSign;
            parameters[21].Value = model.DuePlotDate;
            parameters[22].Value = model.HighCorpCostID;
            parameters[23].Value = model.CostBigType;
            parameters[24].Value = model.DelinType;
            parameters[25].Value = model.DelinDay;

            DbHelperSQL.RunProcedure("Proc_Tb_HSPR_CostItem_ADD", parameters, out rowsAffected);
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.HSPR.Tb_HSPR_CostItem GetModel(long CostID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@CostID", SqlDbType.BigInt)
            };
            parameters[0].Value = CostID;

            MobileSoft.Model.HSPR.Tb_HSPR_CostItem model = new MobileSoft.Model.HSPR.Tb_HSPR_CostItem();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_HSPR_CostItem_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["CostID"].ToString() != "")
                {
                    model.CostID = long.Parse(ds.Tables[0].Rows[0]["CostID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CommID"].ToString() != "")
                {
                    model.CommID = int.Parse(ds.Tables[0].Rows[0]["CommID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CostSNum"].ToString() != "")
                {
                    model.CostSNum = int.Parse(ds.Tables[0].Rows[0]["CostSNum"].ToString());
                }
                model.CostName = ds.Tables[0].Rows[0]["CostName"].ToString();
                if (ds.Tables[0].Rows[0]["CostType"].ToString() != "")
                {
                    model.CostType = int.Parse(ds.Tables[0].Rows[0]["CostType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CostGeneType"].ToString() != "")
                {
                    model.CostGeneType = int.Parse(ds.Tables[0].Rows[0]["CostGeneType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CollUnitID"].ToString() != "")
                {
                    model.CollUnitID = long.Parse(ds.Tables[0].Rows[0]["CollUnitID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DueDate"].ToString() != "")
                {
                    model.DueDate = int.Parse(ds.Tables[0].Rows[0]["DueDate"].ToString());
                }
                model.AccountsSign = ds.Tables[0].Rows[0]["AccountsSign"].ToString();
                model.AccountsName = ds.Tables[0].Rows[0]["AccountsName"].ToString();
                if (ds.Tables[0].Rows[0]["ChargeCycle"].ToString() != "")
                {
                    model.ChargeCycle = int.Parse(ds.Tables[0].Rows[0]["ChargeCycle"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RoundingNum"].ToString() != "")
                {
                    model.RoundingNum = int.Parse(ds.Tables[0].Rows[0]["RoundingNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsBank"].ToString() != "")
                {
                    model.IsBank = int.Parse(ds.Tables[0].Rows[0]["IsBank"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DelinDelay"].ToString() != "")
                {
                    model.DelinDelay = int.Parse(ds.Tables[0].Rows[0]["DelinDelay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DelinRates"].ToString() != "")
                {
                    model.DelinRates = decimal.Parse(ds.Tables[0].Rows[0]["DelinRates"].ToString());
                }
                model.PreCostSign = ds.Tables[0].Rows[0]["PreCostSign"].ToString();
                model.Memo        = ds.Tables[0].Rows[0]["Memo"].ToString();
                if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "")
                {
                    model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CorpCostID"].ToString() != "")
                {
                    model.CorpCostID = long.Parse(ds.Tables[0].Rows[0]["CorpCostID"].ToString());
                }
                model.CostCode    = ds.Tables[0].Rows[0]["CostCode"].ToString();
                model.SysCostSign = ds.Tables[0].Rows[0]["SysCostSign"].ToString();
                if (ds.Tables[0].Rows[0]["DuePlotDate"].ToString() != "")
                {
                    model.DuePlotDate = int.Parse(ds.Tables[0].Rows[0]["DuePlotDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["HighCorpCostID"].ToString() != "")
                {
                    model.HighCorpCostID = long.Parse(ds.Tables[0].Rows[0]["HighCorpCostID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CostBigType"].ToString() != "")
                {
                    model.CostBigType = int.Parse(ds.Tables[0].Rows[0]["CostBigType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DelinType"].ToString() != "")
                {
                    model.DelinType = int.Parse(ds.Tables[0].Rows[0]["DelinType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DelinDay"].ToString() != "")
                {
                    model.DelinDay = int.Parse(ds.Tables[0].Rows[0]["DelinDay"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }