private void Button_MyInfoPage_MouseUp(object sender, MouseEventArgs e) { if (!GlobalVariables.isUserLogin) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("您还未登录!", 2); return; } //准备工作 this.UnVisibleAllPanels(); //取消不必要的按钮 this.Button_LastCouponsPage.Visible = false; this.Button_NextCouponsPage.Visible = false; //切换 int y = this.VerticalScroll.Value; this.Panel_MyInfo.Location = new System.Drawing.Point(0, 95 - y); //去重操作 RemoveDuplicate(); InitMyInfoData(); this.Panel_MyInfo.Visible = true; ShowMyInfo(); }
private void Button_NearShop_MouseUp(object sender, MouseEventArgs e) { //切换 int y = this.VerticalScroll.Value; this.Panel_NearShop.Location = new System.Drawing.Point(0, 95 - y); if (!InitNearShopData()) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("暂无周边商家信息!", 2); } Thread.Sleep(20); //准备工作 this.UnVisibleAllPanels(); //显示必要的按钮 this.Button_LastCouponsPage.Visible = true; this.Button_NextCouponsPage.Visible = true; this.Panel_NearShop.Visible = true; ShowNearShop(); }
private void Button_CouponsPage_MouseUp(object sender, MouseEventArgs e) { //切换 int y = this.VerticalScroll.Value; this.Panel_Coupons.Location = new System.Drawing.Point(0, 95 - y); if (GetTradeName() == null) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("暂无优惠劵信息!", 2); return; } // InitCouponData(GetTradeName()[0], 'c'); InitCouponData("", 'c'); Thread.Sleep(20); //准备工作 this.UnVisibleAllPanels(); //取消不必要的按钮 this.Button_LastCouponsPage.Visible = false; this.Button_NextCouponsPage.Visible = false; //显示必要的按钮 this.Btn_Rank.Visible = true; this.Btn_Rec.Visible = true; this.Btn_NewCouponList.Visible = true; // InitCouponButton(); this.Panel_Coupons.Visible = true; // ShowCouponCommonBtn(); ShowCoupon(); // Thread.Sleep(100); }
private bool UserLogin(string userid) { this.CloseAllDialog(); this.InitTimer(); UploadInfo ui = new UploadInfo(); Member m = ui.MemberAuth(userid); MyMsgBox mb = new MyMsgBox(); if (m == null) { mb.ShowMsg("核对用户信息失败!", 1); } else { if (m.StrMobileNo.Length == 0) { Login login = new Login(userid, this); login.TopMost = true; // this.Controls.Add(login); if (DialogResult.Yes == login.ShowDialog(this)) { GlobalVariables.isUserLogin = true; GlobalVariables.LoginUserId = userid; GlobalVariables.M = m; return true; } else { mb.ShowMsg("登录失败!\n请先绑定手机!", 1); } } else { GlobalVariables.isUserLogin = true; GlobalVariables.LoginUserId = userid; GlobalVariables.M = m; return true; } } return false; }
private bool UserLogin(string userid) { UploadInfo ui = new UploadInfo(); Member m = ui.MemberAuth(userid); MyMsgBox mb = new MyMsgBox(); if (m == null) { mb.ShowMsg("无效的用户!", 2); return false; } else { if (m.StrMobileNo.Length == 0) { Login login = new Login(userid, null); login.Location = new Point(30, 50); login.TopMost = true; this.Visible = false; // this.Controls.Add(login); if (DialogResult.Yes == login.ShowDialog(par)) { GlobalVariables.isUserLogin = true; GlobalVariables.LoginUserId = userid; GlobalVariables.M = m; this.DialogResult = DialogResult.Yes; return true; } else { mb.ShowMsg("登录失败!\n请先绑定手机!", 2); this.Visible = true; return false; } } else { GlobalVariables.isUserLogin = true; GlobalVariables.LoginUserId = userid; GlobalVariables.M = m; this.DialogResult = DialogResult.Yes; return true; } } }
/// <summary> /// 收藏和打印半透明Label的时间处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TranlateLabel_Click(object sender, EventArgs e) { MyMsgBox mb = new MyMsgBox(); if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先刷卡!\n获取更多特权请致电:\n4001-868-968", 2); return; } Label lb = sender as Label; int type = 1; //0表示收藏,1表示打印 String id = null; CouponPicInfo pi = null; switch (lb.Name) { case "Home_Fav": type = 0; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 6 + theCouponNum]; id = pi.id; } break; case "Home_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 6 + theCouponNum]; id = pi.id; } break; case "ShopInfo_Fav": type = 0; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][curType]; id = pi.id; } break; case "ShopInfo_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][curType]; id = pi.id; } break; case "Coupon_Fav": type = 0; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 9 + theCouponNum]; id = pi.id; } break; case "Coupon_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 9 + theCouponNum]; id = pi.id; } break; case "MyInfo_Top_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 3 + theCouponNum]; id = pi.id; } break; case "MyInfo_Bottom_Fav": type = 0; if (LP_ctype[1].Count > 0) { pi = LP_ctype[1][(curPage - 1) * 3 + theCouponNum]; id = pi.id; } break; case "MyInfo_Bottom_Print": type = 1; if (LP_ctype[1].Count > 0) { pi = LP_ctype[1][(curPage - 1) * 3 + theCouponNum]; id = pi.id; } break; default: pi = null; id = null; break; } if (pi == null || id == null) { return; } try { if (id != null) { if (type == 1) { if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先登录", 1); return; } else { if (GetUserPrintTimes() < GlobalVariables.PrintLimit) { CouponsPopForm cpf = new CouponsPopForm(pi, this); cpf.ShowDialog(); Thread.Sleep(200); } else { mb.ShowMsg("打印次数达到上限!", 1); return; } } } else { if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先登录", 1); return; } else { mb.ShowMsg("确认收藏?", '1'); if (mb.DialogResult == DialogResult.Yes) { UploadInfo ui = new UploadInfo(); if (ui.CouponFavourite(GlobalVariables.LoginUserId, id)) { mb.ShowMsg("收藏成功!", 1); string[] str = new string[(GlobalVariables.M.AryFavourite.Length + 1)]; int i = 0; foreach (string favid in GlobalVariables.M.AryFavourite) { str[i++] = favid; } str[GlobalVariables.M.AryFavourite.Length] = id; GlobalVariables.M.AryFavourite = str; } else { mb.ShowMsg("收藏失败!请稍后重试", 1); } } } } } else return; mb.Dispose(); } catch (Exception) { this.CloseAllDialog(); mb.ShowMsg("操作错误!请稍后重试!", 2); mb.Dispose(); } }
private bool InitNearShopData() { if (LP_stype != null) { for (int i = 0; i < LP_stype.Length; i++) { if (LP_stype[i] != null) { LP_stype[i].Clear(); } } } DownloadInfo di = new DownloadInfo(this); string[] aryStrShopId = di.ShopAround(); MyMsgBox mb = new MyMsgBox(); LP_stype = new List<PicInfo>[1]; if (aryStrShopId.Length == 0) { LP_stype[0] = new List<PicInfo>(); return false; } else { LP_stype[0] = FindShopById(aryStrShopId); } return true; }
private void Button_VIP_MouseUp(object sender, MouseEventArgs e) { MyMsgBox mb = new MyMsgBox(); if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先刷卡!\n获取更多特权请致电:\n4001-868-968", 2); return; } if (GlobalVariables.M.IntType == 1) { //切换 int y = this.VerticalScroll.Value; this.Panel_Coupons.Location = new System.Drawing.Point(0, 95 - y); if (GetTradeName() == null) { mb.ShowMsg("暂无VIP优惠劵信息!", 2); return; } // InitCouponData(GetTradeName()[0], 'v'); InitCouponData("", 'v'); Thread.Sleep(20); //准备工作 this.UnVisibleAllPanels(); //取消不必要的按钮 this.Button_LastCouponsPage.Visible = false; this.Button_NextCouponsPage.Visible = false; this.Btn_Rank.Visible = false; this.Btn_Rec.Visible = false; this.Btn_NewCouponList.Visible = false; InitCouponButton(); // ShowCouponVipBtn(); this.Panel_Coupons.Visible = true; ShowCoupon(); } else { mb.ShowMsg("您还不是VIP会员\n如果想办理VIP,请联系:\n4001-868-968", 2); } }
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { int WM_KEYDOWN = 256; int WM_SYSKEYDOWN = 260; if (!GlobalVariables.isUserLogin) { if (isFirstKey) { this.LoginText.Text = ""; if (!LoginText.Focused) { LoginText.Focus(); // MessageBox.Show(keyData.ToString().Substring(1,1)); SendKeys.Send(keyData.ToString().Substring(1, 1)); // this.LoginText.Text = keyData.ToString().Substring(1, 1); } if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN) { LoginText.Focus(); isFirstKey = false; } } else { if (keyData.Equals(Keys.Enter)) { if (isOnLoad) { this.LoginText.Text = ""; isFirstKey = true; return false; } this.Label_LoginWaitInfo.Visible = true; Label_LoginWaitInfo.Refresh(); String cardtext = ""; ; int i = 0, j = 0; for (i = 0; i < LoginText.Text.Length; i++) { if (LoginText.Text[i] >= '0' && LoginText.Text[i] <= '9') { cardtext += LoginText.Text[i].ToString(); j++; } } if (cardtext == "3897") { this.SCardTimer.Stop(); this.SCardTimer.Enabled = false; LoginSuccessDispatch(); GlobalVariables.isUserLogin = true; GlobalVariables.LoginUserId = cardtext; GlobalVariables.M = null; } else { if (!UserLogin(cardtext)) { isFirstKey = true; } else { this.SCardTimer.Stop(); this.SCardTimer.Enabled = false; LoginSuccessDispatch(); } } this.Label_LoginWaitInfo.Visible = false; } } } else { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("请您先退出!", 2); } return false; }
private void InitMyInfoData() { MyMsgBox mb = new MyMsgBox(); if (GlobalVariables.M == null) { mb.ShowMsg("下载用户信息失败!", 2); return; } //初始化List if (LP_ctype != null) { for (int i = 0; i < LP_ctype.Length; i++) { if (LP_ctype[i] != null) { LP_ctype[i].Clear(); } } } LP_ctype = new List<CouponPicInfo>[2]; LP_ctype[0] = FindCouponById(GlobalVariables.M.AryFavourite); LP_ctype[1] = FindCouponById(GlobalVariables.M.AryHistory); cPage1 = 1; cPage2 = 1; theCouponNum = 0; }
/// <summary> /// 点击商家二级界面上的商家小图跳转至商家详细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChangeShopPic(object sender, MouseEventArgs e) { PictureBox pb = sender as PictureBox; String name = pb.Name; // MessageBox.Show(name.Length.ToString()); String numstr = "1"; int num = 1; if (name.Length == 15) { numstr = name.Substring(14, 1); num = (numstr[0] - '0'); } if (name.Length == 16) { numstr = name.Substring(14, 2); num = (numstr[0] - '0') * 10 + (numstr[1] - '0'); } // MessageBox.Show(num.ToString()); int curNumType = name.Substring(12, 1)[0] - '0'; int[] tempPage = { tPage1, tPage2, tPage3 }; if (LP_stype[curNumType - 1].Count > 0) { this.UnVisibleAllPanels(); //显示隐藏按钮 this.Button_LastCouponsPage.Visible = true; this.Button_NextCouponsPage.Visible = true; int y = this.VerticalScroll.Value; this.Panel_ShopInfo.Location = new System.Drawing.Point(0, 95 - y); InitShopInfoData(LP_stype[curNumType - 1][num + (tempPage[curNumType - 1] - 1) * 12 - 1].id); Thread.Sleep(20); this.Panel_ShopInfo.Visible = true; ShowShopInfo(); this.BackPage = "Shop"; } else { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("无此商家信息", 2); } }
/// <summary> /// 发送短信 /// </summary> private void SendMessage() { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("是否发送此优惠劵的信息到您的手机上?\n(信息不收取任何费用)", '1'); if (mb.DialogResult == DialogResult.Yes) { string strSql = "select strIntro from t_bz_coupon where strId='" + pi.id + "'"; AccessCmd cmd = new AccessCmd(); ; OleDbDataReader reader = cmd.ExecuteReader(strSql); if (reader.Read()) { if (!reader.IsDBNull(0)) { strMesContent = reader.GetString(0).Trim(); } else { strMesContent = ""; } } reader.Close(); cmd.Close(); if (strMesContent != "") { if (thSendMes != null) { if (thSendMes.IsAlive) { mb.ShowMsg("短信服务器忙,请稍后再试!", 1); thSendMes.Abort(); thSendMes.Join(); return; } } thSendMes = new Thread(new ThreadStart(SendMes)); thSendMes.Start(); mb.ShowMsg("短信已发送!", 1); } else { mb.ShowMsg("该优惠劵暂无优惠信息", 1); return; } } }
private void DoWork() { try { printQueue pq = new printQueue(); Dictionary<string, int> myprinter; string defaultPrinterName = Printer.GetDeaultPrinterName(); // MessageBox.Show(defaultPrinterName); if (pq.CanelAllPrintJob() == false) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("打印纸已用尽!暂停服务!", 3); wait.CloseScrollBar(); return; } myprinter = pq.GetAllPrinterQueues(); if (0 == myprinter[defaultPrinterName]) { if (!pd.PrinterSettings.IsValid) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("打印机不可用!暂停服务!", 3); wait.CloseScrollBar(); return; } pd.Print(); Application.DoEvents(); Thread.Sleep(500); myprinter = pq.GetAllPrinterQueues(); if (myprinter[defaultPrinterName] == 0) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("打印纸已用尽!暂停服务!", 3); wait.CloseScrollBar(); return; } for (int i = 0; i <= 60; i += 1) { wait.SetProgressBarPositionP(i);//设置进度条当前位置 System.Threading.Thread.Sleep(100);//sleep一下减缓进度条进度,实际代码中,此处应该是实际的工作 } myprinter = pq.GetAllPrinterQueues(); if (myprinter[defaultPrinterName] == 0) { string tempId = DateTime.Now.ToString("yyyyMMddHHmmss"); // long tempId = DateTime.Now.Ticks; if (MD5code == "") { MD5code = "00000000"; } string strSql = "insert into t_bz_coupon_print values('" + tempId + "','" + GlobalVariables.LoginUserId + "','" + pi.id + "',#" + DateTime.Now.ToString("yyyy-M-d H:m:s") + "#,'" + MD5code + "')"; AccessCmd cmd = new AccessCmd(); // MessageBox.Show(strSql); cmd.ExecuteNonQuery(strSql); strSql = "update t_bz_print_total set intPrintTotal=intPrintTotal+1"; cmd.ExecuteNonQuery(strSql); strSql = "select * from t_bz_print_total"; OleDbDataReader reader = cmd.ExecuteReader(strSql); int printNum = 0; if (reader.Read()) { printNum = reader.GetInt32(0); } if (printNum >= GlobalVariables.IntCouponPrint) { UploadInfo ui = new UploadInfo(); ui.PrintAlert(printNum); } reader.Close(); cmd.Close(); for (int i = 60; i <= 100; i += 1) { wait.SetProgressBarPositionP(i);//设置进度条当前位置 System.Threading.Thread.Sleep(50);//sleep一下减缓进度条进度,实际代码中,此处应该是实际的工作 } } else { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("打印纸已用尽!暂停服务!", 3); wait.CloseScrollBar(); return; } } else { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("打印纸已用尽!暂停服务!", 3); wait.CloseScrollBar(); return; } } catch (Exception e) { ErrorLog.log(e); wait.CloseScrollBar(); return; } }
private void Button_ShopInfo_MouseUp(object sender, MouseEventArgs e) { this.Button_ShopInfo.BackgroundImage = Image.FromFile(path + "\\template\\12.jpg"); if (LP_stype[0] != null && LP_stype[0].Count > 0) { InitShopInfoData(LP_stype[0][curType].id); } else { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("没有信息!", 2); return; } Thread.Sleep(20); this.UnVisibleAllPanels(); int y = this.VerticalScroll.Value; this.Panel_ShopInfo.Location = new System.Drawing.Point(0, 95 - y); this.Panel_ShopInfo.Visible = true; ShowShopInfo(); this.BackPage = "Home"; }
private void Btn_NewCouponList_Click(object sender, EventArgs e) { ChangeExternThreeButtonForeColor(sender as Button); MyMsgBox mb = new MyMsgBox(); try { String time = DateTime.Now.ToString("yyyy/M/d H:m:s"); string strSql = "select top 24 strId from t_bz_coupon where #" + time + "#>dtActiveTime and #" + time + "#< dtExpireTime order by dtActiveTime desc"; AccessCmd cmd = new AccessCmd(); OleDbDataReader reader = cmd.ExecuteReader(strSql); String strId = ""; while (reader.Read()) { if (!reader.IsDBNull(0)) { strId += reader.GetString(0) + ","; } } reader.Close(); cmd.Close(); if (strId != "") { LP_ctype[0] = FindCouponById(strId.Substring(0, strId.Length - 1).Split(',')); } else { LP_ctype[0] = new List<CouponPicInfo>(); } curPage = 1; curType = 0; theCouponNum = 0; ShowCoupon(); } catch (Exception e1) { mb.ShowMsg(e1.Message + "\n正在修复", 1); } }
private void Button_ShopPage_MouseUp(object sender, MouseEventArgs e) { if (LP_shop == null || LP_shop.Count == 0) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("暂无商家信息", 2); return; } //取消不必要的按钮 this.Button_LastCouponsPage.Visible = false; this.Button_NextCouponsPage.Visible = false; //切换 int y = this.VerticalScroll.Value; this.Panel_Shop.Location = new System.Drawing.Point(0, 95 - y); //准备工作 this.UnVisibleAllPanels(); InitShopTitleLabel(); this.Panel_Shop.Visible = true; SetShopTradeTitle(); InitShopData(); ShowShop(); }
private void Btn_Rank_Click(object sender, EventArgs e) { ChangeExternThreeButtonForeColor(sender as Button); DownloadInfo di = new DownloadInfo(this); string[] aryStrCouponId = di.CouponTop(); MyMsgBox mb = new MyMsgBox(); if (aryStrCouponId.Length == 0) { mb.ShowMsg("排行榜暂时无数据!", 2); return; } LP_ctype[0] = FindCouponById(aryStrCouponId); curPage = 1; curType = 0; theCouponNum = 0; ShowCoupon(); }
private void sendCode() { Random rand = new Random(); String code = rand.Next(0, 10000).ToString("D4"); checkCode = code; UploadInfo ui = new UploadInfo(); string strReturn = ui.CouponAuth(GlobalVariables.LoginUserId, code, id); if (strReturn.Equals("sms_error")) { this.error.Text ="短信发送失败!请稍后重试。"; return; } if (strReturn.Equals("balance_error")) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("对不起,您的余额不足!\n请及时充值", 2) ; this.Close(); } }
private void TranslateClick(object sender, EventArgs e) { if (Home.Visible) { if (!GlobalVariables.isUserLogin) { MyMsgBox mb = new MyMsgBox(); mb.ShowMsg("请您先刷卡!", 1); return; } } else { this.DialogResult = DialogResult.No; this.Close(); } }