示例#1
0
        public AccountResponse SignIn(string username, string password, string userDeviceId)
        {
            bool            res   = default(bool);
            AccountResponse ibase = new AccountResponse();

            try
            {
                if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
                {
                    ibase.Status = ResponseStatus.Failed;
                    ibase.Error  = "Required parameters not set";
                }
                else
                {
                    AggieGlobalLogManager.Info("RegistrationController :: SignIn started ");
                    var connectionString = "AggieGlobal";
                    var repo             = new AccountManager(connectionString);
                    ibase.Status    = ResponseStatus.Successful;
                    ibase.AuthToken = repo.LoginCheck(username, password, userDeviceId);
                    if (string.IsNullOrEmpty(ibase.AuthToken))
                    {
                        ibase.Error = "Invalid credentials";
                    }
                    repo.Dispose();
                }
            }
            catch (Exception ex)
            {
                ibase.Status = ResponseStatus.Failed;
                ibase.Error  = "Login failed || " + ex.Message;
                AggieGlobalLogManager.Fatal("RegistrationController :: SignIn failed :: " + ex.Message);
            }
            return(ibase);
        }
示例#2
0
 public static object ProcessMillisecond(string source, string propertyName)
 {
     try
     {
         if (source != null && source.Length > 0)
         {
             Newtonsoft.Json.Linq.JArray itmarr = Newtonsoft.Json.Linq.JArray.Parse(source);
             foreach (var itm in itmarr)
             {
                 var val = itm[propertyName];
                 if (val != null && val.ToString().Length > 0)
                 {
                     string[] tSplit = val.ToString().Split('.');
                     if (tSplit.Length == 2)
                     {
                         tSplit[1]         = tSplit[1].Substring(6, tSplit[1].Length - 6);
                         itm[propertyName] = string.Join(".", tSplit);
                     }
                 }
             }
             return(itmarr.ToString());
         }
     }
     catch (Exception ex)
     {
         AggieGlobalLogManager.Fatal("Millisecond conversion failed. exception{0}", ex.Message);
     }
     return(source);
 }
示例#3
0
        /// <summary>
        /// delete all request cycle related cache keys from application cache
        /// </summary>
        public static void ClearAllRequestCycleCache()
        {
            try
            {
                List <string> keys = new List <string>();
                keys.Add("RequestCycleCaching_");

                foreach (var key in keys)
                {
                    if (HttpContext.Current == null)
                    {
                        break;
                    }
                    foreach (var item in HttpContext.Current.Cache)
                    {
                        var k = (string)((System.Collections.DictionaryEntry)(item)).Key;
                        if (k.StartsWith(key))
                        {
                            DeleteCache(k);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal(ex, "Utility:ClearAllRequestCycleCache(): Failed :: ");
            }
        }
示例#4
0
        public static string ValidDocumentName(string DocumentName, string extension)
        {
            try
            {
                string SupportedfileFormat = GetConfigKeyValue("SupportedfileFormat");
                string extensionInFileName = System.IO.Path.GetExtension(DocumentName).ToLower();

                if (extensionInFileName.Equals(string.Empty))
                {
                    return(DocumentName + extension);
                }
                if (!extensionInFileName.Equals(extension, StringComparison.OrdinalIgnoreCase))
                {
                    if (Array.IndexOf(SupportedfileFormat.Split(','), extensionInFileName) < 0)
                    {
                        return(DocumentName + extension);
                    }
                    return(Path.GetFileNameWithoutExtension(DocumentName) + extension);
                }
            }
            catch (Exception exp)
            {
                AggieGlobalLogManager.Fatal(exp, "ValidDocumentName");
            }
            return(DocumentName);
        }
示例#5
0
        public bool CreateUpdatePlot(PlotDetail requestData)
        {
            string LoginTokenKey             = string.Empty;
            int    AuthenticationSuccessmode = 0;

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    if (requestData.PlotId == 0)
                    {
                        AuthenticationSuccessmode = CreateRecord("CreatePlot", requestData.FarmId, requestData.PlotName, requestData.PlotSize, requestData.Organic, requestData.SoilPhId, requestData.SoilId, requestData.Notes, requestData.UserID, AuthenticationSuccessmode);
                        requestData.PlotId        = AuthenticationSuccessmode;
                    }
                    else
                    {
                        UpdateRecord("UpdatePlot", requestData.PlotName, requestData.PlotSize, requestData.Organic, requestData.SoilPhId, requestData.SoilId, requestData.Notes, requestData.FarmId, requestData.PlotId, AuthenticationSuccessmode);
                    }
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountRepository :: CreateUpdateFarm :: " + ex.Message);
            }
            return(requestData.PlotId == 1 ? true : false);
        }
        public AccountResponse UpdateSession()
        {
            int             ret   = default(int);
            AccountResponse ibase = new AccountResponse();

            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 AccountManager(connectionString);
                    ret = repo.UpdateSession(sessionObject._email, sessionObject._userId, sessionObject._deviceid);
                    if (ret == 0)
                    {
                        ibase.Status = ResponseStatus.Successful;
                        ibase.Error  = "Invalid credentials";
                    }
                }
            }
            catch (Exception ex)
            {
                ibase.Status = ResponseStatus.Failed;
                ibase.Error  = "Invalid credentials";
                AggieGlobalLogManager.Fatal("FarmDetailsController :: GetFarmsDetails failed :: " + ex.Message);
            }
            return(ibase);
        }
