Esempio n. 1
0
        private void Main_Load(object sender, EventArgs e)
        {
            flp_articles_list.AutoScroll = true;
            SlaDataSet dataSet = new SlaDataSet();

            SlaDataSetTableAdapters.SLA_PRODUCTSTableAdapter listProducts = new SlaDataSetTableAdapters.SLA_PRODUCTSTableAdapter();
            listProducts.Fill(dataSet.SLA_PRODUCTS);

            foreach (SlaDataSet.SLA_PRODUCTSRow product in listProducts.GetData().Where(p => p.PRD_USR_ID != UserAuthService.getUserId()))
            {
                FlowLayoutPanel flowLayoutPanel = new FlowLayoutPanel();

                Label lbId = new Label();
                lbId.Hide();
                lbId.Text = product.PRD_ID.ToString();

                Label lbNom = new Label();
                lbNom.AutoSize  = false;
                lbNom.Text      = product.PRD_NAME;
                lbNom.TextAlign = ContentAlignment.MiddleCenter;

                Label lbPrix = new Label();
                lbPrix.AutoSize  = false;
                lbPrix.Text      = product.PRD_PRICE + " .-";
                lbPrix.TextAlign = ContentAlignment.MiddleCenter;

                flowLayoutPanel.Size = new Size(78, 122);

                lbNom.Size  = new Size(75, 20);
                lbPrix.Size = new Size(75, 20);


                PictureBox picture = new PictureBox();
                picture.Size = new Size(78, 70);

                flowLayoutPanel.Controls.Add(lbId);
                flowLayoutPanel.Controls.Add(picture);
                flowLayoutPanel.Controls.Add(lbNom);
                flowLayoutPanel.Controls.Add(lbPrix);

                foreach (Control control in flowLayoutPanel.Controls)
                {
                    control.Click += new EventHandler(produit_click);
                }
                flp_articles_list.Controls.Add(flowLayoutPanel);
                picture.Image    = simplart.Properties.Resources.bsi_toomt14;
                picture.SizeMode = PictureBoxSizeMode.StretchImage;
                picture.Refresh();
            }
        }
Esempio n. 2
0
        public fv_product(Main main, int id)
        {
            this.main = main;
            SlaDataSet dataSet = new SlaDataSet();

            SlaDataSetTableAdapters.SLA_PRODUCTSTableAdapter listProducts = new SlaDataSetTableAdapters.SLA_PRODUCTSTableAdapter();
            listProducts.Fill(dataSet.SLA_PRODUCTS);
            product = listProducts.GetData().Where(p => p.PRD_ID.Equals(id)).First();

            InitializeComponent();

            lbl_product_name.Text         = product.PRD_NAME;
            lbl_prd_price.Text            = product.PRD_PRICE + " .-";
            rtxt_product_description.Text = product.PRD_DESCRIPTION;
            nud_quantity.Maximum          = product.PRD_QUANTITY;
        }