コード例 #1
0
        public void BizAction(LocationTypeDto inputData)
        {
            var location = _dbAccess.GetLocationType(inputData.Id);

            if (location == null)
            {
                throw new NullReferenceException("Could not find the location. Someone entering illegal ids?");
            }

            var status = location.UpdateLocationType(inputData.Title);

            CombineErrors(status);

            Message = $"person is update: {location.ToString()}.";
        }
コード例 #2
0
        public void BizAction(int inputData)
        {
            var item = _updatedbAccess.GetLocationType(inputData);

            if (item == null)
            {
                AddError("Could not find the location. Someone entering illegal ids?");
            }

            if (_updatedbAccess.HaveAnyActivity(item.Id))
            {
                AddError("Location hvae any activity!!!");
            }

            _dbAccess.Delete(item);

            Message = $"location is Delete: {item.ToString()}.";
        }
コード例 #3
0
        private void calculateBySubSystem(ActivityPlaneDto inputData, Project project)
        {
            var workPackages = _workPackageDbAccess.GetRoadMap(inputData.WorkPackageId);

            if (workPackages == null)
            {
                AddError("Not available WorkPackage!!!", "activity");
            }

            var location = _locationDbAccess.GetLocationType(inputData.LocationId);

            if (location == null)
            {
                AddError("Not available location!!!", "activity");
            }

            var subSystem = _subsystemDbAccess.GetSubSystme(inputData.SubSystemId);

            if (subSystem == null)
            {
                AddError("Not available subSystem!!!", "activity");
            }

            var descipline = _desciplineDbAccess.GetDescipline(inputData.DesciplineId);

            if (subSystem == null)
            {
                AddError("Not available descipline!!!", "activity");
            }

            if (inputData.StartDate > inputData.EndDate)
            {
                AddError("Inserted Start Date is greater of End Date!!!", "activity");
            }

            if (inputData.StartDate < project.StartDate)
            {
                AddError("Start Date must be greater of project start date!!!", "activity");
            }

            if (inputData.EndDate > project.EndDate)
            {
                AddError("End Date must be lowest of project end date!!!", "activity");
            }

            if (!this.HasErrors)
            {
                var items = _dbAccess.GetActivityForConfigPlan(inputData.WorkPackageId, inputData.LocationId, inputData.SubSystemId, inputData.DesciplineId)
                            .ToList();

                float  formMh     = items.Sum(s => s.FormDictionary.ManHours);
                double totalHours = (inputData.EndDate - inputData.StartDate).TotalHours;

                if (totalHours < formMh)
                {
                    AddError("Total hours for claculate date is Smaller than sum of Tasks's form Mh", "activity");
                    return;
                }

                double fac = 0;

                if (totalHours > formMh)
                {
                    double dif = (totalHours - formMh);
                    fac = Math.Floor(dif / items.Count);
                }

                var groupItems = items
                                 .OrderBy(s => s.FormDictionary.Priority).GroupBy(s => s.FormDictionary.Id);

                DateTime startDate = inputData.StartDate;
                DateTime endDate   = inputData.StartDate;

                foreach (var g in groupItems)
                {
                    var orderbySubSystem = g.OrderBy(o => o.SubSystem.PriorityNo).ThenBy(o => o.SubSystem.SubPriorityNo);
                    foreach (var ac in orderbySubSystem)
                    {
                        var fmh = ac.FormDictionary.ManHours;
                        fmh = (float)(fmh + fac);

                        endDate = startDate.AddHours(fmh);
                        ac.UpdateActivityPlane(startDate, endDate);
                        startDate = endDate;
                    }
                }

                _dbAccess.UpdateActivityPlane(items);
            }
        }