示例#7
0
        public int CreateUpdateFarm(FarmDetail requestData)
        {
            string LoginTokenKey             = string.Empty;
            int    AuthenticationSuccessmode = 0;

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    requestData.CoOpId   = (requestData.CoOpId == 0 ? 3 : requestData.CoOpId);
                    requestData.IsActive = true;
                    if (requestData.FarmId == default(int))
                    {
                        AuthenticationSuccessmode = CreateRecord("CreateFarmDetail", requestData.FarmName, requestData.CoOpId, requestData.FarmSize, requestData.FarmSizeUnit, requestData.FarmEstablishedDate, requestData.FarmAddress, requestData.IsActive);
                        requestData.FarmId        = AuthenticationSuccessmode;
                    }
                    else
                    {
                        AuthenticationSuccessmode = UpdateRecord("UpdateFarmDetail", requestData.FarmName, requestData.CoOpId, requestData.FarmSize, requestData.FarmSizeUnit, requestData.FarmEstablishedDate, requestData.FarmAddress, requestData.FarmId, requestData.IsActive);
                    }
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountRepository :: CreateUpdateFarm :: " + ex.Message);
            }
            return(AuthenticationSuccessmode);
        }
        public IEnumerable <SoilPhDetailResponse> GetSoilPhDetails()
        {
            bool res = default(bool);
            IEnumerable <SoilPhDetail>   SoilDetail         = null;
            IList <SoilPhDetailResponse> SoilDetailResponse = new List <SoilPhDetailResponse>();;
            int    OpMode                    = default(int);
            int    _farmId                   = default(int);
            string LoginTokenKey             = string.Empty;
            int    AuthenticationSuccessmode = 0;

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    SoilDetail = GetRecord("GetSoilPhListDetails");
                    foreach (SoilPhDetail det in SoilDetail)
                    {
                        SoilPhDetailResponse response = new SoilPhDetailResponse();
                        response.SoilPhId    = EncryptionHelper.AesEncryption(det.SoilPhId.ToString(), EncryptionKey.LOG);
                        response.SoilPhvalue = det.SoilPhvalue;
                        response.Status      = ResponseStatus.Successful;
                        SoilDetailResponse.Add(response);
                    }
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("PlotRepository :: SoilRepository failed :: " + ex.Message);
            }
            return(SoilDetailResponse);
        }
        public AccountResponse GetAcountByUserClientData(string Email, int userId, string DeviceId)
        {
            bool res = default(bool);
            IEnumerable <Account> userData = null;
            int             OpMode         = default(int);
            string          LoginTokenKey  = string.Empty;
            AccountResponse iresponse      = null;

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    userData = GetRecord("GetAcountByUserClientData", Email, userId);
                    if (userData != null && userData.Count() > default(int))
                    {
                        iresponse           = new AccountResponse();
                        iresponse.EmailId   = userData.FirstOrDefault().EmailId;
                        iresponse.FirstName = userData.FirstOrDefault().FirstName;
                        iresponse.LastName  = userData.FirstOrDefault().LastName;
                        iresponse.Address   = userData.FirstOrDefault().Address;
                        iresponse.IsAdmin   = userData.FirstOrDefault().IsAdmin;
                    }

                    return(iresponse);
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountRepository :: GetAcountByUserId failed :: " + ex.Message);
            }
            return(null);
        }
        public string SignIn(string username, string password, string userDeviceId)
        {
            bool res = default(bool);
            IEnumerable <Account> userData = null;
            int    OpMode                    = default(int);
            string LoginTokenKey             = string.Empty;
            int    AuthenticationSuccessmode = default(int);

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    userData = GetRecord("GetAccountDetails", username, password, userDeviceId, AuthenticationSuccessmode);
                }
                if (userData != null && userData.Count() > default(int) && userData.FirstOrDefault().UserId > default(int))
                {
                    LoginTokenKey = username + "-" + userData.FirstOrDefault().UserId + "-" + userDeviceId;
                    return(EncryptionHelper.AesEncryption(LoginTokenKey, EncryptionKey.LOG));
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountRepository :: LoginCheck failed :: " + ex.Message);
            }
            return(string.Empty);
        }
