Exemplo n.º 1
0
        private void cbbCategory_Click(object sender, EventArgs e)
        {
            DataTable dt = AdminSettingController.Category_Show().Tables[0];

            cbbCategory.Items.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                string temp = dr["CategoryName"].ToString();
                cbbCategory.Items.Add(temp);
            }
        }
Exemplo n.º 2
0
        private void cbbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            string CategoryName = cbbCategory.SelectedItem.ToString();

            DataTable dtIDCategory = AdminSettingController.IDCategory_Find(CategoryName).Tables[0];
            string    IDCategory   = dtIDCategory.Rows[0][0].ToString();

            DataTable dtSubCategory = AdminSettingController.SubCategory_Show(IDCategory).Tables[0];

            cbbSubCategory.Items.Clear();
            foreach (DataRow dr in dtSubCategory.Rows)
            {
                string SubCategoryName = dr["SubCategoryName"].ToString();
                cbbSubCategory.Items.Add(SubCategoryName);
            }
        }
Exemplo n.º 3
0
        private void btnAddItems_Click(object sender, EventArgs e)
        {
            string ItemName    = txtItemName.Text.Trim();
            float  ImportPrice = float.Parse(txtImportPrice.Text.Trim());
            float  SalePrice   = float.Parse(txtSalePrice.Text.Trim());
            string Description = txtDescription.Text.Trim();
            string Orgin       = txtOrgin.Text.Trim();

            if (ItemImageName == "")
            {
                ItemImageName = "noImage.png";
            }
            string Image = ItemImageName;

            string    CategoryName    = cbbCategory.SelectedItem.ToString();
            DataTable dtIDCategory    = AdminSettingController.IDCategory_Find(CategoryName).Tables[0];
            string    IDCategory      = dtIDCategory.Rows[0][0].ToString();
            string    SubCategoryName = cbbSubCategory.SelectedItem.ToString();
            DataTable dtIDSubcategory = AdminSettingController.IDSubCategory_Find(SubCategoryName).Tables[0];
            string    IDSubCategory   = dtIDSubcategory.Rows[0][0].ToString();

            bool check = AdminSettingController.AddItem(UserName, PassWord, ItemName, ImportPrice, SalePrice, Description, Orgin, IDCategory, IDSubCategory, Image, ref err);

            if (check == true)
            {
                DialogResult dialogResult;
                dialogResult = MessageBox.Show("Bạn đã thêm món ăn thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.OK)
                {
                    txtItemName.Clear();
                    txtImportPrice.Clear();
                    txtSalePrice.Clear();
                    txtDescription.Clear();
                    txtOrgin.Clear();
                    cbbCategory.Items.Clear();
                    cbbCategory.Text = "Chọn loại";
                    cbbSubCategory.Items.Clear();
                    cbbSubCategory.Text   = "Chọn danh mục";
                    ptBImageProduct.Image = null;
                }
            }
            else
            {
                MessageBox.Show("Đăng ký thất bại, xin thử lại lần nữa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
        private void btnProductCategory_Click(object sender, EventArgs e)
        {
            int ybtn = 4;

            if (flaqMenuCategory == true)
            {
                this.pnCategory.Visible = true;
                flaqMenuCategory        = false;
            }
            else
            {
                this.pnCategory.Visible = false;
                this.pnPanel.Visible    = false;
                flaqMenuCategory        = true;
            }
            DataTable dtCategory = AdminSettingController.Category_Show().Tables[0];
            int       count      = 0;

            foreach (DataRow dr in dtCategory.Rows)
            {
                Guna.UI.WinForms.GunaButton btnCategory = new Guna.UI.WinForms.GunaButton();
                btnCategory.Location         = new Point(3, ybtn);
                btnCategory.Size             = new Size(215, 35);
                btnCategory.Animated         = true;
                btnCategory.BackColor        = Color.Transparent;
                btnCategory.BaseColor        = Color.Silver;
                btnCategory.BorderColor      = Color.Black;
                btnCategory.ForeColor        = Color.Black;
                btnCategory.BorderSize       = 1;
                btnCategory.Cursor           = Cursors.Hand;
                btnCategory.Font             = new Font("Tahoma", 13, FontStyle.Bold);
                btnCategory.Image            = null;
                btnCategory.OnHoverBaseColor = Color.DarkGray;
                btnCategory.Radius           = 5;
                btnCategory.TextAlign        = HorizontalAlignment.Center;
                btnCategory.Text             = dr["CategoryName"].ToString();
                btnCategory.Click           += BtnCategory_Click;
                btnCategory.DoubleClick     += BtnCategory_DoubleClick;
                ybtn += 34;
                pnCategory.Controls.Add(btnCategory);
                count++;
            }
            pnCategory.Height = 36 * count;
        }
        private void btnRegister_Click(object sender, EventArgs e)
        {
            string   UserNameSeller = txtUsername.Text.Trim();
            string   PassWordSeller = txtPassword.Text.Trim();
            string   FullName       = txtFullName.Text.Trim();
            string   Gender         = cbbGender.SelectedItem.ToString();
            DateTime DateofBirth    = dtpDateOfBirth.Value;
            string   PhoneNumber    = txtPhone.Text.Trim();
            string   Email          = txtEmail.Text.Trim();
            string   Image          = "noImageUser.png";

            bool check = AdminSettingController.Register_Seller(UserName, UserNameSeller, PassWord, PassWordSeller, FullName, Gender, DateofBirth, PhoneNumber, Email, Image, ref err);

            if (check == true)
            {
                DialogResult dialogResult;
                dialogResult = MessageBox.Show("Bạn đã đăng ký nhân viên thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Đăng ký thất bại, xin thử lại lần nữa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 6
0
        private void BtnCategory_Click(object sender, EventArgs e)
        {
            pnPanel.Controls.Clear();
            this.pnPanel.Visible = true;
            Guna.UI.WinForms.GunaButton btn = sender as Guna.UI.WinForms.GunaButton;
            Guna.UI.WinForms.GunaPanel  pn  = new Guna.UI.WinForms.GunaPanel();
            string CategoryName             = btn.Text;

            if (CategoryName == "Rau")
            {
                pn.Location      = new Point(3, 4);
                pnPanel.Location = new Point(233, 215);
            }
            if (CategoryName == "Củ")
            {
                pn.Location      = new Point(3, 4);//38);
                pnPanel.Location = new Point(233, 249);
            }
            if (CategoryName == "Quả")
            {
                pn.Location      = new Point(3, 4);//72);
                pnPanel.Location = new Point(233, 283);
            }
            if (CategoryName == "Hạt giống")
            {
                pn.Location      = new Point(3, 4);//106);
                pnPanel.Location = new Point(233, 317);
            }
            if (CategoryName == "Phân bón")
            {
                pn.Location      = new Point(3, 4);//140);
                pnPanel.Location = new Point(233, 351);
            }

            string    IDCategory    = AdminSettingController.IDCategory_Find(CategoryName).Tables[0].Rows[0][0].ToString();
            DataTable dtSubCategory = AdminSettingController.SubCategory_Show(IDCategory).Tables[0];

            pn.BackColor = Color.Silver;
            pn.Width     = 217;

            pnPanel.Controls.Add(pn);
            int ybtn  = 0;
            int count = 0;

            foreach (DataRow dr in dtSubCategory.Rows)
            {
                Guna.UI.WinForms.GunaButton btnSubCategory = new Guna.UI.WinForms.GunaButton();
                btnSubCategory.Location         = new Point(0, ybtn);
                btnSubCategory.Size             = new Size(215, 35);
                btnSubCategory.Animated         = true;
                btnSubCategory.BackColor        = Color.Transparent;
                btnSubCategory.BaseColor        = Color.Silver;
                btnSubCategory.BorderColor      = Color.Black;
                btnSubCategory.ForeColor        = Color.Black;
                btnSubCategory.BorderSize       = 1;
                btnSubCategory.Cursor           = Cursors.Hand;
                btnSubCategory.Font             = new Font("Tahoma", 13, FontStyle.Bold);
                btnSubCategory.Image            = null;
                btnSubCategory.OnHoverBaseColor = Color.DarkGray;
                btnSubCategory.Radius           = 5;
                btnSubCategory.TextAlign        = HorizontalAlignment.Center;
                btnSubCategory.Text             = dr["SubCategoryName"].ToString();
                btnSubCategory.Click           += BtnSubCategory_Click;
                ybtn += 34;
                count++;
                pn.Controls.Add(btnSubCategory);
            }
            pn.Height      = 35 * count;
            pnPanel.Height = 37 * count;
        }