private void SaveBt_Click(object sender, EventArgs e) { if (ComboCentral.Text == string.Empty || ComboCabina.Text == string.Empty || DPNumber.Text == string.Empty || AreaDP.Text == string.Empty) { if (ComboCentral.Text == string.Empty) { MessageBox.Show("اختار السنترال", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (ComboCabina.Text == string.Empty) { MessageBox.Show("اختار الكابينة", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (DPNumber.Text == string.Empty) { MessageBox.Show("حدد رقم البكس", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (AreaDP.Text == string.Empty) { MessageBox.Show("ادخل عنوان البكس", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { try { string dpGeneral = Numcent.ToString() + ComboCabina.Text + DPNumber.Text; var DBonWork = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase); DB.DP SaveDP = new DB.DP { IDcabina = Numcabina, Area = AreaDP.Text.Trim(), DPNumber = DPNumber.Text.Trim(), DPGeneral = dpGeneral }; DBonWork.DPs.InsertOnSubmit(SaveDP); DBonWork.SubmitChanges(); MyList.Add(DPNumber.Text.Trim()); AreaDP.Clear(); DPNumber.Clear(); DPNumber.Focus(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void ComboCabina_SelectedIndexChanged(object sender, EventArgs e) { Numcabina = pr.CabinaExisting(ComboCabina.Text); MyList.Clear(); var DBonWork = new DB.SmartCentralDB(Properties.Settings.Default.ConctToDataBase); var SelecDP = (from D in DBonWork.DPs where D.IDcabina == Numcabina select D.DPNumber).Distinct(); if (SelecDP.Count() > 0) { foreach (var item in SelecDP) { MyList.Add(item); } } DPNumber.Focus(); }
private void DPNumber_Validated(object sender, EventArgs e) { if (ComboCentral.Text == string.Empty || ComboCabina.Text == string.Empty || DPNumber.Text == string.Empty) { ComboCentral.Focus(); } else { if (vrify(pr.ReturnUpperString(DPNumber.Text))) { MessageBox.Show("البكس موجود بالفعل", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error); DPNumber.Clear(); DPNumber.Focus(); } else { AreaDP.Focus(); } } }