public JsonResult GetControllers(string street)
        {
            var controllers = new CustomerCareProvider().GetControllers(street);
            var jsonResult  = new JsonResult();

            jsonResult.Data = controllers;
            jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(jsonResult);
        }
        public JsonResult GetBuildings(string street)
        {
            var buildings  = new CustomerCareProvider().GetBuildings(street);
            var jsonResult = new JsonResult();

            jsonResult.Data = buildings;
            jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(jsonResult);
        }
        public ActionResult BulkPaymentsAjax(BulkPaymentsAjaxModel model)
        {
            try
            {
                var date = Misc.ToDateTime(model.Date);
                if (date == null)
                {
                    date = DateTime.Today;
                }

                var useController = model.UseController > 0;

                var result =
                    new CustomerCareProvider()
                    .RegisterBulkPayments
                    (
                        Auth.User.UserId,
                        model.SubagentId,
                        model.UserId,
                        date.Value,
                        useController,
                        model.Payments.Select(
                            p =>
                            new BulkPaymentDa()
                {
                    ContractId = p.ContractId,
                    ReceiptNo  = p.ReceiptNo ?? "",
                    Amount     = Misc.ToDouble(p.Amount)
                }).ToArray());

                var redirectUrl = useController ? Url.Action("Index", "Index") : Url.Action("Transactions", "Accountant",
                                                                                            new
                {
                    dateStart  = date.Value.ToShortDateString(),
                    dateEnd    = date.Value.ToShortDateString(),
                    userId     = model.UserId,
                    subagentId = model.SubagentId
                });

                return(result.Success
                    ? Json(
                           new
                {
                    Success = true,
                    Message = "",
                    RedirectUrl = redirectUrl
                })
                    : Json(result));
            }
            catch (Exception ex)
            {
                return(Json(false, ex.Message));
            }
        }