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.PSSR; _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.PSSR; //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; if (!fiwpdto[0].DocEstablishedLUID.Equals(DataLibrary.Utilities.DocEstablishedForCSU.AssociatedDoc)) fiwpdto[0].DocEstablishedLUID = DataLibrary.Utilities.DocEstablishedForCSU.PSSR; _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.PSSR, _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.WizardDataSource.SetTargetMenuForCSU(DataLibrary.Utilities.DocEstablishedForCSU.PSSR); if (Lib.WizardDataSource.NextMenu != null) this.Frame.Navigate(Lib.WizardDataSource.NextMenu); } catch (Exception ex) { (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(ex, "PSSR", "There was an error Save to PSSR. Pleae contact administrator", "Error!"); } Login.MasterPage.Loading(false, this); }
private async void SaveDocument() { Login.MasterPage.Loading(true, this); List<DataLibrary.FiwpequipDTO> updatelist = new List<DataLibrary.FiwpequipDTO>(); try { updatelist.AddRange(_trgFiwpequip.Where(x => x.DTOStatus == (int)DataLibrary.Utilities.RowStatus.Update)); updatelist.AddRange(_trgFiwpequip.Where(x => x.DTOStatus == (int)DataLibrary.Utilities.RowStatus.New)); updatelist.AddRange(_delFiwpequip); DataLibrary.DocumentDTO document = new DataLibrary.DocumentDTO(); document.DocumentTypeLUID = Lib.DocType.ModelView; 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>(); if (Lib.IWPDataSource.iwplist == null) { Login.MasterPage.Loading(false, this); return; } fiwpdto = Lib.IWPDataSource.iwplist.Where(x => x.FiwpID == _fiwpid).ToList(); fiwpdto[0].DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update; //현재 단계 저장 if (!fiwpdto[0].DocEstablishedLUID.Equals(DataLibrary.Utilities.AssembleStep.APPROVER)) fiwpdto[0].DocEstablishedLUID = DataLibrary.Utilities.AssembleStep.EQUIPMENT; List<DataLibrary.FiwpequipDTO> result; //if(updatelist.Count > 0) result = await (new Lib.ServiceModel.ProjectModel()).SaveFiwpequipForAssembleIWP(updatelist, fiwpdto, Login.UserAccount.PersonnelId); Lib.WizardDataSource.SetTargetMenu(DataLibrary.Utilities.AssembleStep.EQUIPMENT, Lib.CommonDataSource.selPackageTypeLUID, true); if (Lib.WizardDataSource.NextMenu != null) this.Frame.Navigate(Lib.WizardDataSource.NextMenu); } catch (Exception ex) { (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(ex, "Save Equipment", "There is a problem saving the selected item - Please try again later", "Error"); } Login.MasterPage.Loading(false, this); }
private void AddItem() { if (lvITRForms.SelectedItem != null) { Login.MasterPage.Loading(true, this); try { if (_trgIWPITR == null) { Login.MasterPage.Loading(false, this); return; } if (lvITRForms.SelectedItems.Count > 0) { foreach (DataLibrary.DocumentDTO dto in lvITRForms.SelectedItems) { if (_trgIWPITR.Where(x => x.SPCollectionID == dto.SPCollectionID).Count() > 0) _trgIWPITR.Where(x => x.SPCollectionID == dto.SPCollectionID).FirstOrDefault().DTOStatus = (int)DataLibrary.Utilities.RowStatus.None; else { DataLibrary.DocumentDTO newdto = new DataLibrary.DocumentDTO(); newdto = dto; newdto.FIWPID = _fiwpid; newdto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.New; newdto.UpdatedBy = Login.UserAccount.UserName; newdto.UpdatedDate = DateTime.Now; newdto.IsDisplayable = "N"; _trgIWPITR.Add(newdto); } } lvFiwpITRForms.ItemsSource = null; lvFiwpITRForms.ItemsSource = _trgIWPITR.Where(x => x.DTOStatus != (int)DataLibrary.Utilities.RowStatus.Delete); } if (_orgITR == null) { Login.MasterPage.Loading(false, this); return; } lvITRForms.ItemsSource = (from x in _orgITR where !(from b in _trgIWPITR where b.DTOStatus != (int)DataLibrary.Utilities.RowStatus.Delete select b.SPCollectionID).Contains(x.SPCollectionID) select x); } catch (Exception ex) { (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(ex, "Add " + tbpageTitle.Text, "There is a problem adding the selected item - Please try again later", "Error"); } Login.MasterPage.Loading(false, this); } }
private async void AddItem() { //if (lvCoverfile.SelectedItem != null) //{ Login.MasterPage.Loading(true, this); try { if (lvCoverfile.SelectedItems.Count > 0) { if (_trgIWPCoverPage == null) { Login.MasterPage.Loading(false, this); return; } foreach (DataLibrary.DocumentDTO dto in lvCoverfile.SelectedItems) { //수정 if (_trgIWPCoverPage.Where(x => x.SPCollectionID == dto.SPCollectionID).Count() > 0) { //기존 _trgIWPCoverPage를 update 처리 _trgIWPCoverPage[0].FIWPID = _fiwpid; _trgIWPCoverPage[0].SPCollectionID = dto.SPCollectionID; _trgIWPCoverPage[0].FileStoreId = dto.FileStoreId; _trgIWPCoverPage[0].LocationURL = dto.LocationURL; _trgIWPCoverPage[0].DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update; _trgIWPCoverPage[0].UpdatedBy = Login.UserAccount.UserName; _trgIWPCoverPage[0].UpdatedDate = DateTime.Now; _trgIWPCoverPage[0].IsDisplayable = "N"; } //신규 else { if (_trgIWPCoverPage.Count > 0) _trgIWPCoverPage.Clear(); DataLibrary.DocumentDTO newdto = new DataLibrary.DocumentDTO(); newdto = dto; newdto.FIWPID = _fiwpid; newdto.LocationURL = dto.LocationURL; newdto.FileStoreId = dto.FileStoreId; newdto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.New; newdto.UpdatedBy = Login.UserAccount.UserName; newdto.UpdatedDate = DateTime.Now; newdto.IsDisplayable = "N"; _trgIWPCoverPage.Add(newdto); } } lvFiwpCoverfile.ItemsSource = null; lvFiwpCoverfile.ItemsSource = _trgIWPCoverPage; //이미지 바인딩 try { string Url = (lvFiwpCoverfile.Items[0] as DataLibrary.DocumentDTO).LocationURL.ToString(); Uri pathCheckUri = new Uri(Url); var client = new HttpClient(); //파일 있는지 확인 string page = await client.GetStringAsync(pathCheckUri); //선택 이미지 세팅 imgCoverPage.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(Url)); } catch (Exception ex) { imgCoverPage.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(WinAppLibrary.Utilities.Helper.BaseUri + "Assets/Default.png")); } } } catch (Exception ex) { (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(ex, "Load cover page", "There is a problem adding the selected item - Please try again later", "Error!"); imgCoverPage.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(WinAppLibrary.Utilities.Helper.BaseUri + "Assets/Default.png")); } txtNoImg.Visibility = Windows.UI.Xaml.Visibility.Collapsed; imgCoverPage.Visibility = Windows.UI.Xaml.Visibility.Visible; Login.MasterPage.Loading(false, this); //} }