コード例 #1
0
ファイル: SelectIWP.xaml.cs プロジェクト: paraneye/WinApp
        private async void btnNSave_Click(object sender, RoutedEventArgs e)
        {
            Login.MasterPage.Loading(true, this);

            List<DataLibrary.FiwpDTO> iwplist = new List<DataLibrary.FiwpDTO>();
            List<DataLibrary.FiwpDTO> newFiwps = new List<DataLibrary.FiwpDTO>();
            DataLibrary.FiwpDTO newFiwp = new DataLibrary.FiwpDTO();

            if (string.IsNullOrEmpty(txtIWPName.Text.Trim()))
            {
                WinAppLibrary.Utilities.Helper.SimpleMessage("Please Input IWP name.", "Warning");
                Login.MasterPage.Loading(false, this);
                return;
            }

            if (_commonsource.ProjectSchedule == null)
            {
                Login.MasterPage.Loading(false, this);
                return;
            }
            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();

            newFiwp.DTOStatus = (int)DataLibrary.Utilities.RowStatus.New;
            newFiwp.DisciplineCode = psdto.DisciplineCode;
            newFiwp.ProjectID = psdto.ProjectID;

            if (lvNForeman.Items.Count > 0 && lvNForeman.SelectedItems.Count == 0)
            {
                WinAppLibrary.Utilities.Helper.SimpleMessage("Foreman is not selected. Please assign a foreman", "Warning");
                Login.MasterPage.Loading(false, this);
                return;
            }
            if (lvNForeman.SelectedItems.Count > 0)
                newFiwp.LeaderId = (lvNForeman.SelectedItems[0] as DataLibrary.ComboCodeBoxDTO).DataID;

            newFiwp.ExternalScheduleId = psdto.ExternalScheduleId;
            newFiwp.CWPID = Lib.CWPDataSource.selectedCWP;
            newFiwp.P6ActivityObjectID = psdto.P6ProjectObjectID;
            newFiwp.ProjectScheduleID = psdto.ProjectScheduleID;
            newFiwp.P6ParentObjectID = psdto.P6ParentObjectID;
            newFiwp.P6CalendarID = psdto.P6CalendarID;
            newFiwp.OwnerID = psdto.OwnerID;
            newFiwp.StartDate = psdto.StartDate;
            newFiwp.FinishDate = psdto.StartDate;
            newFiwp.FiwpName = txtIWPName.Text;
            newFiwp.Description = txtDescription.Text;
            newFiwp.P6RemainingDuration = 0;
            newFiwp.TotalManhours = 0;
            newFiwp.UpdatedBy = Login.UserAccount.UserName;
            newFiwp.UpdatedDate = DateTime.Now;
            newFiwp.CreatedBy = Login.UserAccount.UserName;
            newFiwp.CreatedDate = DateTime.Now;

            newFiwp.PackageTypeLUID = Lib.PackageType.FIWP;


            newFiwps.Add(newFiwp);
           
            var result = await _iwp.SaveFIWP(newFiwps);


            LoadIWP(Lib.ScheduleDataSource.selectedSchedule);

            Login.MasterPage.Loading(false, this);
            grNewIWP.Visibility = Visibility.Collapsed;
        }
コード例 #2
0
ファイル: SelectHydro.xaml.cs プロジェクト: paraneye/WinApp
        private async void btnNSave_Click(object sender, RoutedEventArgs e)
        {
            Login.MasterPage.Loading(true, this);

            List<DataLibrary.FiwpDTO> iwplist = new List<DataLibrary.FiwpDTO>();
            List<DataLibrary.FiwpDTO> newFiwps = new List<DataLibrary.FiwpDTO>();
            DataLibrary.FiwpDTO newFiwp = new DataLibrary.FiwpDTO();
            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();

            newFiwp.DTOStatus = (int)DataLibrary.Utilities.RowStatus.New;
            newFiwp.DisciplineCode = psdto.DisciplineCode; 
            newFiwp.ProjectID = psdto.ProjectID; 
            if (lvNForeman.SelectedItems.Count > 0)
            {
                newFiwp.LeaderId = (lvNForeman.SelectedItems[0] as DataLibrary.ComboCodeBoxDTO).DataID;
            }

            newFiwp.CWPID = psdto.CWPID;
            newFiwp.P6ActivityObjectID = psdto.P6ProjectObjectID;
            newFiwp.ProjectScheduleID = psdto.ProjectScheduleID;
            newFiwp.P6ParentObjectID = psdto.P6ParentObjectID;
            newFiwp.P6CalendarID = psdto.P6CalendarID;
            newFiwp.OwnerID = psdto.OwnerID;
            newFiwp.StartDate = psdto.StartDate;
            newFiwp.FinishDate = psdto.StartDate;
            newFiwp.FiwpName = txtIWPName.Text;
            newFiwp.Description = txtDescription.Text;
            newFiwp.P6RemainingDuration = 0;
            newFiwp.TotalManhours = 0;
            newFiwp.UpdatedBy = Login.UserAccount.UserName;
            newFiwp.UpdatedDate = DateTime.Now;
            newFiwp.CreatedBy = Login.UserAccount.UserName;
            newFiwp.CreatedDate = DateTime.Now;
            newFiwp.TestTypeLUID = (cbNTestType.SelectedValue as DataLibrary.LookupDTO).LookupID;

            newFiwp.PackageTypeLUID = Lib.PackageType.HydroTest;


            newFiwps.Add(newFiwp);

            var result = await _siwp.SaveHydro(newFiwps);


            LoadIWP(Lib.ScheduleDataSource.selectedSchedule);

            Login.MasterPage.Loading(false, this);
            grNewIWP.Visibility = Visibility.Collapsed;
        }
