예제 #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     SqlConnection con = new SqlConnection(ConnectionString);
     SqlCommand cmd = new SqlCommand();
     cmd.Connection = con;
     string username = txtyuserId.Text;
     string password = txtpassword.Text;
     string usertType = ddlLogintype.SelectedItem.ToString();
     BLlogin objbllogin = new BLlogin();
     SqlDataReader drLogin = objbllogin.checklogin(username, password, usertType);
     if (drLogin.HasRows == true)
     {
         drLogin.Read();
         string type = drLogin["LoginType"].ToString();
         int LoginId = int.Parse(drLogin["LoginuserId"].ToString());
         HomeMDI objhomemdi = new HomeMDI();
         objhomemdi.Show();
         drLogin.Close();
     }
     else
     {
         MessageBox.Show("Incorrect UserId or Password");
         LoginUserDetails objloginuserdetails = new LoginUserDetails();
         objloginuserdetails.Show();
     }
 }
예제 #2
0
파일: Login.cs 프로젝트: ttss2272/bc
        private void btnCreateuser_Click(object sender, EventArgs e)
        {
            string Output = string.Empty;
            try
            {
                EntAdduser objentadduser = new EntAdduser();
                objentadduser.LoginUserName = txtUserName.Text;
                objentadduser.Password = txtpassword.Text;
                BLAdduser objbladduser = new BLAdduser();
                DataTable dt = objbladduser.AddUser(objentadduser);
                HomeMDI objmdi = new HomeMDI();
                BLlogin objlogin = new BLlogin();
                string Expirydate = null;
                if (dt.Rows.Count > 0)
                {
                    Expirydate = dt.Rows[0]["ExpiryDate"].ToString();
                    DateTime currentdate = DateTime.Now;
                    DateTime expirydate = Convert.ToDateTime(Expirydate);
                    if (currentdate == expirydate)
                    {
                        MessageBox.Show("Your Application Is Going to Expire Today..!!! Please Contact your Support");
                        this.Visible = false;
                        objmdi.Show();
                    }
                    else if (currentdate > expirydate)
                    {
                        MessageBox.Show("Sorry...Your Application Is Expired....!!! Please Contact your Support");
                        objmdi.Close();
                    }
                    else
                    {
                        MessageBox.Show("Welcome...To Loan Application!!!!");
                        this.Visible = false;

                        HomeMDI objHomeMdi = new HomeMDI();
                        Login loginPage = new Login();
                        if (objHomeMdi.ShowDialog() == DialogResult.OK)
                        {
                            Application.Run(new HomeMDI());

                        }
                        else
                        {
                            Application.Exit();
                        }

                        InitializeComponent();
                    }
                    txtpassword.Text = "";
                    txtUserName.Text = "";
                }
                else
                {
                    MessageBox.Show("Username Or Password Not Match");
                    txtpassword.Text = "";
                    txtUserName.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }