private void alButton1_Click(object sender, EventArgs e) { VipSoft.BLL.MemCard mBll = new BLL.MemCard(); //新建会员卡实体对象,保存界面录入的值 VipSoft.Model.MemCard mCard = new Model.MemCard(); mCard.Name = this.Name.Text.Trim(); mCard.CardID = this.cardid.Text.Trim(); mCard.CardMianID = this.cardmianid.Text.Trim(); mCard.CardTypeID = int.Parse(((System.Collections.DictionaryEntry)CardTypeID.Items[0]).Value.ToString()); mCard.CreateTime = DateTime.Parse(this.createtime.Text.Trim()); mCard.Email = this.Email.Text.Trim(); mCard.IsPast = this.IsPast.Checked ; mCard.IsPointAuto = this.IsPointAuto.Checked ; mCard.PastTime = DateTime.Parse(this.PastTime.Text.Trim()); mCard.Sex = int.Parse(((System.Collections.DictionaryEntry)Sex.Items[0]).Value.ToString()); mCard.Mobile = this.Mobile.Text.Trim(); mCard.LevelID = int.Parse(this.LevelID.SelectedValue.ToString()); mCard.Money = Decimal.Parse(this.Money.Text.Trim()); mCard.Password = this.Password.Text.Trim(); mCard.PayMoney = Decimal.Parse(this.PayMoney.Text.Trim()); mCard.Point = Int32.Parse(this.Point.Text.Trim()); mCard.Remark = this.Remark.Text.Trim(); mCard.State = int.Parse(((System.Collections.DictionaryEntry)State.Items[0]).Value.ToString()); mCard.ShopID = PublicState.Master.ShopID; mCard.ShopName = PublicState.Master.ShopName; //... if (this.memId == 0) { mBll.Add(mCard); MessageBox.Show("会员新增成功。"); if (this.continue_add.Checked) { this.cardid.Text = ""; this.cardmianid.Text = ""; this.CardTypeID.Text = ""; this.Name.Text = ""; //... } else { this.Close(); } } else { mCard.ID = memId; mBll.Update(mCard); MessageBox.Show("会员修改成功。"); this.Close(); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(VipSoft.Model.MemCard model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(VipSoft.Model.MemCard model) { return(dal.Add(model)); }