コード例 #3
0
        //Confirm
        private async void btnSelectedAssign_Click(object sender, RoutedEventArgs e)
        {
            Login.MasterPage.Loading(true, this);

         
            //set fiwp
            DataLibrary.ProgressAssignment update = new DataLibrary.ProgressAssignment();

            List<DataLibrary.MTODTO> assignedPsdto = new List<DataLibrary.MTODTO>();

            List<DataLibrary.FiwpDTO> fiwplist = await (new Lib.ServiceModel.ProjectModel()).GetFiwpByID(Lib.IWPDataSource.selectedHydro);

            DataLibrary.FiwpDTO fiwpdto = new DataLibrary.FiwpDTO();

            if (fiwplist.Count > 0)
                fiwpdto = fiwplist[0];

            if (fiwpdto != null)
            {
                fiwpdto.UpdatedBy = Login.UserAccount.UserName;
                fiwpdto.UpdatedDate = DateTime.Now;
                fiwpdto.CreatedDate = fiwpdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : fiwpdto.CreatedDate;
                fiwpdto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                update.fiwp = fiwpdto;

            }

            foreach (var var in lvUnAssignedComponent.SelectedItems)
            {
                DataLibrary.MTODTO dto = var as DataLibrary.MTODTO;
                dto.SIWPID = Lib.IWPDataSource.selectedHydro;
                dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                assignedPsdto.Add(dto);
            }

            update.progress = assignedPsdto;

            //set schedule
            LoadSchedule();
            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();
            if (psdto != null)
            {
                psdto.CWPID = Lib.CWPDataSource.selectedCWP;
                psdto.UpdatedBy = Login.UserAccount.UserName;
                psdto.UpdatedDate = DateTime.Now;
                psdto.CreatedDate = psdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : psdto.CreatedDate;
                update.schedule = psdto;
            }

            var result = await _commonsource.UpdateHydroProgressAssignmentByStartPoint(update, Lib.CommonDataSource.selectedDrawing);

            await _commonsource.GetDrawingForAssignHydroOnMode(Lib.CWPDataSource.selectedCWP, 0, _obj.moduleList, _obj.processsystemList, _obj.lineList, _obj.pidList,
                            new List<int>(), new List<int>(), new List<int>(), new List<DataLibrary.ComboBoxDTO>(), null, new List<string>(), _projectid, _disciplineCode, -1);

            await _commonsource.GetComponentProgressBySIWP(Lib.IWPDataSource.selectedHydro, 0, _projectid, _disciplineCode);

            int drawingId = Convert.ToInt32((lvDrawing.SelectedItem as DataItem).UniqueId);
            lvUnAssignedComponent.ItemsSource = _commonsource.GetGroupedUnAssignedComponent(drawingId);
            lvAssignedComponent.ItemsSource = _commonsource.GetGroupedAssignedComponent();

            tbUnAssignManhours.Text = "Total Man Hours : " + _commonsource.UnAssignedManhour;
            tbUnAssignCnt.Text = "No. of components : " + _commonsource.UnAssignedCnt;
            tbAssignManhours.Text = "Total Man Hours : " + _commonsource.AssignedManhour;
            tbAssignCnt.Text = "No. of components : " + _commonsource.AssignedCnt;

            InitScope();

            Login.MasterPage.Loading(false, this);
        }
