private List<long> GetTreeChecked() { if (TreeView1.CheckedNodes.Count == 0) return null; Hashtable parentNodes = new Hashtable(); AuthorityManager authMgr = new AuthorityManager(userInfo); List<PermissionInfo> lstAll = authMgr.accountRoleEx.GetOwnPermissionByLoginApplication(userInfo.Login, portalName); foreach (PermissionInfo ai in lstAll) { if (string.IsNullOrEmpty(ai.Privilege.Privilege)) parentNodes.Add(ai.Id.ToString(), null); } List<long> lst = new List<long>(); for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { if (TreeView1.CheckedNodes[i].Value.Equals("Root")) continue; if (parentNodes.ContainsKey(TreeView1.CheckedNodes[i].Value)) continue; lst.Add( Convert.ToInt32( TreeView1.CheckedNodes[i].Value ) ); } return lst; }
public DataTable getAllDomainsByApplication() { AuthorityManager authMgr = new AuthorityManager(); //DataTable dtAllDomains = authMgr.getDomainsByApplication(); List<string> lst = authMgr.accountRoleEx.GetAccountFieldValue("domain"); DataTable dtAllDomains = GetTableFromList(ref lst, "domain"); return dtAllDomains; }
public bool onClickOK(string strDeptPaths, string strGroupID, string strDomain, string editorID) { log.Debug("*-*-strDeptPaths=" + strDeptPaths); string[] arrDeptPaths = strDeptPaths.Split(Constants.COL_DELIM.ToCharArray()); log.Debug("*-*-arrDeptPaths[0]=" + arrDeptPaths[0]); AuthorityManager authMgr = new AuthorityManager(editorID); bool bResult = authMgr.saveAddDepartment(arrDeptPaths, strGroupID, strDomain); return true; }
public string saveGroup(string strGroupID, string strGroupName, string strComment, string editorID) { log.Debug("saveGroup"); log.Debug("*-*-strGroupID=" + strGroupID); log.Debug("*-*-strGroupName=" + strGroupName); log.Debug("*-*-strComment=" + strComment); AuthorityManager authMgr = new AuthorityManager(editorID); string strSavedGroupID = authMgr.saveUserGroupItem(strGroupID, strGroupName, strComment); log.Debug("*-*-*-*--*-*-strSavedGroupID=" + strSavedGroupID); return strSavedGroupID; //manager method }
public string saveLocalUser(string strLocalUserID, string strLogin, string strName, string strPassword, string strCompany, string strDepartment, string strEMail, string editorID) { log.Debug("saveLocalUser"); log.Debug("id=" + strLocalUserID); log.Debug("strName=" + strName); log.Debug("strLogin="******"strPassword="******"strCompany=" + strCompany); log.Debug("strDepartment=" + strDepartment); log.Debug("strEMail=" + strEMail); AuthorityManager authMgr = new AuthorityManager(editorID); string strSavedLocalUserID = authMgr.saveLocalUser(strLocalUserID, strLogin, strName, strPassword, strCompany, strDepartment, strEMail); log.Debug("*-*-*-*--*-*-strSavedLocalUserID=" + strSavedLocalUserID); return strSavedLocalUserID; //manager method }
public TreeViewControl() { authMgr = new AuthorityManager(); treeNodes = new DataTable(); }
public string singleuser_onClickOK(string strUserIDs, string editorID) // public bool singleuser_onClickOK(string strUserIDs, string editorID) { log.Debug("*-*-strUserIDs=" + strUserIDs); string[] arrUserIDs = strUserIDs.Split(Constants.CHECKBOX_ITEM_DELIM.ToCharArray()); log.Debug("*-*-arrUserIDs[0]=" + arrUserIDs[0]); //log.Debug("*-*-arrUserIDs[1]=" + arrUserIDs[1]); //log.Debug("*-*-arrUserIDs[2]=" + arrUserIDs[2]); AuthorityManager authMgr = new AuthorityManager(editorID); string bResult = authMgr.saveAssignUsersToRole(strUserIDs); //bool bResult = authMgr.saveAssignUsersToRole(strUserIDs); log.Debug("*-*-bResult=" + bResult); return bResult; }
public DataTable getTableData(string strDomain, string strCompany, string strDepartment, string strSearch) { log.Debug("getTableData()--strDomain=" + strDomain); log.Debug("getTableData()--strCompany=" + strCompany); log.Debug("getTableData()--strDepartment=" + strDepartment); log.Debug("getTableData()--strSearch=" + strSearch); //get the record set in mainpage AuthorityManager authMgr = new AuthorityManager(); //define datatable for tableedit DataTable dtUsers = new DataTable(); //dtUsers = authMgr.getUsersByDepartment(strDomain, strCompany, strDepartment, strSearch); dtUsers.Columns.Add(" ", typeof(string)); dtUsers.Columns.Add("name", typeof(string)); dtUsers.Columns.Add("login", typeof(string)); dtUsers.Columns.Add("descr", typeof(string)); dtUsers.Columns.Add("accounttype", typeof(string)); dtUsers.Columns.Add("id", typeof(string)); List<AccountInfo> lst = authMgr.accountRoleEx.FindAccount(strCompany, strDomain, strDepartment, strSearch, strSearch); foreach (AccountInfo ai in lst) { string icon = ""; // 0:icon 1:name 2:login 3:descr 4:type 5:id dtUsers.Rows.Add(icon, ai.Name, ai.Login, ai.Domain + "/" + ai.Company + "/" + ai.Department, ai.Type, ai.Id); } //convert List<ConditionSet> to datatable //for (int i = 0; i < csRecord.Count; i++) //{ // //log.Debug("====="); // ConditionSet cc = (ConditionSet)csRecord[i]; // DataRow tRow = dt.NewRow(); // tRow[0] = cc.Operate; // tRow[1] = cc.Datatype; // tRow[2] = cc.Values; // tRow[3] = cc.IsEmpty; // dt.Rows.Add(tRow); //} return dtUsers; }
public DataTable getCompaniesByDomain(string strDomain) { log.Debug("getCompaniesByDomain"); AuthorityManager authMgr = new AuthorityManager(); //DataTable dtCompanies = authMgr.getCompaniesByDomain(strDomain); Hashtable h = new Hashtable(); h.Add("domain", strDomain); List<string> lst = authMgr.accountRoleEx.GetAccountFieldValue("company", h); DataTable dtCompanies = GetTableFromList(ref lst, "company"); return dtCompanies; }
public void QueryTreeViewClick(object sender, System.EventArgs e) { AuthorityManager authMgr = new AuthorityManager(userInfo); //清空所有checkbox for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { TreeView1.CheckedNodes[i].Checked = false; i--; } TreeView1.Nodes[0].Checked = false; //取得高亮group对应的所有的permission //DataTable dtPrimPer = authMgr.getPrimaryPermissionsByGroupName(txtGroupName.Value); DataTable dtPrimPer = new DataTable(); dtPrimPer.Columns.Add("name", typeof(string)); /*List<PermissionInfo> lst = authMgr.accountRoleEx.GetPermissionByRole(txtGroupName.Value); ; foreach (PermissionInfo ai in lst) { dtPrimPer.Rows.Add(ai.Name); } */ List<RoleExInfo> lst = authMgr.accountRoleEx.GetApplicationByRole(txtGroupName.Value); ; foreach (RoleExInfo ai in lst) { dtPrimPer.Rows.Add(ai.Application); } int count = 0; //循环permission,如果有permission name与treeview节点相同,则check该节点 for (int i = 0; i < dtPrimPer.Rows.Count; i++) { string permissionName = (string)dtPrimPer.Rows[i]["name"]; //循环treeview节点,找到与permission name相同的节点,跳出treeview循环,继续大循环permission for (int j = 0; j < TreeView1.Nodes[0].ChildNodes.Count; j++) { string tmp = TreeView1.Nodes[0].ChildNodes[j].Text;//FindNode(valuePath); if (tmp.Equals(permissionName)) { TreeView1.Nodes[0].ChildNodes[j].Checked = true; count = count + 1; break; } //TreeView1.Nodes[0].ChildNodes[i].Value //TreeView1.Nodes[0].ChildNodes.Count } } //如果所有的子节点都被check,则check父节点 if (count == TreeView1.Nodes[0].ChildNodes.Count) { TreeView1.Nodes[0].Checked = true; } }
public void EditSaveGroupClick(object sender, System.EventArgs e) { string strGroupName = txtGroupName.Value; string strComment = txtComment.Value; string strOldGroupName = txtOldGroupName.Value; log.Debug("EditsaveGroup"); //log.Debug("*-*-strGroupID=" + strGroupID); log.Debug("*-*-strGroupName=" + strGroupName); log.Debug("*-*-strOldGroupName=" + strOldGroupName); log.Debug("*-*-strComment=" + strComment); /*AuthorityManager authMgr = new AuthorityManager(editorID); string strSavedGroupID = authMgr.saveUserGroupItem(strGroupID, strGroupName, strComment); log.Debug("*-*-*-*--*-*-strSavedGroupID=" + strSavedGroupID); return strSavedGroupID; */ AuthorityManager authMgr = new AuthorityManager(userInfo); try { authMgr.accountRoleEx.RenameRole(strOldGroupName, strGroupName, portalName, strComment); } catch (Exception ex) { ErrMsg("Err! " + ex.Message); return; } Finish("Success !"); }
public DataTable getSystemTimeOut() { AuthorityManager authMgr = new AuthorityManager(userInfo); DataTable dtDomains = authMgr.getDomainsByApplication(); return dtDomains; }
public DataTable getNodeData() { AuthorityManager authMgr = new AuthorityManager(userInfo); //DataTable dt = new DataTable(); //DataTable tmpDt = authMgr.GetAllPermissionList(); /*dt = tmpDt.Clone(); foreach (DataRow dr in tmpDt.Rows) { DataRow tmpDr = dt.NewRow(); for (int i = 0; i < dt.Columns.Count; ++i) { tmpDr[i] = dr[i]; } dt.Rows.Add(tmpDr); }*/ return authMgr.GetAllPermissionList(); }
public bool deleteDomainOrLocalUser(string strAcctId) { AuthorityManager authMgr = new AuthorityManager(userInfo); authMgr.deleteDomainOrLocalUser(strAcctId); return true; }
public DataTable getGroupInfo(string strGroupID) { log.Debug("getGroupInfo"); log.Debug("*-*-strGroupID=" + strGroupID); AuthorityManager authMgr = new AuthorityManager(); DataTable dtGroupInfo = authMgr.getGroupInfoByID(strGroupID); return dtGroupInfo; }
public DataTable getLocalUser(string strLocalUserID) { log.Debug("getLocalUser"); log.Debug("*-*-strLocalUserID=" + strLocalUserID); AuthorityManager authMgr = new AuthorityManager(); DataTable dtAccountInfo = authMgr.getLocalUserByID(strLocalUserID); return dtAccountInfo; }
public DataTable getAllDomains() { AuthorityManager authMgr = new AuthorityManager(); DataTable dtAllDomains = authMgr.getDomainsByApplication(); return dtAllDomains; }
protected void bindUsersInGroupTable() { try { AuthorityManager authMgr = new AuthorityManager(userInfo); DataTable dtUsersInGroup = authMgr.getUsersAndDeptsListByGroup(hidGroupName.Value); if (dtUsersInGroup != null && dtUsersInGroup.Rows.Count != 0) { for (int i = dtUsersInGroup.Rows.Count; i < DEFAULT_ROWS_UsersInGroup; i++) { dtUsersInGroup.Rows.Add(dtUsersInGroup.NewRow()); } } else { for (int i = 0; i < DEFAULT_ROWS_UsersInGroup; i++) { dtUsersInGroup.Rows.Add(dtUsersInGroup.NewRow()); } } gdUsersInGroup.DataSource = dtUsersInGroup; gdUsersInGroup.DataBind(); setUsersInGroupColumnWidth(); } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } }
public DataTable getGroupInfo(string strGroupName) { log.Debug("getGroupInfo"); log.Debug("*-*-strGroupName=" + strGroupName); AuthorityManager authMgr = new AuthorityManager(userInfo); //DataTable dtGroupInfo = authMgr.getGroupInfoByID(strGroupID); Hashtable h = new Hashtable(); h.Add("name", strGroupName); DataTable dtGroupInfo = new DataTable(); dtGroupInfo.Columns.Add("name", typeof(string)); dtGroupInfo.Columns.Add("comment", typeof(string)); List<RoleExInfo> lst = authMgr.accountRoleEx.FindRole(h); if (lst != null && lst.Count > 0) { RoleExInfo r = lst[0]; dtGroupInfo.Rows.Add(r.Name, r.Descr); } return dtGroupInfo; }
protected void bindUsersInSubSystemTable() { try { AuthorityManager authMgr = new AuthorityManager(userInfo); DataTable dtUsers = authMgr.getUsersInSubSystem(idSearchTxt.Text); if (dtUsers != null && dtUsers.Rows.Count != 0) { for (int i = dtUsers.Rows.Count; i < DEFAULT_ROWS_UsersInSubSystem; i++) { dtUsers.Rows.Add(dtUsers.NewRow()); } } else { for (int i = 0; i < DEFAULT_ROWS_UsersInSubSystem; i++) { dtUsers.Rows.Add(dtUsers.NewRow()); } } gdUsersInSubSystem.DataSource = dtUsers; gdUsersInSubSystem.DataBind(); setUsersInSubSystemColumnWidth(); } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } }
public DataTable getNodeData() { AuthorityManager authMgr = new AuthorityManager(userInfo); //DataTable dt = new DataTable(); //DataTable tmpDt = authMgr.GetAllPermissionList(); /*dt = tmpDt.Clone(); foreach (DataRow dr in tmpDt.Rows) { DataRow tmpDr = dt.NewRow(); for (int i = 0; i < dt.Columns.Count; ++i) { tmpDr[i] = dr[i]; } dt.Rows.Add(tmpDr); }*/ //return authMgr.GetAllPermissionList(); //string editor = Session[AttributeNames.USER_CODE] as string; string accountauthoritylogin = Session["accountauthoritylogin"] as string; DataTable dt = new DataTable(); dt.Columns.Add("name", typeof(string)); dt.Columns.Add("id", typeof(string)); List<PermissionInfo> lst = authMgr.accountRoleEx.GetOwnPermissionByLoginApplication(accountauthoritylogin, portalName); //List<PermissionInfo> lst = authMgr.accountRoleEx.GetOwnPermissionByLoginRole(accountauthoritylogin, "", portalName); foreach (PermissionInfo ai in lst) { dt.Rows.Add(ai.Name, ai.Id); } return dt; }
protected void deleteUserInSubSystem_click(Object sender, EventArgs e) { try { AuthorityManager authMgr = new AuthorityManager(userInfo); authMgr.deleteDomainOrLocalUser(hidUserId.Value); bindUsersInSubSystemTable(); bindGroupsTable(); bindUsersInGroupTable(); queryClick(sender, e); ScriptManager.RegisterStartupScript(this.updatePanel1, typeof(System.Object), "HighLightUsersInSubSystemTable", "HighLightUsersInSubSystemTable();HighLightGroupTable();", true); } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } }
public void AddSaveGroupClick(object sender, System.EventArgs e) { string strGroupName = txtGroupName.Value; string strComment = txtComment.Value; log.Debug("AddsaveGroup"); //log.Debug("*-*-strGroupID=" + strGroupID); log.Debug("*-*-strGroupName=" + strGroupName); log.Debug("*-*-strComment=" + strComment); //string strEditorID = (string)HttpContext.Current.Session[AttributeNames.USER_ID]; AuthorityManager authMgr = new AuthorityManager(userInfo); /*string strSavedGroupID = authMgr.saveUserGroupItem(strGroupID, strGroupName, strComment, strEditorID); log.Debug("*-*-*-*--*-*-strSavedGroupID=" + strSavedGroupID); return strSavedGroupID; */ string roleType = "0"; //string editor = Session[AttributeNames.USER_CODE] as string; List<long> applicationList = GetTreeChecked(); if (applicationList == null || applicationList.Count == 0) { ErrMsg("請勾選Menu!"); return; } try { string accountauthoritylogin = Session["accountauthoritylogin"] as string; authMgr.accountRoleEx.CreateAndUpdateRoleAndRolePermission(strGroupName, portalName, roleType, strComment, applicationList, accountauthoritylogin); } catch (Exception ex) { ErrMsg("Err! " + ex.Message); return; } //return ""; //manager method Finish("Success !"); }
//以下处理tree public void queryClick(object sender, System.EventArgs e) { try { AuthorityManager authMgr = new AuthorityManager(userInfo); //TreeView1.ExpandAll(); //清空所有checkbox for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { TreeView1.CheckedNodes[i].Checked = false; i--; } TreeView1.Nodes[0].Checked = false; if (hidGroupName.Value.Equals("")) { return; } //取得高亮group对应的所有的permission DataTable dtPrimPer = authMgr.getPrimaryPermissionsByGroupName(hidGroupName.Value); //循环permission,如果有permission name与treeview节点相同,则check该节点 for (int i = 0; i < dtPrimPer.Rows.Count; i++) { string permissionType = (string)dtPrimPer.Rows[i]["type"]; // "/iMES/Operation/FA/Image Download Check" //permissionType = permissionType.Substring(1); // "iMES/Operation/FA/Image Download Check" TreeNode tmp = TreeView1.FindNode(permissionType); tmp.Checked = true; if (tmp.Parent!=null) { tmp.Parent.Checked = true; for (int j = 0; j < tmp.Parent.ChildNodes.Count; j++) { if (!tmp.Parent.ChildNodes[j].Checked) { tmp.Parent.Checked = false; break; } } if (tmp.Parent.Checked == true) { tmp = tmp.Parent; if (tmp.Parent!=null) { tmp.Parent.Checked = true; for (int j = 0; j < tmp.Parent.ChildNodes.Count; j++) { if (!tmp.Parent.ChildNodes[j].Checked) { tmp.Parent.Checked = false; break; } } /* if (tmp.Parent.Checked == true) { tmp = tmp.Parent; CheckParents(tmp.Parent); }*/ } } } } } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } /* //如果所有的子节点都被check,则check父节点 if (count == TreeView1.Nodes[0].ChildNodes.Count) { TreeView1.Nodes[0].Checked = true; }*/ }
public DataTable getDeptsByCompany(string strDomain, string strCompany) { log.Debug("getDeptsByCompany"); AuthorityManager authMgr = new AuthorityManager(); //DataTable dtDepts = authMgr.getDeptsByCompany(strDomain, strCompany,""); Hashtable h = new Hashtable(); h.Add("domain", strDomain); h.Add("company", strCompany); List<string> lst = authMgr.accountRoleEx.GetAccountFieldValue("department", h); DataTable dtDepts = GetTableFromList(ref lst, "department"); return dtDepts; }
public void saveClick(object sender, System.EventArgs e) { try { AuthorityManager authMgr = new AuthorityManager(userInfo); //DataTable dtPrimPer = authMgr.getPrimaryPermissionsByGroupName(txtGroupName.Value); for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { if (TreeView1.CheckedNodes[i].ChildNodes.Count > 0) { TreeView1.CheckedNodes.RemoveAt(i); i--; } } string[] arrPermissions = new string[TreeView1.CheckedNodes.Count]; for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { arrPermissions[i] = TreeView1.CheckedNodes[i].Value; } //strPermissions:"name1,name2,name3,name4" bool rtn = authMgr.saveAuthority(arrPermissions, hidGroupId.Value); } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(System.Object), "saveClick_Complete", "saveClick_Complete();", true); }
public bool adduser_onClickOK(string strUserIDs, string strGroupName) { log.Debug("*-*-strUserIDs=" + strUserIDs); string[] arrUserIDs = strUserIDs.Split(Constants.CHECKBOX_ITEM_DELIM.ToCharArray()); log.Debug("*-*-arrUserIDs[0]=" + arrUserIDs[0]); //log.Debug("*-*-arrUserIDs[1]=" + arrUserIDs[1]); //log.Debug("*-*-arrUserIDs[2]=" + arrUserIDs[2]); AuthorityManager authMgr = new AuthorityManager(); //string result=authMgr.saveAddUsersToGroup(strUserIDs, strGroupName); string strEditor = Session["accountauthoritylogin"] as string; authMgr.accountRoleEx.CreateAndUpdateAccountRole(new List<string>(arrUserIDs), strGroupName, portalName, strEditor); return true; }
public DataTable getCompaniesByDomain(string strDomain) { log.Debug("getCompaniesByDomain"); AuthorityManager authMgr = new AuthorityManager(); DataTable dtCompanies = authMgr.getCompaniesByDomain(strDomain); return dtCompanies; }
public DataTable getTableData(string strDomain, string strCompany, string strSearch) { log.Debug("getTableData()--strDomain=" + strDomain); log.Debug("getTableData()--strCompany=" + strCompany); log.Debug("getTableData()--strSearch=" + strSearch); //get the record set in mainpage AuthorityManager authMgr = new AuthorityManager(); //define datatable for tableedit DataTable dtDepts = new DataTable(); DataColumn aDept = new DataColumn("aDept"); DataColumn Department = new DataColumn("Department"); DataColumn dept_path = new DataColumn("dept_path"); dtDepts = authMgr.getDeptsByCompany(strDomain, strCompany, strSearch); dtDepts.Columns.Add(aDept); dtDepts.Columns.Add(Department); dtDepts.Columns.Add(dept_path); int dtDeptsCount = dtDepts.Rows.Count - 1; for (int i = dtDeptsCount; i >= 0; i--) { DataRow tmpRow = dtDepts.Rows[i]; //Filters out any empty department's name from dtDepts if (tmpRow[0].ToString().Trim().Equals("")) { dtDepts.Rows.RemoveAt(i); } else { tmpRow[1] = tmpRow[0]; tmpRow[2] = tmpRow[0]; tmpRow[3] = strDomain + ";" + strCompany + ";" + tmpRow[0]; } } dtDepts.Columns.Remove(Constants.TABLE_COLUMN_DEPARTMENT); return dtDepts; }
public string adduser_onClickOK(string strUserIDs, string strGroupName, string editorID) { log.Debug("*-*-strUserIDs=" + strUserIDs); string[] arrUserIDs = strUserIDs.Split(Constants.CHECKBOX_ITEM_DELIM.ToCharArray()); log.Debug("*-*-arrUserIDs[0]=" + arrUserIDs[0]); //log.Debug("*-*-arrUserIDs[1]=" + arrUserIDs[1]); //log.Debug("*-*-arrUserIDs[2]=" + arrUserIDs[2]); AuthorityManager authMgr = new AuthorityManager(editorID); string result=authMgr.saveAddUsersToGroup(strUserIDs, strGroupName); return result; }