예제 #1
0
        public ActionResult ValidateLookupMaster(long lookupTypeId, long lookupMasterID = 0, string lookupMasterValue = "", int priority = 0)
        {
            try
            {
                CacheUtility.ClearCache(ConstantTexts.LookupMasterCacheKey);
                List <DOCMN_LookupMaster> lstDOCMN_LookupMaster = new List <DOCMN_LookupMaster>();
                lstDOCMN_LookupMaster = CacheUtility.GetAllLookupsFromCache(lookupTypeId);


                if (lstDOCMN_LookupMaster.Where(xx => xx.LookupValue.ToUpper() == lookupMasterValue.ToUpper() && xx.CMN_LookupMasterId != lookupMasterID).Count() > 0)
                {
                    return(Json(new { ID = 1, Message = "Lookup value already exists." }));
                }

                else if (lstDOCMN_LookupMaster.Where(xx => xx.DisplayOrder == priority && xx.CMN_LookupMasterId != lookupMasterID).Count() > 0)
                {
                    return(Json(new { ID = 1, Message = "Priority value 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" }));
            }
        }
예제 #2
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" }));
     }
 }
예제 #3
0
        private DOCMN_LookupMaster PGetLookupMaster(long?lookupMasterID, long lookupTypeID)
        {
            DOCMN_LookupMaster objDOCMN_LookupMaster = new DOCMN_LookupMaster();

            try
            {
                if (lookupMasterID > 0)
                {
                    CacheUtility.ClearCache(ConstantTexts.LookupMasterCacheKey);
                    objDOCMN_LookupMaster = CacheUtility.GetLookupById(lookupMasterID);
                }
                objDOCMN_LookupMaster.CMN_LookupTypeRef = lookupTypeID;
                return(objDOCMN_LookupMaster);
            }
            catch (Exception ex)
            {
                BLCommon.LogError(0, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.LookupsCorrelation, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                throw ex;
            }
        }