コード例 #4
0
        public void BizAction(ActivityDto inputData)
        {
            var workPackage = _workPackageDbAccess.GetRoadMap(inputData.WorkPackageId);

            if (workPackage == null)
            {
                AddError("WorkPackage is Not Valid.");
            }

            var location = _locationDbAccess.GetLocationType(inputData.LocationId);

            if (location == null)
            {
                AddError("Location is Not Valid.");
            }

            var descipline = _desciplineDbAccess.GetDescipline(inputData.DesciplineId);

            if (descipline == null)
            {
                AddError("Descipline is Not Valid.");
            }

            var form = _formDicDbAccess.GetFormDictionary(inputData.FormDictionaryId);

            if (form == null)
            {
                AddError("Form is Not Valid.");
            }

            var system = _systemDbAccess.GetSystme(inputData.SystemdId);

            if (system == null)
            {
                AddError("System is Not Valid.");
            }

            var subSystem = _subSystemDbAccess.GetSubSystme(inputData.SubsytemId);

            if (subSystem == null)
            {
                AddError("Subsystem is Not Valid.");
            }
            var workStep = _workStepDbAccess.GetWorkPackageStep(inputData.WorkPackageStepId);

            if (workStep == null)
            {
                AddError("WorkPackage Step is Not Valid.");
            }

            var activity = _dbAccess.GetActivity(inputData.Id);

            if (activity == null)
            {
                AddError("Could not find the Activity. Someone entering illegal ids?");
                return;
            }

            var status = activity.UpdateActivity(inputData.TagNumber, inputData.TagDescription
                                                 , inputData.ValueUnitNum, inputData.EstimateMh, inputData.ActualMh, inputData.ActualStartDate,
                                                 inputData.ActualEndDate, inputData.Condition, inputData.Status);

            CombineErrors(status);

            Message = $"activity is update: {activity.ToString()}.";
        }
コード例 #5
0
        public Activity BizAction(ActivityDto inputData)
        {
            var workPackage = _workPackageDbAccess.GetRoadMap(inputData.WorkPackageId);

            if (workPackage == null)
            {
                AddError("WorkPackage is Not Valid.");
            }

            var location = _locationDbAccess.GetLocationType(inputData.LocationId);

            if (location == null)
            {
                AddError("Location is Not Valid.");
            }

            var descipline = _desciplineDbAccess.GetDescipline(inputData.DesciplineId);

            if (descipline == null)
            {
                AddError("Descipline is Not Valid.");
            }

            var form = _formDicDbAccess.GetFormDictionary(inputData.FormDictionaryId);

            if (form == null)
            {
                AddError("Form is Not Valid.");
            }

            var system = _systemDbAccess.GetSystme(inputData.SystemdId);

            if (system == null)
            {
                AddError("System is Not Valid.");
            }

            var subSystem = _subSystemDbAccess.GetSubSystme(inputData.SubsytemId);

            if (subSystem == null)
            {
                AddError("Subsystem is Not Valid.");
            }
            var workStep = _workStepDbAccess.GetWorkPackageStep(inputData.WorkPackageStepId);

            if (workStep == null)
            {
                AddError("WorkPackage Step is Not Valid.");
            }

            if (inputData.WeightFactor < 0)
            {
                AddError("WeightFactor is Not Valid.");
            }

            if (string.IsNullOrWhiteSpace(inputData.TagNumber))
            {
                AddError("TagNumber is Not Valid.");
            }

            var desStatus = Activity.CreateActivity(inputData.TagNumber, inputData.TagDescription, inputData.Progress,
                                                    inputData.WeightFactor, inputData.ValueUnitNum, inputData.EstimateMh, inputData.ActualMh, inputData.Status, inputData.ActualStartDate, inputData.ActualEndDate
                                                    , inputData.PlanStartDate, inputData.PlanEndDate, inputData.FormDictionaryId, inputData.ValueUnitId
                                                    , inputData.WorkPackageId, inputData.LocationId, inputData.SubsytemId,
                                                    inputData.Condition, inputData.ActivityCode, inputData.DesciplineId, inputData.WorkPackageStepId);

            CombineErrors(desStatus);

            if (!HasErrors)
            {
                _dbAccess.Add(desStatus.Result);
            }

            return(HasErrors ? null : desStatus.Result);
        }