コード例 #4
0
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Login.MasterPage.Loading(true, this);

            try
            {
                List<DataLibrary.DocumentDTO> _result = new List<DataLibrary.DocumentDTO>();

                List<DataLibrary.DocumentDTO> _savedto = new List<DataLibrary.DocumentDTO>();
                foreach (DataLibrary.DocumentDTO _dto in _trgSafety)
                {
                    //_dto.CWPID = Lib.CWPDataSource.selectedCWP;
                    _dto.DocumentTypeLUID = Lib.DocType.AssociatedDoc;
                    _dto.FIWPID = _fiwpid;
                    _dto.PersonnelID = Login.UserAccount.PersonnelId;
                    //_dto.ProjectScheduleID = Lib.ScheduleDataSource.selectedSchedule;
                    _dto.ProjectID = _projectid;
                    _dto.DisciplineCode = _disciplineCode;
                    _dto.UpdatedBy = Login.UserAccount.UserName;
                    _dto.UpdatedDate = DateTime.Now;
                    
                    _savedto.Add(_dto);
                }

                DataLibrary.DocumentDTO document = new DataLibrary.DocumentDTO();
                document.DocumentTypeLUID = Lib.DocType.AssociatedDoc;
               // document.CWPID = Lib.CWPDataSource.selectedCWP;
                document.ProjectID = _projectid;
                document.DisciplineCode = _disciplineCode;
               // document.ProjectScheduleID = Lib.ScheduleDataSource.selectedSchedule;
                document.FIWPID = _fiwpid;
                document.UpdatedBy = Login.UserAccount.UserName;
                document.UpdatedDate = DateTime.Now;
                

                List<DataLibrary.DocumentDTO> listdocument = new List<DataLibrary.DocumentDTO>();
                listdocument.Add(document);
                
                List<DataLibrary.FiwpDTO> fiwpdto = new List<DataLibrary.FiwpDTO>();
                fiwpdto = Lib.IWPDataSource.iwplist.Where(x => x.FiwpID == _fiwpid).ToList();
                
                fiwpdto[0].DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;

                fiwpdto[0].DocEstablishedLUID = DataLibrary.Utilities.DocEstablishedForCSU.AssociatedDoc;
               
                _result = await (new Lib.ServiceModel.ProjectModel()).SaveSafetyDocumentForAssembleIWP(_savedto, fiwpdto, listdocument);
                //_result = await (new Lib.ServiceModel.ProjectModel()).SaveAssociatedDocumentForBuildCSU(listdocument, fiwpdto);
                _trgSafety = await (new Lib.ServiceModel.ProjectModel()).GetDocumentForFIWPByDocType(Lib.DocType.AssociatedDoc, _fiwpid, _projectid, _disciplineCode);
                lvFiwpITRForms.ItemsSource = _trgSafety;

                lvITRForms.ItemsSource = null;
                lvITRForms.ItemsSource = (from x in _orgSafety where !(from b in _trgSafety where b.DTOStatus != (int)DataLibrary.Utilities.RowStatus.Delete select b.SPCollectionID).Contains(x.SPCollectionID) select x);


                Lib.IWPDataSource _siwp = new Lib.IWPDataSource();
                await _siwp.GetCSUPackageOnMode(_projectid, Lib.CommonDataSource.selectedSystemID);
               
                DataLibrary.FiwpDTO iwpdto = new DataLibrary.FiwpDTO();
                iwpdto = Lib.IWPDataSource.iwplist.Where(x => x.FiwpID == _fiwpid).FirstOrDefault();

                Lib.IWPDataSource.selectedHydro = iwpdto.FiwpID;
                Lib.IWPDataSource.selectedHydroName = iwpdto.FiwpName;
                Lib.IWPDataSource.isWizard = iwpdto.DocEstablishedLUID == DataLibrary.Utilities.DocEstablishedForCSU.AssociatedDoc ? false : true;

                this.Frame.Navigate(typeof(Discipline.Schedule.BuildCSU.AssembleCSU));

            }

            catch (Exception ex)
            {
                (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(ex, "Associated Document", "There was an error Save to Associated Document. Pleae contact administrator", "Error!");
            }

            Login.MasterPage.Loading(false, this);

        }
