public NcFullDetailPage(NcManagementPage ncManagementPage, NcFile ncFile, NcFileDetails ncFileDetails, NcFileFix ncFileFix) { this.ncManagementPage = ncManagementPage; this.ncFile = ncFile; this.ncFileDetails = ncFileDetails; this.ncFileFix = ncFileFix; InitializeComponent(); // hide non allowed buttons if (!ncManagementPage.mainWindow.loginUser.Value.user_type) // the current user is not an admin { ValidateFlipper.Visibility = Visibility.Collapsed; FinaliseFlipper.Visibility = Visibility.Collapsed; } if (!ncFile.is_valid || ncFile.state == 2) { FinaliseFlipper.Visibility = Visibility.Collapsed; } if (!ncManagementPage.mainWindow.loginUser.Value.user_type && // the current user is not an admin ncManagementPage.mainWindow.loginUser.Value.id != ncFile.fix_user_id) // the current user is not the fixer { ResetFlipper.Visibility = Visibility.Collapsed; } initializeData(ncFile, ncFileDetails, ncFileFix);// populate text fields // populate Image List for (int i = 0; i < ncManagementPage.ncCaseBitmapImageList.Count; i++) { Frame newFrame = new Frame { Margin = new Thickness(4), Content = new ZoomPicPage(ncManagementPage, i) }; PicContainer.Children.Add(newFrame); } if (ncFile.is_valid) { ValidateFlipperFrontBtn.Content = "Anuler validation"; } }
private void initializeData(NcFile ncFile, NcFileDetails ncFileDetails, NcFileFix ncFileFix) { // NcFile case caseTitleLabel.Text = ncFile.case_title; userFullNameTxt.Text = ncFile.nc_user_full_Name; structureTxt.Text = ncFile.structure_name; NcDescriptionTxt.Text = ncFileDetails.description; n_planTxt.Text = ncFileDetails.n_plan; partial_setTxt.Text = ncFileDetails.partial_set; sourceTxt.Text = ncFile.source ? "Externe" : "Interne"; creationDateTxt.Text = ncFile.creation_date; //NcFile fix CauseTxt.Text = ncFileFix.cause; ActionDescriptionTxt.Text = ncFileFix.action_description; ActionTypeTxt.Text = ncFileFix.action_type == 2 ? "Réalisée" : ncFileFix.action_type == 1 ? "En cours" : "Non entamée"; FixerNameTxt.Text = ncFileFix.fixer_full_name; FixerFunctionTxt.Text = ncFileFix.fixer_function; FixerStructureTxt.Text = ncFileFix.fixer_structure_name; StartDate.Text = ncFileFix.estimated_start_date; EndDate.Text = ncFileFix.estimated_end_date; }
public Nullable <NcFileFix> GetNcFileFixSQL(int id, MainWindow mainWindow) // NcFile Detail { Nullable <NcFileFix> ncFileFix = null; string querryString = "SELECT cause, action_description, action_type, fixer_full_name, fixer_function, fixer_structure_name, estimated_start_date, estimated_end_date, fix_date FROM ncfile WHERE id=" + id + ";"; if (-1 != IsSqlConnected(mainWindow, querryString) && sqlReader.Read()) { ncFileFix = new NcFileFix( sqlReader.IsDBNull(0) ? "" : sqlReader.GetString("cause"), // sqlReader.IsDBNull(1) ? -1 : sqlReader.GetInt16("fix_user_id"), sqlReader.IsDBNull(1) ? "" : sqlReader.GetString("action_description"), sqlReader.IsDBNull(2) ? -1 : sqlReader.GetInt16("action_type"), sqlReader.IsDBNull(3) ? "" : sqlReader.GetString("fixer_full_name"), sqlReader.IsDBNull(4) ? "" : sqlReader.GetString("fixer_function"), sqlReader.IsDBNull(5) ? "" : sqlReader.GetString("fixer_structure_name"), sqlReader.IsDBNull(6) ? "" : sqlReader.GetString("estimated_start_date"), sqlReader.IsDBNull(7) ? "" : sqlReader.GetString("estimated_end_date"), sqlReader.IsDBNull(8) ? "" : sqlReader.GetString("fix_date")); } DBConnection.Close(); return(ncFileFix); }
public static String NewDocXFile(String FileFullName, NcFile ncFile, NcFileDetails ncFileDetails, NcFileFix ncFileFix) { try { DocX templateDocument = DocX.Load(@"NcFileDetail.docx"); foreach (Paragraph paragraph in templateDocument.Paragraphs) { paragraph.ReplaceText("<Titre-NC>", ncFile.case_title); paragraph.ReplaceText("<Createur>", ncFile.nc_user_full_Name); paragraph.ReplaceText("<Structure>", ncFile.structure_name); paragraph.ReplaceText("<Description>", ncFileDetails.description); paragraph.ReplaceText("<N-plan>", ncFileDetails.n_plan); paragraph.ReplaceText("<Ens-Partiel>", ncFileDetails.partial_set); paragraph.ReplaceText("<Source>", ncFile.source? "interne" : "externe"); paragraph.ReplaceText("<Date-Creation>", ncFile.creation_date); paragraph.ReplaceText("<Cause>", ncFileFix.cause); paragraph.ReplaceText("<Description-Action>", ncFileFix.action_description); paragraph.ReplaceText("<Type-Action>", ncFileFix.action_type == 1? "correction" : "corrective"); paragraph.ReplaceText("<Responsable-Action>", ncFileFix.fixer_full_name); paragraph.ReplaceText("<Fonction-Responsable-Action>", ncFileFix.fixer_function); paragraph.ReplaceText("<Structure-Responsable-Action>", ncFileFix.fixer_structure_name); paragraph.ReplaceText("<Temp-Planifie-Debut>", ncFileFix.estimated_start_date); paragraph.ReplaceText("<Temp-Planifie-Fin>", ncFileFix.estimated_end_date); } templateDocument.SaveAs(FileFullName); return("ok"); } catch (Exception e) { return(e.Message); } }