123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm
- {
- public partial class MemberCardDeleteSmallForm : LYFZ.Software.UI.MembershipManage.SetSmallForm.MemberCardDeleteSmallForm
- {
- public MemberCardDeleteSmallForm()
- {
- this.Load += MemberCardDeleteSmallForm_Load;
- this.txtQuery.KeyDown += txtQuery_KeyDown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnDelete.Click += btnDelete_Click;
- }
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
- LYFZ.BLL.BLL_ErpMemberCardAmountCashStatus mcacsbll = new BLL.BLL_ErpMemberCardAmountCashStatus();
- LYFZ.BLL.BLL_ErpMemberCardAmountChangeLOG mcscLog = new BLL.BLL_ErpMemberCardAmountChangeLOG();
- LYFZ.BLL.BLL_ErpMemberCardBackCash mcbsbll = new BLL.BLL_ErpMemberCardBackCash();
- LYFZ.BLL.BLL_ErpMemberCardBackCashSet mcbcsetbll = new BLL.BLL_ErpMemberCardBackCashSet();
- LYFZ.BLL.BLL_ErpMemberCardBackCashTakeCash mcbctcbll = new BLL.BLL_ErpMemberCardBackCashTakeCash();
- LYFZ.BLL.BLL_ErpMemberCardDiscount mcdtbll = new BLL.BLL_ErpMemberCardDiscount();
- LYFZ.BLL.BLL_ErpMemberCardInterfaceManagement mcimbll = new BLL.BLL_ErpMemberCardInterfaceManagement();
- LYFZ.BLL.BLL_ErpMemberCardOperateLOG mcoLogbll = new BLL.BLL_ErpMemberCardOperateLOG();
- LYFZ.BLL.BLL_ErpMemberCardPayment mcptbll = new BLL.BLL_ErpMemberCardPayment();
- LYFZ.BLL.BLL_ErpMemberCardPaymentContentDetail mcpcdbll = new BLL.BLL_ErpMemberCardPaymentContentDetail();
- LYFZ.BLL.BLL_ErpMemberCardPhotographerMain mcpmbll = new BLL.BLL_ErpMemberCardPhotographerMain();
- LYFZ.BLL.BLL_ErpMemberCardPhotographerVice mcpvbll = new BLL.BLL_ErpMemberCardPhotographerVice();
- LYFZ.BLL.BLL_ErpMemberCardPoints mcpointsbll = new BLL.BLL_ErpMemberCardPoints();
- LYFZ.BLL.BLL_ErpMemberCardPointsLOG mcpointsLog = new BLL.BLL_ErpMemberCardPointsLOG();
- LYFZ.BLL.BLL_ErpMemberCardRechargeRecord mcrrbll = new BLL.BLL_ErpMemberCardRechargeRecord();
- LYFZ.BLL.BLL_ErpMemberCardServiceContentUseLog mcscuLog = new BLL.BLL_ErpMemberCardServiceContentUseLog();
- LYFZ.BLL.BLL_ErpMemberCardViceCard mcvbll = new BLL.BLL_ErpMemberCardViceCard();
- LYFZ.BLL.BLL_ErpMemberCardValidity mcvybll = new BLL.BLL_ErpMemberCardValidity();
- LYFZ.BLL.BLL_ErpMemberCardTakeCash mctcbll = new LYFZ.BLL.BLL_ErpMemberCardTakeCash();
- LYFZ.BLL.BLL_ErpSystemLogs syslog = new BLL.BLL_ErpSystemLogs();
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void MemberCardDeleteSmallForm_Load(object sender, EventArgs e)
- {
- this.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- this.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
-
- this.dgvData.DataColumns("会员卡号,姓名,性别,电话,类型,状态,等级,积分,金额,折扣,套系金额,已返金额,已取出金额,办卡日期,备注");
- this.dgvData.FillLastColumn();
- }
- /// <summary>
- /// 回车查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtQuery_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- { this.PublicFunctionRows(); }
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- { this.PublicFunctionRows(); }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.CurrentCell.ColumnIndex >= 0 && this.dgvData.CurrentRow.Index >= 0)
- {
- if (MessageBoxCustom.Show("您选择的会员卡号为:" + this.dgvData.CurrentRow.Cells["会员卡号"].Value.ToString().Trim() + ",持卡人为:" + this.dgvData.CurrentRow.Cells["姓名"].Value.ToString().Trim() + ";\r\n删除后则无法恢复!您确定要删除此会员帐户吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- string StrMcNumber = this.dgvData.CurrentRow.Cells["Mc_Number"].Value.ToString().Trim();
- LYFZ.Model.Model_ErpMemberCard modelMc = mcbll.GetModel("Mc_Number", StrMcNumber);
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- clist.Add(mcacsbll.GetDeleteCommandInfo(whereStr: "Mcacr_Number = '" + StrMcNumber + "'"));
- clist.Add(mcscLog.GetDeleteCommandInfo(whereStr: "Mcacl_Number = '" + StrMcNumber + "'"));
- clist.Add(mcbsbll.GetDeleteCommandInfo(whereStr: "Mcbc_Number = '" + StrMcNumber + "'"));
- clist.Add(mcbcsetbll.GetDeleteCommandInfo(whereStr: "Mcb_Number = '" + StrMcNumber + "'"));
- clist.Add(mcbctcbll.GetDeleteCommandInfo(whereStr: "Mctc_Number = '" + StrMcNumber + "'"));
- clist.Add(mcdtbll.GetDeleteCommandInfo(whereStr: "Mcdt_Number = '" + StrMcNumber + "'"));
- clist.Add(mcimbll.GetDeleteCommandInfo(whereStr: "Mcim_Number = '" + StrMcNumber + "'"));
- clist.Add(mcoLogbll.GetDeleteCommandInfo(whereStr: "mcol_Number = '" + StrMcNumber + "'"));
- LYFZ.Model.Model_ErpMemberCardPayment model = mcptbll.GetModel("Mcpt_Number", StrMcNumber);
- clist.Add(mcptbll.GetDeleteCommandInfo("ID", "=", model.ID));
- clist.Add(mcpcdbll.GetDeleteCommandInfo(whereStr: "Mcpcd_PaymentNumber = '" + model.Mcpt_PaymentNumber + "'"));
- clist.Add(mcpmbll.GetDeleteCommandInfo(whereStr: "Mcpm_Number = '" + StrMcNumber + "'"));
- clist.Add(mcpvbll.GetDeleteCommandInfo(whereStr: "Mcpv_Number = '" + StrMcNumber + "'"));
- clist.Add(mcpointsbll.GetDeleteCommandInfo(whereStr: "Mcps_Number = '" + StrMcNumber + "'"));
- clist.Add(mcpointsLog.GetDeleteCommandInfo(whereStr: "MPlg_Number = '" + StrMcNumber + "'"));
- clist.Add(mcrrbll.GetDeleteCommandInfo(whereStr: "Mcrr_Number = '" + StrMcNumber + "'"));
- clist.Add(mcscuLog.GetDeleteCommandInfo(whereStr: "Mcsl_Number = '" + StrMcNumber + "'"));
- clist.Add(mcvbll.GetDeleteCommandInfo(whereStr: "Mvc_Number = '" + StrMcNumber + "'"));
- clist.Add(mcbll.GetDeleteCommandInfo("ID", "=", Convert.ToInt32(this.dgvData.CurrentRow.Cells["Mc_ID"].Value)));
- clist.Add(mcvybll.GetDeleteCommandInfo("Mcvy_Number","=",StrMcNumber));
- clist.Add(mctcbll.GetDeleteCommandInfo("Mctkc_Number", "=", StrMcNumber));
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- string StrUserIP = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP;
- string StrContent = "[删除会员] 会员卡编号:"+modelMc.Mc_Number+", 会员卡号:" + this.dgvData.CurrentRow.Cells["会员卡号"].Value + ",客户:" + this.dgvData.CurrentRow.Cells["姓名"].Value + " " + this.dgvData.CurrentRow.Cells["电话"].Value + ",等级:" + this.dgvData.CurrentRow.Cells["等级"].Value + ",状态:" + this.dgvData.CurrentRow.Cells["状态"].Value + ",可用金额:" + this.dgvData.CurrentRow.Cells["金额"].Value + ",可用积分:" + this.dgvData.CurrentRow.Cells["积分"].Value + ",折扣:" + this.dgvData.CurrentRow.Cells["折扣"].Value + ",返现套系金额:" + this.dgvData.CurrentRow.Cells["套系金额"].Value + ",已返金额:" + this.dgvData.CurrentRow.Cells["已返金额"].Value + ",已取金额:" + this.dgvData.CurrentRow.Cells["已取出金额"].Value;
- clist.Add(new LYFZ.BLL.BLL_ErpSystemLogs().GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除会员, StrContent, strUserID, StrUserName, StrUserIP)));
- clist.Add(new BLL.BLL_ErpACVBSYS().GetAddCommandInfo(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetModelLog(LYFZ.EnumPublic.SystemLogsType.删除会员.ToString(), StrContent)));
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
- { MessageBoxCustom.Show("删除失败!"); return; }
- try
- {
- //更新客户组成员表
- DataTable tbl = orbll.GetView_Custom("tb_ErpCustomerGroupMembers", StrWhere: "GM_CustomerID = '" + modelMc.Mc_CustomerNumber + "'", ShowColumnName: "GM_CustomerGroupID").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- try
- {
- System.Threading.ThreadPool.QueueUserWorkItem(delegate
- {
- for (int i = 0; i < tbl.Rows.Count; i++)
- {
- LYFZ.DAL.DAL_ErpCustomer.UpdateAggregationCustomer(tbl.Rows[i]["GM_CustomerGroupID"].ToString().Trim());
- }
- });
- }
- catch { }
- }
- }
- catch { }
- this.dgvData.Rows.Remove(this.dgvData.CurrentRow);
- if (modelMc.Mc_Status == "1")
- { LYFZ.BLL.OrderPayment_Member.MemberLogout(modelMc.Mc_CustomerNumber, modelMc.Mc_CradNumber); }
- MessageBoxCustom.Show("删除成功!");
- }
- }
- }
- else
- { MessageBoxCustom.Show("请选择您要删除的会员卡"); return; }
- }
- }
- /// <summary>
- /// 数据处理
- /// </summary>
- void PublicFunctionRows()
- {
- if (this.txtQuery.Text.Trim() == "")
- { MessageBoxCustom.Show("请输入你要查询的会员卡卡号"); return; }
- string StrWhere = " 会员卡号 != '' and (会员卡号 like '" + this.txtQuery.Text.Trim() + "%' or 姓名 like '" + this.txtQuery.Text.Trim() + "%' or 电话 like '%" + this.txtQuery.Text.Trim() + "%' or dbo.fn_ChineseToSpell(姓名) like '" + this.txtQuery.Text.Trim() + "%') ";
- DataTable tbl = orbll.GetView_Custom("BView_MemberMain_GoldMember", StrWhere: StrWhere, ShowColumnName: "Mc_ID,Mc_Number,会员卡号,姓名,性别,电话,类型,( case when Mc_Status = '0' then '已注销' else '正在使用' end) as 状态,等级,积分,金额,折扣,套系金额,已返金额,已取出金额,办卡日期,备注").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- this.dgvData.DataSource(tbl, strHideField: "Mc_ID,Mc_Number");
- }
- else
- { MessageBoxCustom.Show("根据你输入的查询条件未找到任何相关信息!"); this.dgvData.Rows.Clear(); return; }
- }
- }
- }
|