public ActionResult CommitContractMember(ContractMemberViewModel viewModel) { var item = viewModel.CommitUserProfile(this, out String alertMessage); if (item == null) { if (!ModelState.IsValid) { return(View("~/Views/Shared/ReportInputError.ascx")); } else { return(View("~/Views/ConsoleHome/Shared/JsAlert.cshtml", model: alertMessage)); } } return(Json(new { result = true, UID = item.UID, RealName = item.RealName, OwnerID = viewModel.OwnerID == -1 ? item.UID : viewModel.OwnerID.HasValue ? viewModel.OwnerID : (int?)null })); }
public ActionResult EditLearner(ContractMemberViewModel viewModel) { ViewBag.ViewModel = viewModel; UserProfile item; item = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.UID).FirstOrDefault(); viewModel.CurrentTrial = 1; if (item != null) { viewModel.Gender = item.UserProfileExtension.Gender; viewModel.EmergencyContactPhone = item.UserProfileExtension.EmergencyContactPhone; viewModel.EmergencyContactPerson = item.UserProfileExtension.EmergencyContactPerson; viewModel.Relationship = item.UserProfileExtension.Relationship; viewModel.AdministrativeArea = item.UserProfileExtension.AdministrativeArea; viewModel.IDNo = item.UserProfileExtension.IDNo; viewModel.Phone = item.Phone; viewModel.Birthday = item.Birthday; viewModel.AthleticLevel = item.UserProfileExtension.AthleticLevel; viewModel.CurrentTrial = item.UserProfileExtension.CurrentTrial; viewModel.RealName = item.RealName; viewModel.Nickname = item.Nickname; viewModel.Address = item.Address; viewModel.Nickname = item.Nickname; viewModel.UID = item.UID; viewModel.Email = item.PID; } return(View("~/Views/Learner/Module/EditLearner.ascx", item)); }
public ActionResult EditContractMember(ContractMemberViewModel viewModel) { ViewResult result = (ViewResult)LoadContractMember(viewModel); UserProfile item = result.Model as UserProfile; if (item == null) { return(result); } viewModel.Gender = item.UserProfileExtension.Gender; viewModel.EmergencyContactPhone = item.UserProfileExtension.EmergencyContactPhone; viewModel.EmergencyContactPerson = item.UserProfileExtension.EmergencyContactPerson; viewModel.Relationship = item.UserProfileExtension.Relationship; viewModel.AdministrativeArea = item.UserProfileExtension.AdministrativeArea; viewModel.IDNo = item.UserProfileExtension.IDNo; viewModel.Phone = item.Phone; viewModel.Birthday = item.Birthday; viewModel.AthleticLevel = item.UserProfileExtension.AthleticLevel; viewModel.RealName = item.RealName; viewModel.Address = item.Address; viewModel.Nickname = item.Nickname; if (viewModel.UseVersion == "2022") { return(View("~/Views/ContractConsole/ContractModal/EditContractMember2022.cshtml", item)); } else { return(View("~/Views/ContractConsole/ContractModal/EditContractMember2022.cshtml", item)); } }
public ActionResult CommitContractMember(ContractMemberViewModel viewModel) { var item = viewModel.CommitUserProfile(this, out String alertMessage); if (item == null) { if (!ModelState.IsValid) { return(View(ConsoleHomeController.InputErrorView)); } else { return(View("~/Views/ConsoleHome/Shared/AlertMessage.cshtml", model: alertMessage)); } } if (viewModel.ProfileOnly == true) { return(View("~/Views/ContractConsole/Editing/UserProfileCommitted.cshtml", item)); } else { return(View("~/Views/ContractConsole/Editing/ContractMemberCommitted.cshtml", item)); } }
public ActionResult EditContractMember(ContractMemberViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.UID = viewModel.DecryptKeyValue(); } UserProfile item = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.UID).FirstOrDefault(); if (item == null) { return(View("~/Views/ConsoleHome/Shared/AlertMessage.cshtml", model: "Opps!您確定您輸入的資料正確嗎!?")); } viewModel.Gender = item.UserProfileExtension.Gender; viewModel.EmergencyContactPhone = item.UserProfileExtension.EmergencyContactPhone; viewModel.EmergencyContactPerson = item.UserProfileExtension.EmergencyContactPerson; viewModel.Relationship = item.UserProfileExtension.Relationship; viewModel.AdministrativeArea = item.UserProfileExtension.AdministrativeArea; viewModel.IDNo = item.UserProfileExtension.IDNo; viewModel.Phone = item.Phone; viewModel.Birthday = item.Birthday; viewModel.AthleticLevel = item.UserProfileExtension.AthleticLevel; viewModel.RealName = item.RealName; viewModel.Address = item.Address; viewModel.Nickname = item.Nickname; return(View("~/Views/ContractConsole/ContractModal/EditContractMember.cshtml")); }
public async Task <ActionResult> CommitContractMemberAsync(ContractMemberViewModel viewModel) { var item = await viewModel.CommitUserProfileAsync(this); if (item == null) { if (!ModelState.IsValid) { return(View(ConsoleHomeController.InputErrorView)); } else { return(View("~/Views/ConsoleHome/Shared/AlertMessage.cshtml", model: ModelState.ErrorMessage())); } } else { if (viewModel.ProfileOnly == true) { } else { if (viewModel.OwnerID == item.UID) { if (item.Address == null) { ModelState.AddModelError("OwnerID", "主簽約人必需有地址!!"); } else if (item.Phone == null) { ModelState.AddModelError("OwnerID", "主簽約人必需有手機號碼!!"); } else if (item.UserProfileExtension?.IDNo == null) { ModelState.AddModelError("OwnerID", "主簽約人必需有身分證字號/護照號碼!!"); } } } } if (!ModelState.IsValid) { return(View(ConsoleHomeController.InputErrorView)); } if (viewModel.ProfileOnly == true) { return(View("~/Views/ContractConsole/Editing/UserProfileCommitted.cshtml", item)); } else { return(View("~/Views/ContractConsole/Editing/ContractMemberCommitted.cshtml", item)); } }
public ActionResult ShowAdvisorList(ContractMemberViewModel viewModel) { ViewResult result = (ViewResult)LoadContractMember(viewModel); UserProfile item = result.Model as UserProfile; if (item == null) { return(result); } return(View("~/Views/ContractConsole/ContractModal/AdvisorList.cshtml", item)); }
public ActionResult LoadContractMember(ContractMemberViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.UID = viewModel.DecryptKeyValue(); } UserProfile item = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.UID).FirstOrDefault(); if (item == null) { return(View("~/Views/ConsoleHome/Shared/AlertMessage.cshtml", model: "Opps!您確定您輸入的資料正確嗎!?")); } return(View(item)); }
public ActionResult EditContractMember(ContractMemberViewModel viewModel, int?referenceUID) { ViewBag.ViewModel = viewModel; UserProfile item; if (referenceUID.HasValue) { item = models.GetTable <UserProfile>().Where(u => u.UID == referenceUID).FirstOrDefault(); if (item != null) { viewModel.Address = item.Address; viewModel.EmergencyContactPhone = item.UserProfileExtension.EmergencyContactPhone; viewModel.EmergencyContactPerson = item.UserProfileExtension.EmergencyContactPerson; viewModel.Relationship = item.UserProfileExtension.Relationship; viewModel.AdministrativeArea = item.UserProfileExtension.AdministrativeArea; } } else { item = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.UID).FirstOrDefault(); if (item != null) { viewModel.Gender = item.UserProfileExtension.Gender; viewModel.EmergencyContactPhone = item.UserProfileExtension.EmergencyContactPhone; viewModel.EmergencyContactPerson = item.UserProfileExtension.EmergencyContactPerson; viewModel.Relationship = item.UserProfileExtension.Relationship; viewModel.AdministrativeArea = item.UserProfileExtension.AdministrativeArea; viewModel.IDNo = item.UserProfileExtension.IDNo; viewModel.Phone = item.Phone; viewModel.Birthday = item.Birthday; viewModel.AthleticLevel = item.UserProfileExtension.AthleticLevel; viewModel.RealName = item.RealName; viewModel.Address = item.Address; viewModel.Nickname = item.Nickname; } } return(View("~/Views/CourseContract/Module/EditContractMember.ascx")); }