public frmMain(Int32 userID, Int32 companyID) { //Int32 appUserID, currentCompanyID; //appUserID = userID; //currentCompanyID = companyID; CurrentCompany = frmMainManager.LoadCompany(companyID); CurrentUser = UserManager.GetItem(userID); curUserRights = UserRightsManager.GetUserRights(userID); InitializeComponent(); }
private void cboUser_SelectedIndexChanged(object sender, EventArgs e) { string[] objList = null; if (!flgLoading) { ClearNodes(); objList = UserRightsManager.GetUserRights(Convert.ToInt32(cboUser.SelectedValue)); if (objList != null) { foreach (string str in objList) { TreeNode[] tNode = tvwRights.Nodes.Find(str, true); if (tNode != null) { tNode[0].Checked = true; } } tvwRights.Nodes[0].Expand(); } } }
private void btnOk_Click(object sender, EventArgs e) { try { // Read Values from TreeViews (Start) TreeNode oMainNode = tvwRights.Nodes[0]; UserRightsList objList; objList = ReadNodesRecursive(oMainNode); if (objList[0].MenuID == "RIGHTS") { objList.RemoveAt(0); } // Read Values from TreeViews (End) bool flgApplyEdit; flgApplyEdit = UserRightsManager.Save(objList); if (flgApplyEdit) { //DialogResult result = MessageBox.Show("User Rights Saved Successfully. Do You want to Close this Window? Click 'Yes' to Close Window, otherwise Click 'No'", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); //if (result == DialogResult.Yes) //{ // this.Close(); //} MessageBox.Show("User Rights Saved Successfully.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("User Rights Not Saved.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public static void FormAuthenticate(string frmName, UserCompany objCompany, User objUser) { frmAddRight = false; frmModifyRight = false; frmViewRight = false; frmDeleteRight = false; repView = false; repPrintRight = false; string rMenuKey = string.Empty; switch (frmName) { case "frmDeptList": rMenuKey = "D0011"; break; case "frmEmployeeList": rMenuKey = "D0012"; break; case "frmVisitorList": rMenuKey = "D0013"; break; case "frmCityList": rMenuKey = "D0014"; break; case "frmDriverList": rMenuKey = "D0015"; break; case "frmVehicleList": rMenuKey = "D0016"; break; case "frmUserList": rMenuKey = "D0017"; break; case "frmVehInOutList": rMenuKey = "T0011"; break; case "frmAppointmentList": rMenuKey = "T0012"; break; case "frmVisitorGPList": rMenuKey = "T0013"; break; case "frmReturnableDCList": rMenuKey = "T0014"; break; case "frmUserAuthority": rMenuKey = "U0011"; break; } if (rMenuKey != string.Empty) { string[] strRightList = UserRightsManager.GetUserFormRights(objUser.DBID, rMenuKey); if (strRightList != null) { foreach (string strRight in strRightList) { if (strRight == rMenuKey + "A") { frmAddRight = true; } else if (strRight == rMenuKey + "M") { frmModifyRight = true; } else if (strRight == rMenuKey + "V") { frmViewRight = true; } else if (strRight == rMenuKey + "D") { frmDeleteRight = true; } else if (strRight == rMenuKey + "P") { repPrintRight = true; } } } } }