Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtUnit.Text.Trim() == "" || ControlValidation.IsReserveWord(txtUnit.Text.Trim().ToLower()))
            {
                lblError.Text      = "Please Enter a valid Unit...";
                lblError.ForeColor = Color.Red;
            }
            else
            {
                var result = AddUnit();
                if (result.Result == true)
                {
                    ProductEntry prodEntry = (ProductEntry)Owner.ActiveControl;
                    prodEntry.BindUnits();

                    lblError.Text      = result.Message;
                    lblError.ForeColor = Color.Green;
                }
                else
                {
                    lblError.Text      = result.Message;
                    lblError.ForeColor = Color.Red;
                }
            }
        }
Example #2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ControlValidation.Isblank(txtPassword.Text.Trim()) == true || ControlValidation.IsReserveWord(txtPassword.Text.Trim().ToLower()))
     {
         lblError.Text    = "Pleasse enter Password !";
         txtPassword.Text = "";
         txtPassword.Focus();
     }
     else if (txtPassword.Text.Trim() != txtConfirmPassword.Text.Trim())
     {
         lblError.Text    = "Password Mismatch !";
         txtPassword.Text = "";
         txtPassword.Focus();
         txtConfirmPassword.Text = "ConfirmNewPassword";
     }
     else
     {
         var result = new Results();
         result = UpdatePassword();
         if (result.Result)
         {
             MessageBox.Show("Password Reset Successfully!!!!");
             Login loginform = new Login();
             loginform.Show();
             this.Hide();
         }
         else
         {
             lblError.Text = result.Message;
         }
     }
 }
Example #3
0
 private void txtConfirmPassword_Leave(object sender, EventArgs e)
 {
     if (txtConfirmPassword.Text.Trim() == "" || ControlValidation.IsReserveWord(txtConfirmPassword.Text.Trim().ToLower()))
     {
         txtConfirmPassword.UseSystemPasswordChar = false;
         txtConfirmPassword.Text = "ConfirmNewPassword";
     }
 }
Example #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            decimal discount;

            if (txtDiscount.Text.Trim() == "")
            {
                discount = 0;
            }
            else
            {
                discount = Convert.ToDecimal(txtDiscount.Text.Trim());
            }
            if (txtCustomerName.Text.Trim() == "" || ControlValidation.IsReserveWord(txtCustomerName.Text.Trim().ToLower()))
            {
                lblError.Text      = "Please Enter Customer Name";
                lblError.ForeColor = Color.Red;
            }
            else
            {
                var custDetails = new CustomerInfoDetails();
                if (txtAddress.Text == "" || ControlValidation.IsReserveWord(txtAddress.Text.Trim().ToLower()))
                {
                    custDetails.custAddress = "XXXX";
                }
                else
                {
                    custDetails.custAddress = txtAddress.Text;
                }
                custDetails.custName     = txtCustomerName.Text;
                custDetails.custMobile   = "9999999999";
                custDetails.custEmail    = "*****@*****.**";
                custDetails.billDate     = dateTimeBillDate.Value.Date;
                custDetails.custDiscount = discount;
                this.Hide();
                if (sellerEntry == 1)
                {
                    this.Hide();
                    var stockEntry = new StockEntry();
                    stockEntry.CalllbackFromCustDetails(_glStockEntry, custDetails, _billnumber);
                    this.Close();
                }
                else
                {
                    CustomerBillForm cust = new CustomerBillForm(productSale);
                    cust.showBill(custBillInfoData, custDetails);
                    cust.ShowDialog(this);
                    this.Close();
                }
            }
        }
Example #5
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
            {
                lblError.Text    = "Please enter Username !";
                txtUsername.Text = "";
                txtUsername.Focus();
            }
            else if (ControlValidation.Isblank(txtAnswer1.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer1.Text.Trim().ToLower()))
            {
                lblError.Text   = "Enter Answar for Question1 !";
                txtAnswer1.Text = "";
                txtAnswer1.Focus();
            }
            else if (ControlValidation.Isblank(txtAnswer2.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer2.Text.Trim().ToLower()))
            {
                lblError.Text   = "Enter Answar for Question2 !";
                txtAnswer2.Text = "";
                txtAnswer2.Focus();
            }

            else
            {
                var result = CheckAnswer();
                if (result.Result)
                {
                    if ((MessageBox.Show("Are you Sure to Reset the Password ???", "Password Reset", MessageBoxButtons.YesNo) == DialogResult.Yes))
                    {
                        NewPassword newpasswordform = new NewPassword();
                        newpasswordform.userName = txtUsername.Text.Trim();
                        newpasswordform.userID   = Convert.ToInt32(txthiddenUserID.Text.Trim());
                        newpasswordform.Show();
                        this.Hide();
                    }
                    else
                    {
                        ForgotPassword forgotPasswordform = new ForgotPassword();
                        forgotPasswordform.Show();
                    }
                }
                else
                {
                    lblError.Text = result.Message;
                }
            }
        }
