예제 #1
0
 public static ModuleFieldInfo GetModuleFieldByModule(ModuleInfo modInfo, string fieldID)
 {
     try
     {
         return((from field in AllCaches.ModuleFieldsInfo
                 where (field.ModuleID == modInfo.ModuleID || field.ModuleID == modInfo.ModuleType) && field.FieldID == fieldID
                 select field).Single());
     }
     catch (Exception ex)
     {
         throw ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_MODULE_FIELD_NOT_FOUND_OR_DUPLICATE, ex.Message,
                                                    "GetModuleFieldByID", modInfo.ModuleID, fieldID);
     }
 }
예제 #2
0
        public static ModuleFieldInfo GetModuleFieldByName(string moduleID, string fieldGroup, string fieldName)
        {
            var fieldInfos = (from field in AllCaches.ModuleFieldsInfo
                              where field.ModuleID == moduleID && field.FieldGroup == fieldGroup && field.FieldName == fieldName
                              select field).ToArray();

            if (fieldInfos.Length == 0)
            {
                throw ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_FIELD_NOT_FOUND, fieldName);
            }
            if (fieldInfos.Length > 1)
            {
                throw ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_FIELD_DUPLICATED, fieldName);
            }

            return(fieldInfos[0]);
        }
예제 #3
0
        public static ModuleInfo GetModuleInfo(string moduleID, string subModule)
        {
            var module = (from item in AllCaches.ModulesInfo
                          where item.ModuleID == moduleID && (string.IsNullOrEmpty(subModule) || subModule == item.SubModule)
                          select item).ToList();

            if (module.Count == 0)
            {
                throw ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_MODULE_NOT_FOUND, moduleID + "." + subModule);
            }

            if (module.Count > 1)
            {
                throw ErrorUtils.CreateError(ERR_SYSTEM.ERR_SYSTEM_MODULE_HAVE_TO_CALL_SUB, moduleID + "." + subModule);
            }

            return(NewCopyModule(module[0]));
        }
예제 #4
0
        public static ModuleInfo GetModuleInfo(string moduleID)
        {
            var module = (from item in AllCaches.ModulesInfo
                          where
                          item.ModuleID == moduleID &&
                          ((item.SubModule == CODES.DEFMOD.SUBMOD.MAINTAIN_ADD) ||
                           (item.SubModule == CODES.DEFMOD.SUBMOD.MODULE_MAIN))
                          select item).ToList();

            if (module.Count == 0)
            {
                throw ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_MODULE_NOT_FOUND, moduleID);
            }

            if (module.Count > 1)
            {
                throw ErrorUtils.CreateError(ERR_SYSTEM.ERR_SYSTEM_MODULE_HAVE_TO_CALL_SUB, moduleID);
            }

            return(NewCopyModule(module[0]));
        }