Beispiel #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Login();
     if (GlobalVars.Utilisateur == null)
     {
         this.Close();
     }
     else
     {
         ShowAdmin(GlobalVars.Utilisateur.Role == 0);
         labelUser.Text = GlobalVars.Utilisateur.Login;
         labelDate.Text = GlobalVars.ConnexionTime;
         DB_PostgreSQL dataBase = new DB_PostgreSQL();
         DataSet       d        = dataBase.returnDataSet("SELECT \"Code\",\"Date_Recu\",\"Prix_Total\",\"Prix_Partiel\",\"Code_Client\",\"Etat\",\"Livree\" FROM \"Facture\" WHERE (\"Etat\"='Non Reglee' OR \"Livree\"='Non Livree')AND date(\"Date_Livraison\")=:date", ":date", DbType.Date, DateTime.Now.Date);
         DataSet       c        = dataBase.returnDataSet("SELECT * FROM \"Client\"");
         c1TrueDBGrid1.DataSource     = d.Tables[0];
         c1TrueDBDropdown1.DataSource = c.Tables[0];
         c1TrueDBGrid1.Splits[0].DisplayColumns["Code_Client"].Button       = false;
         c1TrueDBGrid1.Splits[0].DisplayColumns["Code_Client"].FilterButton = true;
         c1TrueDBGrid1.Columns["Code_Client"].DropDown = this.c1TrueDBDropdown1;
         c1TrueDBDropdown1.DataField = "Code";
         c1TrueDBDropdown1.ListField = "Nom";
         c1TrueDBGrid1.Columns["Code_Client"].ValueItems.Translate = true;
         c1TrueDBDropdown1.ValueTranslate = true;
     }
 }
Beispiel #2
0
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();
            DataSet       d        = null;
            DataSet       c        = dataBase.returnDataSet("SELECT * FROM \"Client\"");

            if (radioButton1.Checked)
            {
                d = dataBase.returnDataSet("SELECT \"Code\",\"Date_Recu\",\"Prix_Total\",\"Prix_Partiel\",\"Code_Client\",\"Etat\",\"Livree\" FROM \"Facture\" WHERE (\"Etat\"='Non Reglee' OR \"Livree\"='Non Livree') AND date(\"Date_Livraison\")=:date", ":date", DbType.Date, DateTime.Now.Date);
            }
            if (radioButton2.Checked)
            {
                d = dataBase.returnDataSet("SELECT \"Code\",\"Date_Recu\",\"Prix_Total\",\"Prix_Partiel\",\"Code_Client\",\"Etat\",\"Livree\" FROM \"Facture\" WHERE (\"Etat\"='Non Reglee' OR \"Livree\"='Non Livree') AND date(\"Date_Livraison\")<:date", ":date", DbType.Date, DateTime.Now.Date);
            }
            if (radioButton3.Checked)
            {
                d = dataBase.returnDataSet("SELECT \"Code\",\"Date_Recu\",\"Prix_Total\",\"Prix_Partiel\",\"Code_Client\",\"Etat\",\"Livree\" FROM \"Facture\" WHERE (\"Etat\"='Non Reglee' OR \"Livree\"='Non Livree') AND date(\"Date_Livraison\")>:date", ":date", DbType.Date, DateTime.Now.Date);
            }
            c1TrueDBGrid1.DataSource     = d.Tables[0];
            c1TrueDBDropdown1.DataSource = c.Tables[0];
            c1TrueDBGrid1.Splits[0].DisplayColumns["Code_Client"].Button       = false;
            c1TrueDBGrid1.Splits[0].DisplayColumns["Code_Client"].FilterButton = true;
            c1TrueDBGrid1.Columns["Code_Client"].DropDown = this.c1TrueDBDropdown1;
            c1TrueDBDropdown1.DataField = "Code";
            c1TrueDBDropdown1.ListField = "Nom";
            c1TrueDBGrid1.Columns["Code_Client"].ValueItems.Translate = true;
            c1TrueDBDropdown1.ValueTranslate = true;
        }
