Пример #1
0
 public Status AddState(State state)
 {
     try
     {
         var retVal = _repository.Add(state);
         _uoWork.SaveChanges();
         _status.ReturnedId   = retVal.StateId;
         _status.IsSuccessful = retVal.StateId > 0;
         return(_status);
     }
     catch (DbEntityValidationException ex)
     {
         ErrorManager.LogApplicationError((ex).StackTrace, (ex).Source, (ex).Message);
         _status.Message.FriendlyMessage  = "Unable to add state";
         _status.Message.TechnicalMessage = "Error: " + (ex).Message;
         _status.Message.MessageCode      = "101";
         _status.Message.MessageId        = 1;
         return(_status);
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         _status.Message.FriendlyMessage  = "Unable to add state";
         _status.Message.TechnicalMessage = "Error: " + ex.Message;
         _status.Message.MessageCode      = "101";
         _status.Message.MessageId        = 1;
         return(_status);
     }
 }
Пример #2
0
 public Status AddCorporateInfo(CompanyInfo corporateInfo)
 {
     try
     {
         var companyInfo = _repository.Add(corporateInfo);
         _uoWork.SaveChanges();
         _status.ReturnedId   = companyInfo.CompanyInfoId;
         _status.IsSuccessful = companyInfo.CompanyInfoId > 0;
         return(_status);
     }
     catch (DbEntityValidationException ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         _status.Message.FriendlyMessage  = "Unable to add company information";
         _status.Message.TechnicalMessage = "Error: " + ex.Message;
         _status.Message.MessageCode      = "101";
         _status.Message.MessageId        = 1;
         return(_status);
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         _status.Message.FriendlyMessage  = "Unable to add company information";
         _status.Message.TechnicalMessage = "Error: " + ex.Message;
         _status.Message.MessageCode      = "101";
         _status.Message.MessageId        = 1;
         return(_status);
     }
 }
 public Status UpdateAppConfigSettingInfo(AppConfigSetting appConfigSetting)
 {
     try
     {
         var appConfig = _repository.Update(appConfigSetting);
         _uoWork.SaveChanges();
         _status.ReturnedId   = appConfig.AppConfigSettingId;
         _status.IsSuccessful = appConfig.AppConfigSettingId > 0;
         return(_status);
     }
     catch (DbEntityValidationException ex)
     {
         ErrorManager.LogApplicationError((ex).StackTrace, (ex).Source, (ex).Message);
         _status.Message.FriendlyMessage  = "Process Failed! Unable update settings ";
         _status.Message.TechnicalMessage = "Error: " + (ex).Message;
         _status.Message.MessageCode      = "101";
         _status.Message.MessageId        = 1;
         return(_status);
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         _status.Message.FriendlyMessage  = "Process Failed! Unable update settings ";
         _status.Message.TechnicalMessage = "Error: " + ex.Message;
         _status.Message.MessageCode      = "101";
         _status.Message.MessageId        = 1;
         return(_status);
     }
 }
Пример #4
0
 public int AddUserLoginTrail(UserLoginTrail userLoginTrail)
 {
     try
     {
         var retVal = _repository.Add(userLoginTrail);
         _uoWork.SaveChanges();
         return(retVal.UserLoginTrailId);
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }
Пример #5
0
        public bool UpdateStationInfo(StationInfo corporateInfo, out string msg)
        {
            try
            {
                #region Model Validation

                // Validation

                List <ValidationResult> valResults;
                if (!EntityValidatorHelper.Validate(corporateInfo, out valResults))
                {
                    var errorDetail = new StringBuilder();
                    if (!valResults.IsNullOrEmpty())
                    {
                        errorDetail.AppendLine("Following error occurred:");
                        valResults.ForEachx(m => errorDetail.AppendLine(m.ErrorMessage));
                    }
                    else
                    {
                        errorDetail.AppendLine("Validation error occurred! Please check all supplied parameters and try again");
                        msg = errorDetail.ToString();
                        return(false);
                    }
                }

                #endregion

                var stationInfo = _repository.Update(corporateInfo);
                _uoWork.SaveChanges();
                msg = "";
                return(stationInfo.StationInfoId > 0);
            }
            catch (Exception ex)
            {
                msg = "Processing Error Occurred! Please try again later";
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                return(false);
            }
        }