Exemplo n.º 1
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (time_count >= 50)
            {
                time_count = 0;
                probar_auto_login.Visible = false;
                btn_cancel.Visible        = false;
                btn_login.Visible         = true;
                btn_exit.Visible          = true;
                timer2.Stop();
                string username = Utils.GetConfig("username", "");
                string password = Utils.GetConfig("password", "");

                string user_id = UserPro.Login(username, Utils.GetJiemi("auth", password));

                if (user_id != "")
                {
                    Utils.SetConfig("login_user_id", user_id);
                    MainForm formMain = new MainForm();
                    this.Hide();
                    formMain.Show();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误");
                }
            }
            else
            {
                time_count = time_count + 1;
            }
        }
        public PastHistoryDetailPage(CaseInfo currentCase)
        {
            _currentCase = currentCase;
            InitializeComponent();
            Emergency        = _currentCase.CaseTypeLabelText;
            CaseDate.Text    = _currentCase.CaseDateTime.ToString();
            Description.Text = _currentCase.CaseDescription;

            uih.GetHelperInfoByID(_currentCase.HelperID);
            UserPro helper = uih.GetHelperInfo();

            HelperImage.Source  = helper.Icon;
            HelperName.Text     = helper.FirstName;
            HelperRating.Text   = bcc.StarNoToStarSign(helper.Rating);
            HelperLanguage.Text = helper.FLanguage + "/" + helper.SLanguage;

            ReceiptInfo _receipt = uih.GetReceiptByID(_currentCase.ReceiptID);

            ServiceFee.Text   = _receipt.ServiceFee.ToString();
            EquipmentFee.Text = _receipt.EqFee.ToString();
            CycbisFee.Text    = _receipt.Surcharge.ToString();
            Tax.Text          = _receipt.Tax.ToString();
            Total.Text        = (_receipt.EqFee + _receipt.ServiceFee + _receipt.Surcharge + _receipt.Tax).ToString();

            PaymentNum.Text   = _receipt.PaymentName;
            CaseDateTime.Text = _currentCase.CaseDateTime.ToString();
        }
Exemplo n.º 3
0
        public void GetHelperInfoByID(string chatid)
        {
            UserPro helper = new UserPro();
            //建立数据库连接
            MySqlConnection conn = new MySqlConnection(connStr);

            try
            {   //建立连接,打开数据库
                conn.Open();
                string sqlstr = "SELECT Uid FROM HelperInfo,UserInfo WHERE UserInfo.ChatID = @para1";

                MySqlCommand cmd = new MySqlCommand(sqlstr, conn);
                //通过设置参数的形式给SQL 语句串值
                cmd.Parameters.AddWithValue("para1", chatid);
                //cmd.Parameters.AddWithValue("para2", password);

                MySqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    helperuidlist.Add(reader.GetInt32(0));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                conn.Close();   //关闭连接
            }
        }
Exemplo n.º 4
0
        //ChatID to ID
        private void GetHelperIDbyChatID(int userid)
        {
            UserPro helper = new UserPro();
            //并没有建立数据库连接
            MySqlConnection conn = new MySqlConnection(connStr);

            try
            {   //建立连接,打开数据库
                conn.Open();
                string sqlstr =
                    "SELECT FirstName,LastName,Icon,ChatID,FLanguage,SLanguage,PaymentID,Location,Rating,`Status`,PriceSign FROM HelperInfo,UserInfo WHERE HelperInfo.Uid = @para1 AND UserInfo.Uid = @para1";

                MySqlCommand cmd = new MySqlCommand(sqlstr, conn);
                //通过设置参数的形式给SQL 语句串值
                cmd.Parameters.AddWithValue("para1", userid);
                //cmd.Parameters.AddWithValue("para2", password);

                MySqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    helper.FirstName = reader.GetString(0);
                    helper.LastName  = reader.GetString(1);
                    helper.Icon      = reader.GetString(2);
                    helper.ChatID    = reader.GetString(3);
                    helper.FLanguage = reader.GetString(4);
                    helper.SLanguage = reader.GetString(5);
                    helper.PaymentID = reader.GetString(6);
                    helper.Location  = reader.GetString(7);
                    helper.Rating    = reader.GetInt32(8);
                    helper.Status    = reader.GetInt32(9);
                    helper.PriceSign = reader.GetString(10);
                    helper.UserID    = userid.ToString();
                    helperlist.Add(helper);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                conn.Close();   //关闭连接
            }
        }
