/// <summary> /// 修改密码按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPass_Click(object sender, EventArgs e) { if (tbxCardNo.Text.Trim().Length == 0) { MessageBox.Show("请输入会员卡/储值卡卡号!", Gattr.AppTitle); this.tbxCardNo.Focus(); } else if (this.tbxNewPass.Text.Trim() == "") { MessageBox.Show("新密码不能为空!", Gattr.AppTitle); this.tbxNewPass.Focus(); } else if (this.tbxNewPass.Text.Trim() != this.tbxNew222.Text.Trim()) { MessageBox.Show("确认密码不正确!", Gattr.AppTitle); this.tbxNew222.Focus(); } else { t_member_info memberinfo = MemberService.Instance.UpdateMemPayPass(tbxCardNo.Text.Trim(), tbxPass.Text.Trim(), tbxNewPass.Text.Trim()); if (memberinfo.code == "1") { MessageBox.Show("密码修改成功,请妥善保管好您的密码!", Gattr.AppTitle); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); } } }
/// <summary> /// 查询会员信息 /// </summary> /// <returns></returns> private bool CardNoInput() { if (tbxCardNo.Text.Trim().Length == 0) { MessageBox.Show("请输入会员卡/储值卡卡号!", Gattr.AppTitle); this.tbxCardNo.Focus(); } else { this.lbRemain.Text = string.Empty; lbName.Text = string.Empty; t_member_info memberinfo = MemberService.Instance.GetMemberInfoByMemNo(tbxCardNo.Text.Trim()); if (memberinfo.code == "-1") { MessageBox.Show(memberinfo.info, Gattr.AppTitle); tbxCardNo.Text = string.Empty; tbxCardNo.Focus(); } else { this.lbRemain.Text = memberinfo.balance.ToString(); lbName.Text = memberinfo.username; } } return(false); }
/// <summary> /// 会员查询 /// </summary> public void SearchMember() { String mem_no = this.txtInput.Text.Trim(); if (mem_no.Length == 0) { MessageBox.Show("请输入会员编号", Gattr.AppTitle); this.txtInput.Focus(); } else { t_member_info meminfo = MemberService.Instance.GetMemberInfoByMemNo(mem_no); if (meminfo.code == "-1") { MessageBox.Show(meminfo.info, Gattr.AppTitle); this.txtInput.Focus(); } else { if (meminfo.code == "1") { t_member_info _temp = MemberService.Instance.CheckMemberinfoForLL(meminfo.mem_no); if (_temp != null) { if (_temp.code == "1") { meminfo.mem_type = "WX"; } } } else { if (meminfo.code == "404") { meminfo.code = "1"; meminfo.mem_no = mem_no; } } if (SetMemberEvent != null) { SetMemberEvent(meminfo); } DialogResult = DialogResult.OK; } //if (meminfo.code == "1") //{ // if (SetMemberEvent != null) // { // SetMemberEvent(meminfo); // } // DialogResult = DialogResult.OK; //} //else //{ // MessageBox.Show(meminfo.info, Gattr.AppTitle); // this.txtInput.Focus(); //} } }
/// <summary> /// 付款 /// </summary> private void PayCard() { if (lbName.Text.Trim().Length == 0) { MessageBox.Show("请输入会员卡/储值卡卡号!", Gattr.AppTitle); this.tbxCardNo.Focus(); } else { bool isok = true; Decimal balance = SIString.TryDec(lbRemain.Text.Trim()); tbxAmt.Text = lbMaxAmt.Text; //实际付款 Decimal pay1 = SIString.TryDec(tbxAmt.Text.Trim()); Decimal pay2 = SIString.TryDec(lbMaxAmt.Text.Trim()); if (balance <= 0)//当前没有余额 { MessageBox.Show("账户余额不足!"); isok = false; }//if (balance <= 0) else if (pay1 > pay2)//现负金额大于应付金额 { MessageBox.Show("现付金额不能大于应付金额!"); tbxAmt.Focus(); isok = false; }//else if (pay1 > pay2) else if (balance < pay2)//当前余额小于应付金额 { DialogResult res = MessageBox.Show(string.Format("当前储值卡余额为{0},不足消费!是否使用储值卡剩下余额付款?", balance), Gattr.AppTitle, MessageBoxButtons.YesNo); if (res == DialogResult.No) { isok = false; } else { tbxAmt.Text = balance.ToString(); pay1 = balance; } } if (isok) { t_member_info memberinfo = MemberService.Instance.GetMemberInfoByMemNoAndPass(tbxCardNo.Text.Trim(), tbxPass.Text.Trim()); if (memberinfo.code == "-1") { MessageBox.Show(memberinfo.info, Gattr.AppTitle); } else { //先判断密码 if (SetCardPayInfo != null) { SetCardPayInfo(tbxCardNo.Text.Trim(), pay1, (balance - pay1).ToString()); } DialogResult = DialogResult.OK; } } } }
/// <summary> /// 根据会员账号获取会员信息 get_mem_info /// </summary> /// <param name="mem_no">会员卡号</param> /// <returns></returns> public t_member_info GetMemberInfoByMemNo(String mem_no) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); t = InvokeMemberService("get_mem_info", _dic); return(t); }
/// <summary> /// 获取支付使用的验证码 /// </summary> /// <param name="mem_no">会员编号</param> /// <returns></returns> public t_member_info GetValidateCode(String mem_no) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); t = InvokeMemberService("get_consumer_vercode", _dic); return(t); }
/// <summary> /// 充值完成 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="ordername">订单号</param> /// <returns></returns> public t_member_info RechargeMoneyFinsh(String mem_no, String ordername) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("ordername", ordername); t = InvokeMemberService("memb_recharge_order_finish", _dic); return(t); }
/// <summary> /// 检测当前会员是否绑定利澜会会员 /// </summary> /// <param name="mem_no">会员卡号</param> /// <returns></returns> public t_member_info CheckMemberinfoForLL(String mem_no) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("type", "WEIXIN"); t = InvokeMemberService("check_member_istoken", _dic); return(t); }
/// <summary> /// 会员充值第一步,先充值到第三方中 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="money">充值金额</param> /// <param name="ordername">订单号</param> /// <param name="paytype">支付方式</param> /// <returns>是否成功</returns> public t_member_info RechargeMoney(String mem_no, String money, String ordername, String paytype) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("money", money); _dic.Add("ordername", ordername); _dic.Add("paytype", paytype); t = InvokeMemberService("memb_recharge_order_add", _dic); return(t); }
/// <summary> /// 根据会员卡号、新支付密码重置支付密码 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="mem_new_pass">新密码</param> /// <returns></returns> public t_member_info ResetPayPass(String mem_no, String mem_new_pass) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("mem_new_pass", mem_new_pass); t = InvokeMemberService("password_reset", _dic); if (t.code == "1") { t = GetMemberInfoByMemNo(mem_no); } return(t); }
public FrmPayWay(decimal payAmt, string defaultPayWay, string sellWay, t_member_info memberinfo) { InitializeComponent(); //if (defaultPayWay.Equals("USD")) if (sellWay.Equals("D")) { this.lbTitle.Text = "请选择找零方式"; } this.sale_way = sellWay; this.tbPayAmt.Text = Convert.ToDecimal(String.Format("{0:F}", payAmt)).ToString(); this._returnText = defaultPayWay; this._payAmt = payAmt; this._memberinfo = memberinfo; }
/// <summary> /// 减少会员积分 /// </summary> /// <param name="mem_no">会员号</param> /// <param name="score">增加积分</param> /// <param name="ordername">关联订单号</param> /// <returns></returns> public t_member_info UseMemberScore(String mem_no, String score, String ordername, String el = "") { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("else", System.Web.HttpUtility.UrlEncode(el).ToUpper()); _dic.Add("mem_no", mem_no); _dic.Add("score", score); _dic.Add("ordername", ordername); t = InvokeMemberService("usescore", _dic); if (t.code == "1") { t = GetMemberInfoByMemNo(mem_no); } return(t); }
/// <summary> /// 构造函数,需要把卡号和需要支付的金额传递过来 /// </summary> /// <param name="cardNo">会员卡/储值卡卡号</param> /// <param name="payAmt">需要支付的金额</param> public FrmPaySavCard(t_member_info memberInfo, Decimal payAmt) { InitializeComponent(); ActiveControl = tbxCardNo; tbxCardNo.Focus(); if (memberInfo != null && SIString.TryStr(memberInfo.mem_no).Length > 0) { tbxCardNo.Text = memberInfo.mem_no; lbName.Text = memberInfo.username; lbRemain.Text = memberInfo.balance.ToString(); tbxCardNo.Enabled = false; ActiveControl = tbxPass; tbxPass.Focus(); } tbxAmt.Text = payAmt.ToString(Gattr.PosSaleAmtPoint); lbMaxAmt.Text = payAmt.ToString(Gattr.PosSaleAmtPoint); }
//重新发送验证码 private void linkLabelVcode_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { t_member_info memberinfo = MemberService.Instance.GetValidateCode(_vip_no); if (memberinfo.code == "-1") { if (string.IsNullOrEmpty(memberinfo.info)) { MessageBox.Show("验证码发送失败,请尝试重新发送或者使用其他方式支付!", Gattr.AppTitle); //LoggerHelper.Log("MsmkLogger", memberinfo.mem_no + "验证码发送失败,请尝试重新发送或者使用其他方式支付!", LogEnum.SysLog); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); //LoggerHelper.Log("MsmkLogger", memberinfo.mem_no + "余额支付错误信息:" + memberinfo.info, LogEnum.SysLog); } return; } }
/// <summary> /// 使用会员卡金额付款 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="money">扣减金额</param> /// <param name="ordername">关联订单号</param> /// <param name="memo">备注</param> /// <returns></returns> public t_member_info UseMemberCardPay(String mem_no, String money, String ordername, String memo) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("money", SIString.TryStr(money)); _dic.Add("ordername", ordername); _dic.Add("else", memo); t = InvokeMemberService("deduction", _dic); if (t.code == "1") { t = AddMemberScore(mem_no, money, ordername); if (t.code == "1") { t = GetMemberInfoByMemNo(mem_no); } } return(t); }
/// <summary> /// 使用会员卡金额付款 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="money">扣减金额</param> /// <param name="ordername">关联订单号</param> /// <param name="memo">备注</param> /// <returns></returns> public t_member_info UseMemberCardPayNew(String mem_no, String money, String ordername, String vercode, String memo) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("money", SIString.TryStr(money)); _dic.Add("ordername", ordername); _dic.Add("else", System.Web.HttpUtility.UrlEncode(memo).ToUpper()); _dic.Add("vercode", vercode); t = InvokeMemberService("deduction", _dic); if (t.code == "1") { //t = AddMemberScore(mem_no, money, ordername); if (t.code == "1") { t = GetMemberInfoByMemNo(mem_no); } } return(t); }
/// <summary> /// 查询按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, System.EventArgs e) { lbMemberBalance.Text = string.Empty; lbMemberCons.Text = string.Empty; lbMemberEmail.Text = string.Empty; lbMemberId.Text = string.Empty; lbMemberLevel.Text = string.Empty; lbMemberName.Text = string.Empty; lbMemberNo.Text = string.Empty; lbMemberScore.Text = string.Empty; lbMemberType.Text = string.Empty; lbMemberMobile.Text = string.Empty; if (tbMem_no.Text.Trim().Length == 0) { MessageBox.Show("请输入要查询的会员账号或手机号", Gattr.AppTitle); tbMem_no.Focus(); return; } t_member_info memberinfo = MemberService.Instance.GetMemberInfoByMemNo(tbMem_no.Text.Trim()); if (memberinfo.code == "1") { lbMemberBalance.Text = SIString.TryStr(ExtendUtility.Instance.ParseToDecimal(memberinfo.balance).ToString(Gattr.PosSalePrcPoint)); lbMemberCons.Text = SIString.TryStr(ExtendUtility.Instance.ParseToDecimal(memberinfo.total_consu).ToString(Gattr.PosSalePrcPoint)); lbMemberEmail.Text = SIString.TryStr(memberinfo.email); lbMemberId.Text = SIString.TryStr(memberinfo.mem_id); lbMemberLevel.Text = SIString.TryStr(memberinfo.Level); lbMemberName.Text = SIString.TryStr(memberinfo.username); lbMemberNo.Text = SIString.TryStr(memberinfo.mem_no); lbMemberScore.Text = SIString.TryStr(ExtendUtility.Instance.ParseToDecimal(memberinfo.score).ToString(Gattr.PosSalePrcPoint)); lbMemberType.Text = SIString.TryStr(memberinfo.regtype); lbMemberMobile.Text = SIString.TryStr(memberinfo.mobile); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); tbMem_no.Focus(); } }
public FrmPayBalance(decimal payAmt, string defaultPayWay, t_member_info memberinfo, decimal moneyCha) { InitializeComponent(); if (memberinfo != null) { //if (defaultPayWay.Equals("USD")) if (payAmt < 0) { if (moneyCha >= payAmt) { this._mCHA = moneyCha; } else { this._mCHA = payAmt; } this.tbPayAmt.Text = Convert.ToDecimal(String.Format("{0:F}", _mCHA)).ToString(); this.tbPayAmt.Enabled = false; } else { if (payAmt < memberinfo.balance) { this.tbPayAmt.Text = Convert.ToDecimal(String.Format("{0:F}", payAmt)).ToString(); } else { this.tbPayAmt.Text = Convert.ToDecimal(String.Format("{0:F}", memberinfo.balance)).ToString(); } this.tbPayAmt.Enabled = true; } this._returnText = defaultPayWay; this._payAmt = payAmt; this._memberinfo = memberinfo; this.tbMemberName.Text = _memberinfo.mem_no; this.tbMemberBalance.Text = Convert.ToDecimal(String.Format("{0:F}", _memberinfo.balance)).ToString(); } }
/// <summary> /// 设置会员信息 /// </summary> void SetMemberInfo() { if (tbMemberNo.Text.Trim().Length == 0) { MessageBox.Show("请输入会员卡号", Gattr.AppTitle); tbMemberNo.Focus(); return; } lbMemberNo.Text = string.Empty; lbMemberBalance.Text = string.Empty; t_member_info memberinfo = MemberService.Instance.GetMemberInfoByMemNo(this.tbMemberNo.Text.Trim()); if (memberinfo.code == "1") { lbMemberNo.Text = memberinfo.username; lbMemberBalance.Text = SIString.TryStr(memberinfo.balance); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); tbMemberNo.Focus(); } }
/// <summary> /// 根据要调用的方法和参数执行会员服务方法 /// </summary> /// <param name="method"></param> /// <param name="_dic"></param> /// <returns></returns> public t_member_info InvokeMemberService(String method, Dictionary <String, String> _dic) { String parameter = String.Empty; String address = String.Empty; String response = String.Empty; t_member_info t = null; try { parameter = MemberServicesProvider.Instance.PrepareParameters(method, GlobalSet.access_way, GlobalSet.mem_access_token, _dic); address = GlobalSet.memberUrl + parameter; response = WebUtility.Instance.GetHttpWebResponse(address); if (response != "404") { t = JsonUtility.Instance.JsonToObject <t_member_info>(response); if (t == null) { t = new t_member_info() { code = "-1", info = response }; } } else { t = new t_member_info() { code = "404", info = "远程服务器返回异常" }; } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", "LL.POS.Transfer->SyncProcessor-->InvokeMemberService-->Exception:" + ex.ToString(), LogEnum.ExceptionLog); } return(t); }
/// <summary> /// 根据要调用的方法和参数执行会员服务方法 /// </summary> /// <param name="method"></param> /// <param name="_dic"></param> /// <returns></returns> private t_member_info InvokeMemberService(String method, Dictionary <String, String> _dic) { String parameter = String.Empty; String address = String.Empty; String response = String.Empty; t_member_info t = null; try { parameter = PrepareParameters(method, _dic); address = Gattr.MemberServiceUri + parameter; response = WebUtility.Instance.GetHttpWebResponse(address); if (response != "404") { t = JsonUtility.Instance.JsonToObject <t_member_info>(response); if (t == null) { t = new t_member_info() { code = "-1", info = response }; } } else { t = new t_member_info() { code = "404", info = "远程服务器返回异常" }; } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", "LL.POS->Services-->Memberserices-->Exception:" + ex.ToString(), LogEnum.ExceptionLog); } return(t); }
/// <summary> /// 会员查询 /// </summary> public void SearchMember() { String mem_no = this.tbCardNo.Text.Trim(); if (mem_no.Length == 0) { MessageBox.Show("请输入会员编号", Gattr.AppTitle); this.tbCardNo.Focus(); } else { t_member_info meminfo = MemberService.Instance.GetMemberInfoByMemNo(mem_no); if (meminfo.code == "-1") { MessageBox.Show(meminfo.info, Gattr.AppTitle); this.tbCardNo.Focus(); } else { if (meminfo.code == "1") { t_member_info _temp = MemberService.Instance.CheckMemberinfoForLL(meminfo.mem_no); if (_temp != null) { if (_temp.code == "1") { if (_temp.time.Date == System.DateTime.Now.Date) { //接口参数 Dictionary <string, object> _dic = Gfunc.GetServiceParameter(); _dic.Add("vip_no", mem_no); _dic.Add("item_no", "80310891"); _dic.Add("plan_no", "WX80310891"); bool isok1 = true; string errorMessage = string.Empty; //参数提交 string result = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/GetIsFirstSale", _dic, ref isok1, ref errorMessage); if (isok1) { if (result == "0") { meminfo.mem_type = "WX"; if (SetMemberEvent != null) { SetMemberEvent(meminfo); } DialogResult = DialogResult.OK; } else { MessageBox.Show("您领取过本活动的赠品!", Gattr.AppTitle); } } else { MessageBox.Show("接口信息获取错误!", Gattr.AppTitle); } } else { MessageBox.Show("您不是今日绑定的会员信息!本次活动仅限于当日绑定的会员!"); } } else { MessageBox.Show("您未将会员卡与微信绑定,无法参加活动,请使用微信绑定会员卡!", Gattr.AppTitle); } } } else { if (meminfo.code == "404") { meminfo.code = "1"; meminfo.mem_no = mem_no; } } } //if (meminfo.code == "1") //{ // if (SetMemberEvent != null) // { // SetMemberEvent(meminfo); // } // DialogResult = DialogResult.OK; //} //else //{ // MessageBox.Show(meminfo.info, Gattr.AppTitle); // this.txtInput.Focus(); //} } }
private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.tbPayAmt.Text.Trim())) { MessageBox.Show("付款金额不能为空!"); return; } else { if (_returnText == "CHA") { if (_memberinfo != null) { if (this._payAmt > 0) { if (this._payAmt < ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("付款金额不能大于应收金额!", Gattr.AppTitle); return; } if (0 >= ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("付款金额不能小于等于0!", Gattr.AppTitle); return; } decimal _amt = ExtendUtility.Instance.ParseToDecimal(_memberinfo.balance); if (ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim()) > _amt) { MessageBox.Show("付款金额不能大于会员账户余额!", Gattr.AppTitle); return; } t_member_info memberinfo = MemberService.Instance.GetValidateCode(_memberinfo.mem_no); if (memberinfo.code == "-1") { if (string.IsNullOrEmpty(memberinfo.info)) { MessageBox.Show("验证码发送失败,请尝试重新发送或者使用其他方式支付!", Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", memberinfo.mem_no + "验证码发送失败,请尝试重新发送或者使用其他方式支付!", LogEnum.SysLog); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", memberinfo.mem_no + "余额支付错误信息:" + memberinfo.info, LogEnum.SysLog); } return; } } else { if (this._payAmt > ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("余额退款金额不能大于本单的总退款金额!", Gattr.AppTitle); return; } if (this._mCHA < ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("余额退款金额不能小于本单原有的余额支付金额!", Gattr.AppTitle); return; } if (0 == ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("余额退款金额不能为0!", Gattr.AppTitle); return; } } } else { MessageBox.Show("会员信息不存在,不能使用余额支付!", Gattr.AppTitle); return; } } decimal.TryParse(this.tbPayAmt.Text.Trim(), out this._returnMoney); this.ReturnMoney = this._returnMoney; this.DialogResult = DialogResult.OK; } }
private void btnOK_Click(object sender, EventArgs e) { ListItem list = (ListItem)this.cbPayWay.SelectedItem; string key = list.Key; int index = key.IndexOf(']'); this._returnText = key.Substring(0, index).Substring(1); if (key.Length != 0) { if (string.IsNullOrEmpty(this.tbPayAmt.Text.Trim())) { MessageBox.Show("付款金额不能为空!"); } else { if (_returnText == "HF") { if (this._payAmt < ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("付款金额不能大于应收金额!", Gattr.AppTitle); return; } } if (_returnText == "CHA") { if (_memberinfo != null) { if (this._payAmt < ExtendUtility.Instance.ParseToDecimal(this.tbPayAmt.Text.Trim())) { MessageBox.Show("付款金额不能大于应收金额!", Gattr.AppTitle); return; } decimal _amt = ExtendUtility.Instance.ParseToDecimal(_memberinfo.balance); if (this._payAmt > _amt) { MessageBox.Show("付款金额不能大于会员账户余额!", Gattr.AppTitle); return; } t_member_info memberinfo = MemberService.Instance.GetValidateCode(_memberinfo.mem_no); if (memberinfo.code == "-1") { if (string.IsNullOrEmpty(memberinfo.info)) { MessageBox.Show("验证码发送失败,请尝试重新发送或者使用其他方式支付!", Gattr.AppTitle); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); } return; } } else { MessageBox.Show("会员信息不存在,不能使用余额支付!", Gattr.AppTitle); return; } } decimal.TryParse(this.tbPayAmt.Text.Trim(), out this._returnMoney); this.ReturnMoney = this._returnMoney; this.DialogResult = DialogResult.OK; } } }
/// <summary> /// 数据处理公共方法 /// </summary> void DealerData(bool isWorkInvoke, int mark) { //TODO:处理数据 //bool isok = true; String _branchNo = string.Empty; DataTable tableFlowNo = null; DataTable tablePayFlow = null; DataTable tableSaleFlow = null; // bool isok1 = true; try { tableFlowNo = UploadInfoBLL.Instance.GetUploadPayNo(GlobalSet.dbsaleconn); if (tableFlowNo != null && tableFlowNo.Rows.Count > 0) { foreach (DataRow dr in tableFlowNo.Rows) { tablePayFlow = UploadInfoBLL.Instance.GetUploadPayInfoByFlowNo(GlobalSet.dbsaleconn, dr[0].ToString()); tableSaleFlow = UploadInfoBLL.Instance.GetUploadSaleInfoByFlowNo(GlobalSet.dbsaleconn, dr[0].ToString()); if ((tablePayFlow != null && tablePayFlow.Rows.Count > 0) || (tableSaleFlow != null && tableSaleFlow.Rows.Count > 0)) { StringBuilder sb = new StringBuilder(); if (isWorkInvoke) { if (isWork == false) { break; } } //object result = PosServiceProvider.Instance.UploadPayAndSaleInfo(GlobalSet.posserviceurl, GlobalSet.posservicename, tablePayFlow, tableSaleFlow, ref isok1); Dictionary <string, object> _dic = new Dictionary <string, object>(); _dic.Add("username", ""); _dic.Add("password", ""); _dic.Add("client_id", GlobalSet.client_id); _dic.Add("access_token", GlobalSet.access_token); _dic.Add("pay", JsonUtility.Instance.DataTableToJson(tablePayFlow)); _dic.Add("sale", JsonUtility.Instance.DataTableToJson(tableSaleFlow)); // LoggerHelper.Log("pay", _dic["pay"].ToString(), LogEnum.TransferLog); // LoggerHelper.Log("sale", _dic["sale"].ToString(), LogEnum.TransferLog); string errorMessage = string.Empty; bool isok11 = true; string isConnect = PServiceProvider.Instance.InvokeMethod(GlobalSet.serverUrl + "/Testconn", _dic, ref isok11, ref errorMessage); if (isok11 && isConnect == "1") { string json = PServiceProvider.Instance.InvokeMethod(GlobalSet.serverUrl + "/" + "Addflow", _dic, ref isok11, ref errorMessage); if (isok11) { if (json != "-10" && json != "-20") { int result = ExtendUtility.Instance.ParseToInt32(json); if (result == 1) { UploadInfoBLL.Instance.UpdateFlowComFlag(GlobalSet.dbsaleconn, dr[0].ToString()); //TODO:记录日志 if (tablePayFlow != null && tablePayFlow.Rows.Count > 0) { sb.AppendLine("流水号:" + dr[0].ToString() + "支付记录条数:" + tablePayFlow.Rows.Count); } if (tableSaleFlow != null && tableSaleFlow.Rows.Count > 0) { sb.AppendLine("流水号:" + dr[0].ToString() + "销售记录条数:" + tableSaleFlow.Rows.Count); } LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); } else { //TODO:记录日志 错误信息 //TODO:记录日志 sb.AppendLine("流水号:" + dr[0].ToString() + "Error:" + result.ToString()); LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); } } else { if (json == "-10") { sb.AppendLine("流水号:" + dr[0].ToString() + "Error:参数错误"); LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); } else { sb.AppendLine("流水号:" + dr[0].ToString() + "Error:权限不足"); LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); } } } else { sb.AppendLine("流水号:" + dr[0].ToString() + "Error:" + errorMessage); LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); } } else { //LoggerHelper.Log("MsmkLogger", "断网情况下不进行数据传输", LogEnum.TransferLog); } //object result = PosUploadServiceProvider.Instance.UploadFlow(GlobalSet.ConnectString, ref isok1, tablePayFlow, tableSaleFlow); //if (isok1 == true) //{ // isok = (bool)result; // if (isok) // { // UploadInfoBLL.Instance.UpdateFlowComFlag(GlobalSet.dbsaleconn, dr[0].ToString()); // //TODO:记录日志 // sb.AppendLine("流水号:" + dr[0].ToString() + "支付记录条数:" + tablePayFlow.Rows.Count + "销售记录条数:" + tableSaleFlow.Rows.Count); // LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); // } // else // { // //TODO:记录日志 错误信息 // //TODO:记录日志 // sb.AppendLine("流水号:" + dr[0].ToString() + "Error:" + result.ToString()); // LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); // } //} //else //{ // //TODO:记录日志 错误信息 // //TODO:记录日志 // sb.AppendLine("流水号:" + dr[0].ToString() + "Error:" + result.ToString()); // LoggerHelper.Log("MsmkLogger", sb.ToString(), LogEnum.TransferLog); //} } } } else { if (mark == 1) { MessageBox.Show("数据上传完毕", GlobalSet.appname); //button1.Enabled = true; //Application.Exit(); } } DataTable table = UploadInfoBLL.Instance.GetNoneUploadMember(GlobalSet.dbsaleconn); if (table != null && table.Rows.Count > 0) { //SyncProcessor.Instance.SyncMember(table); foreach (DataRow dr in table.Rows) { string mem_no = ExtendUtility.Instance.ParseToString(dr["card_no"]); string flow_no = ExtendUtility.Instance.ParseToString(dr["flow_no"]); string score = ExtendUtility.Instance.ParseToString(dr["score"]); string voucher_no = ExtendUtility.Instance.ParseToString(dr["voucher_no"]); DateTime oper_date = ExtendUtility.Instance.ParseToDateTime(dr["oper_date"]); string memo = "门店消费"; if (!string.IsNullOrEmpty(voucher_no)) { memo = "门店退货" + voucher_no; } Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); if (isWorkInvoke) { if (isWork == false) { break; } } t = SyncProcessor.Instance.InvokeMemberService("get_mem_info", _dic); if (t.code == "1") { //有效会员进行有效积分计算 _dic.Add("else", System.Web.HttpUtility.UrlEncode(memo).ToUpper()); _dic.Add("score", score); _dic.Add("ordername", flow_no); t = SyncProcessor.Instance.InvokeMemberService("addscore", _dic); if (t.code == "1") { //更新同步标志 UploadInfoBLL.Instance.UpdateUploadMember(GlobalSet.dbsaleconn, flow_no, mem_no, "1", "1"); LoggerHelper.Log("MsmkLogger", "离线会员消费信息上传成功,流水号:" + flow_no + "会员卡号:" + mem_no, LogEnum.TransferLog); } else { if (t.code == "-1") { //UploadInfoBLL.Instance.UpdateUploadMember(GlobalSet.dbsaleconn, flow_no, mem_no, "1", "2"); LoggerHelper.Log("MsmkLogger", "离线会员消费信息上传失败,流水号:" + flow_no + "会员卡号:" + mem_no, LogEnum.TransferLog); } } } else { if (t.code == "-1") { //无效会员 UploadInfoBLL.Instance.UpdateUploadMember(GlobalSet.dbsaleconn, flow_no, mem_no, "1", "0"); LoggerHelper.Log("MsmkLogger", "离线会员消费信息验证失败,流水号:" + flow_no + "会员卡号:" + mem_no, LogEnum.TransferLog); } } } } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", "LL.POS.Transfer->FormMain-->DealerData--->" + ex.ToString(), LogEnum.TransferLog); } }
/// <summary> /// 确定按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { tbPayAmount2.Text = "0.00"; bool isok = true; if (lbMemberNo.Text.Length == 0) { MessageBox.Show("请输入会员卡号", Gattr.AppTitle); tbMemberNo.Focus(); isok = false; } else { if (tbPayAmount.Text.Trim().Length == 0) { MessageBox.Show("请输入充值金额", Gattr.AppTitle); tbPayAmount.Focus(); isok = false; } else { if (tbPayAmount.Text.Trim() != tbPayAmount1.Text.Trim()) { MessageBox.Show("充值金额和已付金额必须相等", Gattr.AppTitle); tbPayAmount1.Focus(); isok = false; } else { if (this.comboBox1.SelectedIndex < 0) { MessageBox.Show("请选择支付方式", Gattr.AppTitle); comboBox1.Focus(); isok = false; } } } } if (isok) { String payway = SIString.TryStr(this.comboBox1.SelectedItem); if (payway == "银行卡") { payway = "CRD"; } else { payway = "RMB"; } TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); String ordername = Convert.ToInt64(ts.TotalSeconds).ToString(); if (MessageBox.Show("确定要充值?", Gattr.AppTitle, MessageBoxButtons.YesNo) == DialogResult.Yes) { t_member_info memberinfo = MemberService.Instance.RechargeMoney(tbMemberNo.Text.Trim(), tbPayAmount.Text.Trim(), ordername, payway); if (memberinfo.code == "1") { t_member_info memberinfo1 = MemberService.Instance.RechargeMoneyFinsh(tbMemberNo.Text.Trim(), ordername); if (memberinfo1.code == "1") { MessageBox.Show("充值成功,卡号:[" + tbMemberNo.Text.Trim() + "]充值金额[" + tbPayAmount.Text.Trim() + "]", Gattr.AppTitle); DialogResult = DialogResult.OK; //TODO:打印充值小票 Print(Gattr.BranchNo, tbMemberNo.Text.Trim(), SIString.TryDec(this.tbPayAmount.Text.Trim()), 0, SIString.TryDec(this.tbPayAmount.Text.Trim()) + SIString.TryDec(lbMemberBalance.Text.Trim())); LoggerHelper.Log("MsmkLogger", System.DateTime.Now.ToString() + "【" + Gattr.OperId + "】进行会员账户充值!充值成功,卡号:[" + tbMemberNo.Text.Trim() + "]充值金额[" + tbPayAmount.Text.Trim() + "]", LogEnum.SysLog); } else { MessageBox.Show(memberinfo1.info, Gattr.AppTitle); } } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); } } } }