Beispiel #1
0
 public InfoSociete()
 {
     Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Info_Societe\"");
     if (reader.Read())
     {
         this.nom     = (string)reader["Nom"];
         this.adresse = (string)reader["Adresse"];
         this.tel     = (string)reader["Tel"];
         this.fax     = (string)reader["Fax"];
         this.logo    = (byte[])reader["Logo"];
         this._existe = true;
     }
 }
Beispiel #2
0
        public bool FindByKey(string Code)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Famille\" WHERE \"Code\"='" + Code + "'");
            if (reader.Read())
            {
                this.Code        = Code;
                this.Libelle     = (string)reader["Libelle"];
                this.Description = reader["Description"] != DBNull.Value?(string)reader["Description"]:"------------";
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        public static List <TB_Famille> GetList()
        {
            List <TB_Famille> list     = new List <TB_Famille>();
            DB_PostgreSQL     dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Famille\"");
            while (reader.Read())
            {
                TB_Famille f = new TB_Famille();
                f.Code        = (string)reader["Code"];
                f.Libelle     = (string)reader["Libelle"];
                f.Description = reader["Description"] != DBNull.Value?(string)reader["Description"]:"------------";
                list.Add(f);
            }
            return(list);
        }
Beispiel #4
0
        public bool FindByKey(string Code)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Client\" WHERE \"Code\"='" + Code + "'");
            if (reader.Read())
            {
                this.Code    = Code;
                this.Nom     = (string)reader["Nom"];
                this.Prenom  = (string)reader["Prenom"];
                this.NTel    = (string)reader["Tel"];
                this.Adresse = (string)reader["Adresse"];
                return(true);
            }
            return(false);
        }
Beispiel #5
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 #6
0
        public static List <TB_Articles> GetList(string Code_Famille, string Op)
        {
            List <TB_Articles> list     = new List <TB_Articles>();
            DB_PostgreSQL      dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Articles\" WHERE \"Code_Famille\"='" + Code_Famille + "'");
            while (reader.Read())
            {
                TB_Articles a = new TB_Articles();
                a.Code           = (string)reader["Code"];
                a.Libelle        = (string)reader["Libelle"];
                a.N_Pieces       = (int)reader["N_Pieces"];
                a.Description    = (string)reader["Description"];
                a.Prix_Pressing  = (decimal)reader["Prix_Pressing"];
                a.Prix_Repassage = (decimal)reader["Prix_Repassage"];
                a.Prix_Tenture   = (decimal)reader["Prix_Tenture"];
                a.Prix_Autre     = (decimal)reader["Prix_Autre"];
                a.Code_Famille   = (string)reader["Code_Famille"];
                a.Print          = (bool)reader["Print"];
                a.Photo          = reader["Photo"] != DBNull.Value ? (byte[])reader["Photo"] : null;
                if (Op != string.Empty)
                {
                    if ((Op == "Pressing") & (a.Pressing))
                    {
                        list.Add(a);
                    }
                    if ((Op == "Repassage") & (a.Repassage))
                    {
                        list.Add(a);
                    }
                    if ((Op == "Tenture") & (a.Tenture))
                    {
                        list.Add(a);
                    }
                    if ((Op == "Autre") & (a.Autre))
                    {
                        list.Add(a);
                    }
                }
                else
                {
                    list.Add(a);
                }
            }
            return(list);
        }
Beispiel #7
0
        public bool FindByKey(string Login)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"User\" WHERE \"Login\"='" + Login + "'");
            if (reader.Read())
            {
                this.Login    = (string)reader["Login"];
                this.Password = (string)reader["Password"];
                this.Tel      = (string)reader["Tel"];
                this.Photo    = reader["Photo"] is DBNull ? null : (byte[])reader["Photo"];
                this.Role     = (int)reader["Role"];
                _Existe       = true;
                return(true);
            }
            return(false);
        }
Beispiel #8
0
        public static List <ListAF> GetList(string CodeFacture)
        {
            List <ListAF> list     = new List <ListAF>();;
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Ar_Fac\" WHERE \"Code_Facture\"='" + CodeFacture + "'");
            while (reader.Read())
            {
                ListAF s = new ListAF();
                s.Quantite     = (int)reader["Quantite"];
                s.Operation    = (string)reader["Operation"];
                s.Code_Article = (string)reader["Code_Article"];
                s.Code_Facture = (string)reader["Code_Facture"];
                s.Prix         = (decimal)reader["Prix"];
                list.Add(s);
            }
            return(list);
        }
