/// <summary> /// 后台修改订单时重新检查优惠券 /// </summary> /// <param name="oCoupon"></param> /// <param name="soInfo"></param> /// <returns></returns> public string CheckCouponSOByUpdate(CouponInfo oCoupon, SOInfo soInfo) { string result = ""; DataSet soItemDS = new DataSet(); //销售单的明细商品(仅主商品),增加大、中、小类,增加品牌 if (soInfo.ItemHash.Count > 0) { string sysNoStr = ""; foreach (SOItemInfo soItem in soInfo.ItemHash.Values) { if (soItem.ProductType == (int)AppEnum.SOItemType.ForSale) { sysNoStr += soItem.ProductSysNo + ","; } } sysNoStr = sysNoStr.TrimEnd(','); if (sysNoStr != "") { string sql = @" SELECT Product.SysNo,Product.ManufacturerSysNo,Product.C3SysNo,Category3.C2SysNo,Category2.C1SysNo FROM Product (NOLOCK) JOIN Category3 (NOLOCK) ON Category3.SysNo = product.C3SysNo JOIN Category2 (NOLOCK) ON Category2.SysNo = Category3.C2SysNo JOIN Category1 (NOLOCK) ON Category1.SysNo = Category2.C1SysNo WHERE Product.SysNo IN(" + sysNoStr + ")"; soItemDS = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(soItemDS)) { soItemDS = ConvertSOItemDS(soItemDS, soInfo); } } } else { result = "没有订购任何商品"; return result; } #region 优惠券类型 的类别/商品/品牌 检测 if (oCoupon.CouponType == (int)AppEnum.CouponType.Category) { string cstr = oCoupon.CategorySysNoCom; string[] cList = cstr.Split(','); if (cList.Length > 0) { ArrayList c1List = new ArrayList(); ArrayList c2List = new ArrayList(); ArrayList c3List = new ArrayList(); for (int i = 0; i < cList.Length; i++) { string[] cx = cList[i].ToString().Split('_'); switch (cx[0].ToString()) { case "c1": case "C1": c1List.Add(Util.TrimIntNull(cx[1])); break; case "c2": case "C2": c2List.Add(Util.TrimIntNull(cx[1])); break; case "c3": case "C3": c3List.Add(Util.TrimIntNull(cx[1])); break; default: break; } } decimal categorybuyAmt = 0; bool IsContainsCategory = false; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int c1SysNo = Util.TrimIntNull(dr["C1SysNo"]); int c2SysNo = Util.TrimIntNull(dr["C2SysNo"]); int c3SysNo = Util.TrimIntNull(dr["C3SysNo"]); int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); bool isInCategory = false; if (c1List.Contains(c1SysNo)) { IsContainsCategory = true; isInCategory = true; } else if (c2List.Contains(c2SysNo)) { IsContainsCategory = true; isInCategory = true; } else if (c3List.Contains(c3SysNo)) { IsContainsCategory = true; isInCategory = true; } if (isInCategory == true) categorybuyAmt += currprice * currqty; } if (IsContainsCategory == false) { result = "使用的类别优惠券,只能针对优惠券指定的类别商品进行优惠"; return result; } if (categorybuyAmt < oCoupon.SaleAmt) { result = "优惠券指定的类别商品的购买总额没有达到优惠券需消费金额要求"; return result; } } } else if (oCoupon.CouponType == (int)AppEnum.CouponType.Product) { string pstr = oCoupon.ProductSysNoCom; decimal productbuyAmt = 0; bool IsContainsProduct = false; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int productsysno = Util.TrimIntNull(dr["SysNo"]); int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); bool isInProduct = false; if (pstr.Contains(productsysno.ToString())) { IsContainsProduct = true; isInProduct = true; } if (isInProduct == true) productbuyAmt += currprice * currqty; } if (IsContainsProduct == false) { result = "使用的商品优惠券,只能针对优惠券指定的商品进行优惠"; return result; } if (productbuyAmt < oCoupon.SaleAmt) { result = "优惠券指定的商品的购买总额没有达到优惠券需消费金额要求"; return result; } } else if (oCoupon.CouponType == (int)AppEnum.CouponType.Manufactory) { string mstr = oCoupon.ManufactorySysNoCom; decimal manufactorybuyAmt = 0; bool IsContainsManufactory = false; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int manufacturerSysNo = Util.TrimIntNull(dr["ManufacturerSysNo"]); int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); bool isInManufacturer = false; if (mstr.Contains(manufacturerSysNo.ToString())) { IsContainsManufactory = true; isInManufacturer = true; } if (isInManufacturer == true) manufactorybuyAmt += currprice * currqty; } if (IsContainsManufactory == false) { result = "使用的品牌优惠券,只能针对优惠券指定的品牌商品进行优惠"; return result; } if (manufactorybuyAmt < oCoupon.SaleAmt) { result = "优惠券指定的品牌商品的购买总额没有达到优惠券需消费金额要求"; return result; } } else if (oCoupon.CouponType == (int)AppEnum.CouponType.ALL) { decimal productbuyAmt = 0; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); productbuyAmt += currprice * currqty; } if (productbuyAmt < oCoupon.SaleAmt) { result = "购买商品的总额没有达到优惠券需消费金额要求"; return result; } } #endregion return result; }
public void CreateCoupon(CouponInfo oriInfo, int qty) { string sql = @"SELECT couponcode FROM Coupon"; DataSet couponDs = SqlHelper.ExecuteDataSet(sql); ArrayList pwdList = new ArrayList(); if (Util.HasMoreRow(couponDs)) { foreach (DataRow dr in couponDs.Tables[0].Rows) { pwdList.Add(dr["couponcode"].ToString()); } } if (oriInfo.CouponCode != "") { int count = 0; if (!pwdList.Contains(oriInfo.CouponCode)) { sql = @"SELECT MAX(SUBSTRING(CouponID, 2,9)) MaxCouponID FROM Coupon"; DataSet dsMaxNo = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(dsMaxNo)) { if (dsMaxNo.Tables[0].Rows.Count == 1) { foreach (DataRow dr in dsMaxNo.Tables[0].Rows) { if (dr["MaxCouponID"] != null && dr["MaxCouponID"].ToString() != string.Empty) { count = int.Parse(dr["MaxCouponID"].ToString()); qty += int.Parse(dr["MaxCouponID"].ToString()); } } } } oriInfo.CouponID = oriInfo.CouponType.ToString() + (count + 1).ToString().PadLeft(9, '0'); if (qty - count > 1) throw new BizException("指定密码的优惠券一次只能生成一个"); CouponDac couponDac = new CouponDac(); TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { oriInfo.SysNo = SequenceDac.GetInstance().Create("Coupon_Sequence"); oriInfo.CreateTime = DateTime.Now; couponDac.Insert(oriInfo); scope.Complete(); } } else throw new BizException("您指定要生成的优惠券密码已经被使用,请使用其它密码再生成"); } else { PasswordGenerator pwdGen = new PasswordGenerator(); int count = 0; sql = @"SELECT MAX(SUBSTRING(CouponID, 2,9)) MaxCouponID FROM Coupon"; DataSet dsMaxNo = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(dsMaxNo)) { if (dsMaxNo.Tables[0].Rows.Count == 1) { foreach (DataRow dr in dsMaxNo.Tables[0].Rows) { if (dr["MaxCouponID"] != null && dr["MaxCouponID"].ToString() != string.Empty) { count = int.Parse(dr["MaxCouponID"].ToString()); qty += int.Parse(dr["MaxCouponID"].ToString()); } } } } //生成优惠券 ArrayList newList = new ArrayList(); while (count < qty) { string pwd = pwdGen.Generate(); if (!pwdList.Contains(pwd)) { count++; CouponInfo oCoupon = new CouponInfo(); oCoupon.CouponName = oriInfo.CouponName; oCoupon.CouponID = oriInfo.CouponType.ToString() + count.ToString().PadLeft(9, '0'); oCoupon.CouponCode = pwd; oCoupon.CouponAmt = oriInfo.CouponAmt; oCoupon.SaleAmt = oriInfo.SaleAmt; oCoupon.CouponType = oriInfo.CouponType; oCoupon.ValidTimeFrom = oriInfo.ValidTimeFrom; oCoupon.ValidTimeTo = oriInfo.ValidTimeTo; oCoupon.MaxUseDegree = oriInfo.MaxUseDegree; oCoupon.UsedDegree = oriInfo.UsedDegree; oCoupon.CreateTime = oriInfo.CreateTime; oCoupon.CreateUserSysNo = oriInfo.CreateUserSysNo; oCoupon.BatchNo = oriInfo.BatchNo; oCoupon.Status = oriInfo.Status; oCoupon.CategorySysNoCom = oriInfo.CategorySysNoCom; oCoupon.ProductSysNoCom = oriInfo.ProductSysNoCom; oCoupon.ManufactorySysNoCom = oriInfo.ManufactorySysNoCom; oCoupon.UseAreaSysNoCom = oriInfo.UseAreaSysNoCom; oCoupon.UseCustomerSysNo = oriInfo.UseCustomerSysNo; oCoupon.UseCustomerGradeCom = oriInfo.UseCustomerGradeCom; pwdList.Add(pwd); newList.Add(oCoupon); } } if (newList.Count > 0) { CouponDac couponDac = new CouponDac(); foreach (CouponInfo oCoupon in newList) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { oCoupon.SysNo = SequenceDac.GetInstance().Create("Coupon_Sequence"); oCoupon.CreateTime = DateTime.Now; couponDac.Insert(oCoupon); scope.Complete(); } } } } }
/// <summary> /// 检测优惠券是否能使用于SO /// </summary> /// <param name="oCoupon"></param> /// <param name="soInfo"></param> public void CheckCouponSO(CouponInfo oCoupon, SOInfo soInfo) { //有效期 if (oCoupon.ValidTimeTo < DateTime.Now) { throw new BizException("优惠券已经过期,不能使用"); } else if (oCoupon.ValidTimeFrom > DateTime.Now) { throw new BizException("优惠券尚未生效,不能使用"); } //状态 else if (oCoupon.Status != (int)AppEnum.CouponStatus.Activation && oCoupon.Status != (int)AppEnum.CouponStatus.PartlyUsed) { throw new BizException("此优惠券没有被激活或已经使用,不能使用"); } //使用次数 else if (oCoupon.MaxUseDegree == oCoupon.UsedDegree) { throw new BizException("该优惠券已达到最高使用次数,不能再使用"); } DataSet soItemDS = new DataSet(); //销售单的明细商品(仅主商品),增加大、中、小类,增加品牌项 if (soInfo.ItemHash.Count > 0) { string sysNoStr = ""; foreach (SOItemInfo soItem in soInfo.ItemHash.Values) { if (soItem.ProductType == (int)AppEnum.SOItemType.ForSale) { sysNoStr += soItem.ProductSysNo + ","; } } sysNoStr = sysNoStr.TrimEnd(','); if (sysNoStr != "") { string sql = @" SELECT Product.SysNo,Product.ManufacturerSysNo,Product.C3SysNo,Category3.C2SysNo,Category2.C1SysNo FROM Product (NOLOCK) JOIN Category3 (NOLOCK) ON Category3.SysNo = product.C3SysNo JOIN Category2 (NOLOCK) ON Category2.SysNo = Category3.C2SysNo JOIN Category1 (NOLOCK) ON Category1.SysNo = Category2.C1SysNo WHERE Product.SysNo IN(" + sysNoStr + ")"; soItemDS = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(soItemDS)) { soItemDS = ConvertSOItemDS(soItemDS, soInfo); } } } else { throw new BizException("没有购买任何商品"); } #region 优惠券类型 的类别/商品/品牌 检测 if (oCoupon.CouponType == (int)AppEnum.CouponType.Category) { string cstr = oCoupon.CategorySysNoCom; string[] cList = cstr.Split(','); if (cList.Length > 0) { ArrayList c1List = new ArrayList(); ArrayList c2List = new ArrayList(); ArrayList c3List = new ArrayList(); for (int i = 0; i < cList.Length; i++) { string[] cx = cList[i].ToString().Split('_'); switch (cx[0].ToString()) { case "c1": case "C1": c1List.Add(Util.TrimIntNull(cx[1])); break; case "c2": case "C2": c2List.Add(Util.TrimIntNull(cx[1])); break; case "c3": case "C3": c3List.Add(Util.TrimIntNull(cx[1])); break; default: break; } } decimal categorybuyAmt = 0; bool IsContainsCategory = false; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int c1SysNo = Util.TrimIntNull(dr["C1SysNo"]); int c2SysNo = Util.TrimIntNull(dr["C2SysNo"]); int c3SysNo = Util.TrimIntNull(dr["C3SysNo"]); int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); bool isInCategory = false; if (c1List.Contains(c1SysNo)) { IsContainsCategory = true; isInCategory = true; } else if (c2List.Contains(c2SysNo)) { IsContainsCategory = true; isInCategory = true; } else if (c3List.Contains(c3SysNo)) { IsContainsCategory = true; isInCategory = true; } if (isInCategory == true) categorybuyAmt += currprice * currqty; } if (IsContainsCategory == false) throw new BizException("您使用的是类别优惠券,只能购买相应的类别商品时才能使用"); if (categorybuyAmt < oCoupon.SaleAmt) throw new BizException("您使用的是类别优惠券,符合优惠类别的购买商品的金额总和不满足使用要求"); } } else if (oCoupon.CouponType == (int)AppEnum.CouponType.Product) { string pstr = oCoupon.ProductSysNoCom; decimal productbuyAmt = 0; bool IsContainsProduct = false; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int productsysno = Util.TrimIntNull(dr["SysNo"]); int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); bool isInProduct = false; if (pstr.Contains(productsysno.ToString())) { IsContainsProduct = true; isInProduct = true; } if (isInProduct == true) productbuyAmt += currprice * currqty; } if (IsContainsProduct == false) throw new BizException("您使用的是商品优惠券,只能购买相应的商品时才能使用"); if (productbuyAmt < oCoupon.SaleAmt) throw new BizException("您使用的是商品优惠券,符合优惠商品的购买商品的金额总和不满足使用要求"); } else if (oCoupon.CouponType == (int)AppEnum.CouponType.Manufactory) { string mstr = oCoupon.ManufactorySysNoCom; decimal manufactorybuyAmt = 0; bool IsContainsManufactory = false; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int manufacturerSysNo = Util.TrimIntNull(dr["ManufacturerSysNo"]); int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); bool isInManufacturer = false; if (mstr.Contains(manufacturerSysNo.ToString())) { IsContainsManufactory = true; isInManufacturer = true; } if (isInManufacturer == true) manufactorybuyAmt += currprice * currqty; } if (IsContainsManufactory == false) throw new BizException("您使用的是品牌优惠券,只能购买相应的品牌商品时才能使用"); if (manufactorybuyAmt < oCoupon.SaleAmt) throw new BizException("您使用的是品牌优惠券,符合优惠品牌的购买商品的金额总和不满足使用要求"); } else if (oCoupon.CouponType == (int)AppEnum.CouponType.ALL) { decimal productbuyAmt = 0; foreach (DataRow dr in soItemDS.Tables[0].Rows) { int currqty = Util.TrimIntNull(dr["Qty"]); decimal currprice = Util.TrimDecimalNull(dr["Price"]); productbuyAmt += currprice * currqty; } if (productbuyAmt < oCoupon.SaleAmt) throw new BizException("您购买的商品的金额总和不满足优惠券使用要求"); } #endregion //区域 if (oCoupon.UseAreaSysNoCom != "") { Icson.Objects.Basic.AreaInfo oArea = Icson.BLL.Basic.ASPManager.GetInstance().LoadArea(soInfo.ReceiveAreaSysNo); bool isContainsArea = false; if (oArea != null) { if (oCoupon.UseAreaSysNoCom.Contains(oArea.SysNo.ToString())) isContainsArea = true; else if (oCoupon.UseAreaSysNoCom.Contains(oArea.ProvinceSysNo.ToString())) isContainsArea = true; else if (oCoupon.UseAreaSysNoCom.Contains(oArea.CitySysNo.ToString())) isContainsArea = true; } if (isContainsArea == false) throw new BizException("您所在地区不符合优惠券的使用区域"); } //客户 if (oCoupon.UseCustomerSysNo != AppConst.IntNull) { if (soInfo.CustomerSysNo != oCoupon.UseCustomerSysNo) throw new BizException("您不能使用该优惠券"); } //客户等级 if (oCoupon.UseCustomerGradeCom != "") { Icson.Objects.Basic.CustomerInfo oCustomer = Icson.BLL.Basic.CustomerManager.GetInstance().Load(soInfo.CustomerSysNo); if (!oCoupon.UseCustomerGradeCom.Contains(oCustomer.CustomerRank.ToString())) throw new BizException("您的会员等级不能使用当前优惠券"); } }
private void UpdateCoupon(CouponInfo oCoupon) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { new CouponDac().Update(oCoupon); scope.Complete(); } }
private void map(CouponInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.CouponID = Util.TrimNull(tempdr["CouponID"]); oParam.CouponName = Util.TrimNull(tempdr["CouponName"]); oParam.CouponCode = Util.TrimNull(tempdr["CouponCode"]); oParam.CouponAmt = Util.TrimDecimalNull(tempdr["CouponAmt"]); oParam.SaleAmt = Util.TrimDecimalNull(tempdr["SaleAmt"]); oParam.CouponType = Util.TrimIntNull(tempdr["CouponType"]); oParam.ValidTimeFrom = Util.TrimDateNull(tempdr["ValidTimeFrom"]); oParam.ValidTimeTo = Util.TrimDateNull(tempdr["ValidTimeTo"]); oParam.MaxUseDegree = Util.TrimIntNull(tempdr["MaxUseDegree"]); oParam.UsedDegree = Util.TrimIntNull(tempdr["UsedDegree"]); oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.AuditUserSysNo = Util.TrimIntNull(tempdr["AuditUserSysNo"]); oParam.AuditTime = Util.TrimDateNull(tempdr["AuditTime"]); oParam.UsedTime = Util.TrimDateNull(tempdr["UsedTime"]); oParam.BatchNo = Util.TrimIntNull(tempdr["BatchNo"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); oParam.CategorySysNoCom = Util.TrimNull(tempdr["CategorySysNoCom"]); oParam.ProductSysNoCom = Util.TrimNull(tempdr["ProductSysNoCom"]); oParam.ManufactorySysNoCom = Util.TrimNull(tempdr["ManufactorySysNoCom"]); oParam.UseAreaSysNoCom = Util.TrimNull(tempdr["UseAreaSysNoCom"]); oParam.UseCustomerSysNo = Util.TrimIntNull(tempdr["UseCustomerSysNo"]); oParam.UseCustomerGradeCom = Util.TrimNull(tempdr["UseCustomerGradeCom"]); }
public CouponInfo LoadCouponByPwd(string couponCode) { string sql = "select * from coupon where couponcode=" + Util.ToSqlString(couponCode); DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { CouponInfo oCoupon = new CouponInfo(); map(oCoupon, ds.Tables[0].Rows[0]); return oCoupon; } else { return null; } }
public int Insert(CouponInfo oParam) { string sql = @"INSERT INTO Coupon ( SysNo, CouponID, CouponName, CouponCode, CouponAmt, SaleAmt, CouponType, ValidTimeFrom, ValidTimeTo, MaxUseDegree, UsedDegree, CreateUserSysNo, CreateTime, AuditUserSysNo, AuditTime, UsedTime, BatchNo, Status, CategorySysNoCom, ProductSysNoCom, ManufactorySysNoCom, UseAreaSysNoCom, UseCustomerSysNo, UseCustomerGradeCom ) VALUES ( @SysNo, @CouponID, @CouponName, @CouponCode, @CouponAmt, @SaleAmt, @CouponType, @ValidTimeFrom, @ValidTimeTo, @MaxUseDegree, @UsedDegree, @CreateUserSysNo, @CreateTime, @AuditUserSysNo, @AuditTime, @UsedTime, @BatchNo, @Status, @CategorySysNoCom, @ProductSysNoCom, @ManufactorySysNoCom, @UseAreaSysNoCom, @UseCustomerSysNo, @UseCustomerGradeCom )"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramCouponID = new SqlParameter("@CouponID", SqlDbType.NVarChar, 20); SqlParameter paramCouponName = new SqlParameter("@CouponName", SqlDbType.NVarChar, 50); SqlParameter paramCouponCode = new SqlParameter("@CouponCode", SqlDbType.NVarChar, 20); SqlParameter paramCouponAmt = new SqlParameter("@CouponAmt", SqlDbType.Decimal, 9); SqlParameter paramSaleAmt = new SqlParameter("@SaleAmt", SqlDbType.Decimal, 9); SqlParameter paramCouponType = new SqlParameter("@CouponType", SqlDbType.Int, 4); SqlParameter paramValidTimeFrom = new SqlParameter("@ValidTimeFrom", SqlDbType.DateTime); SqlParameter paramValidTimeTo = new SqlParameter("@ValidTimeTo", SqlDbType.DateTime); SqlParameter paramMaxUseDegree = new SqlParameter("@MaxUseDegree", SqlDbType.Int, 4); SqlParameter paramUsedDegree = new SqlParameter("@UsedDegree", SqlDbType.Int, 4); SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramAuditUserSysNo = new SqlParameter("@AuditUserSysNo", SqlDbType.Int, 4); SqlParameter paramAuditTime = new SqlParameter("@AuditTime", SqlDbType.DateTime); SqlParameter paramUsedTime = new SqlParameter("@UsedTime", SqlDbType.DateTime); SqlParameter paramBatchNo = new SqlParameter("@BatchNo", SqlDbType.Int, 4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); SqlParameter paramCategorySysNoCom = new SqlParameter("@CategorySysNoCom", SqlDbType.NVarChar, 100); SqlParameter paramProductSysNoCom = new SqlParameter("@ProductSysNoCom", SqlDbType.NVarChar, 100); SqlParameter paramManufactorySysNoCom = new SqlParameter("@ManufactorySysNoCom", SqlDbType.NVarChar, 100); SqlParameter paramUseAreaSysNoCom = new SqlParameter("@UseAreaSysNoCom", SqlDbType.NVarChar, 100); SqlParameter paramUseCustomerSysNo = new SqlParameter("@UseCustomerSysNo", SqlDbType.Int, 4); SqlParameter paramUseCustomerGradeCom = new SqlParameter("@UseCustomerGradeCom", SqlDbType.NVarChar, 100); if (oParam.SysNo != AppConst.IntNull) paramSysNo.Value = oParam.SysNo; else paramSysNo.Value = System.DBNull.Value; if (oParam.CouponID != AppConst.StringNull) paramCouponID.Value = oParam.CouponID; else paramCouponID.Value = System.DBNull.Value; if (oParam.CouponName != AppConst.StringNull) paramCouponName.Value = oParam.CouponName; else paramCouponName.Value = System.DBNull.Value; if (oParam.CouponCode != AppConst.StringNull) paramCouponCode.Value = oParam.CouponCode; else paramCouponCode.Value = System.DBNull.Value; if (oParam.CouponAmt != AppConst.DecimalNull) paramCouponAmt.Value = oParam.CouponAmt; else paramCouponAmt.Value = System.DBNull.Value; if (oParam.SaleAmt != AppConst.DecimalNull) paramSaleAmt.Value = oParam.SaleAmt; else paramSaleAmt.Value = System.DBNull.Value; if (oParam.CouponType != AppConst.IntNull) paramCouponType.Value = oParam.CouponType; else paramCouponType.Value = System.DBNull.Value; if (oParam.ValidTimeFrom != AppConst.DateTimeNull) paramValidTimeFrom.Value = oParam.ValidTimeFrom; else paramValidTimeFrom.Value = System.DBNull.Value; if (oParam.ValidTimeTo != AppConst.DateTimeNull) paramValidTimeTo.Value = oParam.ValidTimeTo; else paramValidTimeTo.Value = System.DBNull.Value; if (oParam.MaxUseDegree != AppConst.IntNull) paramMaxUseDegree.Value = oParam.MaxUseDegree; else paramMaxUseDegree.Value = System.DBNull.Value; if (oParam.UsedDegree != AppConst.IntNull) paramUsedDegree.Value = oParam.UsedDegree; else paramUsedDegree.Value = System.DBNull.Value; if (oParam.CreateUserSysNo != AppConst.IntNull) paramCreateUserSysNo.Value = oParam.CreateUserSysNo; else paramCreateUserSysNo.Value = System.DBNull.Value; if (oParam.CreateTime != AppConst.DateTimeNull) paramCreateTime.Value = oParam.CreateTime; else paramCreateTime.Value = System.DBNull.Value; if (oParam.AuditUserSysNo != AppConst.IntNull) paramAuditUserSysNo.Value = oParam.AuditUserSysNo; else paramAuditUserSysNo.Value = System.DBNull.Value; if (oParam.AuditTime != AppConst.DateTimeNull) paramAuditTime.Value = oParam.AuditTime; else paramAuditTime.Value = System.DBNull.Value; if (oParam.UsedTime != AppConst.DateTimeNull) paramUsedTime.Value = oParam.UsedTime; else paramUsedTime.Value = System.DBNull.Value; if (oParam.BatchNo != AppConst.IntNull) paramBatchNo.Value = oParam.BatchNo; else paramBatchNo.Value = System.DBNull.Value; if (oParam.Status != AppConst.IntNull) paramStatus.Value = oParam.Status; else paramStatus.Value = System.DBNull.Value; if (oParam.CategorySysNoCom != AppConst.StringNull) paramCategorySysNoCom.Value = oParam.CategorySysNoCom; else paramCategorySysNoCom.Value = System.DBNull.Value; if (oParam.ProductSysNoCom != AppConst.StringNull) paramProductSysNoCom.Value = oParam.ProductSysNoCom; else paramProductSysNoCom.Value = System.DBNull.Value; if (oParam.ManufactorySysNoCom != AppConst.StringNull) paramManufactorySysNoCom.Value = oParam.ManufactorySysNoCom; else paramManufactorySysNoCom.Value = System.DBNull.Value; if (oParam.UseAreaSysNoCom != AppConst.StringNull) paramUseAreaSysNoCom.Value = oParam.UseAreaSysNoCom; else paramUseAreaSysNoCom.Value = System.DBNull.Value; if (oParam.UseCustomerSysNo != AppConst.IntNull) paramUseCustomerSysNo.Value = oParam.UseCustomerSysNo; else paramUseCustomerSysNo.Value = System.DBNull.Value; if (oParam.UseCustomerGradeCom != AppConst.StringNull) paramUseCustomerGradeCom.Value = oParam.UseCustomerGradeCom; else paramUseCustomerGradeCom.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramCouponID); cmd.Parameters.Add(paramCouponName); cmd.Parameters.Add(paramCouponCode); cmd.Parameters.Add(paramCouponAmt); cmd.Parameters.Add(paramSaleAmt); cmd.Parameters.Add(paramCouponType); cmd.Parameters.Add(paramValidTimeFrom); cmd.Parameters.Add(paramValidTimeTo); cmd.Parameters.Add(paramMaxUseDegree); cmd.Parameters.Add(paramUsedDegree); cmd.Parameters.Add(paramCreateUserSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramAuditUserSysNo); cmd.Parameters.Add(paramAuditTime); cmd.Parameters.Add(paramUsedTime); cmd.Parameters.Add(paramBatchNo); cmd.Parameters.Add(paramStatus); cmd.Parameters.Add(paramCategorySysNoCom); cmd.Parameters.Add(paramProductSysNoCom); cmd.Parameters.Add(paramManufactorySysNoCom); cmd.Parameters.Add(paramUseAreaSysNoCom); cmd.Parameters.Add(paramUseCustomerSysNo); cmd.Parameters.Add(paramUseCustomerGradeCom); return SqlHelper.ExecuteNonQuery(cmd); }