public void UpdateDealerManpower(DealerManpower manpower)
 {
     var oldManpower = GetDealerManpower(manpower.Id);
     oldManpower.Name = manpower.Name;
     oldManpower.Type = manpower.Type;
     oldManpower.Description = manpower.Description;
     oldManpower.DealerId = manpower.DealerId;
     oldManpower.UserId = manpower.UserId;
     oldManpower.ProductId = manpower.ProductId;
     manpowerRepo.SaveChanges();
 }
 public static DealerManpowerModel FromDomainModel(DealerManpower manpower)
 {
     var model = new DealerManpowerModel {
         Id = manpower.Id,
         Name = manpower.Name,
         Type = manpower.Type,
         DealerId = manpower.DealerId,
         Dealer = manpower.Dealer.Name,
         UserId = manpower.UserId,
         User = manpower.User.Name,
         ProductId = manpower.ProductId,
         Product = manpower.Product.Name,
         ProfileId = manpower.Profile.Id,
         ContactNumber = manpower.Profile.ContactNumber,
         Address = manpower.Profile.Address,
         Designation = manpower.Profile.Designation,
         Email = manpower.Profile.Email,
         PANNumber = manpower.Profile.PANNumber,
         DateOfJoining = manpower.Profile.DateOfJoining,
         PreviousCompany = manpower.Profile.PreviousCompany,
         PreviousJobProfile = manpower.Profile.PreviousJobProfile,
         TotalWorkExperience = manpower.Profile.TotalWorkExperience,
         ExperienceWithVE = manpower.Profile.ExperienceWithVE,
         TIVRepresenting = manpower.Profile.TIVRepresenting,
         AreaRepresenting = manpower.Profile.AreaRepresenting,
         TrainingLevel = manpower.Profile.TrainingLevel,
         DateOfLeaving = manpower.Profile.DateOfLeaving,
         DateOfBirth = manpower.Profile.DateOfBirth,
         Description = manpower.Profile.Description,
         SAPId = manpower.Profile.SAPCode,
         DOLString = manpower.AttritionProfileMap != null ? (manpower.AttritionProfileMap.DateOfLeaving.HasValue ? manpower.AttritionProfileMap.DateOfLeaving.Value.ToString("dd-MMMM-yyyy") : string.Empty) : string.Empty,
         Competency = manpower.CompetencyProfileMaps != null && manpower.CompetencyProfileMaps.Any() ? manpower.CompetencyProfileMaps.Average(x => x.Score) : 0,
         Salary = manpower.ManpowerSalaries != null && manpower.ManpowerSalaries.Any() ? manpower.ManpowerSalaries.OrderByDescending(x => x.ObjectInfo.CreatedDate).First().Salary : 0,
         Productivity = 0
     };
     return model;
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DealerManpowers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDealerManpowers(DealerManpower dealerManpower)
 {
     base.AddObject("DealerManpowers", dealerManpower);
 }
Example #4
0
 /// <summary>
 /// Create a new DealerManpower object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 /// <param name="dealerId">Initial value of the DealerId property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="objectInfo">Initial value of the ObjectInfo property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 public static DealerManpower CreateDealerManpower(global::System.Int32 id, global::System.String name, global::System.String type, global::System.Int32 dealerId, global::System.Int32 userId, ObjectInfo objectInfo, global::System.Int32 productId)
 {
     DealerManpower dealerManpower = new DealerManpower();
     dealerManpower.Id = id;
     dealerManpower.Name = name;
     dealerManpower.Type = type;
     dealerManpower.DealerId = dealerId;
     dealerManpower.UserId = userId;
     dealerManpower.ObjectInfo = StructuralObject.VerifyComplexObjectIsNotNull(objectInfo, "ObjectInfo");
     dealerManpower.ProductId = productId;
     return dealerManpower;
 }
 public void UpdateDealerManpower(DealerManpower manpower)
 {
     var oldManpower = GetDealerManpower(manpower.Id);
     if (oldManpower != null)
     {
         if (!oldManpower.Type.Equals(manpower.Type, StringComparison.OrdinalIgnoreCase))
         {
             var dseTargetMaps = mapRepo.Find(x => (x.DseId == manpower.Id || x.DsmId == manpower.Id));
             foreach (var dsmDseTargetMap in dseTargetMaps)
             {
                 dsmDseTargetMap.ObjectInfo.DeletedDate = DateTime.Now;
             }
             mapRepo.SaveChanges();
         }
     }
     oldManpower.Name = manpower.Name;
     oldManpower.Type = manpower.Type;
     oldManpower.Description = manpower.Description;
     oldManpower.DealerId = manpower.DealerId;
     oldManpower.UserId = manpower.UserId;
     oldManpower.ProductId = manpower.ProductId;
     manpowerRepo.SaveChanges();
 }