private void CabinaCabel_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (button1.Text == "حفظ") { if (combocent.Text == string.Empty || CabinaCabel.Text == string.Empty || ComboType.Text == string.Empty) { combocent.Focus(); } else { if (vrify(pr.ReturnUpperString(CabinaCabel.Text))) { MessageBox.Show("الكبينة موجودة بالفعل", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); CabinaCabel.Focus(); CabinaCabel.SelectionStart = 0; CabinaCabel.SelectionLength = CabinaCabel.Text.Length; } else { tetarea.Focus(); } } } } }
private void ODU_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { CabinaCabel.Focus(); } }
private void button1_Click(object sender, EventArgs e) { var DBonWork = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase); try { if (button1.Text == "حفظ") { if (combocent.Text == string.Empty || ComboType.Text == string.Empty || CabinaCabel.Text == string.Empty || tetarea.Text == string.Empty) { MessageBox.Show("يجب ملئ الحقول اولا", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); combocent.Focus(); } else { DB.Cabina SaveCabina = new DB.Cabina { IDCable = NumCabel, CABINA = CabinaCabel.Text, Area = tetarea.Text.Trim(), CabinaGeneral = NumCentral.ToString() + CabinaCabel.Text, ODU = ODU.Text }; DBonWork.Cabinas.InsertOnSubmit(SaveCabina); DBonWork.SubmitChanges(); MyList.Add(NumCentral.ToString() + CabinaCabel.Text); tetarea.Clear(); CabinaCabel.Focus(); CabinaCabel.SelectionStart = 0; CabinaCabel.SelectionLength = CabinaCabel.Text.Length; } } if (button1.Text == "تحديث") { NumCabel = pr.CabelExisting(ComboType.Text); pr.Update_Cabinas(NumCabina, NumCabel, tetarea.Text, ODU.Text); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ComboType_SelectedIndexChanged(object sender, EventArgs e) { NumCabel = pr.CabelExisting(ComboType.Text.Trim()); if (ComboType.Text.Contains("M")) { ODU.Size = new System.Drawing.Size(51, 20); label6.Text = "ODU"; label5.Text = "Msan"; ODU.Clear(); ODU.Focus(); } else { ODU.Clear(); ODU.Size = new System.Drawing.Size(0, 0); label6.Text = ""; label5.Text = "كابل"; CabinaCabel.Focus(); } }
private void ComboType_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && ComboType.Text != string.Empty) { NumCabel = pr.CabelExisting(NumCentral.ToString() + ComboType.Text); if (ComboType.Text.Contains("M")) { ODU.Size = new System.Drawing.Size(51, 20); label6.Text = "ODU"; label5.Text = "Msan"; ODU.Focus(); } else { ODU.Size = new System.Drawing.Size(0, 0); label6.Text = ""; label5.Text = "كابل"; CabinaCabel.Focus(); } } }