예제 #1
0
 private void button10_Click(object sender, EventArgs e)
 {
     UploadInfo ui = new UploadInfo();
     ui.form1 = this;
     if (ui.CouponFavourite("0526", "123456"))
     {
         MessageBox.Show("操作成功!");
     }
     else
     {
         MessageBox.Show("操作失败!");
     }
 }
예제 #2
0
        private void button8_Click(object sender, EventArgs e)
        {
            Random rand = new Random();
            this.strCode = rand.Next(0, 10000).ToString("D4");

            UploadInfo ui = new UploadInfo();
            if (ui.MemberLogon(this.textBox2.Text, this.textBox3.Text, this.strCode))
            {
                MessageBox.Show("注册信息已发送,请在下面文本框中输入你手机收到的验证码");
            }
            else
            {
                MessageBox.Show("发生异常!");
            }
        }
예제 #3
0
 private void button9_Click(object sender, EventArgs e)
 {
     if (this.textBox4.Text.Equals(this.strCode))
     {
         UploadInfo ui = new UploadInfo();
         if (ui.MemberLogon(this.textBox2.Text, this.textBox3.Text))
         {
             MessageBox.Show("注册成功!");
         }
         else
         {
             MessageBox.Show("发生异常!");
         }
     }
     else
     {
         MessageBox.Show("验证码错误,请重新输入!");
     }
 }
예제 #4
0
 private void button4_Click(object sender, EventArgs e)
 {
     UploadInfo ui = new UploadInfo();
     ui.form1 = this;
     Member m = ui.MemberAuth(textBox2.Text);
     if (m == null)
     {
         textBox1.Text = "无效用户";
     }
     else
     {
         StringBuilder sb = new StringBuilder();
         sb.Append("卡号:").Append(m.StrCardNo).Append("\n");
         sb.Append("收藏:");
         for (int i = 0; i < m.AryFavourite.Length; i++)
         {
             sb.Append(m.AryFavourite[i]).Append(" ");
         }
         sb.Append("\n");
         sb.Append("历史:");
         for (int i = 0; i < m.AryHistory.Length; i++)
         {
             sb.Append(m.AryHistory[i]).Append(" ");
         }
         textBox1.Text = sb.ToString();
         if (m.StrMobileNo.Length == 0)
         {
             MessageBox.Show("未注册用户,请在下面文本框中输入手机号码进行注册!");
         }
         else
         {
             MessageBox.Show("已注册用户!");
         }
     }
 }
예제 #5
0
 private void button5_Click(object sender, EventArgs e)
 {
     UploadInfo ui = new UploadInfo();
     ui.form1 = this;
     MessageBox.Show(ui.PrintAlert(500) + "");
 }
예제 #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     UploadInfo ui = new UploadInfo();
     ui.form1 = this;
     string strReturn = ui.CouponAuth("3897", "3403", "1325207051877004");
     if (strReturn.Equals("OK"))
     {
         MessageBox.Show("成功!");
     }
     else if (strReturn.Equals("balance_error"))
     {
         MessageBox.Show("余额不足!");
     }
     else if (strReturn.Equals("sms_error"))
     {
         MessageBox.Show("短信发送失败!");
     }
     else
     {
         MessageBox.Show("未知错误!");
     }
 }
예제 #7
0
 private void button3_Click(object sender, EventArgs e)
 {
     UploadInfo ui = new UploadInfo();
     ui.form1 = this;
     MessageBox.Show(ui.CouponPrint() + "");
 }
예제 #8
0
        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;
        }
예제 #9
0
        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();
            }
        }
예제 #10
0
        /// <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();
            }
        }
예제 #11
0
        /// <summary>
        /// 定时刷新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Timer_DownloadInfo_Tick(object sender, EventArgs e)
        {
            this.Timer_DownloadInfo.Stop();
            try
            {
                //下载信息
                DownloadInfo di = new DownloadInfo(this);
                //               this.Label_DownloadWaitObject.Text = "正在下载更新数据\n请稍后.....";
                Thread.Sleep(1000);
                //              this.Label_DownloadWaitObject.Refresh();
                this.BeforeDownload();
                Application.DoEvents();
                Thread.Sleep(1000);
                di.download();
                //               this.Label_DownloadWaitObject.Text = "正在同步数据\n请稍后.....";
                this.Label_DownloadWaitObject.Refresh();
                Thread.Sleep(1000);
                //               this.Label_DownloadWaitObject.Refresh();
                di.SynParam();
                //同步数据
                this.InitData();
                this.Timer_DownloadInfo.Interval = GlobalVariables.IntRefreshSec * 1000;
                //上传消费记录
                //              this.Label_DownloadWaitObject.Text = "正在上传消费数据\n请稍后.....";
                this.Label_DownloadWaitObject.Refresh();
                Thread.Sleep(1000);
                UploadInfo ui = new UploadInfo();
                ui.CouponPrint();
                this.AfterDownload();

            }
            catch (Exception ep)
            {
                ErrorLog.log(ep);
            }
            this.Timer_DownloadInfo.Start();
        }
예제 #12
0
 /// <summary>
 /// 线程函数,发送短信
 /// </summary>
 private void SendMes()
 {
     UploadInfo ui = new UploadInfo();
     ui.CouponSendMessage(GlobalVariables.LoginUserId, strMesContent);
 }
예제 #13
0
        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;
            }
        }
예제 #14
0
 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;
         }
     }
 }