Exemplo n.º 5
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (time_count >= 50)
            {
                time_count = 0;
                probar_auto_login.Visible = false;
                btn_login.Enabled         = true;
                btn_exit.Enabled          = true;
                timer1.Stop();
                string username = txt_username.Text.Trim();
                string password = txt_password.Text;
                if (username == "")
                {
                    MessageBox.Show("请输入用户名");
                    txt_username.Focus();
                }
                else if (password == "")
                {
                    MessageBox.Show("请输入密码");
                    txt_password.Focus();
                }
                else
                {
                    string user_id = UserPro.Login(username, password);

                    if (user_id != "")
                    {
                        Utils.SetConfig("username", username);
                        Utils.SetConfig("password", Utils.GetJiaMi("auth", password));
                        if (chk_password.Checked == true)
                        {
                            Utils.SetConfig("remeber_pass", "yes");
                            if (chk_auto_login.Checked == true)
                            {
                                Utils.SetConfig("auto_login", "yes");
                            }
                            else
                            {
                                Utils.SetConfig("auto_login", "no");
                            }
                        }
                        else
                        {
                            Utils.SetConfig("remeber_pass", "no");
                            if (chk_auto_login.Checked == true)
                            {
                                Utils.SetConfig("auto_login", "yes");
                            }
                            else
                            {
                                Utils.SetConfig("auto_login", "no");
                            }
                        }
                        Utils.SetConfig("login_user_id", user_id);
                        MainForm formMain = new MainForm();
                        this.Hide();
                        formMain.Show();
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码错误");
                    }
                }
            }
            else
            {
                time_count = time_count + 1;
            }
        }
Exemplo n.º 6
0
        public void GetHelperInfoByID(string userid)
        {
            //并没有建立数据库连接
            MySqlConnection conn = new MySqlConnection(connStr);

            try
            {   //建立连接,打开数据库
                conn.Open();
                string sqlstr =
                    "SELECT FirstName,LastName,Icon,ChatID,FLanguage,SLanguage,PaymentID,Location,Rating,`Status`,PriceSign,Bio,ServiceZip1,ServiceZip2,ServiceZip3 FROM HelperInfo,UserInfo WHERE HelperInfo.Uid = @para1 AND UserInfo.Uid = @para1";

                MySqlCommand cmd = new MySqlCommand(sqlstr, conn);
                //通过设置参数的形式给SQL 语句串值
                cmd.Parameters.AddWithValue("para1", userid);
                //cmd.Parameters.AddWithValue("para2", password);

                MySqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string FirstName = reader.GetString(0);
                    string LastName  = reader.GetString(1);
                    string Icon      = reader.GetString(2);
                    string ChatID    = reader.GetString(3);
                    string FLanguage = reader.GetString(4);
                    string SLanguage = reader.GetString(5);
                    string PaymentID = reader.GetString(6);
                    string Location  = reader.GetString(7);
                    int    Rating    = reader.GetInt32(8);
                    int    Status    = reader.GetInt32(9);
                    string PriceSign = reader.GetString(10);
                    string Bio       = reader.GetString(11);
                    string zip1      = reader.GetString(12);
                    string zip2      = reader.GetString(13);
                    string zip3      = reader.GetString(14);

                    string  UserID = userid;
                    UserPro helper = new UserPro()
                    {
                        FirstName = FirstName,
                        LastName  = LastName,
                        Icon      = Icon,
                        ChatID    = ChatID,
                        FLanguage = FLanguage,
                        SLanguage = SLanguage,
                        PaymentID = PaymentID,
                        Location  = Location,
                        Rating    = Rating,
                        Status    = Status,
                        PriceSign = PriceSign,
                        UserID    = UserID,
                        Bio       = Bio,
                        ZipCode1  = zip1,
                        ZipCode2  = zip2,
                        ZipCode3  = zip3
                    };
                    helperlist.Add(helper);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                conn.Close();   //关闭连接
            }
        }