private void קורותחייםToolStripMenuItem_Click(object sender, EventArgs e) { if ((string)button_Add_CV.Tag != GetCV(0).path&& (string)button_Add_CV.Tag != null) { string[] pathParts = ((string)button_Add_CV.Tag).Split('\\'); pathParts = pathParts[pathParts.Length - 1].Split('.'); if (pathParts[pathParts.Length - 1] == "pdf") { //the file is a pdf file PDF_CV_Viewer.src = (string)button_Add_CV.Tag; } else { //the file is a docx file. open it with a word program. PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.Update(); try { Process.Start((string)button_Add_CV.Tag); } catch { } } } else { PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.Update(); } }
private void button_Add_CV_Click(object sender, EventArgs e) { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = @"C:\Users\" + Environment.UserName + @"\Desktop"; openFileDialog.Filter = "pdf & word documents|*.pdf;*.doc;*.docx" + "|pdf files (*.pdf)|*.pdf" + "|word files (*.docx)|*.docx"; openFileDialog.FilterIndex = 1; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.Cancel) { return; } //Get the path of specified file button_Add_CV.Tag = openFileDialog.FileName; //if the nominee is already in the database then update the CV. if (label_DBID.Text != "0") { SetCV(int.Parse(label_DBID.Text)); } string[] pathParts = ((string)button_Add_CV.Tag).Split('\\'); pathParts = pathParts[pathParts.Length - 1].Split('.'); if (pathParts[pathParts.Length - 1] == "pdf") { //the file is a pdf file PDF_CV_Viewer.src = (string)button_Add_CV.Tag; } else { //the file is a docx file. open it with a word program. PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.Update(); try { Process.Start((string)button_Add_CV.Tag); } catch { } } button_Add_CV.BackColor = Color.Green; button_Add_CV.Text = "ישנם קורות חיים"; } }
private void button_File_DragDrop(object sender, DragEventArgs e) { string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop, false); for (int i = 0; i < paths.Length; i++) { //get the first file which is in the pdf or docx format. if (paths[i].EndsWith(".docx") || paths[i].EndsWith(".pdf")) { //file accepted button_Add_CV.Tag = paths[i]; //if the nominee is already in the database then update the CV. if (label_DBID.Text != "0") { SetCV(int.Parse(label_DBID.Text)); } string[] pathParts = ((string)button_Add_CV.Tag).Split('\\'); pathParts = pathParts[pathParts.Length - 1].Split('.'); if (pathParts[pathParts.Length - 1] == "pdf") { //the file is a pdf file PDF_CV_Viewer.src = (string)button_Add_CV.Tag; } else { //the file is a docx file. open it with a word program. PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.Update(); try { Process.Start((string)button_Add_CV.Tag); } catch { } } button_Add_CV.BackColor = Color.Green; button_Add_CV.Text = "ישנם קורות חיים"; return; } } }
private void NomineeToForm(Nominee nominee) { if (nominee != null) { SetLastChangedTextbox(nominee.DBId); label_ShowDisabled.Visible = nominee.Disabled; textBox_FirstName.Text = nominee.FirstName; textBox_LastName.Text = nominee.LastName; textBox_ID.Text = nominee.Id; textBox_Email.Text = nominee.Email; textBox_BirthYear.Text = nominee.BirthYear.ToString(); comboBox_CellAreaCode.Text = nominee.CellAreaCode; textBox_Cel.Text = nominee.CellPhone; comboBox_City.SelectedValue = nominee.City.Id; checkBox_Sex.Checked = nominee.Male; PositionNomineeArr positionNomineeArr = new PositionNomineeArr(); positionNomineeArr.Fill(); positionNomineeArr = positionNomineeArr.Filter(nominee, Position.Empty); PositionArr positionArr = positionNomineeArr.ToPositionArr(); textBox_Positions.Tag = positionArr; SetPositionTextBoxAndToolTip(positionArr); //scores button_OpenScoreKeeping.Enabled = true; //end scores label_DBID.Text = nominee.DBId.ToString(); (string path, string type)cv = GetCV(nominee.DBId); if (cv.path != "") { button_Add_CV.BackColor = Color.Green; button_Add_CV.Text = "ישנם קורות חיים"; button_Add_CV.Tag = cv.path; //there is a cv file if (cv.type == "pdf") { //the file is a pdf file PDF_CV_Viewer.src = cv.path; } else { //the file is a docx file. open it with a word program. PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.Update(); try { Process.Start(cv.path); } catch { } } } else { //there is no file button_Add_CV.Text = "הוסף קורות חיים"; button_Add_CV.BackColor = SystemColors.ButtonFace; button_Add_CV.UseVisualStyleBackColor = true; PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.Update(); } } else { comboBox_City.SelectedItem = null; textBox_Positions.Tag = new PositionArr(); SetPositionTextBoxAndToolTip(textBox_Positions.Tag as PositionArr); checkBox_Sex.Checked = false; //Reset the text and flags of the input fields. foreach (Control item in groupBox_PD.Controls) { if (item is TextBox || item is ComboBox) { item.Text = ""; if (item.Name != "textBox_Last_Change") { item.BackColor = Color.White; } } } PDF_CV_Viewer.BeginInit(); PDF_CV_Viewer.src = null; PDF_CV_Viewer.src = GetCV(0).path; PDF_CV_Viewer.EndInit(); PDF_CV_Viewer.Update(); button_Add_CV.Tag = GetCV(0).path; button_Add_CV.Text = "הוסף קורות חיים"; button_Add_CV.BackColor = SystemColors.ButtonFace; button_Add_CV.UseVisualStyleBackColor = true; label_ShowDisabled.Visible = false; //scores button_OpenScoreKeeping.Enabled = false; //end scores label_DBID.Text = "0"; } }