Ejemplo n.º 1
0
        private void txt_Password_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue.ToString() == "13")
            {
                if (txt_User.Text != "")
                {
                    if (txt_Password.Text != "")
                    {
                        DataTable dt = obj.Proc_GetUserId(txt_User.Text);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            //if (dt.Rows[0]["is_login"].ToString() == "False")
                            //{
                            string    PasswordConverted = ConvertStringtoMD5(txt_Password.Text);
                            DataTable dt_ = obj.Proc_GetUserIdbyPassword(txt_User.Text, PasswordConverted);
                            if (dt_ != null && dt_.Rows.Count > 0)
                            {
                                // obj.UpdateUserLogin(Convert.ToInt32(dt_.Rows[0]["user_id"].ToString()), true,GetSystemId);
                                SelectType objSelectType = new SelectType(Convert.ToInt32(dt_.Rows[0]["user_id"].ToString()), GetSystemId);
                                this.Hide();
                                objSelectType.ShowDialog();
                                this.Close();
                                Application.ExitThread();
                                Application.Exit();
                            }
                            else
                            {
                                MessageBox.Show("Invalid Password", "Message Alert");
                            }
                            //}
                            //else
                            //    MessageBox.Show("User Already Login !", "Message Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        else
                        {
                            MessageBox.Show("Invalid User Name", "Message Alert");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please Enter Password", "Message Alert");
                    }
                }
                else
                {
                    MessageBox.Show("Please Enter User Name", "Message Alert");
                }
            }
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_User.Text != "")
         {
             if (txt_Password.Text != "")
             {
                 DataTable dt = obj.Proc_GetUserId(txt_User.Text);
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     string    PasswordConverted = txt_Password.Text;//ConvertStringtoMD5(txt_Password.Text);
                     DataTable dt_ = obj.Proc_GetUserIdbyPassword(txt_User.Text, PasswordConverted);
                     if (dt_ != null && dt_.Rows.Count > 0)
                     {
                         obj.UpdateUserLogin(Convert.ToInt32(dt_.Rows[0]["user_id"].ToString()), true, GetSystemId);
                         SelectType objSelectType = new SelectType(Convert.ToInt32(dt_.Rows[0]["user_id"].ToString()), GetSystemId);
                         this.Hide();
                         objSelectType.ShowDialog();
                         this.Close();
                         Application.Exit();
                     }
                     else
                     {
                         MessageBox.Show("Invalid Password", "Message Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Invalid User Name", "Message Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Please Enter Password", "Message Alert", MessageBoxButtons.OK);
             }
         }
         else
         {
             MessageBox.Show("Please Enter User Name", "Message Alert", MessageBoxButtons.OK);
         }
     }
     catch
     {
         MessageBox.Show("Unexpected error occured,please contact to network administrator.", "Message Alert");
     }
 }