private void btnDelete_Click(object sender, EventArgs e) { if (lstCdName.SelectedIndex >= 0) { DialogResult Ask = MessageBox.Show("Are you sure to delete Cd Bailment (" + lstCdName.SelectedItem.ToString() + ") of Bailment list?", "Program library", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2); if (Ask == DialogResult.No) { txtSearchCdName.Focus(); txtSearchCdName.SelectAll(); return; } else if (Ask == DialogResult.Yes) { Form1.arrCdBailment.Remove(lstCdName.SelectedItem.ToString()); Hashtable ReadC = new Hashtable(); // Read All Form1.arrCdInfo ReadC.Add(lstCdName.SelectedItem.ToString(), Form1.arrCdInfo[lstCdName.SelectedItem.ToString()]); CdInfo ReWriteC = new CdInfo(); Form1.SavedCdInfo = false; foreach (CdInfo re in ReadC.Values) { ReWriteC = re; } ReWriteC.Bailment = "false"; Form1.arrCdInfo.Remove(lstCdName.SelectedItem.ToString()); Form1.arrCdInfo.Add(ReWriteC.CdName, ReWriteC); txtSearchCdName.AutoCompleteCustomSource.Remove(lstCdName.SelectedItem.ToString()); lstCdName.Items.Remove(lstCdName.SelectedItem.ToString()); ClearText(); return; } } }
private void btnSearch_Click(object sender, EventArgs e) { if (lstSearch.SelectedIndex >= 0) { if (txtType.ForeColor != Color.Black) { txtCDName.ForeColor = Color.Black; txtDateOfWrite.ForeColor = Color.Black; txtSpecifications.ForeColor = Color.Black; txtType.ForeColor = Color.Black; txtNumber.ForeColor = Color.Black; txtBailment.ForeColor = Color.Black; txtDateOfBailment.ForeColor = Color.Black; } // Clear All Pic --\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/ picDataCd.Visible = false; picDataDvd.Visible = false; picDriver.Visible = false; picFloppyDisk.Visible = false; picFloppyZipDisk.Visible = false; picMultimediaCd.Visible = false; picMultimediaDvd.Visible = false; picMusicCd.Visible = false; picMusicDvd.Visible = false; picOtherCD.Visible = false; picOtherCdRw.Visible = false; picOtherDvd.Visible = false; picOtherDvdRw.Visible = false; picPictureCd.Visible = false; picPictureDvd.Visible = false; picVideoCd.Visible = false; picVideoDvd.Visible = false; picWindows.Visible = false; //--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/ string bufferName = lstSearch.SelectedItem.ToString(); CdInfo Read = (CdInfo)Form1.arrCdInfo[bufferName]; SelectTypePic(Read.Type); txtCDName.Text = Read.CdName; txtDateOfWrite.Text = Read.DateOfCd; txtNumber.Text = Read.NumberOfCd; txtSpecifications.Text = Read.Specifications; txtType.Text = Read.Type; if (string.Compare(Read.Bailment, "true", true) == 0) { CdBailment BRead = (CdBailment)Form1.arrCdBailment[bufferName]; txtBailment.Text = "Yes (By: " + BRead.BailmentName + ")"; txtDateOfBailment.Text = BRead.DateOfBailment; } else { txtBailment.Text = "No"; txtDateOfBailment.Text = "-- -- --"; } } else { return; } }
private void SearchTN() { if (Form1.arrCdInfo.ContainsKey(txtCdName.Text) == true) { CdInfo readInfo = (CdInfo)Form1.arrCdInfo[txtCdName.Text]; combType.Text = readInfo.Type; combNumber.Text = readInfo.NumberOfCd; return; } else { combType.Text = "CD - DVD نوع"; combNumber.Text = "CD - DVD تعداد"; MessageBox.Show("Not found (" + txtCdName.Text + ")!", "Error Not Found"); txtCdName.Focus(); txtCdName.SelectAll(); return; } }
private void btnDelete_Click(object sender, EventArgs e) { StatusText = "Ready"; CdInfo ReadOnly = (CdInfo)Form1.arrCdInfo[txtCdName.Text]; DialogResult RemoveIt = MessageBox.Show("Are you sure to delete " + ReadOnly.Type + " (" + ReadOnly.CdName + ") of Club?", "Delete CD - DVD", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (RemoveIt == DialogResult.Yes) { Form1.SavedCdInfo = false; txtCdName.AutoCompleteCustomSource.Remove(ReadOnly.CdName); Form1.arrCdInfo.Remove(ReadOnly.CdName); ClearText(); StatusText = "Removed (" + ReadOnly.CdName + ") of CD - DVD Club Successfuly ..."; return; } else { return; } }
private void btnAdd_Click(object sender, EventArgs e) { progressBar1.Visible = true; Thread.Sleep(100); if (txtCDName.Text == "DVD یا CD نام" || txtSpecifications.Text == "CD - DVD مشخصات و خصوصیات" || combNumber.Text == "CD - DVD تعداد" || combType.Text == "CD - DVD نوع") { progressBar1.Value = 100; MessageBox.Show("Please Fill the All Textbox", "TextBox Empty Error", MessageBoxButtons.OK , MessageBoxIcon.Error); StatusText = "TextBox Empty Error"; } else { // Check comboBox combNumber.Text --=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= Boolean FindNumber = false; foreach (string readN in strNumberCombo) { if (readN == combNumber.Text) { FindNumber = true; break; } } if (FindNumber == false) { progressBar1.Value = 98; MessageBox.Show("Please Enter or Seletct Correct Text of Combo Box!", "Error Not Found Correct Text"); StatusText = "Error Not Found Correct Text"; progressBar1.Visible = false; combNumber.Focus(); combNumber.SelectAll(); return; } // --=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= // // Check combBox combType.Text --=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-- Boolean FindType = false; foreach (string readT in strTypeCombo) { if (readT == combType.Text) { FindType = true; break; } } if (FindType == false) { progressBar1.Value = 98; MessageBox.Show("Please Enter or Seletct Correct Text of Combo Box!", "Error Not Found Correct Text"); StatusText = "Error Not Found Correct Text"; progressBar1.Visible = false; combType.Focus(); combType.SelectAll(); return; } // --=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= Thread.Sleep(80); progressBar1.Value = 1; CdInfo Fill = new CdInfo(); Thread.Sleep(80); progressBar1.Value = 10; // Search Repeat CD Name --------------------------------------- string re = txtCDName.Text; if (Form1.arrCdInfo.Count != 0) { while (true) { if (Form1.arrCdInfo.ContainsKey(re) == true) { re += " "; } else { break; } } } Fill.CdName = re; //---------------------------------------------------------------- Thread.Sleep(80); progressBar1.Value = 20; Fill.Specifications = txtSpecifications.Text; //---------------------------------------------------------------- Thread.Sleep(80); progressBar1.Value = 30; Fill.Type = combType.Text; progressBar1.Value = 40; Thread.Sleep(80); progressBar1.Value = 55; Fill.NumberOfCd = combNumber.Text; progressBar1.Value = 60; Thread.Sleep(80); Fill.DateOfCd = datePickerCdAdd.Value.ToLongDateString(); progressBar1.Value = 70; Fill.Bailment = "false"; Form1.SavedCdInfo = false; Thread.Sleep(80); progressBar1.Value = 80; Form1.arrCdInfo.Add(Fill.CdName, Fill); ClearText(); Thread.Sleep(100); progressBar1.Value = 100; StatusText = ("The new " + Fill.Type + " added to Club"); } Thread.Sleep(100); progressBar1.Visible = false; }
public void ReadListBox() { if (lstDisplay.SelectedIndex >= 0) { // Clear All CheckBox .................................................................... chbDriver.Enabled = false; chbDriver.Checked = false; chbDataCd.Enabled = false; chbDataCd.Checked = false; chbDataDvd.Enabled = false; chbDataDvd.Checked = false; chbFloppyDisk.Enabled = false; chbFloppyDisk.Checked = false; chbFloppyZipDisk.Enabled = false; chbFloppyZipDisk.Checked = false; chbMultimediaCd.Enabled = false; chbMultimediaCd.Checked = false; chbMultimediaDvd.Enabled = false; chbMultimediaDvd.Checked = false; chbMusicCd.Enabled = false; chbMusicCd.Checked = false; chbMusicDvd.Enabled = false; chbMusicDvd.Checked = false; chbOtherCD.Enabled = false; chbOtherCD.Checked = false; chbOtherCdRw.Enabled = false; chbOtherCdRw.Checked = false; chbOtherDvd.Enabled = false; chbOtherDvd.Checked = false; chbOtherDvdRw.Enabled = false; chbOtherDvdRw.Checked = false; chbPictureCd.Enabled = false; chbPictureCd.Checked = false; chbPictureDvd.Enabled = false; chbPictureDvd.Checked = false; chbVideoCd.Enabled = false; chbVideoCd.Checked = false; chbVideoDvd.Enabled = false; chbVideoDvd.Checked = false; chbWindows.Enabled = false; chbWindows.Checked = false; //........................................................................................ CdInfo objInfo = SelectedCD; Hashtable read = new Hashtable(); read.Add(objInfo.CdName, Form1.arrCdInfo[objInfo.CdName]); txtCDName.ForeColor = Color.Black; txtSpecifications.ForeColor = Color.Black; txtNumber.ForeColor = Color.Black; txtType.ForeColor = Color.Black; txtDateOfWrite.ForeColor = Color.Black; txtBailment.ForeColor = Color.Black; foreach (CdInfo fill in read.Values) { txtCDName.Text = fill.CdName; txtSpecifications.Text = fill.Specifications; txtNumber.Text = fill.NumberOfCd; txtType.Text = fill.Type; SelectTypePic(fill.Type); txtDateOfWrite.Text = fill.DateOfCd; if (string.Compare(fill.Bailment, "true", true) == 0) { Hashtable readB = new Hashtable(); readB.Add(fill.CdName, Form1.arrCdBailment[fill.CdName]); foreach (CdBailment fillB in readB.Values) { txtBailment.Text = "Yes (By: " + fillB.BailmentName + ")"; } } else { txtBailment.Text = "No"; } } } }
public void LoadCD() { // Load CdInfo string[] LcName, LcDate, LcNumberCd, LcType, LcSpecifications, LcB; // LcB ==> Load cd Bailment. LcName = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCName.sys")); LcDate = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCDate.sys")); LcNumberCd = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCNumberCd.sys")); LcType = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCType.sys")); LcSpecifications = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCSpecifications.sys")); LcB = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCdBailment.sys")); long i = LcName.LongCount() - 1; for (; i >= 0; i--) { CdInfo Copy = new CdInfo(); Copy.CdName = LcName[i]; Copy.DateOfCd = LcDate[i]; Copy.NumberOfCd = LcNumberCd[i]; Copy.Specifications = LcSpecifications[i]; Copy.Type = LcType[i]; Copy.Bailment = LcB[i]; if (Form1.arrCdInfo.Contains(Copy.CdName) == false) { Form1.arrCdInfo.Add(Copy.CdName, Copy); } else { DialogResult returnE = MessageBox.Show("The CD by Name (" + Copy.CdName + ") Already is Exist in Club!" + "\nAre you to continue Import other CDs of patch (" + Form1.patchCD + ") ?", "Error Repeat in Import Data" , MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (returnE == DialogResult.No) { return; } else if (returnE == DialogResult.Yes) { continue; } } } // Show In ListBox foreach (CdInfo name in Form1.arrCdInfo.Values) { lstDisplay.Items.Add(name); } // Load Cd Bailment string[] LcBName, LcBDate, LcBType, LcBCdNumber, LcBCdName; // LcBCdName ==> Load cd Bailment Cd Name LcBName = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCBName.sys")); LcBDate = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCBDate.sys")); LcBType = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCBType.sys")); LcBCdName = System.IO.File.ReadAllLines((Form1.patchCD + @"\BehzadCBCdName.sys")); LcBCdNumber = File.ReadAllLines((Form1.patchCD + @"\BehzadCBNumberCd.sys")); i = LcBName.LongCount() - 1; for (; i >= 0; i--) { CdBailment Copy = new CdBailment(); Copy.BailmentName = LcBName[i]; Copy.CdName = LcBCdName[i]; Copy.DateOfBailment = LcBDate[i]; Copy.BailmentCdType = LcBType[i]; Copy.NumberCd = LcBCdNumber[i]; if (Form1.arrCdBailment.Contains(Copy.CdName) == false) { Form1.arrCdBailment.Add(Copy.CdName, Copy); } else { DialogResult returnE = MessageBox.Show("The Bailment CD by Name (" + Copy.CdName + ") Already is Exist in Bailment Club!" + "\nAre you to continue Import other CDs of patch (" + Form1.patchCD + ") ?", "Error Repeat in Import Data" , MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (returnE == DialogResult.No) { return; } else if (returnE == DialogResult.Yes) { continue; } } } }
private void btnAdd_Click(object sender, EventArgs e) { if (txtFullUserName.Text == "" || txtFullUserName.Text == "نام کامل امانت گیرنده") { MessageBox.Show("Full Bailment User Name TextBox is Empty! \nPlease Fill it.", "Error TextBox Empty"); AddOk.Visible = false; picError.Visible = true; txtFullUserName.Focus(); txtFullUserName.SelectAll(); return; } else if (txtNumberCd.Text == "" || txtNumberCd.Text == "CD - DVD تعداد") { MessageBox.Show("Number CD - DVD TextBox is Empty! \nPlease Fill it.", "Error TextBox Empty"); AddOk.Visible = false; picError.Visible = true; txtNumberCd.Focus(); txtNumberCd.SelectAll(); return; } else if (combCdName.Text == "" || combCdName.Text == "CD - DVD نام") { MessageBox.Show("CD - DVD Name TextBox is Empty! \nPlease Fill it.", "Error TextBox Empty"); AddOk.Visible = false; picError.Visible = true; combCdName.Focus(); combCdName.SelectAll(); return; } else if (txtTypeCd.Text == "CD - DVD نوع") { DialogResult R = MessageBox.Show("Please Search CD - DVD Type by your CD - DVD Name, Fill Button!" + "Press Rerty Button to Search it , Etc Click On Cancel", "Error TextBox Empty" , MessageBoxButtons.RetryCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (R == DialogResult.Retry) { SearchTypeCD(); } else if (R == DialogResult.Cancel) { AddOk.Visible = false; picError.Visible = true; combCdName.Focus(); return; } } //------------------------------------------------------------------------------------------------------------------------------------- // No Error go Add -> else { //--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/-- // Find Correctly Number of CD - DVD in TextBox Number CD - DVD Boolean FindNumber = false; foreach (string readN in FormAddC.strNumberCombo) { if (readN == txtNumberCd.Text) { FindNumber = true; break; } } if (FindNumber != true) { MessageBox.Show("The Number of CD - DVD is Not Correct! \n Please Change it.", "Warning Not Found Correctly Number Of CD - DVD" , MessageBoxButtons.OK, MessageBoxIcon.Warning); AddOk.Visible = false; picError.Visible = true; txtNumberCd.Focus(); txtNumberCd.SelectAll(); return; } //--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/--\|/-- // //================================================================================================= //Search the correct CD - DVD Name of Form1.arrCdInfo if (Form1.arrCdInfo.ContainsKey(combCdName.Text) == true) { Hashtable write = new Hashtable(); write.Add(combCdName.Text, Form1.arrCdInfo[combCdName.Text]); CdInfo ChangeData = new CdInfo(); foreach (CdInfo reW in write.Values) { if (reW.Bailment == "false") { if (txtTypeCd.Text == reW.Type) { Form1.SavedCdInfo = false; CdBailment AddC = new CdBailment(); AddC.NumberCd = txtNumberCd.Text; AddC.BailmentName = txtFullUserName.Text; AddC.DateOfBailment = dateTimePicker1.Value.ToLongDateString(); AddC.CdName = reW.CdName; AddC.BailmentCdType = reW.Type; ChangeData = reW; ChangeData.Bailment = "true"; Form1.arrCdInfo.Remove(ChangeData.CdName); Form1.arrCdInfo.Add(ChangeData.CdName, ChangeData); Form1.arrCdBailment.Add(AddC.CdName, AddC); picError.Visible = false; AddOk.Visible = true; ClearText(false); return; } else { DialogResult S = MessageBox.Show("Your CD - DVD Name no Match by Type CD - DVD!" + "\nPlease Press Ok to Search Again Etc press Cancel", "Error No Matching Entered Data" , MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (S == DialogResult.OK) { SearchTypeCD(); } else { combCdName.Focus(); combCdName.SelectAll(); } AddOk.Visible = false; picError.Visible = true; return; } } else { MessageBox.Show("Your CD - DVD Already is Exist in Bailment List", "Warning Already Exist" , MessageBoxButtons.OK, MessageBoxIcon.Warning); AddOk.Visible = false; picError.Visible = true; txtFullUserName.Focus(); txtFullUserName.SelectAll(); return; } } } else { MessageBox.Show("Not Found Any CD - DVD for your CD - DVD Name Please Change it.", "Error Not Found" , MessageBoxButtons.OK, MessageBoxIcon.Stop); AddOk.Visible = false; picError.Visible = true; return; } //================================================================================================= } }
private void btnSearch_Click(object sender, EventArgs e) { if (txtCdName.Text == "" || txtCdName.Text == "CD - DVD نام") { MessageBox.Show("CD - DVD Name TextBox is Empty!", "Error TextBox Empty", MessageBoxButtons.OK , MessageBoxIcon.Error); StatusText = "TextBox CD - DVD Name is Empty ..."; txtCdName.Focus(); txtCdName.SelectAll(); return; } else if (combType.Text == "" || combType.Text == "CD - DVD نوع") { MessageBox.Show("ComboBox Type of CD - DVD is Empty \nPlease Fill it!", "Error ComboBox Empty" , MessageBoxButtons.OK, MessageBoxIcon.Error); StatusText = "ComboBox Type of CD - DVD is Empty ..."; combType.Focus(); combType.SelectAll(); return; } else if (combNumber.Text == "" || combNumber.Text == "CD - DVD تعداد") { MessageBox.Show("ComboBox Number of CD - DVD is Empty \nPlease Fill it!", "Error ComboBox Empty" , MessageBoxButtons.OK, MessageBoxIcon.Error); StatusText = "ComboBox Number of CD - DVD is Empty ..."; combNumber.Focus(); combNumber.SelectAll(); return; } else { if (Form1.arrCdInfo.ContainsKey(txtCdName.Text) != true) { MessageBox.Show("Not found any CD or DVD for your CD - DVD Name!", "Error Not Found" , MessageBoxButtons.OK, MessageBoxIcon.Error); StatusText = "TextBox CD - DVD Name is not Correct ..."; txtCdName.Focus(); txtCdName.SelectAll(); return; } else if (Form1.arrCdInfo.ContainsKey(txtCdName.Text) == true) { CdInfo ReadOnly = (CdInfo)Form1.arrCdInfo[txtCdName.Text]; if (string.Compare(ReadOnly.Type, combType.Text, true) == 0) { if (string.Compare(ReadOnly.NumberOfCd, combNumber.Text, true) == 0) { StatusText = "Search Successfuly Find (" + ReadOnly.CdName + ") of CD - DVD Club ..."; picFind.Visible = true; btnDelete.Visible = true; btnDelete.Focus(); btnDelete.Select(); return; } else { MessageBox.Show("CD - DVD Name No Matching by your Number of CD - DVD!", "Warning No Matching" , MessageBoxButtons.OK, MessageBoxIcon.Warning); StatusText = "No Matching CD - DVD Name by Number of CD - DVD ..."; combNumber.Focus(); combNumber.SelectAll(); return; } } else { MessageBox.Show("CD - DVD Name No Matching by your Type of CD - DVD!", "Warning No Matching" , MessageBoxButtons.OK, MessageBoxIcon.Warning); StatusText = "No Matching CD - DVD Name by Type of CD - DVD ..."; combType.Focus(); combType.SelectAll(); return; } } } }