Esempio n. 1
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);
        }