private void btnRegister_Click(object sender, EventArgs e)
 {
     if (txtCustomerName.Text == "" || txtEmail.Text == "" || txtConfirmPassword.Text == "" || txtPassword.Text == "" || txtPinCode.Text == "" || txtPhoneNumber.Text == "" || DDLCity.Enabled == false || DDLCountry.SelectedValue.ToString() == "")
     {
         MessageBox.Show("Validation Failed");
     }
     else if (!erpCustomeName.GetError(txtCustomerName).Equals("") || !erpPassword.GetError(txtPassword).Equals("") || !erpConfirmPassword.GetError(txtConfirmPassword).Equals("") ||
              !erpEmail.GetError(txtEmail).Equals("") || !erpPhoneNumber.GetError(txtPhoneNumber).Equals("") || !erpPinCode.GetError(txtPinCode).Equals(""))
     {
         MessageBox.Show("Validation Failed");
     }
     else
     {
         CommonFunctionalityBLL cfb = new CommonFunctionalityBLL();
         string ut = "";
         if (PassingValues.utype == 1)
         {
             ut = "A";
         }
         else
         {
             ut = "U";
         }
         int x = cfb.registerCustomer(txtCustomerName.Text, txtPassword.Text, datepickerDOB.Text, txtEmail.Text, txtPhoneNumber.Text, DDLCountry.SelectedValue.ToString(), DDLCity.SelectedValue.ToString(), txtPinCode.Text, ut);
         if (x == 1)
         {
             MessageBox.Show("Registration Successful");
         }
         else
         {
             MessageBox.Show("Please Enter Correct Credentials");
         }
         PassingValues.utype = 0;
     }
 }
Beispiel #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUserId.Text == "" || txtPhoneNumber.Text == "" || txtPassword.Text == "")
            {
                MessageBox.Show("Please Fill all the required fields", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (txtUserId.TextLength != 5)
            {
                MessageBox.Show("UserId should contain 5 characters", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (txtPhoneNumber.TextLength != 10)
            {
                MessageBox.Show("Please Enter a valid 10 digit number", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                CommonFunctionalityBLL cfb = new CommonFunctionalityBLL();

                int x = cfb.authenticateCustomer(txtUserId.Text, txtPhoneNumber.Text, txtPassword.Text);
                if (x == 1)
                {
                    panel1.Hide();
                    panel2.Hide();

                    CustomerBusinessLogicLayer cbl = new CustomerBusinessLogicLayer();
                    string [] s = new string[2];
                    string    ct;
                    s = cbl.getCustomerNameAndUserTypeByCustomerId(txtUserId.Text);
                    PassingValues.CustomerName = s[0];
                    ct = s[1];
                    if (ct == "A")
                    {
                        //MessageBox.Show("CustomerType:Admin");
                        menustripAdmin.Show();
                        WelcomePanel.Show();
                    }
                    else if (ct == "U")
                    {
                        //MessageBox.Show("CustomerType:User");
                        menustripCustomer.Show();
                        WelcomePanel.Show();
                    }
                    PassingValues.CustomerId = txtUserId.Text;
                    lblUserName.Text         = PassingValues.CustomerName;
                }
                else
                {
                    MessageBox.Show("Invalid");
                }
                //MessageBox.Show(PassingValues.CustomerName);
            }
        }