public IList <ProductResourcesResponse> GetProductResourcesList() { IList <ProductResourcesResponse> result = new List <ProductResourcesResponse>(); try { IEnumerable <ProductResources> listData = null; var connectionString = "AggieGlobal"; var repo = new ProductResourcesManager(connectionString); listData = repo.GetProductResourcesList(); if (listData != null && listData.Count() > default(int)) { foreach (ProductResources resData in listData) { ProductResourcesResponse resVal = new ProductResourcesResponse(); resVal.ProductResourceId = Convert.ToString(EncryptionHelper.AesEncryption(resData.ProductResourceId.ToString(), EncryptionKey.LOG)); resVal.ProductResourceName = resData.ProductResourceName; resVal.ProductRessourceType = resData.ProductRessourceType; resVal.Status = ResponseStatus.Successful; result.Add(resVal); } } else { ProductResourcesResponse resVal = new ProductResourcesResponse(); resVal.Status = ResponseStatus.Failed; resVal.Error = "No Data found"; result.Add(resVal); } repo.Dispose(); } catch (Exception ex) { ProductResourcesResponse resVal = new ProductResourcesResponse(); resVal.Status = ResponseStatus.Failed; resVal.Error = "Error while retrieving data"; result.Add(resVal); AggieGlobalLogManager.Fatal("ProductResourcesController :: GetProductResourcesList failed :: " + ex.Message); } return(result); }
public IList <ActivityDescriptions> GetAllActivityDescriptions() { IList <ActivityDescriptions> result = new List <ActivityDescriptions>(); try { IEnumerable <ActivityDescriptions> listData = null; var connectionString = "AggieGlobal"; var repo = new ProductResourcesManager(connectionString); listData = repo.GetAllActivityDescriptions(); if (listData == null && listData.Count() == default(int)) { ActivityDescriptions resVal = new ActivityDescriptions(); resVal.Status = ResponseStatus.Failed; resVal.Error = "No Data found"; result.Add(resVal); } else if (listData != null && listData.Count() > default(int)) { foreach (ActivityDescriptions resData in listData) { ActivityDescriptions resVal = new ActivityDescriptions(); resVal.ActivityDescription = resData.ActivityDescription; resVal.ActivityDescriptionId = resData.ActivityDescriptionId; resVal.ProductType = resData.ProductType; resVal.Status = ResponseStatus.Successful; result.Add(resVal); } } repo.Dispose(); } catch (Exception ex) { ActivityDescriptions resVal = new ActivityDescriptions(); resVal.Status = ResponseStatus.Failed; resVal.Error = "Error while retrieving data"; result.Add(resVal); AggieGlobalLogManager.Fatal("ProductResourcesController :: GetAllActivityDescriptions failed :: " + ex.Message); } return(result); }