Beispiel #9
0
        public static List <TB_Client> GetList()
        {
            List <TB_Client> list     = new List <TB_Client>();
            DB_PostgreSQL    dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Client\"");
            while (reader.Read())
            {
                TB_Client c = new TB_Client();
                c.Code    = (string)reader["Code"];
                c.Nom     = (string)reader["Nom"];
                c.Prenom  = (string)reader["Prenom"];
                c.NTel    = (string)reader["Tel"];
                c.Adresse = (string)reader["Adresse"];
                list.Add(c);
            }
            return(list);
        }
Beispiel #10
0
        public bool FindByKey(string Code)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Articles\" WHERE \"Code\"='" + Code + "'");
            if (reader.Read())
            {
                this.Code           = (string)reader["Code"];
                this.Libelle        = (string)reader["Libelle"];
                this.N_Pieces       = (int)reader["N_Pieces"];
                this.Description    = (string)reader["Description"];
                this.Prix_Pressing  = (decimal)reader["Prix_Pressing"];
                this.Prix_Repassage = (decimal)reader["Prix_Repassage"];
                this.Prix_Tenture   = (decimal)reader["Prix_Tenture"];
                this.Prix_Autre     = (decimal)reader["Prix_Autre"];
                this.Code_Famille   = (string)reader["Code_Famille"];
                this.Print          = (Boolean)reader["Print"];
                this.Photo          = reader["Photo"] != DBNull.Value ? (byte[])reader["Photo"] : null;
                return(true);
            }
            return(false);
        }
Beispiel #11
0
        public bool FindByKey(string Code)
        {
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Facture\" WHERE \"Code\"='" + Code + "'");
            if (reader.Read())
            {
                this.Code           = (string)reader["Code"];
                this.Date_Recu      = (DateTime)reader["Date_Recu"];
                this.Date_livraison = (DateTime)reader["Date_Livraison"];
                this.Prix_Total     = (double)reader["Prix_Total"];
                this.Prix_Partiel   = (double)reader["Prix_Partiel"];
                this.Client         = new TB_Client((string)reader["Code_Client"]);
                this.Mode_Payement  = (string)reader["Mode_Payement"];
                this.Etat           = (string)reader["Etat"];
                this.Livree         = (string)reader["Livree"];
                this.Date_Payement  = (DateTime)reader["Date_Payement"];
                this.Date_Sortie    = (DateTime)reader["Date_Sortie"];
                return(true);
            }
            return(false);
        }
Beispiel #12
0
        public static List <TB_Facture> GetList()
        {
            List <TB_Facture> list     = new List <TB_Facture>();
            DB_PostgreSQL     dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Facture\"");
            while (reader.Read())
            {
                TB_Facture f = new TB_Facture();
                f.Code           = (string)reader["Code"];
                f.Date_Recu      = (DateTime)reader["Date_Recu"];
                f.Date_livraison = (DateTime)reader["Date_Livraison"];
                f.Prix_Total     = (double)reader["Prix_Total"];
                f.Prix_Partiel   = (double)reader["Prix_Partiel"];
                f.Client         = new TB_Client((string)reader["Code_Client"]);
                f.Mode_Payement  = (string)reader["Mode_Payement"];
                f.Livree         = (string)reader["Livree"];
                f.Date_Payement  = /*reader["Date_Payement"] is DBNull ?  :*/ (DateTime)reader["Date_Payement"];
                f.Date_Sortie    = /*reader["Date_Sortie"] is DBNull ? null : */ (DateTime)reader["Date_Sortie"];
                list.Add(f);
            }
            return(list);
        }
Beispiel #13
0
        public static List <TB_Articles> GetList()
        {
            List <TB_Articles> list     = new List <TB_Articles>();
            DB_PostgreSQL      dataBase = new DB_PostgreSQL();

            Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Articles\"");
            while (reader.Read())
            {
                TB_Articles a = new TB_Articles();
                a.Code           = (string)reader["Code"];
                a.Libelle        = (string)reader["Libelle"];
                a.N_Pieces       = (int)reader["N_Pieces"];
                a.Description    = (string)reader["Description"];
                a.Prix_Pressing  = (decimal)reader["Prix_Pressing"];
                a.Prix_Repassage = (decimal)reader["Prix_Repassage"];
                a.Prix_Tenture   = (decimal)reader["Prix_Tenture"];
                a.Prix_Autre     = (decimal)reader["Prix_Autre"];
                a.Code_Famille   = (string)reader["Code_Famille"];
                a.Print          = (bool)reader["Print"];
                a.Photo          = reader["Photo"] != DBNull.Value?(byte[])reader["Photo"]:null;
                list.Add(a);
            }
            return(list);
        }