private void ConfigureProviders() { ContractsProvider provider = new ContractsProvider(); foreach (string file in Directory.GetFiles(ContractsCatalogPath, "*.dll")) { Assembly contract = Assembly.LoadFrom(file); provider.AddContract(contract); } _providers.Add(typeof(ContractsProvider), provider); }
public ActionResult AddTariffOptionAjax(AddTariffOptionAjaxModel model) { try { var res = new ContractsProvider().AddTariffOption(Auth.User.UserId, model.ContractId, model.SemanticId, Misc.ToDouble(model.Value), model.ChangeRemarks ?? "", model.Sewage); return(Json(res)); } catch (Exception ex) { return(Json(new { Success = false, ex.Message, })); } }
public ActionResult AddMeterAjax(AddMeterAjaxModel model) { try { var res = new ContractsProvider().AddMeter(Auth.User.UserId, model.ContractId, model.SerialNumber ?? "", Misc.ToDouble(model.Value), model.ChangeRemarks ?? ""); return(Json(res)); } catch (Exception ex) { return(Json(new { Success = false, ex.Message })); } }
public ActionResult ContractSetMetersValues(int contractId, int[] meterid, string[] metervalue) { List <SetMetersValuesDa> values = new List <SetMetersValuesDa>(); for (int i = 0; i < meterid.Length; i++) { values.Add(new SetMetersValuesDa() { MeterId = meterid[i], Value = Misc.ToDouble(metervalue[i]) }); } var res = new ContractsProvider().SetMetersValues(Auth.User.UserId, DateTime.Now, values.ToArray(), MeterReadingType.Regular.SemanticId); return(RedirectToAction("Contract", new { contractId })); }
public ActionResult SetMetersValues(SetMetersValuesModel model) { try { var meters = model.Meters.Select(m => new SetMetersValuesDa() { MeterId = m.MeterId, Value = Misc.ToDouble(m.Value), }).ToArray(); var dateAsOf = DateTime.Parse(model.Date); var res = new ContractsProvider().SetMetersValues(Auth.User.UserId, dateAsOf, meters, model.MeterValueType); return(Json(res)); } catch (Exception ex) { return(Json(new { Success = false, Message = ex.Message, })); } }
public ActionResult Search(SearchContractModel model) { var results = new ContractsProvider().Search(model.Key ?? "", model.Street ?? "", model.Building ?? "", model.Appartment ?? "", model.AreaName ?? "", model.ContractName ?? "", model.ControllerName ?? "", model.Bill ?? ""); if (results.Contracts.Length == 1 && results.Subscribers.Length == 0) { return(RedirectToAction("Show", "Contracts", new { contractId = results.Contracts[0].ContractId, })); } else if (results.Contracts.Length == 0 && results.Subscribers.Length == 1) { return(RedirectToAction("Show", "Subscribers", new { subscriberId = results.Subscribers[0].SubscriberId, })); } return(View(results)); }