Example #1
0
 public PartialViewResult Attrition(int id)
 {
     var manpower = manpowerService.GetDealerManpower(id);
     var model = new AttritionProfileViewModel {
         Attritions = masterService.FindAttritions(x => x.Designation.ToLower() == manpower.Type.ToLower()).Select(x => new KeyValuePair<int, string>(x.Id, x.Name)).ToList(),
         ProfileId = id,
         Attrition = manpower.AttritionProfileMap != null ? AttritionProfileModel.FromDomainModel(manpower.AttritionProfileMap) : new AttritionProfileModel()
     };
     return PartialView("AttritionPartial", model);
 }
Example #2
0
 public void Attrition(AttritionProfileViewModel model)
 {
     var attrition = AttritionProfileModel.ToDomainModel(model.Attrition,model.ProfileId);
     if (attrition.AttritionId > 0 && attrition.DateOfLeaving.HasValue && attrition.DateOfLeaving.Value.Ticks > 0) {
         attrition.DealerManpower = manpowerService.GetDealerManpower(model.ProfileId);
         if (attrition.Id > 0) {
             attritionProfileMapService.UpdateAttritionProfileMap(attrition);
         } else {
             attritionProfileMapService.AddAttritionProfileMap(new[] { attrition });
         }
     }
 }
Example #3
0
 public void Attrition(AttritionProfileViewModel model)
 {
     var attrition = AttritionProfileModel.ToDomainModel(model.Attrition, model.ProfileId);
     if (attrition.AttritionId > 0 && attrition.DateOfLeaving.HasValue && attrition.DateOfLeaving.Value.Ticks > 0)
     {
         var dealerManPower = manpowerService.GetDealerManpower(model.ProfileId);
         if (dealerManPower.AttritionProfileMap == null)
         {
             dealerManPower.AttritionProfileMap = new AttritionProfileMap();
         }
         var now = DateTime.Now;
         dealerManPower.AttritionProfileMap.AttritionId = attrition.AttritionId;
         dealerManPower.AttritionProfileMap.DateOfLeaving = attrition.DateOfLeaving;
         dealerManPower.ObjectInfo.DeletedDate = now;
         dealerManPower.Profile.ObjectInfo.DeletedDate = now;
         dealerManPower.Profile.DateOfLeaving = now;
         manpowerService.UpdateDealerManpower(dealerManPower);
     }
 }