Exemplo n.º 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(VipSoft.Model.ExchangeLog model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(VipSoft.Model.ExchangeLog model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 3
0
        private void Button_Save_Click(object sender, EventArgs e)
        {
            totalPoint = 0;
            if (memInfo == null)
            {
                MessageBox.Show("您必须先选择会员!");
                return;
            }

             exchangList = new List<VipSoft.Model.ExchangeLog>();
             foreach (DataGridViewRow row in this.dataGridView_List.Rows)
             {
                 Model.ExchangeLog info;
                 Model.Gift gift;

                 if (row.Cells[0].Value != null && bool.Parse(row.Cells[0].Value.ToString()))
                 {
                     int id = int.Parse(row.Cells["Column_ID"].Value.ToString());
                     string code = row.Cells["Column_Code"].Value.ToString();
                     string name = row.Cells["Column_Name"].Value.ToString();
                     int point = int.Parse(row.Cells["Column_Point"].Value.ToString());

                     int number = 1;
                     try
                     {
                         number = int.Parse(row.Cells["Column_ENum"].Value.ToString());
                     }
                     catch
                     {
                         MessageBox.Show("请输入正确的兑换数量!");
                         return;
                     }

                     if (number > int.Parse(row.Cells["Column_Number"].Value.ToString()))
                     {
                         MessageBox.Show("兑换数量超出礼品剩余数量!");
                         return;
                     }
                     gift = new Model.Gift();
                     gift.GiftCode=code;
                     gift.Name=name;
                     gift.Photo="";
                     gift.Point=point;
                     gift.Number=number;
                     gift.ID = id;

                     info = new Model.ExchangeLog();
                     info.MemID=memInfo.ID;
                     info.CardID=memInfo.CardID;
                     info.Name=memInfo.Name;
                     info.Number=number;
                     info.Point = point * number;
                     info.GiftID=id;
                     info.GiftName=name;
                     info.GiftCode=code;
                     info.MasterID=PublicState.Master.ID;
                     info.MasterName=PublicState.Master.Name;
                     info.ShopID=PublicState.Master.ShopID;
                     info.ShopName=PublicState.Master.ShopName;
                     exchangList.Add(info);
                 }
             }

             if (exchangList.Count == 0)
             {
                 MessageBox.Show("请先选择需要兑换的礼品!");
                 return;
             }
             if (totalPoint > memInfo.Point)
             {
                 MessageBox.Show("对不起,此会员账户积分不足!");
                 return;
             }

             if (new VipSoft.BLL.ExchangeLog().Add(exchangList))
             {
                 // 日志记录
                 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog();
                 log.Add(new Model.SysLog(PublicState.Master, "积分兑换", "积分兑换产品成功,会员卡号:" + memInfo.CardID + "姓名:" + memInfo.Name, DateTime.Now));
                 // 发送系统短信
                 memInfo = new BLL.MemCard().GetModel(memInfo.ID);
                     Function.UpdateMemberLevel(2, memInfo);//兑换登记时候自动重新计算

                 // 提示
                 MessageBox.Show("兑换成功。");
                 // 界面
                 memInfo = null;
                 this.label_M_Money.Text = "";
                 this.label_M_Name.Text = "";
                 this.label_M_Point.Text = "";
                 this.label_M_TotalMoney.Text = "";
                 this.searchMember1.CardID = "";
                 BindList();
             }
        }