private void memRegister_Load(object sender, EventArgs e) { LoadCardLevel(); loadDicData(); if (memId != 0) { VipSoft.BLL.MemCard mCard = new VipSoft.BLL.MemCard(); VipSoft.Model.MemCard memModel = mCard.GetModel(memId); if (memModel != null) { this.continue_add.Visible = false; this.cardid.Text = memModel.CardID; this.cardmianid.Text = memModel.CardMianID; this.CardTypeID.SelectedValue= int.Parse(memModel.CardTypeID.ToString()); this.Name.Text = memModel.Name; this.LevelID.Text = memModel.LevelID.ToString(); this.id.Text = memModel.ID.ToString(); this.Sex.SelectedValue = int.Parse(memModel.Sex.ToString()); this.State.SelectedValue= int.Parse(memModel.State.ToString()); this.IsPast.Checked = memModel.IsPast; this.IsPointAuto.Checked= memModel.IsPointAuto; this.Email.Text = memModel.Email; this.createtime.Text = memModel.CreateTime.ToString(); this.Mobile.Text = memModel.Mobile; this.Money.Text = memModel.Money.ToString(); this.PayMoney.Text = memModel.PayMoney.ToString(); this.Remark.Text = memModel.Remark.ToString(); this.Point.Text = memModel.Point.ToString(); } } }
//删除会员操作 private void delMem() { //那个选择的条数不是1条时返回 if (this.dataGridView_List.SelectedRows.Count != 1) return; //得到所选记录的主键 int memId = int.Parse(this.dataGridView_List.SelectedRows[0].Cells["ID"].Value.ToString()); string memCardId = this.dataGridView_List.SelectedRows[0].Cells["cardId"].Value.ToString(); string memName = this.dataGridView_List.SelectedRows[0].Cells["MemName"].Value.ToString(); DialogResult dRes = MessageBox.Show("您确定要删除此会员么?此操作不可恢复。", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dRes == DialogResult.No) return; VipSoft.BLL.MemCard mCard = new VipSoft.BLL.MemCard(); //查询该会员的记录,用于记录操作日志 VipSoft.Model.MemCard memModel = mCard.GetModel(memId); if (mCard.Delete(memId)) { // 记录日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master, "会员管理", string.Format("删除会员,ID:{0}会员卡号:{1} 名称:{2}", memId.ToString(), memModel.CardID, memModel.Name), DateTime.Now)); // 提示 MessageBox.Show("会员已被删除。"); // 重新绑定 BindList(); } }
public void GetSearchMember() { if (this.textBox_CardID.Text.Trim() != "") { VipSoft.BLL.MemCard card = new VipSoft.BLL.MemCard(); VipSoft.Model.MemCard memInfo = card.GetModel(this.textBox_CardID.Text); if (memInfo != null) { MemID = memInfo.ID; } else { MemID = -1; } } }
/// <summary> /// 按下回车时的处理方法 /// </summary> public void CardIDKeyDown() { // 卡号 string reg_cardid = @"^[A-Za-z0-9]{0,30}$"; if (this.textBox_CardID.Text == "") { if (ShanKeSelected != null) ShanKeSelected(); return; } else if (!Regex.IsMatch(this.textBox_CardID.Text, reg_cardid)) { MessageBox.Show("卡号输入错误。"); this.textBox_CardID.Focus(); this.textBox_CardID.SelectAll(); return; } VipSoft.BLL.MemCard card = new VipSoft.BLL.MemCard(); VipSoft.Model.MemCard memInfo = card.GetModel(this.textBox_CardID.Text); if (memInfo == null) { MessageBox.Show("未找到此会员。"); this.textBox_CardID.Focus(); this.textBox_CardID.SelectAll(); return; } if (EventMemberSelected != null) EventMemberSelected(memInfo); }
private void recharge_Click(object sender, EventArgs e) { if (this.v_cardid.Text == null || this.v_cardid.Text == "") { MessageBox.Show("请先选择需要充值的会员!"); this.search_box.Focus(); return; } if (this.total.Text == "" || this.total.Text == null || decimal.Parse(this.total.Text) <= 0) { MessageBox.Show("请输入充值金额!"); return; } int id = int.Parse(this.id.Text); decimal rechargeMoney = decimal.Parse(this.total.Text); VipSoft.BLL.MemCard mCard = new VipSoft.BLL.MemCard(); VipSoft.Model.MemCard memModel = mCard.GetModel(id); //更新会员表的卡余额 memModel.Money += rechargeMoney; mCard.Update(memModel); //往充值记录表插入充值记录 VipSoft.BLL.RechargeLog chargeBll = new VipSoft.BLL.RechargeLog(); VipSoft.Model.RechargeLog charge = new Model.RechargeLog(); charge.MemID = id; charge.MemName = memModel.Name; charge.Money = decimal.Parse(this.rechargeAmount.Text); charge.CardID = memModel.CardID; charge.GiveMoney = decimal.Parse(this.giftAmount.Text); charge.MasterID = PublicState.Master.ID; charge.MasterName = PublicState.Master.Name; charge.ShopID = PublicState.Master.ShopID; charge.ShopName = PublicState.Master.ShopName; charge.Type = 0; if (chargeBll.Add(charge) > 0) { MessageBox.Show("充值成功!"); this.Close(); } else { MessageBox.Show("充值失败!"); } }
private void Expense_Load(object sender, EventArgs e) { ClearFormText(); if (CurrentCardID != "") { VipSoft.BLL.MemCard card = new VipSoft.BLL.MemCard(); memInfo = card.GetModel(CurrentCardID); if (memInfo != null) BindMemberMsg(); this.textBox_GoodsCode.Select(); } else this.searchMember1.Select(); BindGoodsTree(); }