Beispiel #3
0
        public IndoFacture(string Code)
        {
            InitializeComponent();
            Save           = false;
            currentFacture = new TB_Facture();
            currentFacture.FindByKey(Code);
            TextCodeFacture.Value      = currentFacture.Code;
            TextAdresseClient.Value    = currentFacture.Client.Adresse;
            TextTelClient.Value        = currentFacture.Client.NTel;
            TextNomClient.Value        = currentFacture.Client.Nom;
            TextPrenomClient.Value     = currentFacture.Client.Prenom;
            NumericPrixAvance.Value    = currentFacture.Prix_Partiel;
            NumericPrixTotal.Value     = currentFacture.Prix_Total;
            DateRecuFacture.Value      = currentFacture.Date_Recu;
            DateLivraisonFacutre.Value = currentFacture.Date_livraison;
            comboModePayement.Text     = currentFacture.Mode_Payement;
            DB_PostgreSQL dataBase = new DB_PostgreSQL();
            DataSet       ARFAC    = dataBase.returnDataSet("SELECT \"Code_Article\",\"Libelle\",\"Quantite\",\"Operation\",\"Prix\" FROM \"Articles\",\"Ar_Fac\" WHERE \"Ar_Fac\".\"Code_Facture\"='" + Code + "' AND" +
                                                            "\"Articles\".\"Code\"=\"Ar_Fac\".\"Code_Article\"");

            c1TrueDBGrid1.DataSource = ARFAC.Tables[0];
            DataSet Client = dataBase.returnDataSet("SELECT * FROM \"Client\"");

            c1Combo1.DataSource    = Client.Tables[0];
            c1Combo1.Text          = currentFacture.Client.Code;
            c1Combo1.DisplayMember = "Code";
            c1Label1.Value         = currentFacture.Etat;
            c1Label2.Value         = currentFacture.Livree;
            if (currentFacture.Livree == "Non Livree")
            {
                dateSortie.Visible = false;
            }
            else
            {
                dateSortie.Value = currentFacture.Date_livraison;
            }

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Cheque\" WHERE \"Code_Facture\"='" + Code + "'");
            if (reader.Read())
            {
                comboBox1.Text    = (string)reader["Banque"];
                c1TextBox1.Value  = (string)reader["Montant"];
                c1TextBox2.Value  = (string)reader["Num"];
                c1DateEdit1.Value = (DateTime)reader["Date"];
            }
        }
Beispiel #4
0
        private void GestionFacture_Load(object sender, EventArgs e)
        {
            DB_PostgreSQL databse = new DB_PostgreSQL();

            facture = databse.returnDataSet("SELECT * FROM \"Facture\"");
            facture.Tables[0].Constraints.Add("PrimaryKey", facture.Tables[0].Columns["Code"], true);
            c1TrueDBGrid1.DataSource = facture.Tables[0];
            c1TrueDBGrid1.RowHeight  = 0;
        }
Beispiel #5
0
        private void LoadData()
        {
            DB_PostgreSQL databse = new DB_PostgreSQL();
            DataSet       tmp;

            tmp = databse.returnDataSet("SELECT * FROM \"Famille\"");
            tmp.Tables[0].Constraints.Add("PrimaryKey", tmp.Tables[0].Columns["Code"], true);
            c1TrueDBGrid1.DataSource = tmp.Tables[0];
            c1TrueDBGrid1.RowHeight  = 0;
        }
Beispiel #6
0
        private void ArticleFacture_Load(object sender, EventArgs e)
        {
            c1Combo1.Text  = panel1.Height.ToString();
            comboBox1.Text = panel1.Width.ToString();
            DB_PostgreSQL dataBase = new DB_PostgreSQL();
            DataSet       F        = dataBase.returnDataSet("SELECT * FROM \"Famille\"");

            c1Combo1.DataSource    = F.Tables[0];
            c1Combo1.DisplayMember = "Libelle";
            c1Combo1.ValueMember   = "Code";
            int x = 0;
            int y = 0;

            foreach (DataRow r in F.Tables[0].Rows)
            {
                Button b = new Button();
                b.Parent    = this.panel2;
                b.BackColor = Color.White;
                b.Font      = new Font("Microsoft Sans Serif", 16);
                b.Text      = (string)r["Libelle"];
                b.Size      = new Size(200, 50);
                b.Tag       = (string)r["Code"];
                b.Location  = new Point(x, y);
                y          += 50;
                b.Click    += new EventHandler(b_Click);
            }
            comboBox1.DataSource = Enum.GetNames(typeof(GlobalVars.Operation));
            List <TB_Articles> da = TB_Articles.GetList((string)c1Combo1.SelectedValue, comboBox1.Text);

            x = 0;
            y = 0;
            foreach (TB_Articles a in da)
            {
                Button b = new Button();
                b.Parent   = this.panel1;
                b.Text     = a.Libelle;
                b.Size     = new Size(200, 200);
                b.Location = new Point(x, y);
                if (x < panel1.Width)
                {
                    if (y < panel1.Height)
                    {
                        y += 200;
                    }
                    else
                    {
                        y  = 0;
                        x += 200;
                    }
                }
            }
            this.Invalidate();
        }
