public AddEditIssueTrendNoticeModel(IssueTrendNotice issueTrendNotice) { CompositionInitializer.SatisfyImports(this); mIssueTrendNotice = issueTrendNotice; IssueTrendNotice = new IssueTrendNotice();//need for the clone to work... IssueTrendNotice = issueTrendNotice; CommonUtils.CloneObject(mIssueTrendNotice, IssueTrendNotice, "Id"); LoadData(true); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); }
public AddEditIssueTrendNoticeModel(Issue issue) { CompositionInitializer.SatisfyImports(this); mIssueTrendNotice = new IssueTrendNotice(); mIssue = issue; mIssueTrendNotice.InitiatedBy = String.Format("{0} by {1}", DateTime.Now.ToString(CMS.Constants.ShortDateFormat), CMS.User.FirstLastName); Number = String.Format("{0}-{1:D3}", mIssue.Id, mIssue.IssueTrendNotices.Count + 1); mIssueTrendNotice.IssueId = mIssue.Id; LoadData(false); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); }
private void SaveIssueTrendNotices(Issue issue, Issue originalIssue, CmsEntities cee) { log.Verbose("SaveIssueTrendNotices()"); //Delete cee.DeleteWhere<IssueTrendNotice>(cee, x => x.IssueId == issue.Id); cee.Configuration.AutoDetectChangesEnabled = false; foreach (IssueTrendNotice notice in issue.IssueTrendNotices.ToList()) { var newIssueTrendNotice = new IssueTrendNotice { IssueId = issue.Id, StatusId = notice.StatusId, Number = notice.Number, Description = notice.Description, CostImpact = notice.CostImpact, ScheduleImpact = notice.ScheduleImpact, QualityImpact = notice.QualityImpact, ScopeChange = notice.ScopeChange, RequestedBy = notice.RequestedBy, ApprovedBy = notice.ApprovedBy, InitiatedBy = notice.InitiatedBy, Notes = notice.Notes, VendorId = notice.VendorId, PurchaseOrder = notice.PurchaseOrder, ContractNumber = notice.ContractNumber, FitsWithinApprovedBudget = notice.FitsWithinApprovedBudget, RequiresSupplementalFunding = notice.RequiresSupplementalFunding, RequiresUpdateToRiskAssessment = notice.RequiresUpdateToRiskAssessment, ChangesExistingContract = notice.ChangesExistingContract }; if (notice.FinancialVarianceCodeId.HasValue && notice.FinancialVarianceCodeId > 0) { newIssueTrendNotice.FinancialVarianceCodeId = notice.FinancialVarianceCodeId; } if (notice.IssueMilestoneDelayTypeId.HasValue && notice.IssueMilestoneDelayTypeId > 0) { newIssueTrendNotice.IssueMilestoneDelayTypeId = notice.IssueMilestoneDelayTypeId; } originalIssue.IssueTrendNotices.Add(newIssueTrendNotice); } cee.Configuration.AutoDetectChangesEnabled = true; }