예제 #1
0
 public Maticsoft.Model.Shop.Sales.SalesItem DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Shop.Sales.SalesItem item = new Maticsoft.Model.Shop.Sales.SalesItem();
     if (row != null)
     {
         if ((row["ItemId"] != null) && (row["ItemId"].ToString() != ""))
         {
             item.ItemId = int.Parse(row["ItemId"].ToString());
         }
         if ((row["RuleId"] != null) && (row["RuleId"].ToString() != ""))
         {
             item.RuleId = int.Parse(row["RuleId"].ToString());
         }
         if ((row["ItemType"] != null) && (row["ItemType"].ToString() != ""))
         {
             item.ItemType = int.Parse(row["ItemType"].ToString());
         }
         if ((row["UnitValue"] != null) && (row["UnitValue"].ToString() != ""))
         {
             item.UnitValue = int.Parse(row["UnitValue"].ToString());
         }
         if ((row["RateValue"] != null) && (row["RateValue"].ToString() != ""))
         {
             item.RateValue = int.Parse(row["RateValue"].ToString());
         }
     }
     return item;
 }
예제 #2
0
 protected void btnSave_OnClick(object sender, EventArgs e)
 {
     Maticsoft.Model.Shop.Sales.SalesRule model = new Maticsoft.Model.Shop.Sales.SalesRule {
         RuleName = this.txtRuleName.Text,
         RuleMode = Globals.SafeInt(this.radMode.SelectedValue, 0),
         RuleUnit = Globals.SafeInt(this.radUnit.SelectedValue, 0),
         Status = Globals.SafeInt(this.radStatus.SelectedValue, 0),
         CreatedDate = DateTime.Now,
         CreatedUserID = base.CurrentUser.UserID
     };
     string str = this.hfItems.Value;
     if (string.IsNullOrWhiteSpace(str))
     {
         MessageBox.ShowFailTip(this, "请填写优惠规则项");
     }
     else
     {
         int num = this.ruleBll.Add(model);
         if (num > 0)
         {
             string[] strArray = str.Split(new char[] { ',' });
             int num2 = Globals.SafeInt(this.radItemType.SelectedValue, 0);
             foreach (string str2 in strArray)
             {
                 Maticsoft.Model.Shop.Sales.SalesItem item = new Maticsoft.Model.Shop.Sales.SalesItem {
                     ItemType = num2,
                     UnitValue = Globals.SafeInt(str2.Split(new char[] { '|' })[0], 0),
                     RateValue = Globals.SafeInt(str2.Split(new char[] { '|' })[1], 0),
                     RuleId = num
                 };
                 this.itemBll.Add(item);
             }
             for (int i = 0; i < this.ChkUserRank.Items.Count; i++)
             {
                 if (this.ChkUserRank.Items[i].Selected)
                 {
                     Maticsoft.Model.Shop.Sales.SalesUserRank rank = new Maticsoft.Model.Shop.Sales.SalesUserRank {
                         RankId = Globals.SafeInt(this.ChkUserRank.Items[i].Value, 0),
                         RuleId = num
                     };
                     this.userRankBll.Add(rank);
                 }
             }
             for (int j = 0; j < this.ChkDealerRank.Items.Count; j++)
             {
                 if (this.ChkDealerRank.Items[j].Selected)
                 {
                     Maticsoft.Model.Shop.Sales.SalesUserRank rank2 = new Maticsoft.Model.Shop.Sales.SalesUserRank {
                         RankId = Globals.SafeInt(this.ChkUserRank.Items[j].Value, 0),
                         RuleId = num
                     };
                     this.userRankBll.Add(rank2);
                 }
             }
             MessageBox.ShowSuccessTipScript(this, "操作成功!", "window.parent.location.reload();");
         }
     }
 }