コード例 #1
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);

        }
コード例 #2
0
        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));
                }
            }
        }
コード例 #3
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");
            }
            
        }