Exemple #1
0
        private void txtId_TextChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells.Count > 0 && !string.IsNullOrEmpty(txtId.Text))
            {
                string position = (string)dataGridView1.SelectedCells[0].OwningRow.Cells["Position"].Value;
                cbxPosition.SelectedItem = position;

                bool status = (bool)dataGridView1.SelectedCells[0].OwningRow.Cells["Status"].Value;

                if (status == false)
                {
                    changeVisibleBtn(true, false);
                }
                else
                {
                    changeVisibleBtn(false, true);
                }

                bool gender = (bool)dataGridView1.SelectedCells[0].OwningRow.Cells["Gender"].Value;

                if (gender)
                {
                    radMale.Checked = true;
                }
                else
                {
                    radFemale.Checked = true;
                }

                int id = (int)dataGridView1.SelectedCells[0].OwningRow.Cells["Id"].Value;

                var accController = new AccountController();
                var acc           = accController.GetByStaffId(id);

                btnCreateAcc.Visible = (acc == null && status == true) ? true : false;

                byte[] img = (byte[])dataGridView1.SelectedCells[0].OwningRow.Cells["Img"].Value;

                if (img != null)
                {
                    picImg.BackgroundImage = ImageStatic.ConvertBinary2Img(img);
                }
                else
                {
                    picImg.BackgroundImage = null;
                }
            }
        }
Exemple #2
0
        private void txtId_TextChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells.Count > 0 && !string.IsNullOrEmpty(txtId.Text))
            {
                int id    = (int)dataGridView1.SelectedCells[0].OwningRow.Cells["DrinkCategoryId"].Value;
                int index = -1;
                int i     = 0;

                foreach (DrinkCategoryDto c in cbxCategory.Items)
                {
                    if (c.Id == id)
                    {
                        index = i;
                        break;
                    }
                    i++;
                }

                cbxCategory.SelectedIndex = index;
                bool status = (bool)dataGridView1.SelectedCells[0].OwningRow.Cells["Status"].Value;

                if (status == false)
                {
                    changeVisibleBtn(true, false);
                }
                else
                {
                    changeVisibleBtn(false, true);
                }

                byte[] img = (byte[])dataGridView1.SelectedCells[0].OwningRow.Cells["Img"].Value;

                if (img != null)
                {
                    pictureBox1.BackgroundImage = ImageStatic.ConvertBinary2Img(img);
                }
                else
                {
                    pictureBox1.BackgroundImage = null;
                }
            }
            else
            {
                pictureBox1.BackgroundImage = null;
            }
        }
Exemple #3
0
        private void Create_pnl(DrinkDto drink)
        {
            var pic = new PictureBox();

            pic.Width  = 235;
            pic.Height = 235;
            pic.BackgroundImageLayout = ImageLayout.Stretch;
            pic.Cursor = Cursors.Hand;

            Image img = null;

            if (drink.Img != null)
            {
                img = ImageStatic.ConvertBinary2Img(drink.Img);
            }
            pic.BackgroundImage = img;

            var _lblname = new Label();

            _lblname.Text      = drink.Name;
            _lblname.Dock      = DockStyle.Bottom;
            _lblname.Height    = 55;
            _lblname.TextAlign = ContentAlignment.MiddleCenter;
            _lblname.BackColor = Color.FromArgb(241, 242, 246);
            _lblname.ForeColor = Color.FromArgb(0, 0, 0);
            _lblname.Font      = new Font("Segoe UI Symbol", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
            pic.Controls.Add(_lblname);

            var _lblprice = new Label();

            _lblprice.Text      = drink.Price.ToString("#,##");
            _lblprice.TextAlign = ContentAlignment.MiddleCenter;
            _lblprice.Height    = 35;
            _lblprice.Width     = 100;
            _lblprice.BackColor = Color.FromArgb(55, 66, 250);
            _lblprice.ForeColor = Color.FromArgb(255, 255, 255);
            _lblprice.Font      = new Font("Segoe UI Symbol", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
            pic.Controls.Add(_lblprice);

            flowLayoutPanel1.Controls.Add(pic);
            pic.Tag    = drink.Id.ToString();
            pic.Click += new EventHandler(OnClick);
        }