Esempio n. 1
0
        public List <API.LABURNUM.COM.Salutation> GetSalutationByAdvanceSearch(DTO.LABURNUM.COM.SalutationModel model)
        {
            IQueryable <API.LABURNUM.COM.Salutation> iQuery = null;

            if (model.SalutationId > 0)
            {
                iQuery = this._laburnum.Salutations.Where(x => x.SalutationId == model.SalutationId && x.IsActive == true);
            }
            if (iQuery != null)
            {
                if (model.Name != null)
                {
                    iQuery = iQuery.Where(x => x.Name.Trim().ToLower().Equals(model.Name.Trim().ToLower()) && x.IsActive == true);
                }
            }
            else
            {
                if (model.Name != null)
                {
                    iQuery = this._laburnum.Salutations.Where(x => x.Name.Trim().ToLower().Equals(model.Name.Trim().ToLower()) && x.IsActive == true);
                }
            }

            List <API.LABURNUM.COM.Salutation> dbSalutations = iQuery.ToList();

            return(dbSalutations);
        }
Esempio n. 2
0
 public void UpdateStatus(DTO.LABURNUM.COM.SalutationModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         new FrontEndApi.SalutationApi().UpdateIsActive(model);
     }
 }
Esempio n. 3
0
 public List <DTO.LABURNUM.COM.SalutationModel> SearchAllSalutations(DTO.LABURNUM.COM.SalutationModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new SalutationHelper(new FrontEndApi.SalutationApi().GetAllSalutations()).Map());
     }
     else
     {
         return(null);
     }
 }
Esempio n. 4
0
 public long Add(DTO.LABURNUM.COM.SalutationModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new FrontEndApi.SalutationApi().Add(model));
     }
     else
     {
         return(-1);
     }
 }
Esempio n. 5
0
 private long AddSalutation(DTO.LABURNUM.COM.SalutationModel model)
 {
     API.LABURNUM.COM.Salutation apiSalutation = new Salutation()
     {
         Name      = model.Name,
         CreatedOn = System.DateTime.Now,
         IsActive  = true
     };
     this._laburnum.Salutations.Add(apiSalutation);
     this._laburnum.SaveChanges();
     return(apiSalutation.SalutationId);
 }
Esempio n. 6
0
 private DTO.LABURNUM.COM.SalutationModel MapCore(API.LABURNUM.COM.Salutation salutation)
 {
     DTO.LABURNUM.COM.SalutationModel dtoClass = new DTO.LABURNUM.COM.SalutationModel()
     {
         SalutationId = salutation.SalutationId,
         Name         = salutation.Name,
         CreatedOn    = salutation.CreatedOn,
         IsActive     = salutation.IsActive,
         LastUpdated  = salutation.LastUpdated
     };
     return(dtoClass);
 }
Esempio n. 7
0
 private long AddSalutation(DTO.LABURNUM.COM.SalutationModel model)
 {
     API.LABURNUM.COM.Salutation apiSalutation = new Salutation()
     {
         Name      = model.Name,
         CreatedOn = new Component.Utility().GetISTDateTime(),
         IsActive  = true
     };
     this._laburnum.Salutations.Add(apiSalutation);
     this._laburnum.SaveChanges();
     return(apiSalutation.SalutationId);
 }
Esempio n. 8
0
 public dynamic SearchActiveSalutations(DTO.LABURNUM.COM.SalutationModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         List <DTO.LABURNUM.COM.SalutationModel> dbSalutations = new SalutationHelper(new FrontEndApi.SalutationApi().GetActiveSalutations()).Map();
         return(GetApiResponseModel("Successfully Performed.", true, dbSalutations));
     }
     else
     {
         return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
     }
 }
Esempio n. 9
0
        public void UpdateIsActive(DTO.LABURNUM.COM.SalutationModel model)
        {
            model.SalutationId.TryValidate();
            IQueryable <API.LABURNUM.COM.Salutation> iQuery        = this._laburnum.Salutations.Where(x => x.SalutationId == model.SalutationId && x.IsActive == true);
            List <API.LABURNUM.COM.Salutation>       dbSalutations = iQuery.ToList();

            if (dbSalutations.Count == 0)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND);
            }
            if (dbSalutations.Count > 1)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND);
            }
            dbSalutations[0].IsActive    = model.IsActive;
            dbSalutations[0].LastUpdated = System.DateTime.Now;
            this._laburnum.SaveChanges();
        }
Esempio n. 10
0
 public void UpdateSalutationStatus(DTO.LABURNUM.COM.SalutationModel model)
 {
     try
     {
         model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel();
         HttpClient          client   = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json");
         HttpResponseMessage response = client.PostAsJsonAsync("Salutation/UpdateStatus", model).Result;
         if (response.IsSuccessStatusCode)
         {
         }
         else
         {
         }
     }
     catch (Exception)
     {
         throw new Exception("Error While Updating Salutation Status");
     }
 }
Esempio n. 11
0
 public List <DTO.LABURNUM.COM.SalutationModel> GetAllSalutations()
 {
     try
     {
         DTO.LABURNUM.COM.SalutationModel model = new DTO.LABURNUM.COM.SalutationModel();
         model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel();
         HttpClient          client   = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json");
         HttpResponseMessage response = client.PostAsJsonAsync("Salutation/SearchAllSalutations", model).Result;
         if (response.IsSuccessStatusCode)
         {
             var data = response.Content.ReadAsStringAsync().Result;
             return(JsonConvert.DeserializeObject <List <DTO.LABURNUM.COM.SalutationModel> >(data));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception)
     {
         throw new Exception("Error While Getting Salutation List");
     }
 }
Esempio n. 12
0
 public dynamic SearchSalutationById(DTO.LABURNUM.COM.SalutationModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         if (model.SalutationId <= 0)
         {
             return(GetApiResponseModel("Salutation Id Cannnot be null.", true, null));
         }
         List <DTO.LABURNUM.COM.SalutationModel> dbClasses = new SalutationHelper(new FrontEndApi.SalutationApi().GetSalutationByAdvanceSearch(model)).Map();
         if (dbClasses.Count == 0)
         {
             return(GetApiResponseModel("No Record Found For Given Salutation Id", true, null));
         }
         if (dbClasses.Count > 1)
         {
             return(GetApiResponseModel("More Than One Record Found Please Contact Administrator", true, null));
         }
         return(GetApiResponseModel("Successfully Performed.", true, dbClasses[0]));
     }
     else
     {
         return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
     }
 }
Esempio n. 13
0
 public long Add(DTO.LABURNUM.COM.SalutationModel model)
 {
     return(AddValidation(model));
 }
Esempio n. 14
0
 private long AddValidation(DTO.LABURNUM.COM.SalutationModel model)
 {
     model.Name.TryValidate();
     return(AddSalutation(model));
 }