private void FinishButton_Click(object sender, EventArgs e) { try { CResult tempCheckForValidation = this.ValidateInput(); if (tempCheckForValidation.IsSuccess) { CUserInfo tempUser = new CUserInfo(); tempUser.UserName = NameTextBox.Text; //string tempPass =RMSGlobal.Encrypt(PasswordTextBox.Text,true); string tempPass = PasswordTextBox.Text; if (!tempPass.Equals(ConfirmPassTextBox.Text)) { MessageBox.Show("Given Password does not match with confirmed password."); PasswordTextBox.Clear(); ConfirmPassTextBox.Clear(); return; } else { tempUser.Password = tempPass; // tempUser.Type = UserTypeComboBox.SelectedIndex; tempUser.Type = CUserConstant.GetUSerConstant(UserTypeComboBox.Text); if (GenderComboBox.SelectedIndex == 0) tempUser.Gender = "Male"; else if (GenderComboBox.SelectedIndex == 1) tempUser.Gender = "Female"; if (ActiveRadioButton.Checked) tempUser.Status = 1; else if (InActiveRadioButton.Checked) tempUser.Status = 0; CUserAccess tempUserAccess = new CUserAccess(); if (OpenDrawerCheckBox.Checked) tempUserAccess.OpenDrawer = 1; if (VoidCheckBox.Checked) tempUserAccess.VoidTable = 1; if (TransferCheckBox.Checked) tempUserAccess.TransferTable = 1; if (MergeCheckBox.Checked) tempUserAccess.MergeTable = 1; if (UnlockCheckBox.Checked) tempUserAccess.UnlockTable = 1; if (ReviewCheckBox.Checked) tempUserAccess.ReviewTransaction = 1; if (ViewCheckBox.Checked) tempUserAccess.ViewReport = 1; if (TillCheckBox.Checked) tempUserAccess.TillReporting = 1; if (ExitCheckBox.Checked) tempUserAccess.ExitRms = 1; if (CustomersCheckBox.Checked) tempUserAccess.Customers = 1; if (UsersCheckBox.Checked) tempUserAccess.Users= 1; if (BookingCheckBox.Checked) tempUserAccess.Booking = 1; if (DepositCheckBox.Checked) tempUserAccess.Deposit = 1; if (UpdateItemCheckBox.Checked) tempUserAccess.UpdateItems = 1; if (chkRemoveItems.Checked) tempUserAccess.RemoveItems = 1; if (chkLogRegister.Checked) tempUserAccess.LogRegister = 1; if (chkProcessTime.Checked) tempUserAccess.ProcessDeliveryTime= 1; if (chkManageKitchenText.Checked) tempUserAccess.KitchenText = 1; if (chkSettings.Checked) tempUserAccess.SystemSettings = 1; tempUser.UserAccess = tempUserAccess; CUserManager tempUserManager = new CUserManager(); CResult tempResult = new CResult(); if (m_sOpType.Equals("Add")) tempResult = tempUserManager.AddUser(tempUser); else if (m_sOpType.Equals("Update")) { tempUser.UserID = m_oUserInfo.UserID; tempResult = tempUserManager.UpdateUser(tempUser); } else ; if (tempResult.IsSuccess) { Form tempMainForm = CFormManager.Forms.Pop(); tempMainForm.Show(); this.Close(); } } } else { MessageBox.Show(tempCheckForValidation.Message); ClearTextBoxes(); return; } } catch (Exception ex) { } }
private void btnSave_Click(object sender, EventArgs e) { CResult oResult = ValidateForm(); if (oResult.IsSuccess) { String sTempUser = txtUserName.Text.Trim(); //String sTempPass =RMSGlobal.Decrypt(txtPassword.Text.Trim(),true); String sTempPass = txtPassword.Text.Trim(); int iTempType = ((CComboBoxItem)cmbUserType.SelectedItem).Value; String sTempGender = cmbSex.SelectedItem.ToString(); CUserInfo oUser = new CUserInfo(); oUser.UserName = sTempUser; oUser.Password =sTempPass; oUser.Type = iTempType; oUser.Gender = sTempGender; if (rdoActive.Checked) { oUser.Status = 1; } else if (rdoInActive.Checked) { oUser.Status = 0; } CUserAccess oUserAccess = new CUserAccess(); if (chkOpenDrawer.Checked) { oUserAccess.OpenDrawer = 1; } if (chkReviewTrans.Checked) { oUserAccess.ReviewTransaction = 1; } if (chkVoidTable.Checked) { oUserAccess.VoidTable = 1; } if (chkViewReport.Checked) { oUserAccess.ViewReport = 1; } if (chkTransferTable.Checked) { oUserAccess.TransferTable = 1; } if (chkTillReport.Checked) { oUserAccess.TillReporting = 1; } if (chkMergeTable.Checked) { oUserAccess.MergeTable = 1; } if (chkExitRms.Checked) { oUserAccess.ExitRms = 1; } if (chkUnlockTable.Checked) { oUserAccess.UnlockTable = 1; } if (chkBooking.Checked) { oUserAccess.Booking = 1; } if (chkUsers.Checked) { oUserAccess.Users = 1; } if (chkDeposit.Checked) { oUserAccess.Deposit = 1; } if (chkCustomer.Checked) { oUserAccess.Customers = 1; } if (chkUpdateItems.Checked) { oUserAccess.UpdateItems = 1; } if (chkRemoveItems.Checked) { oUserAccess.RemoveItems = 1; } if (chkLogRegister.Checked) { oUserAccess.LogRegister = 1; } if (chkSettings.Checked) { oUserAccess.SystemSettings = 1; } if (chkRmsAdmin.Checked) { oUserAccess.RmsAdminAccess = 1; } oUser.UserAccess = oUserAccess; oUser.UserID = m_userID; CUserManager oManager = new CUserManager(); CResult oResult2 = oManager.UpdateUser(oUser); if (oResult2.IsSuccess) { lblSaveStatus.Text = "User information has been modified successfully."; lblSaveStatus.Visible = true; } else { lblSaveStatus.Text = oResult2.Message; lblSaveStatus.Visible = true; } } else { lblSaveStatus.Text = oResult.Message; lblSaveStatus.Visible = true; } }