예제 #1
0
        public IActionResult PostDetail([FromBody] CreateEditDetailViewModel model)
        {
            //DataClaim.GetClaim(Request);
            if (model is null)
            {
                return(BadRequest("Organization Unit Detail Change is null."));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            OrgUnitTransactionDetail detail = new OrgUnitTransactionDetail();
            var menuMapper = _mapper.Map(model, detail);

            menuMapper.SuperiorId    = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(model.EmployeeID));
            menuMapper.ParentId      = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(model.OrganizationUnitID));
            menuMapper.StatusId      = OrgChangeStatus.Add;
            menuMapper.IsCurrentUsed = true;
            //menuMapper.IsActive = true;

            _orgUnitChangeProvider.AddOrgUnitChangeDetail(menuMapper);
            return(Ok(model));
        }
        public int AddChildOrgUnit(OrgUnitTransaction orgChange, IEnumerable <OrgUnit> child)
        {
            foreach (var item in child)
            {
                OrgUnitTransactionDetail detail = new OrgUnitTransactionDetail();
                detail.OrgUnitTransactionId = orgChange.Id;
                detail.OrgUnitId            = item.Id;
                detail.Code = item.Code;
                detail.Name = item.Name;
                detail.OrganizationleveId       = item.OrganizationlevelId;
                detail.SuperiorId               = item.SuperiorId;
                detail.CostCenterId             = item.CostCenterId;
                detail.Description              = item.Description;
                detail.BeginEff                 = item.BeginEff;
                detail.LastEff                  = item.LastEff;
                detail.ParentId                 = item.ParentId;
                detail.IsLegalEntity            = item.IsLegalEntity;
                detail.LegalEntityInformationId = item.LegalEntityInformationId;
                detail.BusinessGroupId          = item.BusinessGroupId;
                detail.StatusId                 = 0;
                detail.CategoryId               = item.CategoryId;
                detail.CreatedBy                = orgChange.CreatedBy;
                detail.CreatedDate              = orgChange.CreatedDate;

                context.OrgUnitTransactionDetail.Add(detail);
            }

            return(context.SaveChanges());
        }
 public int DeadActiveDetail(OrgUnitTransactionDetail entity)
 {
     context.SbAdd(entity);
     return(context.SaveChanges());
 }