コード例 #5
0
ファイル: SelectCSU.xaml.cs プロジェクト: paraneye/WinApp
        private async void btnNSave_Click(object sender, RoutedEventArgs e)
        {
            Login.MasterPage.Loading(true, this);

            List<DataLibrary.FiwpDTO> newFiwps = new List<DataLibrary.FiwpDTO>();
            DataLibrary.FiwpDTO newFiwp = new DataLibrary.FiwpDTO();

            newFiwp.DTOStatus = (int)DataLibrary.Utilities.RowStatus.New;
            newFiwp.DisciplineCode = _disciplineCode;
            newFiwp.ProjectID = _projectid;
            newFiwp.P6ActivityID = "0";
            newFiwp.StartDate = WinAppLibrary.Utilities.Helper.DateTimeMinValue;
            newFiwp.FinishDate = WinAppLibrary.Utilities.Helper.DateTimeMinValue;
            newFiwp.FiwpName = txtTitle.Text;
            newFiwp.UpdatedBy = Login.UserAccount.UserName;
            newFiwp.UpdatedDate = DateTime.Now;
            newFiwp.CreatedBy = Login.UserAccount.UserName;
            newFiwp.CreatedDate = DateTime.Now;

            newFiwp.SystemID = Lib.CommonDataSource.selectedSystemID;
            newFiwp.PackageTypeLUID = Lib.PackageType.CSU;

            newFiwps.Add(newFiwp);

            var result = await _siwp.SaveSIWP(newFiwps);


            LoadCSU(Lib.CommonDataSource.selectedSystemID);

            Login.MasterPage.Loading(false, this);
            grNewIWP.Visibility = Visibility.Collapsed;
        }
