Ejemplo n.º 1
0
        private DMRegion CheckDuplicateRegion(DMRegion region)
        {
            var r = _regionService.GetRegionByCode(region.RegionCode);

            if (r != null)
            {
                region.Reason = "Duplicate code";
            }
            return(region);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        private DMRegion GetRegion(DMRegion region)
        {
            var regionObject = MapperHelper.CreateDataObjectFromObject(region);

            return(region);
        }