Пример #1
0
 private void InitGroupInfo()
 {
     try
     {
         this.m_entityGroup = SystemManageDAO.GetSystemGroupByCode(this.m_GroupCode);
         this.m_tbGroupArea = CreateGroupAreaTable(this.m_GroupCode, this.m_ProjectCode, this.m_CostBudgetBackupCode);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #2
0
        public static string GetSystemGroupNameByDeep(string GroupCode, int Deep)
        {
            string text3;

            try
            {
                string     text = "";
                EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(GroupCode);
                if (systemGroupByCode.HasRecord())
                {
                    int    @int = systemGroupByCode.GetInt("Deep");
                    string code = systemGroupByCode.GetString("ParentCode");
                    if (@int == Deep)
                    {
                        text = systemGroupByCode.GetString("GroupName");
                    }
                    else
                    {
                        while ((@int > Deep) && (code != ""))
                        {
                            EntityData data2 = SystemManageDAO.GetSystemGroupByCode(code);
                            if (data2.HasRecord())
                            {
                                @int = data2.GetInt("Deep");
                                code = data2.GetString("ParentCode");
                                if (@int == Deep)
                                {
                                    text = data2.GetString("GroupName");
                                    break;
                                }
                            }
                            data2.Dispose();
                        }
                    }
                }
                systemGroupByCode.Dispose();
                text3 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
Пример #3
0
        public static string GetSystemGroupSortIDByGroupCode(string code)
        {
            string text2;

            try
            {
                string     text = "";
                EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(code);
                if (systemGroupByCode.HasRecord())
                {
                    text = systemGroupByCode.GetString("SortID");
                }
                systemGroupByCode.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Пример #4
0
        public static string CheckDeleteSystemGroup(string GroupCode)
        {
            string text13;

            try
            {
                string     text = "";
                EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(GroupCode);
                if (systemGroupByCode.HasRecord())
                {
                    string classCode           = systemGroupByCode.GetString("ClassCode");
                    string parentFullID        = systemGroupByCode.GetString("FullID");
                    string itemInfoByClassCode = SystemClassDescription.GetItemInfoByClassCode(classCode);
                    if (itemInfoByClassCode != "")
                    {
                        EntityData systemGroupIncludeAllChildByParentFullID = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(parentFullID);
                        string     text5 = "";
                        foreach (DataRow row in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                        {
                            string text6 = row["GroupCode"].ToString();
                            if (text5 != "")
                            {
                                text5 = text5 + ",";
                            }
                            text5 = text5 + "'" + text6 + "'";
                        }
                        string[] textArray = itemInfoByClassCode.Split(",".ToCharArray());
                        foreach (string text7 in textArray)
                        {
                            if (text7 != "")
                            {
                                string[]   textArray2  = text7.Split("|".ToCharArray());
                                string     text8       = textArray2[0];
                                string     text9       = textArray2[1];
                                string     queryString = string.Format("select top 1 {1} from {0} where {1} in ({2})", text8, text9, text5);
                                QueryAgent agent       = new QueryAgent();
                                try
                                {
                                    try
                                    {
                                        string code = ConvertRule.ToString(agent.ExecuteScalar(queryString));
                                        if (code != "")
                                        {
                                            EntityData data3  = SystemManageDAO.GetSystemGroupByCode(code);
                                            string     text12 = data3.GetString("SortID") + " " + data3.GetString("GroupName");
                                            data3.Dispose();
                                            return(string.Format("表 {0} 中已存在类别为 {1} 的记录,不能删除该类别", text8, text12));
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }
                                finally
                                {
                                    agent.Dispose();
                                }
                            }
                        }
                    }
                }
                systemGroupByCode.Dispose();
                text13 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text13);
        }
Пример #5
0
 public static void MoveSystemGroup(string srcGroupCode, string dstGroupCode, string dstClassCode)
 {
     try
     {
         if (srcGroupCode == "")
         {
             throw new Exception("未传入源结点号");
         }
         if (dstClassCode == "")
         {
             throw new Exception("未传入大类代码");
         }
         EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(srcGroupCode);
         if (!systemGroupByCode.HasRecord())
         {
             throw new Exception("源结点不存在");
         }
         DataRow currentRow = systemGroupByCode.CurrentRow;
         string  text       = ConvertRule.ToString(currentRow["FullID"]);
         string  text2      = ConvertRule.ToString(currentRow["ClassCode"]);
         string  text3      = ConvertRule.ToString(currentRow["ParentCode"]);
         if (text2 != dstClassCode)
         {
             throw new Exception("只能在同一大类下移动");
         }
         DataRow row2 = null;
         if (dstGroupCode.Length > 0)
         {
             EntityData data2 = SystemManageDAO.GetSystemGroupByCode(dstGroupCode);
             if (data2.HasRecord())
             {
                 row2 = data2.CurrentRow;
             }
             data2.Dispose();
         }
         if (srcGroupCode == dstGroupCode)
         {
             throw new Exception("无法移动:源结点和目标结点相同");
         }
         if (text3 == dstGroupCode)
         {
             throw new Exception("无法移动:目标文件夹和源文件夹相同");
         }
         if ((row2 != null) && (ConvertRule.ToString(row2["FullID"]).IndexOf(text) == 0))
         {
             throw new Exception("无法移动:目标文件夹是源文件夹的子文件");
         }
         EntityData entity       = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(text);
         DataTable  currentTable = entity.CurrentTable;
         DataView   view         = new DataView(currentTable, "", "deep", DataViewRowState.CurrentRows);
         foreach (DataRow row3 in currentTable.Rows)
         {
             string  text5    = ConvertRule.ToString(row3["GroupCode"]);
             int     num      = ConvertRule.ToInt(row3["Deep"]);
             string  text6    = ConvertRule.ToString(row3["ParentCode"]);
             DataRow drParent = null;
             if (text5 == srcGroupCode)
             {
                 drParent = row2;
             }
             else
             {
                 DataRow[] rowArray = currentTable.Select("GroupCode='" + text6 + "'");
                 if (rowArray.Length > 0)
                 {
                     drParent = rowArray[0];
                 }
                 else
                 {
                     drParent = currentTable.Select("GroupCode='" + srcGroupCode + "'")[0];
                 }
             }
             SetSystemGroupParent(row3, drParent);
         }
         SystemManageDAO.SubmitAllSystemGroup(entity);
         entity.Dispose();
         systemGroupByCode.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #6
0
        public static void DeleteSystemGroup(string GroupCode)
        {
            Exception exception;

            try
            {
                if (GroupCode != "")
                {
                    string message = CheckDeleteSystemGroup(GroupCode);
                    if (message != "")
                    {
                        throw new Exception(message);
                    }
                    EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(GroupCode);
                    if (systemGroupByCode.HasRecord())
                    {
                        string    keyvalues;
                        string    parentFullID = systemGroupByCode.GetString("FullID");
                        DataTable table        = new DataTable();
                        table.Columns.Add("AccessRangeCode");
                        EntityData systemGroupIncludeAllChildByParentFullID = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(parentFullID);
                        foreach (DataRow row in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                        {
                            EntityData accessRangeByGroupCode = ResourceDAO.GetAccessRangeByGroupCode(row["GroupCode"].ToString());
                            foreach (DataRow row2 in accessRangeByGroupCode.CurrentTable.Rows)
                            {
                                keyvalues = row2["AccessRangeCode"].ToString();
                                DataRow row3 = table.NewRow();
                                row3["AccessRangeCode"] = keyvalues;
                                table.Rows.Add(row3);
                            }
                            accessRangeByGroupCode.Dispose();
                        }
                        using (StandardEntityDAO ydao = new StandardEntityDAO("SystemGroup"))
                        {
                            ydao.BeginTrans();
                            try
                            {
                                foreach (DataRow row3 in table.Rows)
                                {
                                    keyvalues       = row3["AccessRangeCode"].ToString();
                                    ydao.EntityName = "AccessRange";
                                    EntityData entitydata = new EntityData("AccessRange");
                                    entitydata = ydao.SelectbyPrimaryKey(keyvalues);
                                    ydao.DeleteAllRow(entitydata);
                                    ydao.DeleteEntity(entitydata);
                                    entitydata.Dispose();
                                }
                                foreach (DataRow row3 in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                                {
                                    string text3 = row3["GroupCode"].ToString();
                                    ydao.EntityName = "SystemGroup";
                                    EntityData data5 = new EntityData("SystemGroup");
                                    data5 = ydao.SelectbyPrimaryKey(text3);
                                    ydao.DeleteAllRow(data5);
                                    ydao.DeleteEntity(data5);
                                    data5.Dispose();
                                }
                                ydao.CommitTrans();
                            }
                            catch (Exception exception1)
                            {
                                exception = exception1;
                                try
                                {
                                    ydao.RollBackTrans();
                                }
                                catch
                                {
                                }
                                throw exception;
                            }
                        }
                        systemGroupIncludeAllChildByParentFullID.Dispose();
                    }
                    systemGroupByCode.Dispose();
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }
Пример #7
0
 public static void CopySystemGroup(string srcGroupCode, string dstGroupCode, string dstClassCode)
 {
     try
     {
         if (srcGroupCode == "")
         {
             throw new Exception("未传入源结点号");
         }
         if (dstClassCode == "")
         {
             throw new Exception("未传入大类代码");
         }
         EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(srcGroupCode);
         if (!systemGroupByCode.HasRecord())
         {
             throw new Exception("源结点不存在");
         }
         DataRow drSrc        = systemGroupByCode.CurrentRow;
         string  parentFullID = ConvertRule.ToString(drSrc["FullID"]);
         DataRow drDst        = null;
         if (dstGroupCode.Length > 0)
         {
             EntityData data2 = SystemManageDAO.GetSystemGroupByCode(dstGroupCode);
             if (data2.HasRecord())
             {
                 drDst = data2.CurrentRow;
             }
             data2.Dispose();
         }
         EntityData entity = new EntityData("SystemGroup");
         DataTable  tb     = entity.CurrentTable;
         DataRow    row3   = CopySystemGroupNewRow(tb, drSrc, drDst, dstClassCode);
         EntityData systemGroupAllChildByParentFullID = SystemManageDAO.GetSystemGroupAllChildByParentFullID(parentFullID);
         systemGroupAllChildByParentFullID.CurrentTable.Columns.Add("DstGroupCode");
         DataView view = new DataView(systemGroupAllChildByParentFullID.CurrentTable, "", "deep", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             DataRow   row      = view2.Row;
             string    text2    = row["ParentCode"].ToString();
             DataRow[] rowArray = systemGroupAllChildByParentFullID.CurrentTable.Select("GroupCode='" + text2 + "'");
             DataRow   row5     = null;
             if (rowArray.Length > 0)
             {
                 string text3 = ConvertRule.ToString(rowArray[0]["DstGroupCode"]);
                 row5 = tb.Select("GroupCode='" + text3 + "'")[0];
             }
             else
             {
                 row5 = row3;
             }
             DataRow row6 = CopySystemGroupNewRow(tb, row, row5, dstClassCode);
             row["DstGroupCode"] = row6["GroupCode"];
         }
         systemGroupAllChildByParentFullID.Dispose();
         SystemManageDAO.SubmitAllSystemGroup(entity);
         entity.Dispose();
         systemGroupByCode.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }