private void TextBoxGroupID_Leave(object sender, EventArgs e) { try { bool Exsists = false; if (_TypeOperation == ClassPublicVar.TypeOperation.Add) { DTGroupID = _ClassSelect.SelectOpration(new string[] { TableTypeAcc.ID, TableTypeAcc.GroupName, TableTypeAcc.NameLng1, TableTypeAcc.IsGroup }, "TableTypeAcc"); if (TextBoxGroupID.Text == "") { } else if (TextBoxGroupID.Text == "0") { TextBoxGroupID.Text = "0"; TextBoxGroupName.Text = "Root"; } else { foreach (DataRow row in DTGroupID.Rows) { if (row[TableTypeAcc.ID].ToString() == TextBoxGroupID.Text) { if (row[TableTypeAcc.IsGroup].ToString() == "0") { MessageBox.Show("لا يمكن الإضافة لفرد"); TextBoxGroupID.Focus(); TextBoxGroupID.Clear(); Exsists = true; } else { TextBoxGroupID.Text = row[TableTypeAcc.ID].ToString(); TextBoxGroupName.Text = row[TableTypeAcc.NameLng1].ToString(); TextBoxNameLng1.Focus(); Exsists = true; break; } } } if (Exsists == false) { MessageBox.Show("غير موجود"); TextBoxGroupID.Clear(); DTGroupID.Clear(); TextBoxGroupID.Focus(); buttonGroupSearch_Click(sender, e); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//public void SearchGroupID(DataTable DTGroupID) //{ // foreach (DataRow row in DtID.Rows) // { // object sss = row[TableCostCenter.ID]; // if (sss = DBNull.Value) // { // MessageBox.Show("غير موجود"); // TextBoxID.Focus(); // break; // } // } //} private void ToolsStatus() { if (_TypeOperation == ClassPublicVar.TypeOperation.Show) { TextBoxID.ReadOnly = true; TextBoxGroupID.ReadOnly = true; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = true; TextBoxNameLng2.ReadOnly = true; ButtonNew.Enabled = true; ButtonEdit.Enabled = true; ButtonSave.Enabled = false; ButtonDelete.Enabled = true; ButtonPrint.Enabled = true; ButtonSearch.Enabled = true; ButtonCancel.Enabled = false; ButtonExit.Enabled = true; TreeViewMain.Enabled = true; RadioBtnGroup.Enabled = false; RadioBtnNotGroup.Enabled = false; buttonGroupSearch.Enabled = false; ButtonLast.Enabled = true; ButtonNext.Enabled = true; ButtonPrevious.Enabled = true; ButtonFirst.Enabled = true; TextBoxID.Clear(); TextBoxGroupID.Clear(); TextBoxGroupName.Clear(); TextBoxNameLng1.Clear(); TextBoxNameLng2.Clear(); } else if (_TypeOperation == ClassPublicVar.TypeOperation.Add) { TextBoxID.ReadOnly = false; TextBoxGroupID.ReadOnly = false; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = false; TextBoxNameLng2.ReadOnly = false; RadioBtnNotGroup.Checked = true; ButtonNew.Enabled = true; ButtonEdit.Enabled = false; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; ButtonPrint.Enabled = false; ButtonSearch.Enabled = false; ButtonCancel.Enabled = true; ButtonExit.Enabled = false; RadioBtnGroup.Enabled = true; RadioBtnNotGroup.Enabled = true; buttonGroupSearch.Enabled = true; TreeViewMain.Enabled = false; ButtonLast.Enabled = false; ButtonNext.Enabled = false; ButtonPrevious.Enabled = false; ButtonFirst.Enabled = false; TextBoxID.Clear(); TextBoxGroupID.Clear(); TextBoxGroupName.Clear(); TextBoxNameLng1.Clear(); TextBoxNameLng2.Clear(); } else if (_TypeOperation == ClassPublicVar.TypeOperation.Edit) { TextBoxID.ReadOnly = true; TextBoxGroupID.ReadOnly = false; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = false; TextBoxNameLng2.ReadOnly = false; ButtonNew.Enabled = false; ButtonEdit.Enabled = false; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; ButtonPrint.Enabled = false; ButtonSearch.Enabled = false; ButtonCancel.Enabled = true; ButtonExit.Enabled = false; RadioBtnGroup.Enabled = true; RadioBtnNotGroup.Enabled = true; buttonGroupSearch.Enabled = true; TreeViewMain.Enabled = false; ButtonLast.Enabled = false; ButtonNext.Enabled = false; ButtonPrevious.Enabled = false; ButtonFirst.Enabled = false; //TextBoxID.Clear(); //TextBoxGroupID.Clear(); //TextBoxGroupName.Clear(); //TextBoxNameLng1.Clear(); //TextBoxNameLng2.Clear(); } }
private void TextBoxGroupID_Leave(object sender, EventArgs e) { try { bool Exsists = false; if (_TypeOperation == ClassPublicVar.TypeOperation.Add) { //DTGroupID = _ClassSelect.SelectOpration(new string[] { TableCostCenter.ID, TableCostCenter.GroupName , TableCostCenter.NameLng1 , TableCostCenter.IsGroup}, "TableCostCenter", new string[] { TableCostCenter.ID }, new string[] { TextBoxGroupID.Text }); DTGroupID = _ClassSelect.SelectOpration(new string[] { TableCostCenter.ID, TableCostCenter.GroupName, TableCostCenter.NameLng1, TableCostCenter.IsGroup }, "TableCostCenter"); //[TableCostCenter.ID].ToString() //if (DTGroupID.Rows[0][TableCostCenter.ID] == DBNull.Value) //if ( DBNull.Value.Equals(DTGroupID.Rows.Count>0)) //{ // MessageBox.Show("غير موجود"); // TextBoxGroupID.Focus(); //} //foreach (DataRow row in DTGroupID.Rows) //{ //object sss = row[TableCostCenter.ID]; // if ( sss == DBNull.Value ) // { // MessageBox.Show("غير موجود"); // TextBoxID.Focus(); // break; // } //} //if (DTGroupID.Rows[0][TableCostCenter.ID].ToString() == "") //{ // MessageBox.Show("غير موجود"); // TextBoxGroupID.Focus(); //} //if (DTGroupID.Rows.Count < 0) //{ // MessageBox.Show("غير موجود"); // TextBoxGroupID.Focus(); //} if (TextBoxGroupID.Text == "") { } else if (TextBoxGroupID.Text == "0") { TextBoxGroupID.Text = "0"; TextBoxGroupName.Text = "Root"; } else { foreach (DataRow row in DTGroupID.Rows) { if (row[TableCostCenter.ID].ToString() == TextBoxGroupID.Text) { //MessageBox.Show("موجود مسبقا"); //TextBoxID.Focus(); //m = true; if (row[TableCostCenter.IsGroup].ToString() == "0") { MessageBox.Show("لا يمكن الإضافة"); TextBoxGroupID.Focus(); TextBoxGroupID.Clear(); Exsists = true; } else { TextBoxGroupID.Text = row[TableCostCenter.ID].ToString(); TextBoxGroupName.Text = row[TableCostCenter.NameLng1].ToString(); Exsists = true; break; } } } //if (TextBoxGroupID.Text == DTGroupID.Rows[0][TableCostCenter.ID].ToString()) // { // TextBoxGroupID.Text = DTGroupID.Rows[0][TableCostCenter.ID].ToString(); // TextBoxGroupName.Text = DTGroupID.Rows[0][TableCostCenter.NameLng1].ToString(); // } //else if (DTGroupID.Rows[0][TableCostCenter.IsGroup].ToString() == "0") //{ // MessageBox.Show("لا يمكن إضافة"); // TextBoxGroupID.Focus(); //} if (Exsists == false) { //m = true; MessageBox.Show("غير موجود"); TextBoxGroupID.Clear(); DTGroupID.Clear(); TextBoxGroupID.Focus(); buttonGroupSearch_Click(sender, e); } //else //{ // MessageBox.Show("غير موجود"); // TextBoxGroupID.Focus(); //} } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ToolsStatus() { if (_TypeOperation == ClassPublicVar.TypeOperation.Show) { TextBoxMainID.ReadOnly = true; TextBoxMainName.ReadOnly = true; TextBoxID.ReadOnly = true; TextBoxGroupID.ReadOnly = true; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = true; TextBoxNameLng2.ReadOnly = true; TextBoxPhone.ReadOnly = true; TextBoxeFax.ReadOnly = true; TextBoxAddress.ReadOnly = true; TextBoxRentStartDate.ReadOnly = true; TextBoxRentEndDate.ReadOnly = true; TextBoxCrNO.ReadOnly = true; TextBoxCrLssDate.ReadOnly = true; TextBoxCrExpDate.ReadOnly = true; TextBoxMunicp.ReadOnly = true; TextBoxMunicpLssDate.ReadOnly = true; TextBoxMunicpExpDate.ReadOnly = true; TxtBoxAdvocatteship.ReadOnly = true; TxtBoxAdvocatteshipLssDate.ReadOnly = true; TxtBoxAdvocatteshipExpDate.ReadOnly = true; ButtonNew.Enabled = true; ButtonEdit.Enabled = true; ButtonSave.Enabled = false; ButtonDelete.Enabled = true; ButtonPrint.Enabled = true; ButtonSearch.Enabled = true; ButtonCancel.Enabled = false; ButtonExit.Enabled = true; TreeViewMain.Enabled = true; RadioBtnGroup.Enabled = false; RadioBtnNotGroup.Enabled = false; buttonGroupSearch.Enabled = false; ButtonLast.Enabled = true; ButtonNext.Enabled = true; ButtonPrevious.Enabled = true; ButtonFirst.Enabled = true; TextBoxMainID.Clear(); TextBoxMainName.Clear(); TextBoxID.Clear(); TextBoxGroupID.Clear(); TextBoxGroupName.Clear(); TextBoxNameLng1.Clear(); TextBoxNameLng2.Clear(); TextBoxPhone.Clear(); TextBoxeFax.Clear(); TextBoxAddress.Clear(); TextBoxRentStartDate.Clear(); TextBoxRentEndDate.Clear(); TextBoxCrNO.Clear(); TextBoxCrLssDate.Clear(); TextBoxCrExpDate.Clear(); TextBoxMunicp.Clear(); TextBoxMunicpLssDate.Clear(); TextBoxMunicpExpDate.Clear(); TxtBoxAdvocatteship.Clear(); TxtBoxAdvocatteshipLssDate.Clear(); TxtBoxAdvocatteshipExpDate.Clear(); } else if (_TypeOperation == ClassPublicVar.TypeOperation.Add) { TextBoxMainID.ReadOnly = false; TextBoxMainName.ReadOnly = false; TextBoxID.ReadOnly = false; TextBoxGroupID.ReadOnly = false; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = false; TextBoxNameLng2.ReadOnly = false; TextBoxPhone.ReadOnly = false; TextBoxeFax.ReadOnly = false; TextBoxAddress.ReadOnly = false; TextBoxRentStartDate.ReadOnly = false; TextBoxRentEndDate.ReadOnly = false; TextBoxCrNO.ReadOnly = false; TextBoxCrLssDate.ReadOnly = false; TextBoxCrExpDate.ReadOnly = false; TextBoxMunicp.ReadOnly = false; TextBoxMunicpLssDate.ReadOnly = false; TextBoxMunicpExpDate.ReadOnly = false; TxtBoxAdvocatteship.ReadOnly = false; TxtBoxAdvocatteshipLssDate.ReadOnly = false; TxtBoxAdvocatteshipExpDate.ReadOnly = false; RadioBtnNotGroup.Checked = true; ButtonNew.Enabled = true; ButtonEdit.Enabled = false; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; ButtonPrint.Enabled = false; ButtonSearch.Enabled = false; ButtonCancel.Enabled = true; ButtonExit.Enabled = false; TreeViewMain.Enabled = false; RadioBtnGroup.Enabled = true; RadioBtnNotGroup.Enabled = true; buttonGroupSearch.Enabled = true; ButtonLast.Enabled = false; ButtonNext.Enabled = false; ButtonPrevious.Enabled = false; ButtonFirst.Enabled = false; TextBoxMainID.Clear(); TextBoxMainName.Clear(); TextBoxID.Clear(); TextBoxGroupID.Clear(); TextBoxGroupName.Clear(); TextBoxNameLng1.Clear(); TextBoxNameLng2.Clear(); TextBoxPhone.Clear(); TextBoxeFax.Clear(); TextBoxAddress.Clear(); TextBoxRentStartDate.Clear(); TextBoxRentEndDate.Clear(); TextBoxCrNO.Clear(); TextBoxCrLssDate.Clear(); TextBoxCrExpDate.Clear(); TextBoxMunicp.Clear(); TextBoxMunicpLssDate.Clear(); TextBoxMunicpExpDate.Clear(); TxtBoxAdvocatteship.Clear(); TxtBoxAdvocatteshipLssDate.Clear(); TxtBoxAdvocatteshipExpDate.Clear(); } else if (_TypeOperation == ClassPublicVar.TypeOperation.Edit) { TextBoxMainID.ReadOnly = false; TextBoxMainName.ReadOnly = false; TextBoxID.ReadOnly = true; TextBoxGroupID.ReadOnly = false; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = false; TextBoxNameLng2.ReadOnly = false; TextBoxPhone.ReadOnly = false; TextBoxeFax.ReadOnly = false; TextBoxAddress.ReadOnly = false; TextBoxRentStartDate.ReadOnly = false; TextBoxRentEndDate.ReadOnly = false; TextBoxCrNO.ReadOnly = false; TextBoxCrLssDate.ReadOnly = false; TextBoxCrExpDate.ReadOnly = false; TextBoxMunicp.ReadOnly = false; TextBoxMunicpLssDate.ReadOnly = false; TextBoxMunicpExpDate.ReadOnly = false; TxtBoxAdvocatteship.ReadOnly = false; TxtBoxAdvocatteshipLssDate.ReadOnly = false; TxtBoxAdvocatteshipExpDate.ReadOnly = false; ButtonNew.Enabled = false; ButtonEdit.Enabled = false; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; ButtonPrint.Enabled = false; ButtonSearch.Enabled = false; ButtonCancel.Enabled = true; ButtonExit.Enabled = false; TreeViewMain.Enabled = false; RadioBtnGroup.Enabled = true; RadioBtnNotGroup.Enabled = true; buttonGroupSearch.Enabled = true; ButtonLast.Enabled = false; ButtonNext.Enabled = false; ButtonPrevious.Enabled = false; ButtonFirst.Enabled = false; //TextBoxMainID.Clear(); //TextBoxMainName.Clear(); //TextBoxID.Clear(); //TextBoxGroupID.Clear(); //TextBoxGroupName.Clear(); //TextBoxNameLng1.Clear(); //TextBoxNameLng2.Clear(); //TextBoxPhone.Clear(); //TextBoxeFax.Clear(); //TextBoxAddress.Clear(); //TextBoxRentStartDate.Clear(); //TextBoxRentEndDate.Clear(); //TextBoxCrNO.Clear(); //TextBoxCrLssDate.Clear(); //TextBoxCrExpDate.Clear(); //TextBoxMunicp.Clear(); //TextBoxMunicpLssDate.Clear(); //TextBoxMunicpExpDate.Clear(); //TxtBoxAdvocatteship.Clear(); //TxtBoxAdvocatteshipLssDate.Clear(); //TxtBoxAdvocatteshipExpDate.Clear(); } }
private void ToolsStatus() { if (_TypeOperation == ClassPublicVar.TypeOperation.Show) { TextBoxID.ReadOnly = true; TextBoxGroupID.ReadOnly = true; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = true; TextBoxNameLng2.ReadOnly = true; TextBoxAddress.ReadOnly = true; TextBoxCity.ReadOnly = true; TextBoxEmail.ReadOnly = true; TextBoxTelephone1.ReadOnly = true; TextBoxTelephone2.ReadOnly = true; TextBoxFax.ReadOnly = true; TextBoxMobile.ReadOnly = true; TextBoxCreditLimit.ReadOnly = true; TextBoxDebitTrans.ReadOnly = true; TextBoxCreditTrans.ReadOnly = true; TextBoxBalance.ReadOnly = true; ButtonNew.Enabled = true; ButtonEdit.Enabled = true; ButtonSave.Enabled = false; ButtonDelete.Enabled = true; ButtonPrint.Enabled = true; ButtonSearch.Enabled = true; ButtonCancel.Enabled = false; ButtonExit.Enabled = true; TreeViewMain.Enabled = true; RadioBtnGroup.Enabled = false; RadioBtnNotGroup.Enabled = false; buttonGroupSearch.Enabled = false; ButtonExit.Enabled = true; ButtonLast.Enabled = true; ButtonNext.Enabled = true; ButtonPrevious.Enabled = true; ButtonFirst.Enabled = true; TextBoxID.Clear(); TextBoxGroupID.Clear(); TextBoxGroupName.Clear(); TextBoxNameLng1.Clear(); TextBoxNameLng2.Clear(); TextBoxAddress.Clear(); TextBoxCity.Clear(); TextBoxEmail.Clear(); TextBoxTelephone1.Clear(); TextBoxTelephone2.Clear(); TextBoxFax.Clear(); TextBoxMobile.Clear(); TextBoxCreditLimit.Clear(); TextBoxDebitTrans.Clear(); TextBoxCreditTrans.Clear(); TextBoxBalance.Clear(); } else if (_TypeOperation == ClassPublicVar.TypeOperation.Add) { TextBoxID.ReadOnly = false; TextBoxGroupID.ReadOnly = false; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = false; TextBoxNameLng2.ReadOnly = false; TextBoxAddress.ReadOnly = false; TextBoxCity.ReadOnly = false; TextBoxEmail.ReadOnly = false; TextBoxTelephone1.ReadOnly = false; TextBoxTelephone2.ReadOnly = false; TextBoxFax.ReadOnly = false; TextBoxMobile.ReadOnly = false; TextBoxCreditLimit.ReadOnly = false; TextBoxDebitTrans.ReadOnly = false; TextBoxCreditTrans.ReadOnly = false; TextBoxBalance.ReadOnly = false; ButtonNew.Enabled = true; ButtonEdit.Enabled = false; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; ButtonPrint.Enabled = false; ButtonSearch.Enabled = false; ButtonCancel.Enabled = true; ButtonExit.Enabled = false; TreeViewMain.Enabled = false; RadioBtnGroup.Enabled = true; RadioBtnNotGroup.Enabled = true; buttonGroupSearch.Enabled = true; ButtonExit.Enabled = false; ButtonLast.Enabled = false; ButtonNext.Enabled = false; ButtonPrevious.Enabled = false; ButtonFirst.Enabled = false; TextBoxID.Clear(); TextBoxGroupID.Clear(); TextBoxGroupName.Clear(); TextBoxNameLng1.Clear(); TextBoxNameLng2.Clear(); TextBoxAddress.Clear(); TextBoxCity.Clear(); TextBoxEmail.Clear(); TextBoxTelephone1.Clear(); TextBoxTelephone2.Clear(); TextBoxFax.Clear(); TextBoxMobile.Clear(); TextBoxCreditLimit.Clear(); TextBoxDebitTrans.Clear(); TextBoxCreditTrans.Clear(); TextBoxBalance.Clear(); } else if (_TypeOperation == ClassPublicVar.TypeOperation.Edit) { TextBoxID.ReadOnly = true; TextBoxGroupID.ReadOnly = false; TextBoxGroupName.ReadOnly = true; TextBoxNameLng1.ReadOnly = false; TextBoxNameLng2.ReadOnly = false; TextBoxAddress.ReadOnly = false; TextBoxCity.ReadOnly = false; TextBoxEmail.ReadOnly = false; TextBoxTelephone1.ReadOnly = false; TextBoxTelephone2.ReadOnly = false; TextBoxFax.ReadOnly = false; TextBoxMobile.ReadOnly = false; TextBoxCreditLimit.ReadOnly = false; TextBoxDebitTrans.ReadOnly = false; TextBoxCreditTrans.ReadOnly = false; TextBoxBalance.ReadOnly = false; ButtonNew.Enabled = true; ButtonEdit.Enabled = false; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; ButtonPrint.Enabled = false; ButtonSearch.Enabled = false; ButtonCancel.Enabled = true; ButtonExit.Enabled = false; TreeViewMain.Enabled = false; RadioBtnGroup.Enabled = true; RadioBtnNotGroup.Enabled = true; buttonGroupSearch.Enabled = true; ButtonLast.Enabled = false; ButtonNext.Enabled = false; ButtonPrevious.Enabled = false; ButtonFirst.Enabled = false; //TextBoxID.Clear(); //TextBoxGroupID.Clear(); //TextBoxGroupName.Clear(); //TextBoxNameLng1.Clear(); //TextBoxNameLng2.Clear(); //TextBoxAddress.Clear(); //TextBoxCity.Clear(); //TextBoxEmail.Clear(); //TextBoxTelephone1.Clear(); //TextBoxTelephone2.Clear(); //TextBoxFax.Clear(); //TextBoxMobile.Clear(); //TextBoxCreditLimit.Clear(); //TextBoxDebitTrans.Clear(); //TextBoxCreditTrans.Clear(); //TextBoxBalance.Clear(); } }