Beispiel #7
0
        private void gestionArticle_Load(object sender, EventArgs e)
        {
            DB_PostgreSQL databse = new DB_PostgreSQL();

            article = databse.returnDataSet("SELECT \"Code\",\"Libelle\",\"Code_Famille\",\"Prix_Pressing\",\"Prix_Repassage\",\"Prix_Tenture\",\"Prix_Autre\",\"Photo\" FROM \"Articles\"");
            article.Tables[0].Constraints.Add("PrimaryKey", article.Tables[0].Columns["Code"], true);
            famille = databse.returnDataSet("SELECT * FROM \"Famille\"");

            c1TrueDBGrid1.DataSource = article.Tables[0];
            c1TrueDBGrid1.RowHeight  = 0;

            c1TrueDBDropdown1.DataSource = famille.Tables[0];
            c1TrueDBGrid1.Columns["Code_Famille"].DropDown             = this.c1TrueDBDropdown1;
            c1TrueDBGrid1.Columns["Code_Famille"].ValueItems.Translate = true;
            c1TrueDBGrid1.Columns["Code_Famille"].Caption = "Famille";
            c1TrueDBDropdown1.DataField      = "Code";
            c1TrueDBDropdown1.ListField      = "Libelle";
            c1TrueDBDropdown1.ValueTranslate = true;
            c1TrueDBGrid1.Splits[0].DisplayColumns["Famille"].FilterButton = true;
            c1TrueDBGrid1.Splits[0].DisplayColumns["Famille"].Button       = false;
        }
Beispiel #8
0
        public InfoArticle(string Code)
        {
            InitializeComponent();
            Save = false;
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            c1Combo1.DataSource    = dataBase.returnDataSet("SELECT \"Code\",\"Libelle\" FROM \"Famille\"").Tables[0];
            c1Combo1.DisplayMember = "Libelle";
            c1Combo1.ValueMember   = "Code";
            currentArticle.FindByKey(Code);
            SetChamp(currentArticle);
            btnOK.Enabled = false;
        }
Beispiel #9
0
 private void Supprimer_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Vous ete sure de vouloire Supprimer cette article de la Facture ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         int    index = c1TrueDBGrid1.Row;
         string Code  = c1TrueDBGrid1.Columns["Code_Article"].CellText(index);
         if (Code == null)
         {
             MessageBox.Show("Aucun Article selectionee");
             return;
         }
         DB_PostgreSQL dataBase = new DB_PostgreSQL();
         dataBase.ExecuteNonQuery("DELETE FROM \"Ar_Fac\" WHERE \"Code_Article\"='" + Code + "' AND \"Code_Facture\"='" + currentFacture.Code + "'");
         DataSet ARFAC = dataBase.returnDataSet("SELECT \"Code_Article\",\"Libelle\",\"Quantite\",\"Operation\",\"Prix\" FROM \"Articles\",\"Ar_Fac\" WHERE \"Ar_Fac\".\"Code_Facture\"='" + currentFacture.Code + "' AND" +
                                                "\"Articles\".\"Code\"=\"Ar_Fac\".\"Code_Article\"");
         c1TrueDBGrid1.DataSource = ARFAC.Tables[0];
     }
 }
Beispiel #10
0
        public InfoArticle()
        {
            InitializeComponent();
            btnOK.Enabled    = true;
            Save             = true;
            c1TextBox3.Value = 1;
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            c1Combo1.DataSource    = dataBase.returnDataSet("SELECT \"Code\",\"Libelle\" FROM \"Famille\"").Tables[0];
            c1Combo1.DisplayMember = "Libelle";
            c1Combo1.ValueMember   = "Code";
            c1Combo1.Text          = "";
            c1NumericEdit1.Value   = 0;
            c1NumericEdit2.Value   = 0;
            c1NumericEdit3.Value   = 0;
            c1NumericEdit4.Value   = 0;
            TB_Articles article = new TB_Articles();

            c1TextBox1.Value = article.GenerateCode((string)c1TextBox2.Text);
        }
Beispiel #11
0
        private void GestionClient_Load(object sender, EventArgs e)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            c1TrueDBGrid1.DataSource = dataBase.returnDataSet("SELECT * FROM \"Client\"").Tables[0];
        }