protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { string mainCode = Request["MainCode"] + ""; string[] checkCodes = this.txtACode.Value.Split(new char[] { ',' }); FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); qa.Dispose(); int iCount = entity.CurrentTable.Rows.Count; for (int i = 0; i < iCount; i++) { entity.SetCurrentRow(i); string code = entity.GetString("FunctionStructureCode"); bool isFounded = false; foreach (string c in checkCodes) { if (c == code) { isFounded = true; break; } } if (isFounded) { entity.CurrentRow["IsAvailable"] = 0; } else { entity.CurrentRow["IsAvailable"] = 1; } } DAL.EntityDAO.SystemManageDAO.SubmitAllFunctionStructure(entity); entity.Dispose(); Response.Write(Rms.Web.JavaScript.ScriptStart); Response.Write(" window.navigate( 'ConfigFunction.aspx' ) "); Response.Write(Rms.Web.JavaScript.ScriptEnd); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "保存出错"); Response.Write(Rms.Web.JavaScript.Alert(true, "保存出错")); return; } }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { string mainCode = Request["MainCode"] + ""; string roleCode = Request["RoleCode"] + ""; string[] checkCodes = this.txtACode.Value.Split(new char[] { ',' }); EntityData role = DAL.EntityDAO.SystemManageDAO.GetStandard_RoleByCode(roleCode); FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); qa.Dispose(); role.SetCurrentTable("RoleOperation"); foreach (DataRow dr in role.CurrentTable.Select(String.Format(" OperationCode like '{0}%' ", mainCode))) { dr.Delete(); } foreach (string code in checkCodes) { if (code != "") { DataRow dr = role.GetNewRecord(); dr["RoleCode"] = roleCode; dr["OperationCode"] = code; role.AddNewRecord(dr); } } DAL.EntityDAO.SystemManageDAO.SubmitAllStandard_Role(role); entity.Dispose(); role.Dispose(); Response.Write(Rms.Web.JavaScript.ScriptStart); Response.Write(" window.opener.location.reload(); "); Response.Write(" window.navigate( 'ConfigRoleRight.aspx?RoleCode=" + roleCode + "' ); "); Response.Write(Rms.Web.JavaScript.ScriptEnd); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "保存出错"); Response.Write(Rms.Web.JavaScript.Alert(true, "保存出错")); return; } }
private void LoadData() { string mainCode = Request["MainCode"] + ""; try { FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); entity.CurrentTable.Columns.Add("ShowCode"); qa.Dispose(); string allCode = ""; string aCode = ""; int iCount = entity.CurrentTable.Rows.Count; for (int i = 0; i < iCount; i++) { entity.SetCurrentRow(i); string code = entity.GetString("FunctionStructureCode"); int deep = entity.GetInt("Deep"); entity.CurrentRow["ShowCode"] = BuildShowCode(deep); int iA = entity.GetInt("IsAvailable"); if (allCode != "") { allCode += ","; aCode += ","; } allCode += code; if (iA != 1) { aCode += code; } } this.rptFunction.DataSource = entity; this.rptFunction.DataBind(); entity.Dispose(); this.txtAllCode.Value = allCode; this.txtACode.Value = aCode; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }
private void IniPage() { string mainCode = Request["MainCode"] + ""; try { FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.Deep, "1")); QueryAgent qa = new QueryAgent(); EntityData mainFunction = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); qa.Dispose(); this.dtlMainFunction.DataSource = mainFunction; this.dtlMainFunction.DataBind(); mainFunction.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }
public static void LoadAvailableFunction() { try { FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsAvailable, "0")); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); qa.Dispose(); foreach (DataRow dr in entity.CurrentTable.Rows) { string code = (string)dr["FunctionStructureCode"]; m_AvailableFunction.Add(code); } entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog("AvailableFunction", ex, ""); } }
private void LoadData() { ///////////权限 string mainCode = "%"; string roleCode = Request["RoleCode"] + ""; try { EntityData role = DAL.EntityDAO.SystemManageDAO.GetStandard_RoleByCode(roleCode); FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsAvailable, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRightControlPoint, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRoleControlPoint, "0")); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); entity.CurrentTable.Columns.Add("ShowCode"); qa.Dispose(); string allCode = ""; string aCode = ""; int iCount = entity.CurrentTable.Rows.Count; for (int i = 0; i < iCount; i++) { entity.SetCurrentRow(i); string code = entity.GetString("FunctionStructureCode"); int deep = entity.GetInt("Deep"); entity.CurrentRow["ShowCode"] = BuildShowCode(deep); int iA = entity.GetInt("IsAvailable"); if (allCode != "") { allCode += ","; } allCode += code; } role.SetCurrentTable("RoleOperation"); foreach (DataRow dr in role.CurrentTable.Select(String.Format(" OperationCode like '{0}%' ", mainCode))) { string code = (string)dr["OperationCode"]; if (aCode != "") { aCode += ","; } aCode += string.Format("'{0}'", code); } aCode = " FunctionStructureCode in (" + aCode + ") "; DataView dv = new DataView(entity.Tables["FunctionStructure"]); dv.RowFilter = aCode; this.rptFunction.DataSource = dv; this.rptFunction.DataBind(); entity.Dispose(); role.Dispose(); } catch (Exception ex) { //ApplicationLog.WriteLog(this.ToString(), ex, ""); //Response.Write(Rms.Web.JavaScript.Alert(true, "显示权限时发生出错")); } ////////////////////////////////// try { EntityData ds = SystemManageDAO.GetRoleByCode(roleCode); if (ds.HasRecord()) { this.lblRoleName.Text = ds.GetString("RoleName"); this.lblDescription.Text = ds.GetString("Description"); sortID.Text = ds.GetString("sortid"); } ds.Dispose(); EntityData entity = OBSDAO.GetStationByRoleCode(roleCode); this.dgList.DataSource = entity.CurrentTable; this.dgList.DataBind(); entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错")); } }
protected void Page_Load(object sender, System.EventArgs e) { try { string m_strGetType = Request.QueryString["GetType"] + ""; //数据分类 string m_strNodeLayer = Request.QueryString["NodeLayer"] + ""; //父节点的层数 string m_strNodeId = Request.QueryString["NodeId"] + ""; //父节点编号 string[] m_Layers = (Request.QueryString["Layers"] + "").Split('.'); //定点展开的序列 string m_strSelectedLayer = Request.QueryString["SelectedLayer"] + ""; //定层展开的深度 m_ClassCode = Request.QueryString["ClassCode"] + ""; m_ProjectCode = Request.QueryString["ProjectCode"] + ""; m_strAct = Request.QueryString["Act"] + ""; m_iNodeLayer = BLL.ConvertRule.ToInt(m_strNodeLayer); DataTable m_Table = new DataTable("SystemGroup"); m_Table.Columns.Add("GroupCode"); m_Table.Columns.Add("ParentCode"); m_Table.Columns.Add("GroupName"); m_Table.Columns.Add("SortID"); m_Table.Columns.Add("DisplayGroupName"); m_Table.Columns.Add("Layer"); m_Table.Columns.Add("ChildNodesCount"); m_Table.Columns.Add("ShowChildNodes"); m_Table.Columns.Add("NodeType"); m_Table.Columns.Add("ClassCode"); m_Table.Columns.Add("ItemType"); m_Table.Columns.Add("ImageFileName"); EntityData entity = null; DataTable m_DataTable = null; if (m_strGetType == "AllClass") { #region 取第一层 FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsSystemClass, "1")); //只列出某个模块的类别 string FunctionStructureCode = Request.QueryString["FunctionStructureCode"] + ""; if (FunctionStructureCode != "") { sb.AddStrategy(new Strategy(FunctionStructureStrategyName.FunctionStructureCode, FunctionStructureCode)); } sb.AddOrder("FunctionStructureCode", true); string sql = sb.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); entity = qa.FillEntityData("FunctionStructure", sql); qa.Dispose(); m_DataTable = entity.CurrentTable; DataView m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillClassRow(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } #endregion } else if (m_strGetType == "Class") { #region 取指定大类 entity = DAL.EntityDAO.SystemManageDAO.GetFunctionStructureByCode(m_strNodeId); m_DataTable = entity.CurrentTable; DataView m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillClassRow(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } #endregion } else if (m_strGetType == "ChildNodesOfClass") { #region 取某节点子目录 m_iNodeLayer++; DataView m_DV; switch (m_ClassCode) { case "0401": //费用项 entity = DAL.EntityDAO.ProjectDAO.GetAllProject(); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowProject(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; case "0701": //工作项 entity = DAL.EntityDAO.WBSDAO.GetAllRootTask(); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowTask(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; case "1603": // 档案管理 entity = DAL.EntityDAO.OADAO.GetAllOAFileType(); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowDocument(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; default: entity = RmsPM.DAL.EntityDAO.SystemManageDAO.GetSystemGroupByClassCode(m_ClassCode); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "ParentCode=''", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; } #endregion } else if (m_strGetType == "ChildNodes") { #region 取某节点子目录 m_iNodeLayer++; DataView m_DV; switch (m_ClassCode) { case "0401": //费用项 if (m_strNodeId == "") { entity = RmsPM.DAL.EntityDAO.CBSDAO.GetCBSRootByProject(m_ProjectCode); } else { entity = RmsPM.DAL.EntityDAO.CBSDAO.GetCBSByParentCode(m_strNodeId); } m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowCBS(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; case "0701": //工作项 entity = RmsPM.DAL.EntityDAO.WBSDAO.GetChildTask(m_strNodeId); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowTask(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; case "1603": // 档案管理 entity = DAL.EntityDAO.OADAO.GetRuleOAFileType(m_strNodeId); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowDocument(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; default: entity = RmsPM.DAL.EntityDAO.SystemManageDAO.GetSystemGroupByParentCode(m_strNodeId); m_DataTable = entity.CurrentTable; m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } break; } #endregion } else if (m_strGetType == "SingleNodeOfClass") { #region 取某节点 entity = RmsPM.DAL.EntityDAO.SystemManageDAO.GetFunctionStructureByCode(m_strNodeId); m_DataTable = entity.CurrentTable; DataView m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillClassRow(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } #endregion } else if (m_strGetType == "SingleNode") { #region 取某节点 entity = RmsPM.DAL.EntityDAO.SystemManageDAO.GetV_SystemGroupByCode(m_strNodeId); m_DataTable = entity.CurrentTable; DataView m_DV = new DataView(m_DataTable, "", "", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row); m_Table.Rows.Add(m_NewRow); } #endregion } entity.Dispose(); Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(m_Table)); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } Response.End(); }
private void LoadData() { string mainCode = Request["MainCode"] + ""; string roleCode = Request["RoleCode"] + ""; try { EntityData role = DAL.EntityDAO.SystemManageDAO.GetStandard_RoleByCode(roleCode); FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsAvailable, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRightControlPoint, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRoleControlPoint, "0")); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); entity.CurrentTable.Columns.Add("ShowCode"); qa.Dispose(); string allCode = ""; string aCode = ""; int iCount = entity.CurrentTable.Rows.Count; for (int i = 0; i < iCount; i++) { entity.SetCurrentRow(i); string code = entity.GetString("FunctionStructureCode"); int deep = entity.GetInt("Deep"); entity.CurrentRow["ShowCode"] = BuildShowCode(deep); int iA = entity.GetInt("IsAvailable"); if (allCode != "") { allCode += ","; } allCode += code; } role.SetCurrentTable("RoleOperation"); foreach (DataRow dr in role.CurrentTable.Select(String.Format(" OperationCode like '{0}%' ", mainCode))) { string code = (string)dr["OperationCode"]; if (aCode != "") { aCode += ","; } aCode += code; } this.rptFunction.DataSource = entity; this.rptFunction.DataBind(); entity.Dispose(); role.Dispose(); this.txtAllCode.Value = allCode; this.txtACode.Value = aCode; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }
private void LoadOperationList() { try { string ClassCode = this.txtClassCode.Value; EntityData entity = null; if (ClassCode == "0401") //费用项 { /* * FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); * sb.AddStrategy ( new Strategy( FunctionStructureStrategyName.IsAvailable, "0" ) ); * sb.AddOrder("FunctionStructureCode", true); * string sql = sb.BuildMainQueryString(); */ string sql = "select * from FunctionStructure where FunctionStructureCode like '040%' and Deep = 3 and IsAvailable = 0 and IsRightControlPoint = 0"; QueryAgent qa = new QueryAgent(); entity = qa.FillEntityData("FunctionStructure", sql); qa.Dispose(); // entity = DAL.EntityDAO.SystemManageDAO.GetFunctionStructureByParentCode(ClassCode.Substring(0, 2)); } else if (ClassCode == "0411") //预算表 { /* * FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); * sb.AddStrategy ( new Strategy( FunctionStructureStrategyName.IsAvailable, "0" ) ); * sb.AddOrder("FunctionStructureCode", true); * string sql = sb.BuildMainQueryString(); */ string sql = "select * from FunctionStructure where FunctionStructureCode like '041%' and Deep = 3 and IsAvailable = 0 and IsRightControlPoint = 0"; QueryAgent qa = new QueryAgent(); entity = qa.FillEntityData("FunctionStructure", sql); qa.Dispose(); // entity = DAL.EntityDAO.SystemManageDAO.GetFunctionStructureByParentCode(ClassCode.Substring(0, 2)); } else { FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ParentCode, ClassCode)); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsAvailable, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRightControlPoint, "0")); sb.AddOrder("FunctionStructureCode", true); string sql = sb.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); entity = qa.FillEntityData("FunctionStructure", sql); qa.Dispose(); // entity = DAL.EntityDAO.SystemManageDAO.GetFunctionStructureByParentCode(ClassCode); } //功能点代码、名称复制到操作代码、名称 entity.CurrentTable.Columns.Add("OperationCode", typeof(string)); entity.CurrentTable.Columns.Add("OperationName", typeof(string)); foreach (DataRow dr in entity.CurrentTable.Rows) { dr["OperationCode"] = dr["FunctionStructureCode"]; dr["OperationName"] = dr["FunctionStructureName"]; } entity.Dispose(); Session["entityOperation"] = entity; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "取操作列表出错:" + ex.Message)); } }