Exemplo n.º 1
0
        //Sign Up for Customer
        private void Btn_SignUp_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                StringBuilder sb   = new StringBuilder();
                Customer      cust = new Customer();
                cust.CustomerName = txt_Name.Text.ToString();
                cust.EmailID      = txt_Email.Text;

                if (txt_PhoneNumber.Text == string.Empty)
                {
                    sb.Append("Enter Valid Phone Number!" + Environment.NewLine);
                }
                else
                {
                    cust.PhoneNumber = long.Parse(txt_PhoneNumber.Text.ToString());
                }
                cust.Address = txt_Address.Text;
                Users users = new Users();
                users.LoginID  = (txt_LoginID.Text);
                users.Password = txt_Password.Password.ToString();
                users.Role     = "Customer";
                CustomerValidations cv = new CustomerValidations();
                if (cv.AddCustomer_BLL(cust, users) != 0)
                {
                    MessageBox.Show("Customer Details are added");
                    MainWindow mw = new MainWindow();
                    mw.Show();
                    Close();
                }
                else
                {
                    throw new CustomerException("Enter details are not correct");
                }
            }
            catch (CustomerException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        //Sign Up for Customer
        private void Btn_SignUp_Click(object sender, RoutedEventArgs e)
        {
            Customer cust = new Customer();

            cust.CustomerName = txt_Name.Text.ToString();
            cust.EmailID      = txt_Email.Text;
            cust.PhoneNumber  = long.Parse(txt_PhoneNumber.Text);
            cust.Address      = txt_Address.Text;
            Users users = new Users();

            users.LoginID  = (txt_LoginID.Text);
            users.Password = txt_Password.Password.ToString();
            users.Role     = "Customer";
            //users.EmployeeID = 0;

            CustomerValidations cv = new CustomerValidations();

            try
            {
                if (cv.AddCustomer_BLL(cust, users) != 0)
                {
                    MessageBox.Show("Customer Details are added");
                    CustomerHome ch = new CustomerHome();
                    ch.Show();
                    Close();
                }
                else
                {
                    throw new CustomerException("Enter details are not correct");
                }
            }
            catch (CustomerException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }