private void txt_numD_TextChanged(object sender, EventArgs e) { try { int id; if (int.TryParse(txt_numD.Text, out id) || txt_numD.Text == "") { DataRow[] drD = ds.Tables["Dettes"].Select("NumDette = " + txt_numD.Text); if (drD.Length > 0) { DataRow[] drC = ds.Tables["Client"].Select("NumClt = " + drD[0]["NuClt"].ToString()); if (drC.Length > 0) { txt_nmC.Text = drC[0]["NomClt"].ToString(); msk_teleC.Text = drC[0]["tele"].ToString(); txt_adress.Text = drC[0]["Adresse"].ToString(); txt_pxD.Text = drD[0]["PrixDette"].ToString(); cb_nmC.SelectedValue = drC[0]["NumClt"].ToString(); label5.Visible = false; } } } else { MessageBox.Show("رقم الدين الذي أدخلته غير مقبول", "خطأ في إدخال رقم الدين", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button7_Click(object sender, EventArgs e) { try { if (dgv_AfficheProd.SelectedRows.Count == 1) { var rep = MessageBox.Show("هل تريد حذف المنتوج المختار؟ ", "حذف المنتوج", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); if (rep == DialogResult.Yes) { using (TransactionScope trans = new TransactionScope()) { // All this work because on delete cascade doesn't work in desconnected mode !! Acceuil.cnx.Open(); int idP = int.Parse(dgv_AfficheProd.CurrentRow.Cells[0].Value.ToString()); ds.Tables["ProduitsAjt"].Rows.Remove((ds.Tables["ProduitsAjt"].Select("الرقم = " + idP)[0])); SQLiteDataAdapter toDelP = new SQLiteDataAdapter("Select * from Produits", Acceuil.cnx); toDelP.Fill(ds, "ProductToDel"); SQLiteDataAdapter toDelS = new SQLiteDataAdapter("Select * from Stocks", Acceuil.cnx); toDelS.Fill(ds, "StockToDel"); SQLiteDataAdapter toDelPA = new SQLiteDataAdapter("Select * from typePrixA", Acceuil.cnx); toDelPA.Fill(ds, "PrAToDel"); SQLiteDataAdapter toDelPB = new SQLiteDataAdapter("Select * from typePrixB", Acceuil.cnx); toDelPB.Fill(ds, "PrBToDel"); SQLiteDataAdapter toDelPC = new SQLiteDataAdapter("Select * from typePrixC", Acceuil.cnx); toDelPC.Fill(ds, "PrCToDel"); DataView dvP = new DataView(ds.Tables["ProductToDel"], "NumPrd = " + idP, "", DataViewRowState.CurrentRows); dvP[0].Delete(); DataView dvS = new DataView(ds.Tables["StockToDel"], "NuPrd = " + idP, "", DataViewRowState.CurrentRows); dvS[0].Delete(); DataView dvPA = new DataView(ds.Tables["PrAToDel"], "NuPrd = " + idP, "", DataViewRowState.CurrentRows); dvPA[0].Delete(); DataView dvPB = new DataView(ds.Tables["PrBToDel"], "NuPrd = " + idP, "", DataViewRowState.CurrentRows); dvPB[0].Delete(); DataView dvPC = new DataView(ds.Tables["PrCToDel"], "NuPrd = " + idP, "", DataViewRowState.CurrentRows); dvPC[0].Delete(); SQLiteCommandBuilder cmdb = new SQLiteCommandBuilder(toDelP); toDelP.Update(ds, "ProductToDel"); cmdb = new SQLiteCommandBuilder(toDelS); toDelS.Update(ds, "StockToDel"); cmdb = new SQLiteCommandBuilder(toDelPA); toDelPA.Update(ds, "PrAToDel"); cmdb = new SQLiteCommandBuilder(toDelPA); toDelPA.Update(ds, "PrAToDel"); cmdb = new SQLiteCommandBuilder(toDelPA); toDelPA.Update(ds, "PrAToDel"); lbl_nmProd.Text = ds.Tables["ProduitsAjt"].Rows.Count.ToString(); button4.PerformClick(); Acceuil.cnx.Close(); trans.Complete(); } } } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button1_Click(object sender, EventArgs e) { try { using (TransactionScope trans = new TransactionScope()) { Acceuil.cnx.Open(); ds.Tables["Client"].Rows.RemoveAt(0); SQLiteCommandBuilder cmdb = new SQLiteCommandBuilder(dtaClt); dtaClt.Update(ds, "Client"); cmdb = new SQLiteCommandBuilder(dtaDette); dtaDette.Update(ds, "Dettes"); saved = true; Acceuil.cnx.Close(); trans.Complete(); MessageBox.Show("تم حفض المعلومات بنجاح", " حفض المعلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void dgv_Facture_SelectionChanged(object sender, EventArgs e) { try { if (!first) { button1.Enabled = (dgv_Facture.SelectedRows.Count == 1); button2.Enabled = (dgv_Facture.SelectedRows.Count == 1); if (dgv_Facture.SelectedRows.Count == 1) { SQLiteDataAdapter dtaCmd = new SQLiteDataAdapter("select p.NumPrd 'رقم المنتوج', p.Desingation 'إسم المنتوج', c.QttCmd 'الكمية', c.PrixU 'ثمن الوحدة', c.PrixCmd 'الواجب' from Produits p, Commande c where p.NumPrd = c.NuPrd AND c.NumCmd = " + dgv_Facture.CurrentRow.Cells[0].Value.ToString(), Acceuil.cnx); if (ds.Tables["Cmd"] != null) { ds.Tables["Cmd"].Rows.Clear(); } dtaCmd.Fill(ds, "Cmd"); dgv_DetailFacture.DataSource = ds.Tables["Cmd"]; lbl_NbrProd.Text = ds.Tables["Cmd"].Rows.Count.ToString(); first = false; } } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button7_Click(object sender, EventArgs e) { try { if (dgv_AjtDette.SelectedRows.Count == 1) { var rep = MessageBox.Show("هل تريد حدف الدين المختار ", "حذف الدين", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); if (rep == DialogResult.Yes) { numC = dtnp.Rows[dgv_AjtDette.CurrentRow.Index][0].ToString(); nomC = dtnp.Rows[dgv_AjtDette.CurrentRow.Index][1].ToString(); ds.Tables["Client"].Rows.Remove((ds.Tables["Client"].Select("NomClt = '" + nomC + "'")[0])); ds.Tables["Dettes"].Rows.Remove((ds.Tables["Dettes"].Select("NuClt = '" + numC + "'")[0])); dtnp.Rows.RemoveAt(dgv_AjtDette.CurrentRow.Index); lbl_DetteAjt.Text = dtnp.Rows.Count.ToString(); } } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button5_Click(object sender, EventArgs e) { if (dgv_ProdV.SelectedRows.Count == 1) { idPr = dtnv.Rows[dgv_ProdV.CurrentRow.Index][0].ToString(); DataView dv = new DataView(ds.Tables["Stocks"], "NuPrd = " + idPr, "", DataViewRowState.CurrentRows); cb_Prod.SelectedValue = idPr; cb_Prod.Enabled = false; ChangeQtt(cb_Prod.SelectedValue.ToString(), Decimal.Parse(dv[0]["QttProd"].ToString()) + Decimal.Parse(dgv_ProdV.CurrentRow.Cells[1].Value.ToString())); maxQtt = Decimal.Parse(dv[0]["QttProd"].ToString()); lbl_qttavi.ForeColor = System.Drawing.Color.Black; lbl_ttrqtttav.ForeColor = System.Drawing.Color.Black; lbl_qttavi.Text = dv[0]["QttProd"].ToString(); nud_qtt.Text = dgv_ProdV.CurrentRow.Cells[1].Value.ToString(); //newPrice = float.Parse(lbl_prixTotal.Text) - float.Parse(dtnv.Rows[dgv_ProdV.CurrentRow.Index][4].ToString()); calculatePrice(Decimal.Parse(dtnv.Rows[dgv_ProdV.CurrentRow.Index][4].ToString()), false); dgv_ProdV.Enabled = false; button5.Enabled = false; button9.Enabled = false; button8.Enabled = false; button7.Enabled = false; button6.Visible = true; button1.Visible = false; } try { } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button4_Click(object sender, EventArgs e) { try { if (txt_nomTp.Text != "") { idT++; DataRow ligne = dtnt.NewRow(); ligne[0] = idT; ligne[1] = txt_nomTp.Text.Trim(); dtnt.Rows.Add(ligne); ligne = ds.Tables["Types"].NewRow(); ligne[0] = idT; ligne[1] = txt_nomTp.Text; ds.Tables["Types"].Rows.Add(ligne); saved = false; button3.PerformClick(); } else { MessageBox.Show("المرجو ملأ حقل الخاص بنوع السلع", "الحقل الخاص بنوع السلع فارغ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button2_Click(object sender, EventArgs e) { try { if (dgv_AjtDette.SelectedRows.Count == 1) { numC = dtnp.Rows[dgv_AjtDette.CurrentRow.Index][0].ToString(); nomC = dtnp.Rows[dgv_AjtDette.CurrentRow.Index][1].ToString(); txt_nmClt.Text = dgv_AjtDette.CurrentRow.Cells[1].Value.ToString(); mst_teleClt.Text = dgv_AjtDette.CurrentRow.Cells[2].Value.ToString(); txt_Adrss.Text = dgv_AjtDette.CurrentRow.Cells[3].Value.ToString(); txt_pxDtt.Text = dgv_AjtDette.CurrentRow.Cells[4].Value.ToString(); button5.Visible = true; button4.Visible = false; button2.Enabled = false; dgv_AjtDette.ClearSelection(); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void txt_nmV_TextChanged_1(object sender, EventArgs e) { try{ int id, tele; float px; if (int.TryParse(txt_numD.Text, out id) || txt_numD.Text == "") { if (int.TryParse(txt_teleC.Text, out tele) || txt_teleC.Text == "") { if (float.TryParse(txt_pxD.Text, out px) || txt_pxD.Text == "") { dgv_affDette.DataSource = GetFilterdDette(txt_numD.Text, txt_nmC.Text, txt_teleC.Text, txt_pxD.Text, dtp_datAjout.Value.ToShortDateString()); } else { MessageBox.Show("الثمن الذي أدخلته غير مقبول", "خطأ في إدخال ثمن الدين ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("رقم الهاتف الذي أدخلته غير مقبول", "خطأ في إدخال رقم الهاتف", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("رقم الدين الذي أدخلته غير مقبول", "خطأ في إدخال رقم الدين", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button1_Click(object sender, EventArgs e) { try { SQLiteCommand cmd = new SQLiteCommand("select * from Users where username = '******' and password = '******'", Acceuil.cnx); Acceuil.cnx.Open(); SQLiteDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { if (FrmAcc == null) { Acceuil ac = new Acceuil(this); ac.Show(); } else { FrmAcc.Show(); } txt_password.Text = ""; Hide(); } else { MessageBox.Show("إسم الدخول أو كلمة المرور خاطئة", "المعلومات خاطئة", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } Acceuil.cnx.Close(); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button7_Click(object sender, EventArgs e) { try { if (dgr_nvProd.SelectedRows.Count == 1) { DesP = dtnp.Rows[dgr_nvProd.CurrentRow.Index][1].ToString(); idPr = dtnp.Rows[dgr_nvProd.CurrentRow.Index][0].ToString(); txt_nomPrd.Text = dgr_nvProd.CurrentRow.Cells[1].Value.ToString(); nud_qtt.Text = dgr_nvProd.CurrentRow.Cells[2].Value.ToString(); nud_qttMn.Text = dgr_nvProd.CurrentRow.Cells[3].Value.ToString(); txt_prxAch.Text = dgr_nvProd.CurrentRow.Cells[4].Value.ToString(); txt_prxA.Text = dgr_nvProd.CurrentRow.Cells[5].Value.ToString(); txt_prxB.Text = dgr_nvProd.CurrentRow.Cells[6].Value.ToString(); txt_prxC.Text = dgr_nvProd.CurrentRow.Cells[7].Value.ToString(); cb_tpPrd.SelectedIndex = cb_tpPrd.FindStringExact(dgr_nvProd.CurrentRow.Cells[8].Value.ToString()); button8.Visible = true; button2.Visible = false; button9.Enabled = false; button5.Enabled = false; dgr_nvProd.Enabled = false; } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button5_Click(object sender, EventArgs e) { try { BackgroundWorker bg = new BackgroundWorker(); using (TransactionScope tran = new TransactionScope()) { Acceuil.cnx.Open(); SQLiteCommandBuilder cmdb = new SQLiteCommandBuilder(dtaType); dtaType.Update(ds, "Types"); cmdb = new SQLiteCommandBuilder(dtaProduit); dtaProduit.Update(ds, "Produits"); cmdb = new SQLiteCommandBuilder(dtaPxA); dtaPxA.Update(ds, "TypPA"); cmdb = new SQLiteCommandBuilder(dtaPxB); dtaPxB.Update(ds, "TypPB"); cmdb = new SQLiteCommandBuilder(dtaPxC); dtaPxC.Update(ds, "TypPC"); cmdb = new SQLiteCommandBuilder(dtaStocke); dtaStocke.Update(ds, "Stocks"); saved = true; Acceuil.cnx.Close(); dtnp.Rows.Clear(); lbl_prdAjt.Text = dtnp.Rows.Count.ToString(); tran.Complete(); MessageBox.Show("تم حفض المعلومات بنجاح", " حفض المعلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button5_Click(object sender, EventArgs e) { try { if (cb_chngType.SelectedValue != null) { var rep = MessageBox.Show("هل تريد حذف النوع المختار؟ ", "حذف النوع", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); if (rep == DialogResult.Yes) { int idT = int.Parse(cb_chngType.SelectedValue.ToString()); ds.Tables["typesMdf"].Rows.Remove((ds.Tables["typesMdf"].Select("NumType = " + idT)[0])); SQLiteDataAdapter toDelT = new SQLiteDataAdapter("Select * from Types", Acceuil.cnx); toDelT.Fill(ds, "TypeToDel"); DataView dvT = new DataView(ds.Tables["typesMdf"], "NumType = " + idT, "", DataViewRowState.CurrentRows); dvT[0].Delete(); SQLiteCommandBuilder cmdb = new SQLiteCommandBuilder(toDelT); toDelT.Update(ds, "TypeToDel"); } } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button4_Click(object sender, EventArgs e) { try { Acceuil.cnx.Open(); SQLiteCommandBuilder cmdb = new SQLiteCommandBuilder(dtaProduit); dtaProduit.Update(ds, "Produits"); cmdb = new SQLiteCommandBuilder(dtaPxA); dtaPxA.Update(ds, "TypPA"); cmdb = new SQLiteCommandBuilder(dtaPxB); dtaPxB.Update(ds, "TypPB"); cmdb = new SQLiteCommandBuilder(dtaPxC); dtaPxC.Update(ds, "TypPC"); cmdb = new SQLiteCommandBuilder(dtaStocke); dtaStocke.Update(ds, "Stocks"); cmdb = new SQLiteCommandBuilder(dt2); dt2.Update(ds, "typesMdf"); Acceuil.cnx.Close(); svd = true; MessageBox.Show("تم حفض التغييرات بنجاح", " حفض التغييرات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button1_Click(object sender, EventArgs e) { try { using (TransactionScope trans = new TransactionScope()) { ds.Tables["typesMdf"].Rows[i].BeginEdit(); ds.Tables["typesMdf"].Rows[i][1] = txt_nmType.Text; ds.Tables["typesMdf"].Rows[i].EndEdit(); ds.Tables["types"].Rows[i].BeginEdit(); ds.Tables["types"].Rows[i][1] = txt_nmType.Text; ds.Tables["types"].Rows[i].EndEdit(); Acceuil.cnx.Open(); SQLiteCommandBuilder cmdb = new SQLiteCommandBuilder(dt2); dt2.Update(ds, "typesMdf"); Acceuil.cnx.Close(); svd = true; trans.Complete(); MessageBox.Show("تم تعديل و حفض التغييرات بنجاح", "حفض التغييرات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button9_Click(object sender, EventArgs e) { try { if (dgr_nvProd.SelectedRows.Count == 1) { var rep = MessageBox.Show("هل تريد حذف المعلومات المختارة ", "حذف المعلومات", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); if (rep == DialogResult.Yes) { DesP = dtnp.Rows[dgr_nvProd.CurrentRow.Index][1].ToString(); idPr = dtnp.Rows[dgr_nvProd.CurrentRow.Index][0].ToString(); ds.Tables["Produits"].Rows.Remove((ds.Tables["Produits"].Select("Desingation = '" + DesP + "'")[0])); ds.Tables["Stocks"].Rows.Remove((ds.Tables["Stocks"].Select("NuPrd = '" + idPr + "'")[0])); ds.Tables["TypPA"].Rows.Remove((ds.Tables["TypPA"].Select("NuPrd = '" + idPr + "'")[0])); ds.Tables["TypPB"].Rows.Remove((ds.Tables["TypPB"].Select("NuPrd = '" + idPr + "'")[0])); ds.Tables["TypPC"].Rows.Remove((ds.Tables["TypPC"].Select("NuPrd = '" + idPr + "'")[0])); dtnp.Rows.RemoveAt(dgr_nvProd.CurrentRow.Index); dgr_nvProd.Text = dtnp.Rows.Count.ToString(); } } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button4_Click(object sender, EventArgs e) { try { float pd; if (txt_nmClt.Text != "") { if (!CheckInDt(ds.Tables["Client"], "'" + txt_nmClt.Text + "'", "NomClt")) { if (txt_pxDtt.Text == "") { txt_pxDtt.Text = "0"; } if (float.TryParse(txt_pxDtt.Text, out pd)) { DataRow ligneC = ds.Tables["Client"].NewRow(); DataRow ligneD = ds.Tables["Dettes"].NewRow(); DataRow ligneDgv = dtnp.NewRow(); ligneC[1] = txt_nmClt.Text; ligneC[2] = mst_teleClt.Text.Replace(" ", ""); ligneC[3] = txt_Adrss.Text; ds.Tables["Client"].Rows.Add(ligneC); idC++; ligneD[1] = txt_pxDtt.Text; ligneD[2] = idC; ligneD[3] = DateTime.Now.ToShortDateString(); ds.Tables["Dettes"].Rows.Add(ligneD); ligneDgv[0] = idC; ligneDgv[1] = txt_nmClt.Text; ligneDgv[2] = mst_teleClt.Text.Replace(" ", ""); ligneDgv[3] = txt_Adrss.Text; ligneDgv[4] = txt_pxDtt.Text; dtnp.Rows.Add(ligneDgv); saved = false; button3.PerformClick(); lbl_DetteAjt.Text = dtnp.Rows.Count.ToString(); dgv_AjtDette.ClearSelection(); } else { MessageBox.Show("ثمن الدين غير مقبول", "خطأ في إدخال ثمن الدين", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } else { MessageBox.Show("إسم الزبون الذي أذخلته موجود سابقا ", "إسم الزبون مكرر", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } else { MessageBox.Show(" المرجو إدخال إسم الزبون", "إسم الزبون فارغ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button7_Click(object sender, EventArgs e) { try { if (dgv_ProdV.SelectedRows.Count == 1) { var rep = MessageBox.Show("هل تريد حذف المعلومات المختارة ", "حذف المعلومات", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); if (rep == DialogResult.Yes) { idPr = dtnv.Rows[dgv_ProdV.CurrentRow.Index][0].ToString(); DataView dv = new DataView(ds.Tables["Stocks"], "NuPrd = " + idPr, "", DataViewRowState.CurrentRows); ChangeQtt(cb_Prod.SelectedValue.ToString(), int.Parse(dv[0]["QttProd"].ToString()) + int.Parse(dgv_ProdV.CurrentRow.Cells[1].Value.ToString())); //ds.Tables["Cmd"].Rows.Remove(ds.Tables["Cmd"].Select("NumCmd = " + idLCmd + " AND NuPrd = " + idPr)[0]); ds.Tables["Cmd"].Select("NumCmd = " + idLCmd + " AND NuPrd = " + idPr)[0].Delete(); //lbl_prixTotal.Text = (float.Parse(lbl_prixTotal.Text) - float.Parse(dtnv.Rows[dgv_ProdV.CurrentRow.Index][4].ToString())).ToString(); calculatePrice(Decimal.Parse(dtnv.Rows[dgv_ProdV.CurrentRow.Index][4].ToString()), false); dtnv.Rows.RemoveAt(dgv_ProdV.CurrentRow.Index); lbl_qttV.Text = dtnv.Rows.Count.ToString(); saved = false; if (dtnv.Rows.Count == 0) { txt_AnvcD.Enabled = false; } } } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void MdfDette_Load(object sender, EventArgs e) { try { dtaDette.Fill(ds, "Dettes"); dtaClt.Fill(ds, "Client"); if (ds.Tables["Client"].Rows.Count != 0) { idC = int.Parse(ds.Tables["Client"].Rows[ds.Tables["Client"].Rows.Count - 1]["NumClt"].ToString()); } else { idC = 0; } DataRow rw = ds.Tables["Client"].NewRow(); rw["NomClt"] = "إختر إسم"; rw["NumClt"] = 0; ds.Tables["Client"].Rows.InsertAt(rw, 0); cb_nmC.ValueMember = "NumClt"; cb_nmC.DisplayMember = "NomClt"; cb_nmC.DataSource = ds.Tables["Client"]; } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button5_Click(object sender, EventArgs e) { try { float pd; if (txt_nmClt.Text != "" && txt_pxDtt.Text != "") { if (!CheckInDt(ds.Tables["Client"], "'" + txt_nmClt.Text + "'", "NomClt")) { if (float.TryParse(txt_pxDtt.Text, out pd)) { int iC = ds.Tables["Client"].Rows.IndexOf(ds.Tables["Client"].Select("NomClt = '" + nomC + "'")[0]); int iD = ds.Tables["Dettes"].Rows.IndexOf(ds.Tables["Dettes"].Select("NuClt = " + numC)[0]); int idg = dtnp.Rows.IndexOf(dtnp.Select("الرقم = " + numC)[0]); //Update DataTable Client ds.Tables["Client"].Rows[iC].BeginEdit(); ds.Tables["Client"].Rows[iC]["NomClt"] = txt_nmClt.Text; ds.Tables["Client"].Rows[iC]["Tele"] = mst_teleClt.Text.Replace(" ", ""); ds.Tables["Client"].Rows[iC]["Adresse"] = txt_Adrss.Text; ds.Tables["Client"].Rows[iC].EndEdit(); //Update DataTable Dettes ds.Tables["Dettes"].Rows[iD].BeginEdit(); ds.Tables["Dettes"].Rows[iD]["PrixDette"] = txt_pxDtt.Text; ds.Tables["Dettes"].Rows[iD].EndEdit(); //Update DataTable DTNP of GridView dtnp.Rows[idg].BeginEdit(); dtnp.Rows[idg]["إسم الزبون"] = txt_nmClt.Text; dtnp.Rows[idg]["الهاتف"] = mst_teleClt.Text.Replace(" ", ""); dtnp.Rows[idg]["العنوان"] = txt_Adrss.Text; dtnp.Rows[idg]["مبلغ الدين"] = txt_pxDtt.Text; dtnp.Rows[idg].EndEdit(); button5.Visible = false; button4.Visible = true; button3.PerformClick(); MessageBox.Show("تم تعديل المعلومات بنجاح", " تعديل المعلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } else { MessageBox.Show("أحد الأثمنة غير مقبولة", "خطأ في إدخال الأثمنة", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } else { MessageBox.Show("إسم الزبون الذي أذخلته موجود سابقا ", "إسم الزبون مكرر", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } else { MessageBox.Show("الإسم الزبون و الثمن ضروريان ", "أحد الحقول فارغة", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button1_Click(object sender, EventArgs e) { try{ Application.Exit(); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void AffDette_Load(object sender, EventArgs e) { try { GetDette(); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void textBox2_TextChanged(object sender, EventArgs e) { try { dgv_Facture.DataSource = GetFilterdFacture(txt_numFact.Text, txt_nomC.Text, dtp_dateFact.Value.ToShortDateString()); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void GetProduct(object sender, EventArgs e) { try { DataView dv = null; if (txt_numP.Text == "") { if (cb_typePrd.SelectedIndex == 0) { if (txt_nomPrd.Text != "") { dv = new DataView(ds.Tables["Produits"], "Desingation LIKE '%" + txt_nomPrd.Text + "%'", "", DataViewRowState.CurrentRows); } else { //lbl_prix.Text = "0"; //lbl_prxavi.Text = "0"; cb_Prod.DataSource = ds.Tables["Produits"]; cb_Prod.SelectedIndex = 0; } } else { if (txt_nomPrd.Text != "") { dv = new DataView(ds.Tables["Produits"], "Desingation LIKE '%" + txt_nomPrd.Text + "%' AND NuType = " + cb_typePrd.SelectedValue.ToString(), "", DataViewRowState.CurrentRows); } else { dv = new DataView(ds.Tables["Produits"], "NuType = " + cb_typePrd.SelectedValue.ToString(), "", DataViewRowState.CurrentRows); } } } else { int np; if (int.TryParse(txt_numP.Text, out np)) { dv = new DataView(ds.Tables["Produits"], "NumPrd = " + np, "", DataViewRowState.CurrentRows); } } if (dv != null && dv.ToTable().Rows.Count != 0) { cb_Prod.DataSource = dv.ToTable(); } } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void cb_type_SelectionChangeCommitted(object sender, EventArgs e) { try { dgv_AfficheProd.DataSource = GetFiltredData(txt_nuProd.Text, txt_NomProd.Text, cb_type.SelectedValue.ToString(), txt_prix.Text, tpPrix, dtp_datAjout.Text); ColorEmp(); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button5_Click(object sender, EventArgs e) { try { MdfProduit frmMdf = new MdfProduit(int.Parse(dgv_AfficheProd.CurrentRow.Cells[0].Value.ToString()), this); frmMdf.ShowDialog(); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void MfdConnexion_Load(object sender, EventArgs e) { try { dta.Fill(ds, "users"); txt_nomU.Text = ds.Tables["users"].Rows[0]["username"].ToString(); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button1_Click(object sender, EventArgs e) { try { button3.PerformClick(); dgv_AfficheProd.DataSource = GetAlmEmpProducts(); dgv_AfficheProd.Sort(dgv_AfficheProd.Columns["الإسم"], ListSortDirection.Ascending); lbl_titrLstProd.Text = button1.Text; } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Controle: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button4_Click(object sender, EventArgs e) { try{ txt_numD.Text = ""; txt_nmC.Text = ""; txt_teleC.Text = ""; txt_pxD.Text = ""; ch_ShDt.Checked = true; }catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }
private void button6_Click(object sender, EventArgs e) { try { int iV = ds.Tables["Cmd"].Rows.IndexOf(ds.Tables["Cmd"].Select("NumCmd = " + idLCmd + " AND NuPrd = " + idPr)[0]); int idg = dgv_ProdV.CurrentRow.Index; ds.Tables["Cmd"].Rows[iV].BeginEdit(); ds.Tables["Cmd"].Rows[iV]["PrixCmd"] = lbl_prxQtt.Text; ds.Tables["Cmd"].Rows[iV]["QttCmd"] = nud_qtt.Text; ds.Tables["Cmd"].Rows[iV]["NuPrd"] = cb_Prod.SelectedValue.ToString(); ds.Tables["Cmd"].Rows[iV].EndEdit(); // dtnv.Rows[idg].BeginEdit(); dtnv.Rows[idg]["الرقم"] = cb_Prod.SelectedValue.ToString(); dtnv.Rows[idg]["السلعة"] = cb_Prod.Text; dtnv.Rows[idg]["الكمية"] = nud_qtt.Text; dtnv.Rows[idg]["ثمن الوحدة"] = lbl_prix.Text; dtnv.Rows[idg]["الواجب"] = lbl_prxQtt.Text; dtnv.Rows[idg].EndEdit(); ChangeQtt(cb_Prod.SelectedValue.ToString(), int.Parse(lbl_qttavi.Text) - Decimal.Parse(nud_qtt.Text)); lbl_qttavi.Text = (Decimal.Parse(lbl_qttavi.Text) - Decimal.Parse(nud_qtt.Text)).ToString(); if (Decimal.Parse(lbl_qttavi.Text) == 0) { lbl_ttrqtttav.ForeColor = System.Drawing.Color.Red; lbl_qttavi.ForeColor = System.Drawing.Color.Red; button1.Enabled = false; } //newPrice += float.Parse(lbl_prxQtt.Text); //lbl_prixTotal.Text = newPrice.ToString(); calculatePrice(Decimal.Parse(lbl_prxQtt.Text), true); dgv_ProdV.Enabled = true; button5.Enabled = true; button7.Enabled = true; button8.Enabled = true; button9.Enabled = true; button6.Visible = false; button1.Visible = true; cb_Prod.Enabled = true; saved = false; MessageBox.Show("تم تعديل المعلومات بنجاح", " تعديل المعلومات", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign); } catch (Exception ex) { MessageBox.Show("هناك خطأ أثناء العملية المرجوا إعادة المحاولة"); string Err = "[" + DateTime.Now + "] [Exception] __ [Form :" + this.Name + " ; Button: " + sender.ToString() + " ; Event: " + e.ToString() + "] __ ExceptionMessage : " + ex.Message; Acceuil.WriteLog(Err); } }