private void RemoveUser() { TIS.BL.Internal.User userBL = new TIS.BL.Internal.User(); UserObject user; try { this.Cursor = Cursors.WaitCursor; if (gdvUsers.IsRowSelected(gdvUsers.FocusedRowHandle)) { user = (UserObject)gdvUsers.GetRow(this.gdvUsers.FocusedRowHandle); if (userBL.HasDependencies(user)) { DevExpress.XtraEditors.XtraMessageBox.Show("Selected user cannot be removed. Other records depend on this user.", "Remove", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to remove the selected user?", "Remove", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { userBL.Remove(user); this.FindAll(); } } } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { user = null; userBL = null; this.Cursor = Cursors.Default; } }
public void FindAll() { try { UserObjectCollection users = new UserObjectCollection(); users = new TIS.BL.Internal.User().GetAll(); gdcUsers.DataSource = users; } catch (System.Exception exception1) { throw new System.Exception(MethodBase.GetCurrentMethod().Name, exception1); } }
public void FindAll() { try { UserObjectCollection users = new UserObjectCollection(); users = new TIS.BL.Internal.User().GetAll(); gdcUsers.DataSource = users; } catch (System.Exception exception1) { throw new System.Exception(MethodBase.GetCurrentMethod().Name, exception1); } }
private void VerifyUser() { try { this.Cursor = Cursors.WaitCursor; if (this.ValidData()) { UserObject user = new TIS.BL.Internal.User().GetUserByLogin(this.txtLogin.Text.Trim()); if (user != null) { if (user.Active) { if (user.Password.Trim().Equals(this.txtPassword.Text.Trim())) { Context.User = user; this.DialogResult = DialogResult.OK; this.Close(); Program.CLOSE = false; Program.LOGIN = false; } else { DevExpress.XtraEditors.XtraMessageBox.Show("Invalid password for this login", "Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { DevExpress.XtraEditors.XtraMessageBox.Show("User is not active anymore", "Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { DevExpress.XtraEditors.XtraMessageBox.Show("No user found with this login.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { this.Cursor = Cursors.Default; } }
private void RemoveUser() { TIS.BL.Internal.User userBL = new TIS.BL.Internal.User(); UserObject user; try { this.Cursor = Cursors.WaitCursor; if (gdvUsers.IsRowSelected(gdvUsers.FocusedRowHandle)) { user = (UserObject)gdvUsers.GetRow(this.gdvUsers.FocusedRowHandle); if (userBL.HasDependencies(user)) { DevExpress.XtraEditors.XtraMessageBox.Show("Selected user cannot be removed. Other records depend on this user.", "Remove", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to remove the selected user?", "Remove", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { userBL.Remove(user); this.FindAll(); } } } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { user = null; userBL = null; this.Cursor = Cursors.Default; } }
private void FillCboDispatcher() { //TODO: Re-check this UserObjectCollection users = new User().GetAll(); foreach (UserObject user in users) { if (user.Security.Planning != null) { if (Functions.AllowMaintain(user.Security.Planning.AuthPlanning)) { ComboBoxItem item = new ComboBoxItem { Value = user }; this.cboDispatcher.Items.Add(item); } } if (user.UsrID == Context.User.UsrID) { this.cboDispatcher.SelectedIndex = this.cboDispatcher.Items.Count - 1; } } }
public void SaveUser() { TIS.BL.Internal.User userBL = new TIS.BL.Internal.User(); string invalidMessage = ""; try { _user.Active = this.cbxActive.Checked; _user.Login = this.txtLogin.Text.Trim(); _user.Name = this.txtName.Text.Trim(); _user.Password = this.txtPassword.Text.Trim(); _user.Employee = (EmployeeObject)this.louEmployee.EditValue; _user.Surname = this.txtSurname.Text.Trim(); _user.Security.Application.AuthUser = Convert.ToInt16(this.cbxUserDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxUserMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxUserDelete.Checked).ToString(); _user.Security.Main.AuthTask = Convert.ToInt16(this.cbxTaskDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxTaskMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxTaskDelete.Checked).ToString(); _user.Security.Main.AuthCustomer = Convert.ToInt16(this.cbxCustomerDisplay.Checked).ToString() + "0" + "0"; _user.Security.Main.AuthEmployee = Convert.ToInt16(this.cbxEmployeeDisplay.Checked).ToString() + "0" + "0"; _user.Security.Costing.AuthCosting = (string)Convert.ToInt16(this.cbxCostingDisplay.Checked).ToString() + "0" + "0"; _user.Security.Costing.AuthFuel = Convert.ToInt16(this.cbxFuelDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelDelete.Checked).ToString(); _user.Security.Costing.AuthFuelDelivery = Convert.ToInt16(this.cbxFuelDeliveryDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelDeliveryMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelDeliveryDelete.Checked).ToString(); _user.Security.Costing.AuthFuelCorrection = Convert.ToInt16(this.cbxFuelCorrectionDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelCorrectionMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelCorrectionDelete.Checked).ToString(); //Vehicle _user.Security.Vehicle.AuthVehicle = (string)Convert.ToInt16(this.cbxVehicleDisplay.Checked).ToString() + "0" + "0"; //Material _user.Security.Material.AuthMaterial = (string)Convert.ToInt16(this.cbxMaterialDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialDelete.Checked).ToString(); _user.Security.Material.AuthMaterialMaintenance = (string)Convert.ToInt16(this.cbxMaterialMaintenanceDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMaintenanceMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMaintenanceDelete.Checked).ToString(); _user.Security.Material.AuthMaterialMemo = (string)Convert.ToInt16(this.cbxMaterialMemoDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMemoMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMemoDelete.Checked).ToString(); _user.Security.Material.AuthMaterialCategory = (string)Convert.ToInt16(this.cbxMaterialCategoryDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialCategoryMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialCategoryDelete.Checked).ToString(); //Application _user.Security.Application.AuthSettings = "0" + (string)Convert.ToInt16(this.cbxSettingsMaintain.Checked).ToString() + "0"; if (_user.Security.Planning == null) { _user.Security.Planning = new UserSecurityPlanning(); } //Planning _user.Security.Planning.AuthPlanning = (string)Convert.ToInt16(this.chkPlanningDisplay.Checked).ToString() + (string)Convert.ToInt16(this.chkPlanningMaintain.Checked).ToString() + (string)Convert.ToInt16(this.chkPlanningDelete.Checked).ToString(); _user.Security.Planning.AuthAssignmentTrucks = "0" + (string)Convert.ToInt16(this.chkVehiclesMaintain.Checked).ToString() + "0"; _user.SetInitialValues(); if (userBL.ValidUser(_typeForm, _user, ref invalidMessage)) { switch (_typeForm) { case PROF_IT.Common.Enumerations.TypeForm.NewForm: _user.UsrID = Guid.Empty; userBL.Save(_user); break; case PROF_IT.Common.Enumerations.TypeForm.PropertyForm: userBL.Save(_user); break; } this.DialogResult = DialogResult.OK; this.Close(); } else { DevExpress.XtraEditors.XtraMessageBox.Show("Unable to save user. Reason: " + invalidMessage, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (System.Exception exception1) { throw new System.Exception(MethodBase.GetCurrentMethod().Name, exception1); } }
public void SaveUser() { TIS.BL.Internal.User userBL = new TIS.BL.Internal.User(); string invalidMessage = ""; try { _user.Active = this.cbxActive.Checked; _user.Login = this.txtLogin.Text.Trim(); _user.Name = this.txtName.Text.Trim(); _user.Password = this.txtPassword.Text.Trim(); _user.Employee = (EmployeeObject)this.louEmployee.EditValue; _user.Surname = this.txtSurname.Text.Trim(); _user.Security.Application.AuthUser = Convert.ToInt16(this.cbxUserDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxUserMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxUserDelete.Checked).ToString(); _user.Security.Main.AuthTask = Convert.ToInt16(this.cbxTaskDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxTaskMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxTaskDelete.Checked).ToString(); _user.Security.Main.AuthCustomer = Convert.ToInt16(this.cbxCustomerDisplay.Checked).ToString() + "0" + "0"; _user.Security.Main.AuthEmployee = Convert.ToInt16(this.cbxEmployeeDisplay.Checked).ToString() + "0" + "0"; _user.Security.Costing.AuthCosting = (string)Convert.ToInt16(this.cbxCostingDisplay.Checked).ToString() + "0" + "0"; _user.Security.Costing.AuthFuel = Convert.ToInt16(this.cbxFuelDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelDelete.Checked).ToString(); _user.Security.Costing.AuthFuelDelivery = Convert.ToInt16(this.cbxFuelDeliveryDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelDeliveryMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelDeliveryDelete.Checked).ToString(); _user.Security.Costing.AuthFuelCorrection = Convert.ToInt16(this.cbxFuelCorrectionDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelCorrectionMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxFuelCorrectionDelete.Checked).ToString(); //Vehicle _user.Security.Vehicle.AuthVehicle = (string)Convert.ToInt16(this.cbxVehicleDisplay.Checked).ToString() + "0" + "0"; //Material _user.Security.Material.AuthMaterial = (string)Convert.ToInt16(this.cbxMaterialDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialDelete.Checked).ToString(); _user.Security.Material.AuthMaterialMaintenance = (string)Convert.ToInt16(this.cbxMaterialMaintenanceDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMaintenanceMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMaintenanceDelete.Checked).ToString(); _user.Security.Material.AuthMaterialMemo = (string)Convert.ToInt16(this.cbxMaterialMemoDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMemoMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialMemoDelete.Checked).ToString(); _user.Security.Material.AuthMaterialCategory = (string)Convert.ToInt16(this.cbxMaterialCategoryDisplay.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialCategoryMaintain.Checked).ToString() + (string)Convert.ToInt16(this.cbxMaterialCategoryDelete.Checked).ToString(); //Application _user.Security.Application.AuthSettings = "0" + (string)Convert.ToInt16(this.cbxSettingsMaintain.Checked).ToString() + "0"; if(_user.Security.Planning == null) _user.Security.Planning = new UserSecurityPlanning(); //Planning _user.Security.Planning.AuthPlanning = (string)Convert.ToInt16(this.chkPlanningDisplay.Checked).ToString() + (string)Convert.ToInt16(this.chkPlanningMaintain.Checked).ToString() + (string)Convert.ToInt16(this.chkPlanningDelete.Checked).ToString(); _user.Security.Planning.AuthAssignmentTrucks = "0" + (string)Convert.ToInt16(this.chkVehiclesMaintain.Checked).ToString() + "0"; _user.SetInitialValues(); if (userBL.ValidUser(_typeForm, _user, ref invalidMessage)) { switch (_typeForm) { case PROF_IT.Common.Enumerations.TypeForm.NewForm: _user.UsrID = Guid.Empty; userBL.Save(_user); break; case PROF_IT.Common.Enumerations.TypeForm.PropertyForm: userBL.Save(_user); break; } this.DialogResult = DialogResult.OK; this.Close(); } else { DevExpress.XtraEditors.XtraMessageBox.Show("Unable to save user. Reason: " + invalidMessage, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (System.Exception exception1) { throw new System.Exception(MethodBase.GetCurrentMethod().Name, exception1); } }
private void FillCboDispatcher() { //TODO: Re-check this UserObjectCollection users = new User().GetAll(); foreach (UserObject user in users) { if(user.Security.Planning != null) if (Functions.AllowMaintain(user.Security.Planning.AuthPlanning)) { ComboBoxItem item = new ComboBoxItem { Value = user }; this.cboDispatcher.Items.Add(item); } if (user.UsrID == Context.User.UsrID) this.cboDispatcher.SelectedIndex = this.cboDispatcher.Items.Count - 1; } }