예제 #1
0
 /// <summary>
 /// Validate LookupType description exists or not
 /// </summary>
 /// <param name=""></param>
 /// <param name=""></param>
 /// <returns></returns>
 ///
 public ActionResult ValidateLookupType(long lookupTypeId = 0, string lookupTypeDesc = "")
 {
     try
     {
         CacheUtility.ClearCache(ConstantTexts.LookupTypeCacheKey);
         if (CacheUtility.GetAllLookuptypeOrById().Where(xx => xx.LookupTypeDescription.ToUpper() == lookupTypeDesc.ToUpper() && xx.CMN_LookupTypeId != lookupTypeId).Count() > 0)
         {
             return(Json(new { ID = 1, Message = "Lookup Description already exists." }));
         }
         return(Json(new { ID = 0, Message = "" }));
     }
     catch (Exception ex)
     {
         BLCommon.LogError(0, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Lookups, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
         return(Json(new { ID = 1, Message = "An error occured while validating" }));
     }
 }
        private List <DOCMN_LookupType> PGetAllLookupTypeList()
        {
            List <DOCMN_LookupType> lstDOCMN_LookupType = new List <DOCMN_LookupType>();

            try
            {
                var lstLookupType = CacheUtility.GetAllLookuptypeOrById().OrderBy(x => x.LookupTypeDescription);;
                foreach (var item in lstLookupType)
                {
                    lstDOCMN_LookupType.Add(new DOCMN_LookupType
                    {
                        CMN_LookupTypeId      = item.CMN_LookupTypeId,
                        LookupTypeDescription = item.LookupTypeDescription.ToString()
                    });
                }
                return(lstDOCMN_LookupType);
            }
            catch (Exception ex)
            {
                BLCommon.LogError(0, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.LookupsCorrelation, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                throw ex;
            }
        }