예제 #1
0
        async private void btn_login_Click(object sender, EventArgs e)
        {
            //Global.StationId = 100;
            //return;
            //超级密码为123465
            //var t = await Server.AutoLogin(1, Properties.Settings.Default.LastUserCode);
            //var tt = await Server.AutoLogin(1, Global.AutoLogin.user_code);
            linkLabel1.Text     = "正在登录...";
            tx_username.Enabled = tx_password.Enabled = pictureBox1.Enabled = false;
            //return;
            if (tx_username.Text == "admin")
            {
                MD5    md5    = new MD5CryptoServiceProvider();
                byte[] output = md5.ComputeHash(Encoding.Default.GetBytes(tx_password.Text));
                if (BitConverter.ToString(output).Replace("-", "").ToUpper() == Properties.Settings.Default.pwd.Trim())
                {
                    FormLocal f = new FormLocal();
                    f.TopMost = true;
                    f.Show();
                    timer1.Stop();
                    return;
                }
            }
#if DEBUG
            Debug.WriteLine("使用默认账号yyq登录调试");
            tx_username.Text = "yyq";
            tx_password.Text = "123456";
#endif
            var result = await Server.Login(tx_username.Text, tx_password.Text);

            if (result)
            {
                //Test();
                //await Server.GetTestList(Global.LoginInfo.user_id, Global.LoginInfo.user_code, 56, 1, 100);

                //登录成功
                //Convert.ToInt32("Hello");
                Global.FormMain.Show();
                //Global.FormRecord.Show();
                Global.FormLogin.Hide();
                timer1.Stop();
                linkLabel1.Text = " ";

                //new FormInsertUpdateBuy().Show();
            }
            else
            {
                linkLabel1.Text = " ";
                //登录失败
            }
            tx_username.Enabled = tx_password.Enabled = pictureBox1.Enabled = true;
        }
예제 #2
0
 public void initTitle()
 {
     if (Properties.Settings.Default.第一次运行)
     {
         FormLocal f = new FormLocal();
         f.TopMost = true;
         //               f.Show();
         this.Hide();
         return;
     }
     Text            = Properties.Settings.Default.供电局名称 + " - " + Properties.Settings.Default.站点名称 + " - " + "智能物联工器具管理系统";
     label_main.Text = Properties.Settings.Default.供电局名称;
     label_sub.Text  = "(" + Properties.Settings.Default.站点名称 + ")";
 }
예제 #3
0
        /// <summary>
        /// 打开各个功能窗口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            switch (listView1.SelectedItems[0].Text)
            {
            case "领还记录":

                Global.FormRecord.Show();
                Global.FormRecord.Focus();
                break;

            case "维护管理":

                Global.FormMaintain.Show();
                Global.FormMaintain.Focus();

                break;

            case "业务报表":

                Global.FormReport.Show();
                Global.FormReport.Focus();

                break;

            case "子系统":

                Global.FormSubsystem.Show();
                Global.FormSubsystem.Focus();

                break;

            case "个人设置":

                Global.FormSettings.Show();
                Global.FormSettings.Focus();

                break;

            case "实时领还表":
                //ShowDialog(new FormPassword());
                Global.FormTaskReceiveList.Show();
                Global.FormTaskReceiveList.Focus();

                break;

            case "系统设置":

                //Global.FormSettings.Show();
                //Global.FormSettings.Focus();
                //var pwd = Interaction.InputBox("请输入管理员密码:", "系统设置");
                //if (ShowDialog(new FormPassword()) == DialogResult.Yes)
                if (new FormPassword().ShowDialog() == DialogResult.Yes)
                {
                    if (Global.UserInput.Trim() == "admin")
                    {
                        MD5    md5    = new MD5CryptoServiceProvider();
                        byte[] output = md5.ComputeHash(Encoding.Default.GetBytes(Global.PasswordInput));
                        if (BitConverter.ToString(output).Replace("-", "").ToUpper() == Properties.Settings.Default.pwd.Trim())
                        {
                            FormLocal f = new FormLocal();
                            f.TopMost = true;
                            f.Show();
                            return;
                        }
                    }
                    Global.PasswordInput = Global.UserInput = "";
                    MessageBox.Show("抱歉,账号密码错误。");
                }

                break;
            }
        }