Ejemplo n.º 1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public long Add(MobileSoft.Model.Club.Tb_Club_MaterialDetail model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@InfoId",            SqlDbType.BigInt,     8),
                new SqlParameter("@MerchID",           SqlDbType.BigInt,     8),
                new SqlParameter("@CommID",            SqlDbType.Int,        4),
                new SqlParameter("@MerchDefaultPrice", SqlDbType.Decimal,    9),
                new SqlParameter("@MerchCostPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@MerchMemo",         SqlDbType.NVarChar, 500),
                new SqlParameter("@IsPackage",         SqlDbType.SmallInt,   2),
                new SqlParameter("@MerchandiseID",     SqlDbType.BigInt,     8),
                new SqlParameter("@Quantity",          SqlDbType.Int,        4),
                new SqlParameter("@CostID",            SqlDbType.BigInt,     8),
                new SqlParameter("@NoOutStore",        SqlDbType.SmallInt,   2),
                new SqlParameter("@IsHelpSale",        SqlDbType.Int,        4),
                new SqlParameter("@GetMethod",         SqlDbType.Int,        4),
                new SqlParameter("@IsHelpSaleValue",   SqlDbType.Decimal,    9),
                new SqlParameter("@IsLease",           SqlDbType.Int,        4),
                new SqlParameter("@IsPay",             SqlDbType.Int,        4),
                new SqlParameter("@PayMoneyValue",     SqlDbType.Decimal,    9),
                new SqlParameter("@IsDeleteDetail",    SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.MerchID;
            parameters[2].Value     = model.CommID;
            parameters[3].Value     = model.MerchDefaultPrice;
            parameters[4].Value     = model.MerchCostPrice;
            parameters[5].Value     = model.MerchMemo;
            parameters[6].Value     = model.IsPackage;
            parameters[7].Value     = model.MerchandiseID;
            parameters[8].Value     = model.Quantity;
            parameters[9].Value     = model.CostID;
            parameters[10].Value    = model.NoOutStore;
            parameters[11].Value    = model.IsHelpSale;
            parameters[12].Value    = model.GetMethod;
            parameters[13].Value    = model.IsHelpSaleValue;
            parameters[14].Value    = model.IsLease;
            parameters[15].Value    = model.IsPay;
            parameters[16].Value    = model.PayMoneyValue;
            parameters[17].Value    = model.IsDeleteDetail;

            DbHelperSQL.RunProcedure("Proc_Tb_Club_MaterialDetail_ADD", parameters, out rowsAffected);
            return((long)parameters[0].Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.Club.Tb_Club_MaterialDetail GetModel(long InfoId)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@InfoId", SqlDbType.BigInt)
            };
            parameters[0].Value = InfoId;

            MobileSoft.Model.Club.Tb_Club_MaterialDetail model = new MobileSoft.Model.Club.Tb_Club_MaterialDetail();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Club_MaterialDetail_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["InfoId"].ToString() != "")
                {
                    model.InfoId = long.Parse(ds.Tables[0].Rows[0]["InfoId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MerchID"].ToString() != "")
                {
                    model.MerchID = long.Parse(ds.Tables[0].Rows[0]["MerchID"].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]["MerchDefaultPrice"].ToString() != "")
                {
                    model.MerchDefaultPrice = decimal.Parse(ds.Tables[0].Rows[0]["MerchDefaultPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MerchCostPrice"].ToString() != "")
                {
                    model.MerchCostPrice = decimal.Parse(ds.Tables[0].Rows[0]["MerchCostPrice"].ToString());
                }
                model.MerchMemo = ds.Tables[0].Rows[0]["MerchMemo"].ToString();
                if (ds.Tables[0].Rows[0]["IsPackage"].ToString() != "")
                {
                    model.IsPackage = int.Parse(ds.Tables[0].Rows[0]["IsPackage"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MerchandiseID"].ToString() != "")
                {
                    model.MerchandiseID = long.Parse(ds.Tables[0].Rows[0]["MerchandiseID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Quantity"].ToString() != "")
                {
                    model.Quantity = int.Parse(ds.Tables[0].Rows[0]["Quantity"].ToString());
                }
                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]["NoOutStore"].ToString() != "")
                {
                    model.NoOutStore = int.Parse(ds.Tables[0].Rows[0]["NoOutStore"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsHelpSale"].ToString() != "")
                {
                    model.IsHelpSale = int.Parse(ds.Tables[0].Rows[0]["IsHelpSale"].ToString());
                }
                if (ds.Tables[0].Rows[0]["GetMethod"].ToString() != "")
                {
                    model.GetMethod = int.Parse(ds.Tables[0].Rows[0]["GetMethod"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsHelpSaleValue"].ToString() != "")
                {
                    model.IsHelpSaleValue = decimal.Parse(ds.Tables[0].Rows[0]["IsHelpSaleValue"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsLease"].ToString() != "")
                {
                    model.IsLease = int.Parse(ds.Tables[0].Rows[0]["IsLease"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsPay"].ToString() != "")
                {
                    model.IsPay = int.Parse(ds.Tables[0].Rows[0]["IsPay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayMoneyValue"].ToString() != "")
                {
                    model.PayMoneyValue = decimal.Parse(ds.Tables[0].Rows[0]["PayMoneyValue"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsDeleteDetail"].ToString() != "")
                {
                    model.IsDeleteDetail = int.Parse(ds.Tables[0].Rows[0]["IsDeleteDetail"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }