public async Task <ActionResult> Save(VehicleScheduleViewModel model) { ResponseViewModel result = new ResponseViewModel(); var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name); try { result = await _vehicleScheduleService.CreateOrUpdateVehicleSchedule(model, user.Id); if (result.IsOk) { TempData["SaveResult"] = result.Message; return(RedirectToAction("ViewMySchedules", new { model.DriverId })); //return RedirectToAction("Index"); } else { TempData["SaveResult"] = result.Message; } } catch (Exception ex) { TempData["SaveResult"] = result.Message; _logger.Information($"Save VehicleScheduleViewModel error : { JsonConvert.SerializeObject(ex)}"); throw ex; } CommonDropDownList(user.CompanyId, model.DriverId); return(View("Create", model)); }
public ActionResult EditVehicle(VehicleScheduleViewModel model) { VehicleScheduleHoldViewModel modelHold = new VehicleScheduleHoldViewModel(); modelHold.VehicleScheduleHoldEdit(model); return(Json(new { success = true })); }
public ActionResult VehicleAdd(int id) { VehicleScheduleViewModel model = new VehicleScheduleViewModel(); model.MemberCoverageID = id; return(PartialView("_VehicleAdd", model)); }
/// <summary> /// 編輯頁面 /// </summary> /// <returns></returns> public ActionResult Edit(int Id) { VehicleScheduleIdModel findModel = new VehicleScheduleIdModel(); findModel.Id = Id; VehicleScheduleViewModel data = _vehicleScheduleService.GetVehicleSchedule(findModel); //限制只能為公司 var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name); CommonDropDownList(user.CompanyId, data.DriverId); TempData["ClickFrom"] = "viewMySchedules"; return(View("Create", data)); }
/// <summary> /// 新增頁面 /// </summary> /// <returns></returns> public ActionResult Create(string ClickFrom, string DriverId) { VehicleScheduleViewModel model = new VehicleScheduleViewModel(); model.DriverId = DriverId; //限制只能為公司 var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name); TempData["ClickFrom"] = ClickFrom; if (ClickFrom == "index") { CommonDropDownList(user.CompanyId, null); } else if (ClickFrom == "viewMySchedules") { CommonDropDownList(user.CompanyId, DriverId); } return(View(model)); }
public ActionResult VehicleEdit(int id) { VehicleScheduleViewModel model = new VehicleScheduleViewModel(); return(PartialView("~/Views/MemberCov/_VehicleEdit.cshtml", model.GetAVehicle(id))); }
// GET: Renewal public ActionResult Index(int id = 0) { int renewalId = 0; HttpContext.Server.ScriptTimeout = 60; if (id == 0) { id = BHIP.Model.Helper.Security.GetMemberID(); } RenewalViewModel model = new RenewalViewModel(id); PropertyViewModel propertyModel = new PropertyViewModel(); VehicleScheduleViewModel vehicleModel = new VehicleScheduleViewModel(); DriverInfoViewModel driverModel = new DriverInfoViewModel(); DocumentViewModel docModel = new DocumentViewModel(); if (model.CheckRenewalExists(id)) { model.GetRenewalRecord(id, model.GetMemberCoverageID(id)); if (model.IsLocked(model.RenewalID, BHIP.Model.Helper.Security.GetLoggedInUserID())) { Response.Redirect("/Renewal/Locked"); } else { model.LockRenewal(model.RenewalID, BHIP.Model.Helper.Security.GetLoggedInUserID()); } model.MemberCoverageID = model.GetMemberCoverageID(id); model.TotalBuilding = propertyModel.TotalBuildingValue(model.GetMemberCoverageID(id)); model.TotalContent = propertyModel.TotalContentValue(model.GetMemberCoverageID(id)); model.TotalFootage = propertyModel.TotalSquareFeet(model.GetMemberCoverageID(id)); model.InspectionBodyGrid = model.GetInpsectionBody(model.RenewalID); model.HandleFundsGrid = model.GetHandleFunds(model.RenewalID); model.Attachments = docModel.GetDocuments(model.RenewalID); if (model.TotalFootage > 0) { model.CostSquareFoot = (model.TotalBuilding + model.TotalContent) / model.TotalFootage; } else { model.CostSquareFoot = 0; } model.TotalInsurable = model.TotalBuilding + model.TotalContent; } else { if (id > 0) { renewalId = model.CreateRenewalRecord(id); model.MemberCoverageID = model.GetMemberCoverageID(id); model.GetRenewalRecord(id, model.GetMemberCoverageID(id)); model.InitializeQuestions(renewalId, id); model.InspectionBodyGrid = model.GetInpsectionBody(0); model.HandleFundsGrid = model.GetHandleFunds(0); model.TotalAutos = vehicleModel.TotalAutos(model.GetMemberCoverageID(id)); model.TotalDrivers = driverModel.TotalDrivers(model.GetMemberCoverageID(id)); model.TotalBuilding = propertyModel.TotalBuildingValue(model.GetMemberCoverageID(id)); model.TotalContent = propertyModel.TotalContentValue(model.GetMemberCoverageID(id)); model.TotalFootage = propertyModel.TotalSquareFeet(model.GetMemberCoverageID(id)); if (model.TotalFootage > 0) { model.CostSquareFoot = (model.TotalBuilding + model.TotalContent) / model.TotalFootage; } else { model.CostSquareFoot = 0; } model.TotalInsurable = model.TotalBuilding + model.TotalContent; model.Attachments = new DocumentViewModel[0]; } else { model.MemberID = id; model.ContactList = new ContactScheduleViewModel[0]; model.ContactHoldList = new ContactScheduleHoldViewModel[0]; model.LicenseList = new LicenseViewModel[0]; model.AgencyPlanList = new AgencyPlanViewModel[0]; model.HandleFundsGrid = model.GetHandleFunds(0); model.InspectionBodyGrid = model.GetInpsectionBody(0); model.PsychiatryList = new PsychiatryViewModel[0]; model.PsychiatryHoldList = new PsychiatryScheduleHoldViewModel[0]; model.PrimaryCareList = new PrimaryCareViewModel[0]; model.PrimaryCareHoldList = new PrimaryCareHoldViewModel[0]; model.VehicleList = new VehicleScheduleViewModel[0]; model.VehicleHoldList = new VehicleScheduleHoldViewModel[0]; model.DriverInfoList = new DriverInfoViewModel[0]; model.DriverInfoHoldList = new DriverInfoHoldViewModel[0]; model.PropertyList = new PropertyViewModel[0]; model.PropertyHoldList = new PropertyScheduleHoldViewModel[0]; model.Attachments = new DocumentViewModel[0]; } } if (model.Submitted == true && User.IsInRole("Administrator") != true) { model.IsRenewLocked = true; } model.UserRoles = model.GetUserRoles(); return(View(model)); }