private DMRegion CheckDuplicateRegion(DMRegion region) { var r = _regionService.GetRegionByCode(region.RegionCode); if (r != null) { region.Reason = "Duplicate code"; } return(region); }
private bool InsertRegionToDb(DMRegion region, Guid userGuid) { var entity = MapRegionToCoreRegion(region, userGuid); _regionService.Add(entity); if (region.RegionalManagerGuid != Guid.Empty) { InsertRegionKeyPerson(region.RegionalManagerGuid, entity.RegionGuid, "Region", ContractUserRole._regionalManager); } return(true); }
private Core.Entities.Region MapRegionToCoreRegion(DMRegion region, Guid userGuid) { regionEntity = new Entities.Region(); regionEntity.RegionGuid = Guid.NewGuid(); regionEntity.RegionName = region.RegionName; regionEntity.RegionCode = region.RegionCode; //regionEntity.RegionalManager = region.RegionalManagerGuid; regionEntity.CreatedOn = DateTime.UtcNow; regionEntity.IsActive = true; regionEntity.IsDeleted = false; regionEntity.CreatedBy = userGuid; regionEntity.UpdatedBy = userGuid; regionEntity.UpdatedOn = DateTime.UtcNow; return(regionEntity); }
private DMRegion EnableDisableDeleteRegion(DMRegion region, Guid regionGuid) { var action = region.Action.ToLower(); if (action == ImportAction.Delete.ToString().ToLower()) { var result = DeleteRegion(regionGuid); region.Reason = "Deleted Successfully"; } else if (action == ImportAction.Enable.ToString().ToLower()) { var result = EnableDisableRegion(true, regionGuid); region.Reason = "Enable Successfully"; } else { var result = EnableDisableRegion(false, regionGuid); region.Reason = "Disable Successfully"; } region.ImportStatus = Core.Entities.ImportStatus.Success.ToString(); return(region); }
private DMRegion GetRegion(DMRegion region) { var regionObject = MapperHelper.CreateDataObjectFromObject(region); return(region); }