Exemplo n.º 1
0
 public FormLogin(string param1, string param2, AxLGUBaseOpenApi axLGUBaseOpenApi1, AxLGUBaseOpenApi axLGUBaseOpenApi2)
 {
     InitializeComponent();
     init();
     IDBox.Focus();
     //this.param1 = param1;
     //this.param2 = param2;
 }
Exemplo n.º 2
0
 public FormLogin()
 {
     InitializeComponent();
     //IDBox.Text = Properties.Settings.Default.loginId;
     //PwdBox.Text = Properties.Settings.Default.LoginPwd;
     IDBox.Focus();
     init();
 }
Exemplo n.º 3
0
 //아이디 입력 후 엔터
 private void enterKey(object sender, KeyEventArgs e)
 {
     id = IDBox.Text.ToString();
     if (e.KeyCode == Keys.Enter)
     {
         if (IDBox.Text.ToString().Equals(""))
         {
             IDBox.Focus();
             MessageBox.Show("아이디를 입력해 주세요");
         }
         else
         {
             PwdBox.Focus();
         }
     }
 }
Exemplo n.º 4
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            if (IDBox.Text == "")
            {
                MessageBox.Show("ID를 입력하세요!!");
                IDBox.Focus();
                return;
            }
            if (PasswordBox.Password == "")
            {
                MessageBox.Show("PWD를 입력하세요!!");
                PasswordBox.Focus();
                return;
            }
            MySqlConnection connect = getConn();

            connect.Open();
            string          ConnectQurey = "SELECT * FROM info WHERE id='" + IDBox.Text + "'AND password='******'";
            MySqlCommand    command      = new MySqlCommand(ConnectQurey, connect);
            MySqlDataReader read         = command.ExecuteReader();

            System.Console.Write("%s\n", IDBox.Text);
            System.Console.Write("%s\n", PasswordBox.Password);
            if (read.Read())
            {
                MessageBox.Show("로그인 완료!!");
                Application.Current.Properties["id"] = IDBox.Text;
                Window.GetWindow(this).Close();
                Window3 Homepage = new Window3();
                Homepage.Top  = this.Top + (this.ActualHeight - Homepage.Height) / 2;
                Homepage.Left = this.Left + (this.ActualWidth - Homepage.Width) / 2;
                Homepage.ShowDialog();
            }
            else
            {
                MessageBox.Show("로그인 실패ㅠ-ㅠ");
            }
        }
Exemplo n.º 5
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (IDBox.Text == "")
            {
                MessageBox.Show("用户名不能为空!", "提示");
            }
            else if (PwdBox.Text == "")
            {
                MessageBox.Show("密码不能为空!", "提示");
            }
            try //try...catch...异常处理语句
            {
                string name, pass;
                bool   flag = false;
                name = IDBox.Text;
                pass = PwdBox.Text; //获取用户名,密码

                byte[] result = Encoding.Default.GetBytes(PwdBox.Text.Trim());

                MD5 md5 = new MD5CryptoServiceProvider();

                byte[] output = md5.ComputeHash(result);

                CheckPWD.Text = BitConverter.ToString(output).Replace("-", "");

                string        str    = "Data Source=51WU;Initial Catalog=automobile111;User ID=sa;Password=wu777wow;";
                SqlConnection myConn = new SqlConnection(str); //创建数据库连接类的对象
                myConn.Open();                                 //将连接打开
                //SQL语句:从数据库的登录表中搜索登录名,密码
                string sqlstring = "select userid,userpwd from admininfo where userid='" + name + "'and userpwd='" + pass + "'";
                //执行con对象的函数,返回一个SqlCommand类型的对象
                SqlCommand command = new SqlCommand(sqlstring, myConn);
                //用cmd的函数执行语句,返回SqlDataReader对象thisReader,thisReader就是返回的结果集(也就是数据库中查询到的表数据)
                SqlDataReader thisReader = command.ExecuteReader();
                //判断用户名及密码是否正确,对flag进行赋值
                while (thisReader.Read())
                {
                    if ((thisReader.GetValue(0).ToString().Trim()) == (name.ToString().Trim()))
                    {
                        if (thisReader.GetValue(1).ToString().Trim() == pass.ToString().Trim())
                        {
                            flag = true;
                        }
                    }
                }
                //用完后关闭连接,以免影响其他程序访问
                myConn.Close();
                if (flag)
                {
                    MessageBox.Show("登录成功!");
                    login3 F = new login3(); //显示主页面
                    F.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("请检查你的用户名和密码!");
                    IDBox.Focus();
                }
            }
            catch (Exception ex2)
            {
                MessageBox.Show("连接远程SQL数据库发生错误:" + ex2.ToString(), "错误!");
            }
        }
Exemplo n.º 6
0
        private void loginOk1()
        {
            id  = IDBox.Text.ToString();
            pwd = PwdBox.Text.ToString();
            if (PwdBox.Text.ToString().Equals(""))
            {
                IDBox.Focus();
                MessageBox.Show("아이디를 입력해 주세요");
            }
            else if (IDBox.Text.ToString().Equals(""))
            {
                PwdBox.Focus();
                MessageBox.Show("비밀번호를 입력해 주세요");
            }
            else
            {
                string url = "https://daemuri.net/main/getSendAuth.do?id=" + id + "&pwd=" + pwd;
                //string url = "http://127.0.0.1:8080/main/getSendAuth.do?id=" + id + "&pwd=" + pwd;
                try
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    request.Method      = "POST";
                    request.ContentType = "Application/json;charset=utf-8";

                    string sendData = "";

                    byte[] buffer;
                    buffer = Encoding.Default.GetBytes(sendData);
                    request.ContentLength = buffer.Length;
                    Stream sendStream = request.GetRequestStream();
                    sendStream.Write(buffer, 0, buffer.Length);
                    sendStream.Close();

                    HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
                    Stream          respPostStream = response.GetResponseStream();
                    StreamReader    readerPost     = new StreamReader(respPostStream, Encoding.UTF8);

                    string resultJson = readerPost.ReadToEnd();
                    if (!resultJson.Contains("<!DOCTYPE html"))
                    {
                        JObject obj = new JObject();
                        obj = JObject.Parse(resultJson);
                        string rs = obj["rs"].ToString();

                        if (rs.Equals("fail"))
                        {
                            MessageBox.Show("등록된 사용자가 아닙니다.");
                            this.Height = 218;
                        }
                        else
                        {
                            JObject obj2 = new JObject();
                            obj2           = JObject.Parse(rs);
                            callcenter_idx = obj2["callcenter_idx"].ToString();
                            //MessageBox.Show("callcenter_idx = " + callcenter_idx);
                            CidBox.Visible  = true;
                            button3.Visible = true;
                            CidBox.Focus();
                            this.Height = 335;
                        }
                    }
                    else
                    {
                        MessageBox.Show("등록된 사용자가 아닙니다.");
                        this.Height = 217;
                    }
                }
                catch (System.Net.WebException er)
                {
                    MessageBox.Show(er.Message);
                }
            }
        }