Exemple #1
0
        private TB_Articles GetChamp()
        {
            TB_Articles article = new TB_Articles();

            article.N_Pieces       = (decimal)c1TextBox3.Value;
            article.Libelle        = (string)c1TextBox2.Text;
            article.Code_Famille   = (string)c1Combo1.SelectedValue;
            article.Code           = (string)c1TextBox1.Text;
            article.Description    = (string)c1TextBox4.Text;
            article.Prix_Pressing  = (decimal)c1NumericEdit1.Value;
            article.Prix_Repassage = (decimal)c1NumericEdit2.Value;
            article.Prix_Tenture   = (decimal)c1NumericEdit3.Value;
            article.Prix_Autre     = (decimal)c1NumericEdit4.Value;
            article.Print          = checkBox5.Checked;
            if (newPic)
            {
                MyUtils myUtils = new MyUtils();
                article.Photo = myUtils.GetPhoto(textBox1.Text);
            }
            else
            {
                article.Photo = null;
            }
            return(article);
        }
Exemple #2
0
 private void c1TextBox2_TextChanged(object sender, EventArgs e)
 {
     btnOK.Enabled = true;
     if (Save)
     {
         TB_Articles a = new TB_Articles();
         c1TextBox1.Value = a.GenerateCode((string)c1TextBox2.Text);
     }
 }
 private void comboOperation_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedOperation       = comboOperation.Text;
     comboCode.Text          = "";
     comboLibelle.Text       = "";
     comboLibelle.DataSource = comboCode.DataSource = TB_Articles.GetList(selectedFamilleItem.Code, selectedOperation);
     textPrix.DataBindings.Clear();
     textPrix.DataBindings.Add("Text", comboCode.DataSource, "Prix_" + selectedOperation);
 }
Exemple #4
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();
        }
Exemple #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (VerifierChamp())
     {
         TB_Articles newArticle = GetChamp();
         if (!Save)
         {
             newArticle.UpdateData();
         }
         else
         {
             newArticle.SaveData();
         }
         this.Close();
     }
 }
Exemple #6
0
        void b_Click(object sender, EventArgs e)
        {
            panel1.Controls.Clear();
            List <TB_Articles> da = TB_Articles.GetList((string)((Button)sender).Tag, comboBox1.Text);
            int x = 0;
            int y = 0;
            int h = panel1.Height;
            int w = panel1.Width;

            foreach (TB_Articles a in da)
            {
                Button b = new Button();
                b.Parent                = this.panel1;
                b.Text                  = a.Libelle;
                b.TextAlign             = ContentAlignment.BottomCenter;
                b.BackgroundImageLayout = ImageLayout.Zoom;
                b.BackColor             = Color.White;
                b.Font                  = new Font("Microsoft Sans Serif", 16);
                if (a.Photo != null)
                {
                    MemoryStream ms = new MemoryStream();
                    ms.Write(a.Photo, 0, a.Photo.Length);
                    Image imgPhoto = Image.FromStream(ms);
                    b.BackgroundImage = imgPhoto;
                }
                b.Size     = new Size(200, 100);
                b.Location = new Point(x, y);
                if (y != 0)
                {
                    if ((h / (y + 200)) >= 1)
                    {
                        y += 100;
                    }
                    else
                    {
                        y  = 0;
                        x += 200;
                    }
                }
                else
                {
                    y += 100;
                }
            }
            this.Invalidate();
        }
Exemple #7
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);
        }
Exemple #8
0
 private void Supprimer_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Vous ete sure de vouloire Supprimer cette article ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         int    index = c1TrueDBGrid1.Row;
         string Code  = c1TrueDBGrid1.Columns["Code"].CellText(index);
         if (Code == null)
         {
             MessageBox.Show("Code Vide");
             return;
         }
         TB_Articles Ar = new TB_Articles();
         Ar.FindByKey(Code);
         Ar.DeleteData();
         ((DataTable)c1TrueDBGrid1.DataSource).Rows.Find(Code).Delete();
     }
 }
        private void frmFactureAjouterArticle_Load(object sender, EventArgs e)
        {
            textQ.Text = "1";

            comboOperation.Text = "Pressing";

            comboFamille.DataSource    = listFamille;
            comboFamille.DisplayMember = "Libelle";
            comboFamille.ValueMember   = "Code";

            comboCode.Text          = "";
            comboLibelle.Text       = "";
            comboLibelle.DataSource = comboCode.DataSource = TB_Articles.GetList(selectedFamilleItem.Code, comboOperation.Text);
            textPrix.DataBindings.Clear();
            textPrix.DataBindings.Add("Text", comboCode.DataSource, "Prix_" + comboOperation.Text);

            comboLibelle.DisplayMember = "Libelle";
            comboCode.DisplayMember    = "Code";
        }
Exemple #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);
        }
Exemple #11
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);
        }
Exemple #12
0
 private void SetChamp(TB_Articles article)
 {
     c1TextBox1.Value       = article.Code;
     c1TextBox2.Value       = article.Libelle;
     c1TextBox3.Value       = article.N_Pieces;
     c1TextBox4.Value       = article.Description;
     c1NumericEdit1.Value   = article.Prix_Pressing;
     c1NumericEdit2.Value   = article.Prix_Repassage;
     c1NumericEdit3.Value   = article.Prix_Tenture;
     c1NumericEdit4.Value   = article.Prix_Autre;
     checkBox1.Checked      = article.Pressing;
     checkBox2.Checked      = article.Repassage;
     checkBox3.Checked      = article.Tenture;
     checkBox4.Checked      = article.Autre;
     c1Combo1.SelectedValue = article.Code_Famille;
     checkBox5.Checked      = article.Print;
     if (article.Photo != null)
     {
         MemoryStream ms = new MemoryStream();
         ms.Write(article.Photo, 0, article.Photo.Length);
         Image imgPhoto = Image.FromStream(ms);
         c1PictureBox1.Image = imgPhoto;
     }
 }
 public frmFactureAjouterArticle()
 {
     InitializeComponent();
     listArticle = TB_Articles.GetList();
     listFamille = TB_Famille.GetList();
 }