Example #1
0
 public DataTable AddUser(EntAdduser objentadduser)
 {
     // string strMessage = "Login";
     SqlConnection con = new SqlConnection(ConnectionString);
     con.Open();
     DataTable dt=null;
     SqlCommand cmd = new SqlCommand("Usp_AddNewUsers", con);
     cmd.CommandType = CommandType.StoredProcedure;
     try
     {
         cmd.Parameters.AddWithValue("@UserId", objentadduser.LoginUserName);
         cmd.Parameters.AddWithValue("@Paswored",objentadduser.Password);
         SqlDataAdapter sqlDa = new SqlDataAdapter(cmd);
         dt= new DataTable();
         sqlDa.Fill(dt);
     }
     catch (Exception ex)
     {
        //MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         cmd.Dispose();
         con.Close();
         con.Dispose();
     }
     return dt;
 }
Example #2
0
        public string UserRegistration(EntAdduser objentadduser)
        {
            string strMessage = "Add User";
            SqlConnection con = new SqlConnection(ConnectionString);
            con.Open();
            SqlCommand cmd = new SqlCommand("Usp_UserRegistration", con);
            cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@UserType", objentadduser.LoginType);
                cmd.Parameters.AddWithValue("@UserId", objentadduser.LoginUserName);
                cmd.Parameters.AddWithValue("@Paswored", objentadduser.Password);
                strMessage=cmd.ExecuteNonQuery().ToString();

                //MessageBox.Show(ex.Message.ToString());

                cmd.Dispose();
                con.Close();
                con.Dispose();

            return strMessage;
        }
Example #3
0
 private void btnCreateuser_Click(object sender, EventArgs e)
 {
     string Output = string.Empty;
     if (Validate())
     {
         if (btnCreateuser.Text == "Save")
         {
             if (ddlLogintype.Text == "--Select--")
             {
                 MessageBox.Show("Please Select Login Type");
             }
             else
             {
                 EntAdduser objentadduser = new EntAdduser();
                 objentadduser.LoginType = ddlLogintype.SelectedItem.ToString();
                 objentadduser.LoginUserName = txtyuserId.Text;
                 objentadduser.Password = txtpassword.Text;
                 BLAdduser objbladduser = new BLAdduser();
                 Output = objbladduser.UserRegistration(objentadduser);
                 if (Output == "1")
                 {
                     MessageBox.Show("New User Added Successfully..");
                 }
                 else
                 {
                     MessageBox.Show("User Name Already Exists...");
                 }
                 txtpassword.Text = "";
                 txtyuserId.Text = "";
                 ddlLogintype.Text = "--Select--";
             }
         }
         else
         {
             SqlConnection con = new SqlConnection(ConnectionString);
             con.Open();
             SqlCommand cmd = new SqlCommand("Usp_UpdateUser", con);
             cmd.CommandType = CommandType.StoredProcedure;
             try
             {
                 cmd.Parameters.AddWithValue("@UserType", ddlLogintype.Text.ToString());
                 cmd.Parameters.AddWithValue("@UserName", txtyuserId.Text.ToString());
                 cmd.Parameters.AddWithValue("@Password", txtpassword.Text.ToString());
                 txtyuserId.Enabled = false;
                 string strMessage = Convert.ToString(cmd.ExecuteScalar());
                 MessageBox.Show("Record Updated Successfully..");
                 //loadcustomerGrid();
                 con.Close();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message.ToString());
             }
             finally
             {
                 cmd.Dispose();
                 con.Close();
                 con.Dispose();
             }
         }
     }
     else
     {
         // MessageBox.Show("Internal error occure");
     }
 }
Example #4
0
File: Login.cs Project: 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());
            }
        }
Example #5
0
 public string UserRegistration(EntAdduser objentadduser)
 {
     DlAdduser objdladduser = new DlAdduser();
       string res = objdladduser.UserRegistration(objentadduser);
       return res;
 }
Example #6
0
 public DataTable AddUser(EntAdduser objentadduser)
 {
     DlAdduser  objdladduser = new DlAdduser();
      DataTable dt= objdladduser.AddUser(objentadduser);
      return dt;
 }