private async void gvSchedule_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { var schedule = e.AddedItems[0] as WinAppLibrary.ServiceModels.DataItem; Lib.ScheduleDataSource.selectedSchedule = int.Parse(schedule.UniqueId); Lib.ScheduleDataSource.selectedScheduleName = schedule.Title; //iwplist if (Lib.CommonDataSource.selPackageTypeLUID == Lib.PackageType.SIWP) { if (Lib.IWPDataSource.iwplist == null || _schedule.Schedule == null) return; List<DataLibrary.FiwpDTO> iwps = Lib.IWPDataSource.iwplist.Where(x => x.FiwpID == Lib.IWPDataSource.selectedSIWP).ToList(); DataLibrary.ProjectscheduleDTO psdto = _schedule.Schedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault(); foreach (DataLibrary.FiwpDTO dto in iwps) { dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update; dto.DisciplineCode = psdto.DisciplineCode; dto.ProjectID = psdto.ProjectID; dto.CWPID = Lib.CWPDataSource.selectedCWP; dto.P6ActivityObjectID = psdto.P6ProjectObjectID; dto.ProjectScheduleID = psdto.ProjectScheduleID; dto.P6ParentObjectID = psdto.P6ParentObjectID; dto.P6CalendarID = psdto.P6CalendarID; dto.OwnerID = psdto.OwnerID; dto.StartDate = psdto.StartDate; dto.FinishDate = psdto.StartDate; dto.UpdatedDate = DateTime.Now; dto.CreatedDate = dto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : dto.CreatedDate; dto.UpdatedBy = Login.UserAccount.UserName; dto.CreatedBy = Login.UserAccount.UserName; } var result = await (new Lib.ServiceModel.ProjectModel()).SaveFIWP(iwps); Lib.IWPDataSource _iwp = new Lib.IWPDataSource(); await _iwp.GetFiwpByCwpSchedulePackageTypeOnMode(Lib.CWPDataSource.selectedCWP, 0, Lib.CommonDataSource.selPackageTypeLUID); Lib.WizardDataSource.SetTargetMenu(iwps[0].DocEstablishedLUID, Lib.CommonDataSource.selPackageTypeLUID, true); if (Lib.WizardDataSource.NextMenu != null) this.Frame.Navigate(Lib.WizardDataSource.NextMenu); } else { this.Frame.Navigate(typeof(Discipline.Schedule.AssembleIWP.SelectIWP)); } } }
//WorkFlow 저장 private async void SaveWorkFlow() { try { List<TypeTransition> CrewListDto = new List<TypeTransition>(); Guid workflowid = new Guid(); string SaveYN = "Y"; //저장가능 여부 int oldseq = 0; int i = 0; int iseq = 0; foreach (PendingWorkflow item in lvWorkflow.Items) { TypeTransition dto = new TypeTransition(); if (i == 0) { oldseq = Convert.ToInt32(item.TransitionStatusSeq); } else if(oldseq != Convert.ToInt32(item.TransitionStatusSeq)) { iseq = iseq + 1; oldseq = Convert.ToInt32(item.TransitionStatusSeq); } dto.Row = iseq; //같은 그룹끼리의 번호 dto.UserId = item.SigmaUserId; dto.Role = item.SigmaRoleId; workflowid = item.WorkFlowId; SaveYN = item.IsModified; CrewListDto.Add(dto); i = i + 1; } bool result; string strTitle = fiwpDto.Description; //Title = SignoffStatus 화면의 Description 컬럼 if (isNewYN == "Y") //신규일경우 result = await (new Lib.ServiceModel.WorkflowModel()).SaveWorkflowCrew(PackageTypeCode, 0, Login.UserAccount.PersonnelId, CrewListDto, strTitle, string.Empty, string.Empty, _fiwpID, _fiwpID); else { if (SaveYN == "Y") //업데이트가 가능할 경우 (워크플로우가 진행되지 않은 상태) { result = await (new Lib.ServiceModel.WorkflowModel()).UpdateWorkflowCrew(PackageTypeCode, 0, workflowid, CrewListDto, fiwpDto.FiwpID); } else { result = true; WinAppLibrary.Utilities.Helper.SimpleMessage("This Workflow is alredy processing", "Cannot Saved"); } } if (result) { if (isNewYN == "Y") { WinAppLibrary.Utilities.Helper.SimpleMessage("Successfully Saved", "Save Complete"); } else if (SaveYN == "Y") { WinAppLibrary.Utilities.Helper.SimpleMessage("Successfully Updated", "Update Complete"); } #region //현재 위자드 모드 확인/저장 Lib.IWPDataSource _iwp = new Lib.IWPDataSource(); await _iwp.GetFiwpByCwpSchedulePackageTypeOnMode(Lib.CWPDataSource.selectedCWP, Lib.ScheduleDataSource.selectedSchedule, Lib.CommonDataSource.selPackageTypeLUID); List<DataLibrary.FiwpDTO> iwplist = _iwp.GetFiwpByProjectScheduleID(); DataLibrary.FiwpDTO iwpdto = new DataLibrary.FiwpDTO(); iwpdto = iwplist.Where(x => x.FiwpID == Lib.IWPDataSource.selectedIWP).FirstOrDefault(); Lib.IWPDataSource.isWizard = iwpdto.DocEstablishedLUID == DataLibrary.Utilities.AssembleStep.APPROVER ? false : true; Lib.WizardDataSource.SetTargetMenu(DataLibrary.Utilities.AssembleStep.APPROVER, Lib.CommonDataSource.selPackageTypeLUID, true); if (Lib.WizardDataSource.NextMenu != null) this.Frame.Navigate(Lib.WizardDataSource.NextMenu); #endregion } else { WinAppLibrary.Utilities.Helper.SimpleMessage("Failed to save the workflow - Please try again later", "Saving Error"); } } catch (Exception ex) { WinAppLibrary.Utilities.Helper.SimpleMessage("Error to save the workflow", "Error"); } }