Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.CompanyRebate GetModel(int CompanyRebateId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CompanyRebateId, SettlementMethod, SalesPercentage, ProfitDescription, Remark, IsDeleted, CreateId, CreateDate, EditId, EditDate, CompanyId, ProductId, CaseCode, RebateName, CompanyRebatePer, MerchantRebate, AgentRebate, HQRebate  ");
            strSql.Append("  from dbo.[CompanyRebate] ");
            strSql.Append(" where CompanyRebateId=@CompanyRebateId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyRebateId", SqlDbType.Int, 4)
            };
            parameters[0].Value = CompanyRebateId;


            BWJS.Model.CompanyRebate model = new BWJS.Model.CompanyRebate();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.CompanyRebate model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[CompanyRebate] set ");

            strSql.Append(" SettlementMethod = @SettlementMethod , ");
            strSql.Append(" SalesPercentage = @SalesPercentage , ");
            strSql.Append(" ProfitDescription = @ProfitDescription , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" IsDeleted = @IsDeleted , ");
            //strSql.Append(" CreateId = @CreateId , ");
            //strSql.Append(" CreateDate = @CreateDate , ");
            strSql.Append(" EditId = @EditId , ");
            strSql.Append(" EditDate = @EditDate , ");
            strSql.Append(" CompanyId = @CompanyId , ");
            strSql.Append(" ProductId = @ProductId , ");
            strSql.Append(" CaseCode = @CaseCode , ");
            strSql.Append(" RebateName = @RebateName , ");
            strSql.Append(" CompanyRebatePer = @CompanyRebatePer , ");
            strSql.Append(" MerchantRebate = @MerchantRebate , ");
            strSql.Append(" AgentRebate = @AgentRebate , ");
            strSql.Append(" HQRebate = @HQRebate  ");
            strSql.Append(" where CompanyRebateId=@CompanyRebateId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyRebateId",   model.CompanyRebateId),
                new SqlParameter("@SettlementMethod",  model.SettlementMethod),
                new SqlParameter("@SalesPercentage",   model.SalesPercentage),
                new SqlParameter("@ProfitDescription", model.ProfitDescription),
                new SqlParameter("@Remark",            model.Remark),
                new SqlParameter("@IsDeleted",         model.IsDeleted),
                //new SqlParameter("@CreateId",model.CreateId) ,
                //new SqlParameter("@CreateDate",model.CreateDate) ,
                new SqlParameter("@EditId",            model.EditId),
                new SqlParameter("@EditDate",          model.EditDate),
                new SqlParameter("@CompanyId",         model.CompanyId),
                new SqlParameter("@ProductId",         model.ProductId),
                new SqlParameter("@CaseCode",          model.CaseCode),
                new SqlParameter("@RebateName",        model.RebateName),
                new SqlParameter("@CompanyRebatePer",  model.CompanyRebatePer),
                new SqlParameter("@MerchantRebate",    model.MerchantRebate),
                new SqlParameter("@AgentRebate",       model.AgentRebate),
                new SqlParameter("@HQRebate",          model.HQRebate)
            };

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BWJS.Model.CompanyRebate model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[CompanyRebate](");
            strSql.Append("SettlementMethod,SalesPercentage,ProfitDescription,Remark,IsDeleted,CreateId,CreateDate,EditId,EditDate,CompanyId,ProductId,CaseCode,RebateName,CompanyRebatePer,MerchantRebate,AgentRebate,HQRebate");
            strSql.Append(") values (");
            strSql.Append("@SettlementMethod,@SalesPercentage,@ProfitDescription,@Remark,@IsDeleted,@CreateId,@CreateDate,@EditId,@EditDate,@CompanyId,@ProductId,@CaseCode,@RebateName,@CompanyRebatePer,@MerchantRebate,@AgentRebate,@HQRebate");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SettlementMethod",  model.SettlementMethod),
                new SqlParameter("@SalesPercentage",   model.SalesPercentage),
                new SqlParameter("@ProfitDescription", model.ProfitDescription),
                new SqlParameter("@Remark",            model.Remark),
                new SqlParameter("@IsDeleted",         model.IsDeleted),
                new SqlParameter("@CreateId",          model.CreateId),
                new SqlParameter("@CreateDate",        model.CreateDate),
                new SqlParameter("@EditId",            model.EditId),
                new SqlParameter("@EditDate",          model.EditDate),
                new SqlParameter("@CompanyId",         model.CompanyId),
                new SqlParameter("@ProductId",         model.ProductId),
                new SqlParameter("@CaseCode",          model.CaseCode),
                new SqlParameter("@RebateName",        model.RebateName),
                new SqlParameter("@CompanyRebatePer",  model.CompanyRebatePer),
                new SqlParameter("@MerchantRebate",    model.MerchantRebate),
                new SqlParameter("@AgentRebate",       model.AgentRebate),
                new SqlParameter("@HQRebate",          model.HQRebate)
            };


            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.CompanyRebate DataRowToModel(DataRow row)
        {
            BWJS.Model.CompanyRebate model = new BWJS.Model.CompanyRebate();

            if (row != null)
            {
                if (row["CompanyRebateId"].ToString() != "")
                {
                    model.CompanyRebateId = int.Parse(row["CompanyRebateId"].ToString());
                }
                if (row["SettlementMethod"].ToString() != "")
                {
                    model.SettlementMethod = int.Parse(row["SettlementMethod"].ToString());
                }
                if (row["SalesPercentage"].ToString() != "")
                {
                    model.SalesPercentage = decimal.Parse(row["SalesPercentage"].ToString());
                }
                model.ProfitDescription = row["ProfitDescription"].ToString();
                model.Remark            = row["Remark"].ToString();
                if (row["IsDeleted"].ToString() != "")
                {
                    model.IsDeleted = int.Parse(row["IsDeleted"].ToString());
                }
                if (row["CreateId"].ToString() != "")
                {
                    model.CreateId = int.Parse(row["CreateId"].ToString());
                }
                if (row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }
                if (row["EditId"].ToString() != "")
                {
                    model.EditId = int.Parse(row["EditId"].ToString());
                }
                if (row["EditDate"].ToString() != "")
                {
                    model.EditDate = DateTime.Parse(row["EditDate"].ToString());
                }
                if (row["CompanyId"].ToString() != "")
                {
                    model.CompanyId = int.Parse(row["CompanyId"].ToString());
                }
                if (row["ProductId"].ToString() != "")
                {
                    model.ProductId = int.Parse(row["ProductId"].ToString());
                }
                model.CaseCode   = row["CaseCode"].ToString();
                model.RebateName = row["RebateName"].ToString();
                if (row["CompanyRebatePer"].ToString() != "")
                {
                    model.CompanyRebatePer = decimal.Parse(row["CompanyRebatePer"].ToString());
                }
                if (row["MerchantRebate"].ToString() != "")
                {
                    model.MerchantRebate = decimal.Parse(row["MerchantRebate"].ToString());
                }
                if (row["AgentRebate"].ToString() != "")
                {
                    model.AgentRebate = decimal.Parse(row["AgentRebate"].ToString());
                }
                if (row["HQRebate"].ToString() != "")
                {
                    model.HQRebate = decimal.Parse(row["HQRebate"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BWJS.Model.CompanyRebate model)
 {
     return(dal.Update(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BWJS.Model.CompanyRebate model)
 {
     return(dal.Add(model));
 }