public IList <FarmDetailResponse> GetAllFarmsDetails()
        {
            bool ret = default(bool);
            IEnumerable <FarmDetail>   farmData     = null;
            IList <FarmDetailResponse> responsedata = new List <FarmDetailResponse>();

            try
            {
                AggieGlobalLogManager.Info("FarmDetailsController :: GetFarmsDetails started ");
                var connectionString = "AggieGlobal";
                var repo             = new FarmManager(connectionString);
                farmData = repo.GetFarmDetails(default(int));
                if (farmData != null && farmData.Count() > default(int))
                {
                    foreach (FarmDetail det in farmData)
                    {
                        FarmDetailResponse resdata = new FarmDetailResponse();
                        resdata.FarmId              = EncryptionHelper.AesEncryption(Convert.ToString(det.FarmId), EncryptionKey.LOG);
                        resdata.FarmName            = det.FarmName;
                        resdata.CoOpName            = det.CoOpName;
                        resdata.FarmAddress         = det.FarmAddress;
                        resdata.FarmEstablishedDate = det.FarmEstablishedDate;
                        resdata.FarmSize            = det.FarmSize;
                        resdata.FarmSizeUnit        = det.FarmSizeUnit;
                        resdata.Status              = ResponseStatus.Successful;
                        responsedata.Add(resdata);
                    }
                }
                else
                {
                    FarmDetailResponse resdata = new FarmDetailResponse();
                    resdata.Error  = "Failed to retreive data";
                    resdata.Status = ResponseStatus.Failed;
                    responsedata.Add(resdata);
                }
                repo.Dispose();
            }
            catch (Exception ex)
            {
                FarmDetailResponse resdata = new FarmDetailResponse();
                resdata.Error  = "Failed to retreive data";
                resdata.Status = ResponseStatus.Failed;
                responsedata.Add(resdata);

                AggieGlobalLogManager.Fatal("FarmDetailsController :: GetFarmsDetails failed :: " + ex.Message);
            }
            return(responsedata);
        }
        public FarmDetailResponse GetFarmsDetails()
        {
            bool ret = default(bool);
            IEnumerable <FarmDetail> farmData     = null;
            FarmDetailResponse       responsedata = new FarmDetailResponse();

            try
            {
                if (HttpContext.Current.Session[ApplicationConstant.UserSession] != null)
                {
                    SessionData sessionObject = (SessionData)HttpContext.Current.Session[ApplicationConstant.UserSession];
                    AggieGlobalLogManager.Info("FarmDetailsController :: GetFarmsDetails started ");
                    var connectionString = "AggieGlobal";
                    var repo             = new FarmManager(connectionString);
                    farmData = repo.GetFarmDetails(sessionObject._userId);
                    if (farmData != null && farmData.Count() > default(int))
                    {
                        responsedata.FarmId              = EncryptionHelper.AesEncryption(Convert.ToString(farmData.FirstOrDefault().FarmId), EncryptionKey.LOG);
                        responsedata.FarmName            = farmData.FirstOrDefault().FarmName;
                        responsedata.CoOpName            = farmData.FirstOrDefault().CoOpName;
                        responsedata.FarmAddress         = farmData.FirstOrDefault().FarmAddress;
                        responsedata.FarmEstablishedDate = farmData.FirstOrDefault().FarmEstablishedDate;
                        responsedata.FarmSize            = farmData.FirstOrDefault().FarmSize;
                        responsedata.FarmSizeUnit        = farmData.FirstOrDefault().FarmSizeUnit;
                        responsedata.Status              = ResponseStatus.Successful;
                    }
                    else
                    {
                        responsedata.Error  = "Failed to retreive data";
                        responsedata.Status = ResponseStatus.Failed;
                    }
                    repo.Dispose();
                }
            }
            catch (Exception ex)
            {
                responsedata.Status = ResponseStatus.Failed;
                AggieGlobalLogManager.Fatal("FarmDetailsController :: GetFarmsDetails failed :: " + ex.Message);
            }
            return(responsedata);
        }