예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BWJS.Model.OrderRebate model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dbo.[OrderRebate](");
            strSql.Append("AgentMoney,AgentRebate,HQRebate,HQMoney,NetProfit,PayStatus,IsSettled,IsCancel,SettlementDate,CreateDate,TransNo,Remark,IsDeleted,CompanyId,UserId,OrderApplyId,CompanyRebateId,OrderMoney,MerchantRebate,MerchantMoney");
            strSql.Append(") values (");
            strSql.Append("@AgentMoney,@AgentRebate,@HQRebate,@HQMoney,@NetProfit,@PayStatus,@IsSettled,@IsCancel,@SettlementDate,@CreateDate,@TransNo,@Remark,@IsDeleted,@CompanyId,@UserId,@OrderApplyId,@CompanyRebateId,@OrderMoney,@MerchantRebate,@MerchantMoney");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters = {
                        new SqlParameter("@AgentMoney", model.AgentMoney) ,
                        new SqlParameter("@AgentRebate", model.AgentRebate) ,
                        new SqlParameter("@HQRebate", model.HQRebate) ,
                        new SqlParameter("@HQMoney", model.HQMoney) ,
                        new SqlParameter("@NetProfit", model.NetProfit) ,
                        new SqlParameter("@PayStatus", model.PayStatus) ,
                        new SqlParameter("@IsSettled", model.IsSettled) ,
                        new SqlParameter("@IsCancel", model.IsCancel) ,
                        new SqlParameter("@SettlementDate", model.SettlementDate) ,
                        new SqlParameter("@CreateDate", model.CreateDate) ,
                        new SqlParameter("@TransNo", model.TransNo) ,
                        new SqlParameter("@Remark", model.Remark) ,
                        new SqlParameter("@IsDeleted", model.IsDeleted) ,
                        new SqlParameter("@CompanyId", model.CompanyId) ,
                        new SqlParameter("@UserId", model.UserId) ,
                        new SqlParameter("@OrderApplyId", model.OrderApplyId) ,
                        new SqlParameter("@CompanyRebateId", model.CompanyRebateId) ,
                        new SqlParameter("@OrderMoney", model.OrderMoney) ,
                        new SqlParameter("@MerchantRebate", model.MerchantRebate) ,
                        new SqlParameter("@MerchantMoney", model.MerchantMoney)

            };

            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {

                return Convert.ToInt32(obj);

            }
        }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.OrderRebate GetModel(int OrderRebateId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select OrderRebateId, AgentMoney, AgentRebate, HQRebate, HQMoney, NetProfit, PayStatus, IsSettled, IsCancel, SettlementDate, CreateDate, TransNo, Remark, IsDeleted, CompanyId, UserId, OrderApplyId, CompanyRebateId, OrderMoney, MerchantRebate, MerchantMoney  ");
            strSql.Append("  from dbo.[OrderRebate] ");
            strSql.Append(" where OrderRebateId=@OrderRebateId");
            SqlParameter[] parameters = {
                    new SqlParameter("@OrderRebateId", SqlDbType.Int,4)
            };
            parameters[0].Value = OrderRebateId;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.OrderRebate model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update dbo.[OrderRebate] set ");

            strSql.Append(" AgentMoney = @AgentMoney , ");
            strSql.Append(" AgentRebate = @AgentRebate , ");
            strSql.Append(" HQRebate = @HQRebate , ");
            strSql.Append(" HQMoney = @HQMoney , ");
            strSql.Append(" NetProfit = @NetProfit , ");
            strSql.Append(" PayStatus = @PayStatus , ");
            strSql.Append(" IsSettled = @IsSettled , ");
            strSql.Append(" IsCancel = @IsCancel , ");
            strSql.Append(" SettlementDate = @SettlementDate , ");
            strSql.Append(" CreateDate = @CreateDate , ");
            strSql.Append(" TransNo = @TransNo , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" IsDeleted = @IsDeleted , ");
            strSql.Append(" CompanyId = @CompanyId , ");
            strSql.Append(" UserId = @UserId , ");
            strSql.Append(" OrderApplyId = @OrderApplyId , ");
            strSql.Append(" CompanyRebateId = @CompanyRebateId , ");
            strSql.Append(" OrderMoney = @OrderMoney , ");
            strSql.Append(" MerchantRebate = @MerchantRebate , ");
            strSql.Append(" MerchantMoney = @MerchantMoney  ");
            strSql.Append(" where OrderRebateId=@OrderRebateId ");

            SqlParameter[] parameters = {
                        new SqlParameter("@OrderRebateId",model.OrderRebateId) ,
                        new SqlParameter("@AgentMoney",model.AgentMoney) ,
                        new SqlParameter("@AgentRebate",model.AgentRebate) ,
                        new SqlParameter("@HQRebate",model.HQRebate) ,
                        new SqlParameter("@HQMoney",model.HQMoney) ,
                        new SqlParameter("@NetProfit",model.NetProfit) ,
                        new SqlParameter("@PayStatus",model.PayStatus) ,
                        new SqlParameter("@IsSettled",model.IsSettled) ,
                        new SqlParameter("@IsCancel",model.IsCancel) ,
                        new SqlParameter("@SettlementDate",model.SettlementDate) ,
                        new SqlParameter("@CreateDate",model.CreateDate) ,
                        new SqlParameter("@TransNo",model.TransNo) ,
                        new SqlParameter("@Remark",model.Remark) ,
                        new SqlParameter("@IsDeleted",model.IsDeleted) ,
                        new SqlParameter("@CompanyId",model.CompanyId) ,
                        new SqlParameter("@UserId",model.UserId) ,
                        new SqlParameter("@OrderApplyId",model.OrderApplyId) ,
                        new SqlParameter("@CompanyRebateId",model.CompanyRebateId) ,
                        new SqlParameter("@OrderMoney",model.OrderMoney) ,
                        new SqlParameter("@MerchantRebate",model.MerchantRebate) ,
                        new SqlParameter("@MerchantMoney",model.MerchantMoney)

            };

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #4
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.OrderRebate DataRowToModel(DataRow row)
        {
            BWJS.Model.OrderRebate model = new BWJS.Model.OrderRebate();

            if (row != null)
            {
                if (row["OrderRebateId"].ToString() != "")
                {
                    model.OrderRebateId = int.Parse(row["OrderRebateId"].ToString());
                }
                if (row["AgentMoney"].ToString() != "")
                {
                    model.AgentMoney = decimal.Parse(row["AgentMoney"].ToString());
                }
                if (row["AgentRebate"].ToString() != "")
                {
                    model.AgentRebate = decimal.Parse(row["AgentRebate"].ToString());
                }
                if (row["HQRebate"].ToString() != "")
                {
                    model.HQRebate = decimal.Parse(row["HQRebate"].ToString());
                }
                if (row["HQMoney"].ToString() != "")
                {
                    model.HQMoney = decimal.Parse(row["HQMoney"].ToString());
                }
                if (row["NetProfit"].ToString() != "")
                {
                    model.NetProfit = decimal.Parse(row["NetProfit"].ToString());
                }
                if (row["PayStatus"].ToString() != "")
                {
                    model.PayStatus = int.Parse(row["PayStatus"].ToString());
                }
                if (row["IsSettled"].ToString() != "")
                {
                    model.IsSettled = int.Parse(row["IsSettled"].ToString());
                }
                if (row["IsCancel"].ToString() != "")
                {
                    model.IsCancel = int.Parse(row["IsCancel"].ToString());
                }
                if (row["SettlementDate"].ToString() != "")
                {
                    model.SettlementDate = DateTime.Parse(row["SettlementDate"].ToString());
                }
                if (row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }
                model.TransNo = row["TransNo"].ToString();
                model.Remark = row["Remark"].ToString();
                if (row["IsDeleted"].ToString() != "")
                {
                    model.IsDeleted = int.Parse(row["IsDeleted"].ToString());
                }
                if (row["CompanyId"].ToString() != "")
                {
                    model.CompanyId = int.Parse(row["CompanyId"].ToString());
                }
                if (row["UserId"].ToString() != "")
                {
                    model.UserId = int.Parse(row["UserId"].ToString());
                }
                if (row["OrderApplyId"].ToString() != "")
                {
                    model.OrderApplyId = int.Parse(row["OrderApplyId"].ToString());
                }
                if (row["CompanyRebateId"].ToString() != "")
                {
                    model.CompanyRebateId = int.Parse(row["CompanyRebateId"].ToString());
                }
                if (row["OrderMoney"].ToString() != "")
                {
                    model.OrderMoney = decimal.Parse(row["OrderMoney"].ToString());
                }
                if (row["MerchantRebate"].ToString() != "")
                {
                    model.MerchantRebate = decimal.Parse(row["MerchantRebate"].ToString());
                }
                if (row["MerchantMoney"].ToString() != "")
                {
                    model.MerchantMoney = decimal.Parse(row["MerchantMoney"].ToString());
                }

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