private void FormMain_Load(object sender, EventArgs e) { //Count Rows of Order & Cause & plagnt int CountCause = 0; int Countplainte = 0; int Countorder = 0; try { if (cnx.State == ConnectionState.Closed) { cnx.Open(); } cmd.Connection = cnx; cmd.CommandText = "select count(id_cause) from cause"; CountCause = (int)cmd.ExecuteScalar(); barStaticItem62.Caption = CountCause.ToString(); cmd.Connection = cnx; cmd.CommandText = "select count(id_plainte) from plainte"; Countplainte = (int)cmd.ExecuteScalar(); barStaticItem71.Caption = Countplainte.ToString(); cmd.Connection = cnx; cmd.CommandText = "select count(id_order) from orderr"; Countorder = (int)cmd.ExecuteScalar(); barStaticItem73.Caption = Countorder.ToString(); cnx.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } //------------------------------------ try { if (cnx.State == ConnectionState.Closed) { cnx.Open(); } DateTime DateDesition; int Delai = 0; DateTime DateMoment = DateTime.Now; int Constante = 5; DateTime DateFin; DateTime NotificationDay; SqlDataReader dr2; SqlDataReader dr1; cmd.Connection = cnx; cmd.CommandText = "select id_cause,duree from cause "; dr1 = cmd.ExecuteReader(); bool show = false; while (dr1.Read()) { Delai = Convert.ToInt32(dr1[1].ToString()); SqlCommand cmd2 = new SqlCommand(); cmd2.Connection = cnx; cmd2.CommandText = "select date_session,decision from sessione where id_cause='" + dr1[0].ToString() + "' and (decision='مداولة' or decision='المداولة')"; dr2 = cmd2.ExecuteReader(); while (dr2.Read()) { DateDesition = (DateTime)dr2[0]; DateFin = DateDesition.AddDays(Delai); NotificationDay = DateFin.AddDays(-5); if (DateMoment.Day >= NotificationDay.Day) { show = true; } } dr2.Close(); } dr1.Close(); cnx.Close(); if (show == true) { alertControl1.AutoFormDelay = 5000; alertControl1.ShowPinButton = true; alertControl1.ShowCloseButton = true; alertControl1.LookAndFeel.SetStyle3D(); alertControl1.Show(this, "هناك قضايا أجالاتها قريبة الانتهاء ", "المرجوا الدهاب الى جدول الاجالات "); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //------------------------------------- DateTime datenow = DateTime.Now; String fileContent; string pathString; pathString = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\dll\"; fileContent = System.IO.File.ReadLines(pathString + "ver.txt").First(); if (fileContent == GetSerial.GetSerialNumber()) { if (Properties.Settings.Default.DateInisial <= datenow && Properties.Settings.Default.DateFinal >= datenow) { barButtonItem2.Enabled = true; barButtonItem3.Enabled = true; barButtonItem4.Enabled = true; ادارة.Enabled = true; barButtonItem6.Enabled = true; barButtonItem5.Enabled = true; ezsffdsfdsfsd.Enabled = true; barButtonItem9.Enabled = true; barButtonItem10.Enabled = true; barButtonItem11.Enabled = true; barButtonItem12.Enabled = true; barButtonItem16.Enabled = true; barButtonItem17.Enabled = true; barButtonItem18.Enabled = true; barButtonItem19.Enabled = true; barButtonItem20.Enabled = true; barButtonItem23.Enabled = true; barButtonItem24.Enabled = true; barButtonItem25.Enabled = true; barButtonItem33.Enabled = true; barButtonItem27.Enabled = true; barButtonItem28.Enabled = true; barButtonItem31.Enabled = true; barButtonItem31.Enabled = true; barButtonItem32.Enabled = true; barButtonItem14.Enabled = true; barButtonItem31.Enabled = true; barButtonItem35.Enabled = true; barButtonItem36.Enabled = true; barButtonItem15.Enabled = true; barButtonItem26.Enabled = true; barButtonItem38.Enabled = true; barButtonItem39.Enabled = true; barButtonItem30.Enabled = true; accordionControlElement20.Enabled = true; barButtonItem40.Enabled = true; } else { MessageBox.Show("البرنامج غير مفعل / يرجى الدهاب الى الاعدادات لتفعيل البرنامج", "", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.Close(); barButtonItem2.Enabled = false; barButtonItem3.Enabled = false; barButtonItem4.Enabled = false; ادارة.Enabled = false; barButtonItem6.Enabled = false; barButtonItem5.Enabled = false; ezsffdsfdsfsd.Enabled = false; barButtonItem9.Enabled = false; barButtonItem10.Enabled = false; barButtonItem11.Enabled = false; barButtonItem12.Enabled = false; barButtonItem16.Enabled = false; barButtonItem17.Enabled = false; barButtonItem18.Enabled = false; barButtonItem19.Enabled = false; barButtonItem20.Enabled = false; barButtonItem23.Enabled = false; barButtonItem24.Enabled = false; barButtonItem29.Enabled = false; barButtonItem25.Enabled = false; barButtonItem33.Enabled = false; barButtonItem27.Enabled = false; barButtonItem28.Enabled = false; barButtonItem31.Enabled = false; barButtonItem31.Enabled = false; barButtonItem32.Enabled = false; barButtonItem14.Enabled = false; barButtonItem30.Enabled = false; hg.Enabled = false; accordionControlElement5.Enabled = false; accordionControlElement9.Enabled = false; accordionControlElement10.Enabled = false; barButtonItem31.Enabled = true; accordionControlElement2.Enabled = false; accordionControlElement3.Enabled = false; accordionControlElement4.Enabled = false; accordionControlElement1.Enabled = false; accordionControlElement12.Enabled = false; accordionControlElement13.Enabled = false; accordionControlElement6.Enabled = false; accordionControlElement7.Enabled = false; accordionControlElement8.Enabled = false; accordionControlElement14.Enabled = false; accordionControlElement15.Enabled = false; accordionControlElement16.Enabled = false; accordionControlElement17.Enabled = false; accordionControlElement18.Enabled = false; accordionControlElement19.Enabled = false; barButtonItem35.Enabled = false; barButtonItem36.Enabled = false; barButtonItem15.Enabled = false; barButtonItem26.Enabled = false; barButtonItem38.Enabled = false; barButtonItem39.Enabled = false; barButtonItem30.Enabled = false; accordionControlElement20.Enabled = false; barButtonItem40.Enabled = false; Activation ac = new Activation(); ac.Show(); } } else { MessageBox.Show("البرنامج غير مفعل / يرجى الدهاب الى الاعدادات لتفعيل البرنامج", "", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.Close(); barButtonItem2.Enabled = false; barButtonItem3.Enabled = false; barButtonItem4.Enabled = false; ادارة.Enabled = false; barButtonItem6.Enabled = false; barButtonItem5.Enabled = false; ezsffdsfdsfsd.Enabled = false; barButtonItem9.Enabled = false; barButtonItem10.Enabled = false; barButtonItem11.Enabled = false; barButtonItem12.Enabled = false; barButtonItem16.Enabled = false; barButtonItem17.Enabled = false; barButtonItem18.Enabled = false; barButtonItem19.Enabled = false; barButtonItem20.Enabled = false; barButtonItem23.Enabled = false; barButtonItem24.Enabled = false; barButtonItem29.Enabled = false; barButtonItem25.Enabled = false; barButtonItem33.Enabled = false; barButtonItem27.Enabled = false; barButtonItem28.Enabled = false; barButtonItem31.Enabled = false; barButtonItem31.Enabled = false; barButtonItem32.Enabled = false; barButtonItem14.Enabled = false; barButtonItem30.Enabled = false; hg.Enabled = false; accordionControlElement5.Enabled = false; accordionControlElement9.Enabled = false; accordionControlElement10.Enabled = false; barButtonItem31.Enabled = true; accordionControlElement2.Enabled = false; accordionControlElement3.Enabled = false; accordionControlElement4.Enabled = false; accordionControlElement1.Enabled = false; accordionControlElement12.Enabled = false; accordionControlElement13.Enabled = false; accordionControlElement6.Enabled = false; accordionControlElement7.Enabled = false; accordionControlElement8.Enabled = false; accordionControlElement14.Enabled = false; accordionControlElement15.Enabled = false; accordionControlElement16.Enabled = false; accordionControlElement17.Enabled = false; accordionControlElement18.Enabled = false; accordionControlElement19.Enabled = false; barButtonItem35.Enabled = false; barButtonItem36.Enabled = false; barButtonItem15.Enabled = false; barButtonItem26.Enabled = false; barButtonItem38.Enabled = false; barButtonItem39.Enabled = false; barButtonItem30.Enabled = false; accordionControlElement20.Enabled = false; barButtonItem40.Enabled = false; Activation ac = new Activation(); ac.Show(); } }
private void FormMain_Load(object sender, EventArgs e) { string[] files = System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\Dashboard"); FileStream fs = new FileStream("Dashboard\\" + "FormMainDashBoard" + ".xml", FileMode.Open, FileAccess.Read); dashboardViewer1.LoadDashboard(fs); dashboardViewer1.Refresh(); //DevExpress.XtraBars.Ribbon.RibbonStatusBar.DefaultForeColor //------------------------------------ try { if (cnx.State == ConnectionState.Closed) { cnx.Open(); } DateTime DateDesition; int Delai = 0; DateTime DateMoment = DateTime.Now; int Constante = 5; DateTime DateFin; DateTime NotificationDay; SqlDataReader dr2; SqlDataReader dr1; cmd.Connection = cnx; cmd.CommandText = "select id_cause,duree from cause "; dr1 = cmd.ExecuteReader(); bool show = false; while (dr1.Read()) { Delai = Convert.ToInt32(dr1[1].ToString()); SqlCommand cmd2 = new SqlCommand(); cmd2.Connection = cnx; cmd2.CommandText = "select date_session,decision from sessione where id_cause='" + dr1[0].ToString() + "' and (decision='مداولة' or decision='المداولة')"; dr2 = cmd2.ExecuteReader(); while (dr2.Read()) { DateDesition = (DateTime)dr2[0]; DateFin = DateDesition.AddDays(Delai); NotificationDay = DateFin.AddDays(-5); if (DateMoment.Day >= NotificationDay.Day) { show = true; } } dr2.Close(); } dr1.Close(); cnx.Close(); if (show == true) { alertControl1.AutoFormDelay = 5000; alertControl1.ShowPinButton = true; alertControl1.ShowCloseButton = true; alertControl1.LookAndFeel.SetStyle3D(); alertControl1.Show(this, "هناك قضايا أجالاتها قريبة الانتهاء ", "المرجوا الدهاب الى جدول الاجالات "); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //------------------------------------- DateTime datenow = DateTime.Now; //String fileContent; //string pathString; //pathString = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\dll\"; //fileContent = System.IO.File.ReadLines(pathString + "ver.txt").First(); //if (fileContent == GetSerial.GetSerialNumber()) //{ // if (Properties.Settings.Default.DateInisial <= datenow && Properties.Settings.Default.DateFinal >= datenow) // { // barButtonItem2.Enabled = true; // barButtonItem3.Enabled = true; // barButtonItem4.Enabled = true; // ادارة.Enabled = true; // barButtonItem6.Enabled = true; // barButtonItem5.Enabled = true; // ezsffdsfdsfsd.Enabled = true; // barButtonItem9.Enabled = true; // barButtonItem10.Enabled = true; // barButtonItem11.Enabled = true; // barButtonItem12.Enabled = true; // barButtonItem16.Enabled = true; // barButtonItem17.Enabled = true; // barButtonItem18.Enabled = true; // barButtonItem19.Enabled = true; // barButtonItem20.Enabled = true; // barButtonItem23.Enabled = true; // barButtonItem24.Enabled = true; // barButtonItem25.Enabled = true; // barButtonItem33.Enabled = true; // barButtonItem27.Enabled = true; // barButtonItem28.Enabled = true; // barButtonItem31.Enabled = true; // barButtonItem31.Enabled = true; // barButtonItem32.Enabled = true; // barButtonItem14.Enabled = true; // barButtonItem31.Enabled = true; // barButtonItem35.Enabled = true; // barButtonItem36.Enabled = true; // barButtonItem15.Enabled = true; // barButtonItem26.Enabled = true; // barButtonItem38.Enabled = true; // barButtonItem39.Enabled = true; // barButtonItem30.Enabled = true; // accordionControlElement20.Enabled = true; // barButtonItem40.Enabled = true; // } // else // { // MessageBox.Show("البرنامج غير مفعل / يرجى الدهاب الى الاعدادات لتفعيل البرنامج", "", MessageBoxButtons.OK, MessageBoxIcon.Information); // //this.Close(); // barButtonItem2.Enabled = false; // barButtonItem3.Enabled = false; // barButtonItem4.Enabled = false; // ادارة.Enabled = false; // barButtonItem6.Enabled = false; // barButtonItem5.Enabled = false; // ezsffdsfdsfsd.Enabled = false; // barButtonItem9.Enabled = false; // barButtonItem10.Enabled = false; // barButtonItem11.Enabled = false; // barButtonItem12.Enabled = false; // barButtonItem16.Enabled = false; // barButtonItem17.Enabled = false; // barButtonItem18.Enabled = false; // barButtonItem19.Enabled = false; // barButtonItem20.Enabled = false; // barButtonItem23.Enabled = false; // barButtonItem24.Enabled = false; // barButtonItem29.Enabled = false; // barButtonItem25.Enabled = false; // barButtonItem33.Enabled = false; // barButtonItem27.Enabled = false; // barButtonItem28.Enabled = false; // barButtonItem31.Enabled = false; // barButtonItem31.Enabled = false; // barButtonItem32.Enabled = false; // barButtonItem14.Enabled = false; // barButtonItem30.Enabled = false; // hg.Enabled = false; // accordionControlElement5.Enabled = false; // accordionControlElement9.Enabled = false; // accordionControlElement10.Enabled = false; // barButtonItem31.Enabled = true; // accordionControlElement2.Enabled = false; // accordionControlElement3.Enabled = false; // accordionControlElement4.Enabled = false; // accordionControlElement1.Enabled = false; // accordionControlElement12.Enabled = false; // accordionControlElement13.Enabled = false; // accordionControlElement6.Enabled = false; // accordionControlElement7.Enabled = false; // accordionControlElement8.Enabled = false; // accordionControlElement14.Enabled = false; // accordionControlElement15.Enabled = false; // accordionControlElement16.Enabled = false; // accordionControlElement17.Enabled = false; // accordionControlElement18.Enabled = false; // accordionControlElement19.Enabled = false; // barButtonItem35.Enabled = false; // barButtonItem36.Enabled = false; // barButtonItem15.Enabled = false; // barButtonItem26.Enabled = false; // barButtonItem38.Enabled = false; // barButtonItem39.Enabled = false; // barButtonItem30.Enabled = false; // accordionControlElement20.Enabled = false; // barButtonItem40.Enabled = false; // Activation ac = new Activation(); // ac.Show(); // } //} //else //{ // MessageBox.Show("البرنامج غير مفعل / يرجى الدهاب الى الاعدادات لتفعيل البرنامج", "", MessageBoxButtons.OK, MessageBoxIcon.Information); // //this.Close(); // barButtonItem2.Enabled = false; // barButtonItem3.Enabled = false; // barButtonItem4.Enabled = false; // ادارة.Enabled = false; // barButtonItem6.Enabled = false; // barButtonItem5.Enabled = false; // ezsffdsfdsfsd.Enabled = false; // barButtonItem9.Enabled = false; // barButtonItem10.Enabled = false; // barButtonItem11.Enabled = false; // barButtonItem12.Enabled = false; // barButtonItem16.Enabled = false; // barButtonItem17.Enabled = false; // barButtonItem18.Enabled = false; // barButtonItem19.Enabled = false; // barButtonItem20.Enabled = false; // barButtonItem23.Enabled = false; // barButtonItem24.Enabled = false; // barButtonItem29.Enabled = false; // barButtonItem25.Enabled = false; // barButtonItem33.Enabled = false; // barButtonItem27.Enabled = false; // barButtonItem28.Enabled = false; // barButtonItem31.Enabled = false; // barButtonItem31.Enabled = false; // barButtonItem32.Enabled = false; // barButtonItem14.Enabled = false; // barButtonItem30.Enabled = false; // hg.Enabled = false; // accordionControlElement5.Enabled = false; // accordionControlElement9.Enabled = false; // accordionControlElement10.Enabled = false; // barButtonItem31.Enabled = true; // accordionControlElement2.Enabled = false; // accordionControlElement3.Enabled = false; // accordionControlElement4.Enabled = false; // accordionControlElement1.Enabled = false; // accordionControlElement12.Enabled = false; // accordionControlElement13.Enabled = false; // accordionControlElement6.Enabled = false; // accordionControlElement7.Enabled = false; // accordionControlElement8.Enabled = false; // accordionControlElement14.Enabled = false; // accordionControlElement15.Enabled = false; // accordionControlElement16.Enabled = false; // accordionControlElement17.Enabled = false; // accordionControlElement18.Enabled = false; // accordionControlElement19.Enabled = false; // barButtonItem35.Enabled = false; // barButtonItem36.Enabled = false; // barButtonItem15.Enabled = false; // barButtonItem26.Enabled = false; // barButtonItem38.Enabled = false; // barButtonItem39.Enabled = false; // barButtonItem30.Enabled = false; // accordionControlElement20.Enabled = false; // barButtonItem40.Enabled = false; // Activation ac = new Activation(); // ac.Show(); //} }