public ActionResult Tarifas(Guid?lodgingId, Guid?roomId, string fechaDesde, string fechaHasta) { //Guid l = new Guid("d4867abb-f568-4abe-a11b-85932390c520"); //Guid r = new Guid("291d436d-9c50-46e0-98bd-2095595c41b0"); Guid l = lodgingId.HasValue ? (Guid)lodgingId : Guid.Empty; Guid r = roomId.HasValue ? (Guid)roomId : Guid.Empty; //DateTime fd = new DateTime(2017,1,1); //DateTime fh = new DateTime(2017, 12, 31); IFormatProvider culture = new CultureInfo("en-US", true); DateTime fd = DateTime.ParseExact(fechaDesde.Replace("{", "").Replace("}", ""), "dd/MM/yyyy", culture); DateTime fh = DateTime.ParseExact(fechaHasta.Replace("{", "").Replace("}", ""), "dd/MM/yyyy", culture);//esta línea no tiene sentido fd = new DateTime(fd.Year, 1, 1); fh = new DateTime(fd.Year, 12, 31); RateListModel m = new RateListModel() { //Rates = DbAccess.GetRates(lodgingId.GetValueOrDefault(), roomId.GetValueOrDefault(), fdesde, fhasta), Rates = DbAccess.GetRates(l, r, fd, fh), //Lodging = DbAccess.GetLodging(lodgingId.GetValueOrDefault()) }; m.TablaCupos = Utils.GenerarTablaHTML(m.Rates, fd, "Tarifas"); return(View(m)); }
public void InsertRateList(RateListModel rateList) { if (rateList.HdlRegistration != null) { if (rateList.HdlRegistration.RegistrationTypeId == 3) { //Add the specialized charges rate list foreach (var item in rateList.SpecializedLabRateLists.ToList()) { item.TestTitle = null; item.Hdl = null; _specializedLabRateListRepository.Insert(item); } } else { if (rateList.HdlRegistration.RegistrationCategoryId == 1) { //Add the monthly rate list foreach (var item in rateList.MonthlyRateLists.ToList()) { item.TestTitle = null; item.Hdl = null; _monthlyRateListRepository.Insert(item); } } else if (rateList.HdlRegistration.RegistrationCategoryId == 2) { //Add the referring rate list foreach (var item in rateList.ReferredRateLists.ToList()) { item.TestTitle = null; item.Hdl = null; _referringRateListRepository.Insert(item); } } else { throw new Exception("The registration category is invalid. It can be either Monthly or referring"); } } } else { throw new InvalidDataException("The Doctor/Hospital/Laboratory does not exist. Please select one in order to add its rate list"); } }
public ActionResult UpdateRateList(RateListModel rateListModel) { if (rateListModel != null) { try { dhlRegistrationService.UpdateRateList(rateListModel); } catch (Exception e) { Program.Logger.Error(e); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while updating the rate list")))); } return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS))); } else { return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper rate details")))); } }
public RateListResponseModel GetRateLists() { var hdlRegistrations = _dhlRegistrationRepository.GetAll().ToList(); var rateLists = new List <RateListModel>(); var specializedRateList = _specializedLabRateListRepository.GetAll().ToList(); var groups = _testGroupsRepository.GetAll().ToList(); var testTitls = _testTitlesRepository.GetAll().ToList(); var monthlyRateList = _monthlyRateListRepository.GetAll().ToList(); var referredRateList = _referringRateListRepository.GetAll().ToList(); foreach (var hdl in hdlRegistrations) { var rateListModel = new RateListModel(); rateListModel.HdlRegistration = hdl; if (hdl.RegistrationTypeId == 3) { rateListModel.SpecializedLabRateLists.AddRange(specializedRateList.FindAll(x => x.HdlId == hdl.Id)); } else { if (hdl.RegistrationCategoryId == 1) { rateListModel.MonthlyRateLists.AddRange(monthlyRateList.FindAll(x => x.HdlId == hdl.Id)); } else if (hdl.RegistrationCategoryId == 2) { rateListModel.ReferredRateLists.AddRange(referredRateList.FindAll(x => x.HdlId == hdl.Id)); } else { throw new Exception("The registration category is invalid. It can be either Monthly or referring"); } } rateLists.Add(rateListModel); } return(new RateListResponseModel { RateListModels = rateLists, HdlRegistrations = hdlRegistrations, TestTitles = testTitls }); }
public ActionResult Cierres(Guid?lodgingId, Guid?roomId, string fechaDesde, string fechaHasta) { Guid l = lodgingId.HasValue ? (Guid)lodgingId : Guid.Empty; Guid r = roomId.HasValue ? (Guid)roomId : Guid.Empty; IFormatProvider culture = new CultureInfo("en-US", true); DateTime fd = DateTime.ParseExact(fechaDesde.Replace("{", "").Replace("}", ""), "dd/MM/yyyy", culture); DateTime fh = DateTime.ParseExact(fechaHasta.Replace("{", "").Replace("}", ""), "dd/MM/yyyy", culture);//esta línea no tiene sentido fd = new DateTime(fd.Year, 1, 1); fh = new DateTime(fd.Year, 12, 31); RateListModel m = new RateListModel() { Rates = DbAccess.GetRates(l, r, fd, fh), }; m.TablaCupos = Utils.GenerarTablaHTML(m.Rates, fd, "Cupos"); return(View(m)); }
public void UpdateRateList(RateListModel rateList) { if (rateList.HdlRegistration != null) { if (rateList.HdlRegistration.RegistrationTypeId == 3) { //Add the specialized charges rate list foreach (var item in rateList.SpecializedLabRateLists.ToList()) { var objFromDb = _specializedLabRateListRepository.Get(item.Id); if (objFromDb != null) { _util.CopyProperties(item, objFromDb); _specializedLabRateListRepository.Update(objFromDb); } else { Program.Logger.Warn("This specialized rate list item does not exist"); } } } else { if (rateList.HdlRegistration.RegistrationCategoryId == 1) { //Add the monthly rate list foreach (var item in rateList.MonthlyRateLists.ToList()) { var objFromDb = _monthlyRateListRepository.Get(item.Id); if (objFromDb != null) { _util.CopyProperties(item, objFromDb); _monthlyRateListRepository.Update(objFromDb); } else { Program.Logger.Warn("This monthly rate list item does not exist"); } } } else if (rateList.HdlRegistration.RegistrationCategoryId == 2) { //Add the referring rate list foreach (var item in rateList.ReferredRateLists.ToList()) { var objFromDb = _referringRateListRepository.Get(item.Id); if (objFromDb != null) { _util.CopyProperties(item, objFromDb); _referringRateListRepository.Update(objFromDb); } else { Program.Logger.Warn("This referring rate list item does not exist"); } } } else { throw new Exception("The registration category is invalid. It can be either Monthly or referring"); } } } else { throw new InvalidDataException("The Doctor/Hospital/Laboratory does not exist. Please select one in order to add its rate list"); } }
public async Task <RateListModel> AddNewRateList(RateListModel rateListModel) { var url = URLBuilder.GetURL(Controllers.MAINTENANCE, EndPoint.MAINTENANCE_RATE_LIST_INSERT); return(await requestProvider.PostAsync(url, rateListModel)); }
public async Task <RateListModel> UpdateRatelist(RateListModel rateListModel) { var url = URLBuilder.GetURL(Controllers.MAINTENANCE, EndPoint.MAINTENANCE_RATE_LIST_UPDATE); return(await requestProvider.PutAsync(url, rateListModel)); }