Example #6
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
     {
         lblPasswordError.Text = "";
         lblUsernameError.Text = "Please enter a valid Username";
         txtUsername.Text      = "";
         txtUsername.Focus();
     }
     else if (ControlValidation.Isblank(txtPassword.Text.Trim()) == true || ControlValidation.IsReserveWord(txtPassword.Text.Trim().ToLower()))
     {
         lblUsernameError.Text = "";
         lblPasswordError.Text = "Pleasse enter a valid Password";
         txtPassword.Text      = "";
         txtPassword.Focus();
     }
     else
     {
         //After Password Validation Successful
         var login = _userAuthRepository.GetAll().Where(x => x.UserName == txtUsername.Text && x.Password == txtPassword.Text).FirstOrDefault();
         if (login != null)
         {
             CacheItemPolicy policy = new CacheItemPolicy();
             policy.AbsoluteExpiration = DateTimeOffset.Now.AddHours(12);
             _userInfoCache.Add("userinfo", login, policy);
             //Dashboard dashboardfrm = new Dashboard();
             //dashboardfrm.Show();
             //Accessing the Cache Value from Cache Memory
             var    userInfo = (UserAuth)_userInfoCache.Get("userinfo");
             string str      = userInfo.UserName;
             this.Hide();
         }
         else
         {
             lblLoginError.Text = "Invalid UserId and Password!";
         }
         lblUsernameError.Text = "";
         lblPasswordError.Text = "";
     }
 }
Example #7
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtProductType.Text.Trim() == "" || ControlValidation.IsReserveWord(txtProductType.Text.Trim().ToLower()))
            {
                lblError.Text      = "Please Enter a valid Item Type...";
                lblError.ForeColor = Color.Red;
            }
            else
            {
                var result = AddNewType();
                if (result.Result == true)
                {
                    /*  ProductEntry obj = null;
                     * foreach( Object objj in Owner.Controls)
                     * {
                     *    var test = (Panel)objj;
                     *    if (test.AccessibilityObject.Name == "Product Entry"){
                     *        obj = (ProductEntry)test.AccessibilityObject;
                     *    }
                     * }
                     * //Owner.Controls.*/


                    ProductEntry prodEntry = (ProductEntry)Owner.ActiveControl;
                    prodEntry.BindProductType();
                    txtProductType.Text = "";
                    lblError.Text       = result.Message;
                    lblError.ForeColor  = Color.Green;
                }
                else
                {
                    lblError.Text      = result.Message;
                    lblError.ForeColor = Color.Red;
                }
            }
        }
Example #8
0
 private void btnSignUp_Click(object sender, EventArgs e)
 {
     if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
     {
         lblError.Text    = "Please enter Username !";
         txtUsername.Text = "";
         txtUsername.Focus();
     }
     else if (ControlValidation.Isblank(txtPassword.Text.Trim()) == true || ControlValidation.IsReserveWord(txtPassword.Text.Trim().ToLower()))
     {
         lblError.Text    = "Pleasse enter Password !";
         txtPassword.Text = "";
         txtPassword.Focus();
     }
     else if (txtPassword.Text.Trim() != txtConfirmPassword.Text.Trim())
     {
         lblError.Text    = "Password Mismatch !";
         txtPassword.Text = "";
         txtPassword.Focus();
         txtConfirmPassword.Text = "ConfirmPassword";
     }
     else if (ControlValidation.Isblank(txtFirstName.Text.Trim()) == true || ControlValidation.IsReserveWord(txtFirstName.Text.Trim().ToLower()))
     {
         lblError.Text     = "Enter First Name !";
         txtFirstName.Text = "";
         txtFirstName.Focus();
     }
     else if (ControlValidation.Isblank(txtLastName.Text.Trim()) == true || ControlValidation.IsReserveWord(txtLastName.Text.Trim().ToLower()))
     {
         lblError.Text    = "Enter Last Name !";
         txtLastName.Text = "";
         txtLastName.Focus();
     }
     else if (radioMale.Checked == false && radioFemale.Checked == false)
     {
         lblError.Text = "Select Gender !";
     }
     else if (ControlValidation.Isblank(txtMobileNo.Text.Trim()) == true || txtMobileNo.Text.Trim() == "MobileNo" || ControlValidation.IsValidMobileNo(txtMobileNo.Text.Trim()) == false)
     {
         lblError.Text    = "Enter valid Mobile Number !";
         txtMobileNo.Text = "";
         txtMobileNo.Focus();
     }
     else if (ControlValidation.Isblank(txtEmail.Text.Trim()) == true || txtEmail.Text.Trim() == "E-mail" || ControlValidation.IsValidEmail(txtEmail.Text.Trim()) == false)
     {
         lblError.Text = "Enter a valid email id !";
         txtEmail.Text = "";
         txtEmail.Focus();
     }
     else if (cmbQues1.SelectedIndex == 0)
     {
         lblError.Text = "Select Security Question 1 !";
     }
     else if (ControlValidation.Isblank(txtAnswer1.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer1.Text.Trim().ToLower()))
     {
         lblError.Text   = "Enter Answer for Question1 !";
         txtAnswer1.Text = "";
         txtAnswer1.Focus();
     }
     else if (cmbQues2.SelectedIndex == 0)
     {
         lblError.Text = "Select Security Question 2 !";
     }
     else if (ControlValidation.Isblank(txtAnswer2.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer2.Text.Trim().ToLower()))
     {
         lblError.Text   = "Enter Answer for Question2 !";
         txtAnswer2.Text = "";
         txtAnswer2.Focus();
     }
     else
     {
         InventoryEntities database = new InventoryEntities();
         if (ControlValidation.IsReserveWord(txtMiddleName.Text.Trim()))
         {
             txtMiddleName.Text = "";
         }
         var result = Register();
         if (result.Result == true)
         {
             lblError.Text = "";
             Login loginform = new Login();
             loginform.Show();
             this.Hide();
         }
         else
         {
             lblError.Text = result.Message;
         }
     }
 }