示例#11
0
        public IEnumerable <ProductDetail> GetProductListByUser(int userID, DateTime dateStamp)
        {
            IEnumerable <ProductDetail> proddetail = null;
            int AuthenticationSuccessmode          = 0;

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    if (dateStamp == null)
                    {
                        proddetail = GetRecord("GetProductListByUser", userID, AuthenticationSuccessmode);
                    }
                    else
                    {
                        proddetail = GetRecord("GetProductListByDate", userID, dateStamp, AuthenticationSuccessmode);
                    }
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("ProductRepository :: GetProductListByUser failed :: " + ex.Message);
            }
            return(proddetail);
        }
示例#12
0
        public IList <SoilDataResponse> GetSoilDetails()
        {
            IList <SoilDataResponse> dataresponse = new List <SoilDataResponse>();

            try
            {
                if (HttpContext.Current.Session[ApplicationConstant.UserSession] != null)
                {
                    SessionData sessionObject = (SessionData)HttpContext.Current.Session[ApplicationConstant.UserSession];

                    AggieGlobalLogManager.Info("PlotController :: GetSoilDetails started ");
                    var connectionString = "AggieGlobal";
                    var repo             = new PlotManager(connectionString);
                    dataresponse = repo.GetSoilDetails();
                    repo.Dispose();
                }
            }
            catch (Exception e)
            {
                SoilDataResponse det = new SoilDataResponse();
                det.Status = ResponseStatus.Failed;
                det.Error  = "Failed to retreive data";
                dataresponse.Add(det);
                AggieGlobalLogManager.Fatal("AccountRepository :: LoginCheck failed :: " + e.Message);
            }
            return(dataresponse);
        }
        public bool CreateAccount(Account userdata, out bool IsDuplicate)
        {
            bool result = default(bool);

            IsDuplicate = false;
            try
            {
                result = new RepositoryCreator().AccountRepository.CreateAccount(userdata, out IsDuplicate);

                if (result == true && userdata.UserId > default(int))
                {
                    var         connectionString = "AggieGlobal";
                    FarmManager fmanager         = new FarmManager(connectionString);
                    FarmDetail  fDetail          = new FarmDetail();
                    fDetail.FarmId              = default(int);
                    fDetail.FarmName            = "Farm_" + userdata.EmailId;
                    fDetail.FarmSize            = default(int);
                    fDetail.FarmSizeUnit        = string.Empty;
                    fDetail.FarmAddress         = string.Empty;
                    fDetail.FarmEstablishedDate = DateTime.Now;
                    userdata.FarmId             = fmanager.CreateUpdateFarm(fDetail);
                    if (userdata.FarmId > default(int))
                    {
                        fmanager.MapFarmByUserDetail(userdata.FarmId, userdata.UserId);
                    }
                    fmanager.Dispose();
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountManager :: CreateAccount failed :: " + ex.Message);
            }
            return(result);
        }
示例#14
0
        public IEnumerable <FarmDetail> GetFarmDetails(int userid)
        {
            bool res = default(bool);
            IEnumerable <FarmDetail> farmDetail = null;
            int    OpMode                    = default(int);
            string LoginTokenKey             = string.Empty;
            int    AuthenticationSuccessmode = 0;

            try
            {
                using (var connection = GetConnection())
                {
                    connection.Open();
                    farmDetail = GetRecord("GetFarmDetails", userid, AuthenticationSuccessmode);
                }
                if (farmDetail != null && farmDetail.Count() > default(int))
                {
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountRepository :: LoginCheck failed :: " + ex.Message);
            }
            return(farmDetail);
        }
        public AccountResponse GetUserDetails()
        {
            AccountResponse userData    = null;
            var             httpContent = Request.Content;

            try
            {
                string userId = string.Empty;

                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 AccountManager(connectionString);
                    userData        = repo.GetAcountByUserClientData(sessionObject._email, sessionObject._userId, sessionObject._deviceid);
                    userData.Status = ResponseStatus.Successful;
                    return(userData);
                }
                else
                {
                    userData        = new AccountResponse();
                    userData.Error  = "Invalid credentials";
                    userData.Status = ResponseStatus.Failed;
                }
            }
            catch (Exception ex)
            {
                userData        = new AccountResponse();
                userData.Error  = "failed to retreive user data";
                userData.Status = ResponseStatus.Failed;
                AggieGlobalLogManager.Fatal("FarmDetailsController :: GetFarmsDetails failed :: " + ex.Message);
            }
            return(userData);
        }
        public bool CreateAccount(Account userData, out bool IsDuplicate)
        {
            try
            {
                DbTransaction transaction = null;
                int           result      = default(int);
                IsDuplicate = false;
                using (var connection = GetConnection())
                {
                    try
                    {
                        connection.Open();
                        transaction      = connection.BeginTransaction();
                        userData.optMode = 2;
                        AggieGlobalLogManager.Info("RegistrationController :: Registration started  Account Repository");
                        CreateRecordWithinTransaction("CreateAccount", transaction, userData.FirstName, userData.LastName, userData.password, userData.Address, userData.EmailId, userData.FarmId, userData.UserDeviceId, userData.optMode, userData.AuthenticationSuccessmode);
                        result = 1;
                        transaction.Commit();
                        AggieGlobalLogManager.Info("RegistrationController :: Registration ended  Account Repository");

                        if (result == 1)
                        {
                            int userNewId = GetAcountUserIdByEmail(userData.EmailId, userData.UserDeviceId);
                            userData.UserId    = userNewId;
                            userData.AuthToken = EncryptionHelper.AesEncryption(userData.EmailId + "-" + userNewId + "-" + userData.UserDeviceId, EncryptionKey.LOG);
                            return((result == 1) ? true : false);
                        }
                    }
                    catch (Exception ex)
                    {
                        string error = string.Empty;
                        using (System.IO.StringReader reader = new System.IO.StringReader(ex.Message))
                        {
                            error = reader.ReadLine();
                        }
                        string[] errorObj = null;
                        if (!string.IsNullOrEmpty(error))
                        {
                            errorObj = error.Split(Environment.NewLine.ToCharArray());
                        }
                        if (errorObj[0] == "1"? IsDuplicate = true:false)
                        {
                            result = 0;
                        }
                        AggieGlobalLogManager.Fatal("RegistrationController :: Register failed :: " + ex.Message);
                        return(Convert.ToBoolean(userData.AuthenticationSuccessmode));
                    }
                    return(Convert.ToBoolean(result));
                }
            }
            catch (Exception e)
            {
                AggieGlobalLogManager.Fatal("AccountRepository :: CreateAccount failed :: " + e.Message);
            }
            IsDuplicate = false;
            return(Convert.ToBoolean(userData.AuthenticationSuccessmode));
        }
示例#17
0
        public IEnumerable <PlotDetailResponse> GetPlotDetailsById(string plotid)
        {
            plotid = plotid.Replace("+", "%20");
            plotid = System.Net.WebUtility.UrlDecode(plotid);
            plotid = plotid.Replace(" ", "+");

            bool res = default(bool);
            IList <PlotDetailResponse> responsedata  = new List <PlotDetailResponse>();
            IEnumerable <PlotDetail>   internalPlots = null;

            try
            {
                if (HttpContext.Current.Session[ApplicationConstant.UserSession] != null)
                {
                    SessionData sessionObject = (SessionData)HttpContext.Current.Session[ApplicationConstant.UserSession];
                    AggieGlobalLogManager.Info("PlotController :: CreateUpdatePlot started ");
                    var connectionString = "AggieGlobal";
                    var repo             = new PlotManager(connectionString);
                    internalPlots = repo.GetPlotDetailsById(plotid);
                    if (internalPlots != null && internalPlots.Count() > default(int))
                    {
                        foreach (PlotDetail det in internalPlots)
                        {
                            PlotDetailResponse resdata = new PlotDetailResponse();
                            resdata.PlotId   = EncryptionHelper.AesEncryption(Convert.ToString(det.PlotId), EncryptionKey.LOG);
                            resdata.FarmId   = EncryptionHelper.AesEncryption(Convert.ToString(det.FarmId), EncryptionKey.LOG);
                            resdata.PlotName = det.PlotName;
                            resdata.PlotSize = det.PlotSize;
                            resdata.Organic  = det.Organic;
                            resdata.SoilId   = Convert.ToString(EncryptionHelper.AesEncryption(det.SoilId.ToString(), EncryptionKey.LOG));
                            resdata.SoilPhId = Convert.ToString(EncryptionHelper.AesEncryption(det.SoilPhId.ToString(), EncryptionKey.LOG));
                            resdata.Notes    = det.Notes;
                            resdata.Status   = ResponseStatus.Successful;
                            responsedata.Add(resdata);
                        }
                    }
                    else
                    {
                        PlotDetailResponse resdata = new PlotDetailResponse();
                        resdata.Status = ResponseStatus.Failed;
                        resdata.Error  = "Unable to retireve plot detail";
                        responsedata.Add(resdata);
                    }
                    repo.Dispose();
                }
            }
            catch (Exception ex)
            {
                PlotDetailResponse resdata = new PlotDetailResponse();
                resdata.Status = ResponseStatus.Failed;
                resdata.Error  = "Unable to retireve plot details";
                responsedata.Add(resdata);
                AggieGlobalLogManager.Fatal("PlotController :: CreateUpdatePlot failed :: " + ex.Message);
            }

            return(responsedata);
        }
示例#18
0
        public IList <SoilDataResponse> GetSoilDetails()
        {
            IList <SoilDataResponse> dataresponse = new List <SoilDataResponse>();

            try
            {
            } catch (Exception e) { AggieGlobalLogManager.Fatal("AccountRepository :: LoginCheck failed :: " + e.Message); }

            return(dataresponse);
        }
        public FarmDetailResponse MapFarmByUserDetail(string FarmId)
        {
            bool res = default(bool);
            FarmDetailResponse resposne      = null;
            SessionData        sessionObject = null;
            int farmId = default(int);
            int userId = default(int);

            try
            {
                if (HttpContext.Current.Session[ApplicationConstant.UserSession] != null)
                {
                    sessionObject = (SessionData)HttpContext.Current.Session[ApplicationConstant.UserSession];
                    resposne      = new FarmDetailResponse();
                    if (string.IsNullOrEmpty(FarmId))
                    {
                        resposne.Error  = "Failed to process";
                        resposne.Status = ResponseStatus.Failed;
                        return(resposne);
                    }
                    else
                    {
                        farmId = Convert.ToInt32(EncryptionHelper.AesDecryption(FarmId, EncryptionKey.LOG));
                        userId = sessionObject._userId;
                    }


                    AggieGlobalLogManager.Info("FarmDetailsController :: MapFarmByUserDetail started ");
                    var connectionString = "AggieGlobal";

                    var repo = new FarmManager(connectionString);

                    res = repo.MapFarmByUserDetail(farmId, userId);
                    if (res == true)
                    {
                        resposne.Status = ResponseStatus.Successful;
                    }
                    else
                    {
                        resposne.Error  = "Failed to process data";
                        resposne.Status = ResponseStatus.Failed;
                    }
                    AggieGlobalLogManager.Info("FarmDetailsController :: MapFarmByUserDetail ended ");
                    repo.Dispose();
                }
            }
            catch (Exception ex)
            {
                resposne.Error  = "Failed to process";
                resposne.Status = ResponseStatus.Failed;
                AggieGlobalLogManager.Fatal("FarmManager :: MapFarmByUserDetail failed :: " + ex.Message);
            }
            return(resposne);
        }
示例#20
0
 public int CreateUpdateFarmAndPlot(FarmDetail requestData)
 {
     try
     {
         return(new RepositoryCreator().FarmRepository.CreateUpdateFarm(requestData));
     }
     catch (Exception ex)
     {
         AggieGlobalLogManager.Fatal("FarmManager :: CreateUpdateFarmAndPlot failed :: " + ex.Message);
     }
     return(requestData.FarmId);
 }
示例#21
0
 public int CreateSubCategory(ProductDetail detail)
 {
     try
     {
         return(new RepositoryCreator().ProductRepository.CreateSubCategory(detail));
     }
     catch (Exception ex)
     {
         AggieGlobalLogManager.Fatal("ProductManager :: CreateSubCategory failed :: " + ex.Message);
     }
     return(default(int));
 }
示例#22
0
        public IList <ActivityDetailCountResponse> GetActivityCountByDate(string dateStamp)
        {
            IList <ActivityDetailCountResponse> requestData = new List <ActivityDetailCountResponse>();
            ActivityDetailCountResponse         response    = new ActivityDetailCountResponse();

            if (string.IsNullOrEmpty(dateStamp))
            {
                response.Error  = "Failed to get activity list data imvalid parameter";
                response.Status = ResponseStatus.Failed;
                requestData.Add(response);
                return(requestData);
            }
            try
            {
                if (HttpContext.Current.Session[ApplicationConstant.UserSession] != null)
                {
                    SessionData sessionObject = (SessionData)HttpContext.Current.Session[ApplicationConstant.UserSession];

                    ActivityDetail resdata           = new ActivityDetail();
                    var            connectionString  = "AggieGlobal";
                    var            repo              = new ActivityManager(connectionString);
                    IEnumerable <ActivityDetail> res = repo.GetActivityCountByDate(sessionObject._userId, dateStamp);
                    if (res != null && res.Count() > default(int))
                    {
                        foreach (ActivityDetail det in res)
                        {
                            response = new ActivityDetailCountResponse();
                            response.ActivityDate  = det.ActivityDate;
                            response.ActivityCount = det.ActivityCount;
                            response.Status        = ResponseStatus.Successful;
                            requestData.Add(response);
                        }
                    }
                    else
                    {
                        response.Error  = "Failed to get activity lis";
                        response.Status = ResponseStatus.Failed;
                        requestData.Add(response);
                        return(requestData);
                    }
                    repo.Dispose();
                }
            }
            catch (Exception ex)
            {
                response.Error  = "Failed to get activity list data";
                response.Status = ResponseStatus.Failed;
                requestData.Add(response);
                AggieGlobalLogManager.Fatal("ActivityController :: GetActivityCountByDate failed :: " + ex.Message);
            }

            return(requestData);
        }
示例#23
0
 public IEnumerable <ProductResources> GetProductResourcesList()
 {
     try
     {
         return(new RepositoryCreator().ProductRessourcesRepository.GetProductResourcesList());
     }
     catch (Exception ex)
     {
         AggieGlobalLogManager.Fatal("ProductResourcesManager :: GetProductResourcesList failed :: " + ex.Message);
     }
     return(null);
 }
示例#24
0
 public IEnumerable <ActivityDescriptions> GetAllActivityDescriptions()
 {
     try
     {
         return(new RepositoryCreator().ActivityDescriptionRepository.GetAllActivityDescriptions());
     }
     catch (Exception ex)
     {
         AggieGlobalLogManager.Fatal("ProductResourcesManager :: GetAllActivityDescriptions failed :: " + ex.Message);
     }
     return(null);
 }
示例#25
0
        private CommandParser()
        {
            string filePath = Path.Combine(Utility.CurrentDirectory, ConfigurationManager.AppSettings["DataAccessConfigPath"]);

            if (!File.Exists(filePath))
            {
                string s = string.Format("FATAL ERROR: Configuration file for template:{0} is not present from 'CommandParser'! Application can't be run correctly!, Check the App-key \"DataAccessConfigPath\" to fix configuration issues!", filePath);
                AggieGlobalLogManager.Fatal(s);
                //AggieGlobalLogManager.Trace(, Severity.Error);
                return;
            }
            xdoc = XDocument.Load(filePath);
        }
        public bool UpdateActivity(ActivityDetail prodData)
        {
            bool result = default(bool);
            int  AuthenticationSuccessmode = 0;

            using (var connection = GetConnection())
            {
                try
                {
                    connection.Open();

                    if (prodData.ProductTypeId == ProductType.Crop.GetHashCode())
                    {
                        prodData.ActivityId = UpdateRecord("UpdateActivityCrop", prodData.UserId, prodData.ProductId, prodData.CategoryId, prodData.LastHarvestedDate, prodData.IsHarvestedBefore,
                                                           prodData.IsSoldBefore, prodData.IsSoldBeforeNoReason, prodData.SoldPrice, prodData.ActivityDate, prodData.PlantationDate, prodData.PlotId,
                                                           prodData.ActivityDescriptionId, prodData.ActivityId, AuthenticationSuccessmode);
                    }
                    else if (prodData.ProductTypeId == ProductType.LiveStock.GetHashCode())
                    {
                        prodData.ActivityId = UpdateRecord("UpdateActivityLiveStock", prodData.UserId, prodData.ProductId, prodData.CategoryId,
                                                           prodData.NumberOfLivestock, prodData.LiveStockUsageId, prodData.LiveStockUtilityId,
                                                           prodData.IsLivestockSalable, prodData.LastDateOfLivestockSold, prodData.LivestocksellingLocationId, prodData.ActivityDate,
                                                           prodData.PlotId, prodData.ActivityDescriptionId, prodData.LivestocksellingLocationName, prodData.LiveStockName,
                                                           prodData.LiveStockUsageName, prodData.LiveStockUtilityName, prodData.SoldLiveStockAmount, prodData.ActivityId, AuthenticationSuccessmode);
                    }
                    else if (prodData.ProductTypeId == ProductType.Resource.GetHashCode())
                    {
                        prodData.ActivityId = UpdateRecord("UpdateActivityResources", prodData.UserId, prodData.ProductId, prodData.CategoryId, prodData.NumberOfResource, prodData.ResourceCostTypeId,
                                                           prodData.ResourceTypeId, prodData.ResourceTypeName, prodData.ResourceMaintenancePrice, prodData.ResourcePrice, prodData.ActivityDate, prodData.PlotId, prodData.ActivityDescriptionId,
                                                           prodData.ResourceMaintenanceCostTypeId, prodData.ActivityId, AuthenticationSuccessmode);
                    }
                }
                catch (Exception ex)
                {
                    string error = string.Empty;
                    using (System.IO.StringReader reader = new System.IO.StringReader(ex.Message))
                    {
                        error = reader.ReadLine();
                    }
                    string[] errorObj = null;
                    if (!string.IsNullOrEmpty(error))
                    {
                        errorObj = error.Split(Environment.NewLine.ToCharArray());
                    }
                    AggieGlobalLogManager.Fatal("ActivityRepository :: UpdateActivity :: failed :: " + ex.Message);
                    result = false;
                    return(result);
                }
            }
            return(result);
        }
示例#27
0
        public bool MapFarmByUserDetail(int FarmId, int UserId)
        {
            bool res = default(bool);

            try
            {
                return(new RepositoryCreator().FarmRepository.MapFarmByUserDetail(FarmId, UserId));
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("FarmManager :: GetFarmDetails failed :: " + ex.Message);
            }
            return(res);
        }
        public string LoginCheck(string username, string password, string userDeviceId)
        {
            bool res = default(bool);

            try
            {
                return(new RepositoryCreator().AccountRepository.SignIn(username, password, userDeviceId));
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountManager :: LoginCheck failed :: " + ex.Message);
            }
            return(string.Empty);
        }
示例#29
0
        public int DefaultStateID()
        {
            var strDefaultStateID = default(int);

            try
            {
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal(ex, "ConfigController.GetAppLocation: -{0}", ex.Message);
                throw;
            }
            return(strDefaultStateID);
        }
示例#30
0
        public string GetAppLocation()
        {
            string strAppLocation = string.Empty;

            try
            {
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal(ex, "ConfigController.GetAppLocation: -{0}", ex.Message);
                throw;
            }
            return(strAppLocation);
        }