コード例 #6
0
        private async void ChangeDateResult(string type, SelectionChangedEventArgs e)
        {
            try
            {
                if (count > 1)
                {
                    DataLibrary.FiwpDTO dto = new DataLibrary.FiwpDTO();

                    DateTime _startdate = Convert.ToDateTime(StartDate.Text);
                    DateTime _finishdate = Convert.ToDateTime(FinishDate.Text);

                    TimeSpan ts = _finishdate - _startdate;
                    int diffDay = ts.Days;

                    DateTime _schedultStartdate = Convert.ToDateTime(sc.ScheduleJson[0].StartDate);
                    DateTime _schedultFisishtdate = Convert.ToDateTime(sc.ScheduleJson[0].FinishDate);
                    TimeSpan tsschedulestart = _startdate - _schedultStartdate;
                    TimeSpan tsscheduleend = _finishdate - _schedultFisishtdate;



                    if (tsschedulestart.Days < 0)
                    {
                        if (e != null && e.RemovedItems.Count > 0)
                        {
                            count = 1;
                            StartDate.Text = Convert.ToDateTime(e.RemovedItems[0]).ToString("MM/dd/yyyy");
                        }
                        WinAppLibrary.Utilities.Helper.SimpleMessage("IWP start date and end date can not be exceed the scheduled date on top", "Warning!");
                    }
                    else if (tsscheduleend.Days > 0)
                    {
                        if (e != null && e.RemovedItems.Count > 0)
                        {
                            count = 1;
                            FinishDate.Text = Convert.ToDateTime(e.RemovedItems[0]).ToString("MM/dd/yyyy");
                        }
                        WinAppLibrary.Utilities.Helper.SimpleMessage("IWP start date and end date can not be exceed the scheduled date on top", "Warning!");
                    }

                    else if (diffDay < 0)//종료일이 시작일보다 빠르면 경고 문
                    {
                        if (e != null && e.RemovedItems.Count > 0)
                        {
                            count = 1;
                            switch (type.ToLower())
                            {
                                case "start":
                                    StartDate.Text = Convert.ToDateTime(e.RemovedItems[0]).ToString("MM/dd/yyyy");
                                    break;
                                case "end":
                                    FinishDate.Text = Convert.ToDateTime(e.RemovedItems[0]).ToString("MM/dd/yyyy");
                                    break;
                            }
                        }

                        WinAppLibrary.Utilities.Helper.SimpleMessage("End date can not be exceed start date", "Warning!");
                    }
                    else
                    {
                        dto.FiwpID = Lib.IWPDataSource.selectedIWP;
                        dto.StartDate = _startdate;
                        dto.FinishDate = _finishdate;
                        dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                        dto.UpdatedBy = Login.UserAccount.UserName;
                        dto.P6CalendarID = sc.ScheduleJson[0].P6CalendarID;
                        var result = await _iwpsource.UpdateIwpPeriod(dto, tbAssignManhours.Text.Replace("Total Man Hours : ", "").Trim().Length > 0 ? tbAssignManhours.Text.Replace("Total Man Hours : ", "").Trim() : "0");

                        if (result != null)
                        {
                            tbNoCrew.Text = result.CrewMembersAssigned.ToString();

                            Lib.IWPDataSource.selectIwpStart = result.StartDate.ToString("MM/dd/yyyy");
                            Lib.IWPDataSource.selectIWpEnd = result.FinishDate.ToString("MM/dd/yyyy");
                            Lib.IWPDataSource.selectEstimateManHour = result.CrewMembersAssigned.ToString();
                        }
                    }
                }
                else
                    count++;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #7
0
        private async void UnAssignAdd()
        {
            Login.MasterPage.Loading(true, this);
            
            //set MTO
            DataLibrary.ProgressAssignment update = new DataLibrary.ProgressAssignment();

            List<DataLibrary.FiwpDTO> fiwplist = await (new Lib.ServiceModel.ProjectModel()).GetFiwpByID(Lib.IWPDataSource.selectedIWP);
            if (fiwplist == null)
            {
                Login.MasterPage.Loading(false, this);
                return;
            }

            DataLibrary.FiwpDTO fiwpdto = new DataLibrary.FiwpDTO();

            if (fiwplist.Count > 0)
                fiwpdto = fiwplist[0];

            if (fiwpdto != null)
            {
                fiwpdto.UpdatedBy = Login.UserAccount.PersonnelId;
                fiwpdto.UpdatedDate = DateTime.Now;
                fiwpdto.CreatedDate = fiwpdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : fiwpdto.CreatedDate;
                fiwpdto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                fiwpdto.StartDate = WinAppLibrary.Utilities.Helper.DateTimeMinValue;
                fiwpdto.FinishDate = WinAppLibrary.Utilities.Helper.DateTimeMinValue;
                update.fiwp = fiwpdto;
            }

            List<DataLibrary.MTODTO> unassignedPsdto = new List<DataLibrary.MTODTO>();

            foreach (var var in lvAssignedComponent.SelectedItems)
            {
                DataLibrary.MTODTO dto = var as DataLibrary.MTODTO;
                dto.UpdatedBy = Login.UserAccount.PersonnelId;
                dto.FIWPID = 0;
                dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                unassignedPsdto.Add(dto);
            }

            update.progress = unassignedPsdto;

            //set schedule
            LoadSchedule();
            if (_commonsource.ProjectSchedule == null)
            {
                Login.MasterPage.Loading(false, this);
                return;
            }

            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();
            if (psdto != null)
            {
                psdto.CWPID = Lib.CWPDataSource.selectedCWP;
                psdto.UpdatedBy = Login.UserAccount.PersonnelId;
                psdto.UpdatedDate = DateTime.Now;
                psdto.CreatedDate = psdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : psdto.CreatedDate;
                update.schedule = psdto;
            }

            var result = await _commonsource.UpdateFIWPProgressAssignment(update);
           
            await _commonsource.GetDrawingForAssignIWPOnMode(Lib.CWPDataSource.selectedCWP, Lib.ScheduleDataSource.selectedSchedule, 0, _obj.taskCategoryIdList, _obj.taskTypeLUIDList, _obj.materialIDList, _obj.progressIDList,
                      _obj.searhValue, _projectid, _disciplineCode, -1);
            await _commonsource.GetComponentProgressByFIWP(Lib.IWPDataSource.selectedIWP, Lib.ScheduleDataSource.selectedSchedule, _projectid, _disciplineCode);


            //unasign 하려는 assigned component의 drawingid가 drawinglist에 없으면 drawing rebind
            bool state = false;
            foreach (DataItem dto in lvDrawing.Items)
            {
                if (lvAssignedComponent.Items.Count > 0)
                {
                    if (dto.UniqueId == (lvAssignedComponent.Items[0] as DataLibrary.MTODTO).DrawingID.ToString())
                        state = true;
                }
            }

            if (state)
            {
                int drawingId = Convert.ToInt32((lvDrawing.SelectedItem as DataItem).UniqueId);
                lvUnAssignedComponent.ItemsSource = _commonsource.GetGroupedUnAssignedComponent(drawingId, Lib.IWPDataSource.selectedIWP);
                lvAssignedComponent.ItemsSource = _commonsource.GetGroupedAssignedComponent();

                tbUnAssignManhours.Text = "Total Man Hours : " + _commonsource.UnAssignedManhour;
                tbUnAssignCnt.Text = "Number of Components : " + _commonsource.UnAssignedCnt;
                tbAssignManhours.Text = "Total Man Hours : " + _commonsource.AssignedManhour;
                tbAssignCnt.Text = "Number of Components : " + _commonsource.AssignedCnt;
                ChangeDateResult("", null);
            }
            else
            {
                List<DataGroup> source = _commonsource.GetGroupedDrawing();
                this.DefaultViewModel["Drawings"] = source;
            }
            Login.MasterPage.Loading(false, this);
        }
コード例 #8
0
        //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");
            }
            
        }