public ActionResult IsSapCodeExist(CsmDealerViewModel csmDealerViewModel) { bool isSapCodeExist = false; if (csmDealerViewModel.Manpower.Type.Equals("DSM")) { isSapCodeExist = true; } else { var manpowers = manpowerService.FindDealerManpowerBySap(csmDealerViewModel.Manpower.SAPId); if (manpowers == null || manpowers.Count() == 0) isSapCodeExist = true; if (manpowers.Count(x => x.Id == csmDealerViewModel.Manpower.Id) > 0) isSapCodeExist = true; } return Json(isSapCodeExist, JsonRequestBehavior.AllowGet); }
public ActionResult SaveManpower(CsmDealerViewModel model) { var profile = DealerManpowerModel.ToProfileDomain(model.Manpower); var manpower = DealerManpowerModel.ToManpowerDomain(model.Manpower); profile.DealerManpower = manpower; if (profile.Id > 0) { profileService.UpdateProfile(profile); dealerManpowerService.UpdateDealerManpower(manpower); } else { profileService.AddProfile(new[] { profile }); } //Add Salary if (model.Manpower.Salary > 0) { salaryService.AddManpowerSalary(new[]{new ManpowerSalary { Id=0, Salary = model.Manpower.Salary, DealerManpowerId = manpower.Id }}); } return RedirectToAction("DseProfile", "Dealer", new { id = manpower.Id }); }
public ActionResult ManpowerProfile(int id, int dealerId) { Session["BreadcrumbList"] = Utils.HtmlExtensions.SetBreadcrumbs((List<BreadcrumbModel>)Session["BreadcrumbList"], string.Format("/Dealer/ManpowerProfile/{0}", id), "Profile"); var csm = userService.GetUserByUserName(User.Identity.Name); var model = new CsmDealerViewModel { Manpower = id > 0 ? DealerManpowerModel.FromDomainModel(manpowerService.GetDealerManpower(id)) : new DealerManpowerModel(), Designations = Enumeration.GetAll<Designation>(), TrainingLevels = Enumeration.GetAll<TrainingLevel>(), Attrition = new AttritionProfileModel(), Training = new TrainingProfileModel(), Attritions = masterService.GetAllAttritions().Select(x => new KeyValuePair<int, string>(x.Id, x.Name)), AllTrainings = masterService.GetAllTrainings().Select(x => new KeyValuePair<int, string>(x.Id, x.Name)), Products = masterService.GetAllProducts().Select(x => new KeyValuePair<int, string>(x.Id, x.Name)).ToList() }; model.Manpower.DealerId = dealerId; model.Manpower.UserId = csm.Id; ViewBag.List = Session["BreadcrumbList"]; return View(model); }