private void NewIssue_CheckedChanged(object sender, EventArgs e) { if (NewIssue.IsChecked.Value) { ProjectControls.Visibility = Visibility.Visible; SummaryControls.Visibility = Visibility.Visible; DescriptionControls.Visibility = Visibility.Visible; IssueIDControls.Visibility = Visibility.Collapsed; SummaryTextBox.SelectAll(); SummaryTextBox.Focus(); } else { ProjectControls.Visibility = Visibility.Collapsed; SummaryControls.Visibility = Visibility.Collapsed; DescriptionControls.Visibility = Visibility.Collapsed; IssueIDControls.Visibility = Visibility.Visible; IssueIDTextBox.SelectAll(); IssueIDTextBox.Focus(); } ValidateData(null, null); }
private void SummaryTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.A) { SummaryTextBox.SelectAll(); } }
private void AppendSummaryText(string strItem, int nNumItems, int nNumBadItems, int nIndentLevel = 0) { string strFormat = ""; for (int i = 0; i < nIndentLevel; i++) { strFormat += " "; } strFormat += "{0:N0} {1}{2} - {3} issue{4}\r\n"; SummaryTextBox.AppendText(string.Format(strFormat, nNumItems, strItem, nNumItems != 1 ? "s" : "", (nNumBadItems == 0) ? "No" : nNumBadItems.ToString() + " minor", nNumBadItems != 1 ? "s" : "")); }
public void PopulateSummaryTextBox() { AppendSummaryText("Manufacturer", m_DataIntegrity.NumManufacturers, m_DataIntegrity.NumBadManufacturers); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Caliber", m_DataIntegrity.NumCalibers, m_DataIntegrity.NumBadCalibers); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Firearm", m_DataIntegrity.NumFirearms, m_DataIntegrity.NumBadFirearms); AppendSummaryText("Usable Cartridge Record", m_DataIntegrity.NumFirearmCalibers, m_DataIntegrity.NumBadFirearmCalibers, 1); AppendSummaryText("Bullet Specific Record", m_DataIntegrity.NumFirearmBullets, m_DataIntegrity.NumBadFirearmBullets, 1); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Ammo Record", m_DataIntegrity.NumAmmo, m_DataIntegrity.NumBadAmmo); AppendSummaryText("Ammo Test", m_DataIntegrity.NumAmmoTests, m_DataIntegrity.NumBadAmmoTests, 1); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Bullet", m_DataIntegrity.NumBullets, m_DataIntegrity.NumBadBullets); AppendSummaryText("Cartridge Specific Data Record", m_DataIntegrity.NumBulletCalibers, m_DataIntegrity.NumBadBulletCalibers, 1); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Case", m_DataIntegrity.NumCases, m_DataIntegrity.NumBadCases); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Powder", m_DataIntegrity.NumPowders, m_DataIntegrity.NumBadPowders); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Primer", m_DataIntegrity.NumPrimers, m_DataIntegrity.NumBadPrimers); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Load", m_DataIntegrity.NumLoads, m_DataIntegrity.NumBadLoads); AppendSummaryText("Charge", m_DataIntegrity.NumCharges, m_DataIntegrity.NumBadCharges, 1); AppendSummaryText("Charge Test", m_DataIntegrity.NumChargeTests, m_DataIntegrity.NumBadChargeTests, 1); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Batch" + (m_DataIntegrity.NumBatches != 1 ? "e" : ""), m_DataIntegrity.NumBatches, m_DataIntegrity.NumBadBatches); AppendSummaryText("Batch Test", m_DataIntegrity.NumBatchTests, m_DataIntegrity.NumBadBatchTests, 1); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Test Shot", m_DataIntegrity.NumTestShots, m_DataIntegrity.NumBadTestShots); SummaryTextBox.AppendText("\r\n"); AppendSummaryText("Inventory Transaction", m_DataIntegrity.NumTransactions, m_DataIntegrity.NumBadTransactions); SummaryTextBox.AppendText("\r\n"); }
private void ButtonStart_Click(object sender, EventArgs e) { string sTemp; string sTemp2; string sParamName; var aParamList = new string[1]; // Dim iTemp As Integer if (string.IsNullOrEmpty(SearchParamTextBox.Text)) { MessageBox.Show("Required define param name for searching", "Required param name", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } sParamName = SearchParamTextBox.Text; OpenFileDialog.InitialDirectory = Environment.CurrentDirectory; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } var inFile = new System.IO.StreamReader(OpenFileDialog.FileName, System.Text.Encoding.Default, true, 1); ProgressBar.Value = 0; ProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); SummaryTextBox.Text = ""; while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); sTemp2 = Libraries.GetNeedParamFromStr(sTemp, sParamName); if (Array.IndexOf(aParamList, sTemp2) == -1 & !string.IsNullOrEmpty(sTemp2)) { Array.Resize(ref aParamList, aParamList.Length + 1); aParamList[aParamList.Length - 1] = sTemp2; SummaryTextBox.AppendText(sTemp2 + Constants.vbNewLine); } ProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); } inFile.Close(); ProgressBar.Value = 0; MessageBox.Show("Searching complete." + Constants.vbNewLine + "Found " + Conversions.ToString(SummaryTextBox.Lines.Length - 1) + " definitions.", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void InsertToFilm() { string query = "INSERT INTO Film (Название, Жанр, Актёры, Режиссёр, Страна, Год, " + "[Целевая аудитория 18+], [Кол-во копий], [Тип носителя], Описание, Продолжительность, Рейтинг, [Язык озвучки]) VALUES ('" + NameOfTheFilmTextBox.Text + "','" + CategoryOfFilmComboBox.Text + "','" + ActorsTextBox.Text + "','" + DirectorTextBox.Text + "','" + ProducingCountryComboBox.Text + "','" + int.Parse(YearOfIssueTextBox.Text) + "','" + FilmForAdultsComboBox.Text + "','" + int.Parse(NumberOfCopiesTextBox.Text) + "','" + TheTypeOfMediaComboBox.Text + "','" + SummaryTextBox.Text + "','" + int.Parse(LengthInMinutes.Text) + "','" + Rating.Text + "','" + LanguagesForVoiceComboBox.Text + "')"; cmd.CommandText = query; cmd.Connection = connection; try { connection.Open(); addFlag = cmd.ExecuteNonQuery(); connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (GetLastId() == -1) { return; } else { for (int i = 1; i <= Convert.ToInt16(NumberOfCopiesTextBox.Text); i++) { InsertToBusyFilmCopy(GetLastId(), i); } } //Проходим по всему ComboBox и достаём FilmId, после этого заполняем таблицу предыдущих частей for (int i = 0; i < listBox.Items.Count; i++) { string [] subStr = listBox.Items[i].ToString().Split('='); int id = Convert.ToInt16(subStr[1]); FillTablePreviousPartsOfFilm(id); comboBox1.Items.Clear(); } CategoryOfFilmComboBox.SelectedIndex = -1; CategoryOfFilmComboBox.Text = "Выберите или введите новый"; NameOfTheFilmTextBox.Clear(); ActorsTextBox.Clear(); DirectorTextBox.Clear(); ProducingCountryComboBox.SelectedIndex = -1; ProducingCountryComboBox.Text = "Выберите"; YearOfIssueTextBox.Clear(); FilmForAdultsComboBox.SelectedIndex = -1; FilmForAdultsComboBox.Text = "Выберите"; NumberOfCopiesTextBox.Clear(); TheTypeOfMediaComboBox.SelectedIndex = -1; TheTypeOfMediaComboBox.Text = "Выберите"; SummaryTextBox.Clear(); LengthInMinutes.Clear(); Rating.Clear(); LanguagesForVoiceComboBox.SelectedIndex = -1; LanguagesForVoiceComboBox.Text = "Выберите"; listBox.Items.Clear(); pictureBox.Image = null; pictureBox1.Image = null; pictureBox2.Image = null; pictureBox3.Image = null; }
private void GetPreviousPartsOfFilm(int FilmId) { string query = "select * FROM Film WHERE Id like '" + FilmId + "%'"; byte[] image = null; byte[] image1 = null; byte[] image2 = null; byte[] image3 = null; try { connection.Open(); SqlCeCommand cmd = new SqlCeCommand(query, connection); SqlCeDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { NameOfTheFilmTextBox.Text = reader["Название"].ToString(); CategoryOfFilmTextBox.Text = reader["Жанр"].ToString(); ActorsTextBox.Text = reader["Актёры"].ToString(); DirectorTextBox.Text = reader["Режиссёр"].ToString(); ProducingCountryTextBox.Text = reader["Страна"].ToString(); YearOfIssueTextBox.Text = reader["Год"].ToString(); FilmForAdultsTextBox.Text = reader["Целевая аудитория 18+"].ToString(); NumberOfCopiesTextBox.Text = reader["Кол-во копий"].ToString(); TheTypeOfMediaTextBox.Text = reader["Тип носителя"].ToString(); SummaryTextBox.Text = reader["Описание"].ToString(); LengthInMinutes.Text = reader["Продолжительность"].ToString(); Rating.Text = reader["Рейтинг"].ToString(); LangForVoiceTextBox.Text = reader["Язык озвучки"].ToString(); try { image = (byte[])reader["Photo1"]; image1 = (byte[])reader["Photo2"]; image2 = (byte[])reader["Photo3"]; image3 = (byte[])reader["Photo4"]; } catch (Exception ex) { MessageBox.Show(ex.Message, "Отсутствует изображение.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (image == null) { pictureBox.Image = null; } else { MemoryStream memoryStream = new MemoryStream(image); pictureBox.Image = Image.FromStream(memoryStream); } if (image1 == null) { pictureBox1.Image = null; } else { MemoryStream memoryStream = new MemoryStream(image1); pictureBox1.Image = Image.FromStream(memoryStream); } if (image2 == null) { pictureBox2.Image = null; } else { MemoryStream memoryStream = new MemoryStream(image2); pictureBox2.Image = Image.FromStream(memoryStream); } if (image3 == null) { pictureBox3.Image = null; } else { MemoryStream memoryStream = new MemoryStream(image3); pictureBox3.Image = Image.FromStream(memoryStream); } } else { CategoryOfFilmTextBox.Clear(); NameOfTheFilmTextBox.Clear(); ActorsTextBox.Clear(); DirectorTextBox.Clear(); ProducingCountryTextBox.Clear(); YearOfIssueTextBox.Clear(); FilmForAdultsTextBox.Clear(); NumberOfCopiesTextBox.Clear(); TheTypeOfMediaTextBox.Clear(); SummaryTextBox.Clear(); LengthInMinutes.Clear(); Rating.Clear(); LangForVoiceTextBox.Clear(); } reader.Close(); connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } Show(); }
private void Button3_Click(object sender, EventArgs e) { SummaryTextBox.Clear(); }