예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddSanPham f = new frmAddSanPham();

            f.ShowDialog();
            gridControl1.DataSource = SanPhamController.GetAllList();
        }
예제 #2
0
        private void gr_btn_del_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            int intRowSelect = gridView1.FocusedRowHandle;

            if (intRowSelect >= 0)
            {
                string strSanPhamID = gridView1.GetRowCellValue(intRowSelect, "SanPhamID").ToString();
                switch (e.Button.Caption.ToUpper())
                {
                case "PAUSE":    // ngừng kinh doanh
                    if (MessageBox.Show("Bạn có muốn ngừng kinh doanh sản phẩm này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        SanPhamController.SetTrangThaiKinhDoanh(strSanPhamID, true);   //ngung kinh doanh
                        gridControl1.DataSource = SanPhamController.GetAllList();
                    }
                    break;

                case "START":                                                     //  kinh doanh laij
                    SanPhamController.SetTrangThaiKinhDoanh(strSanPhamID, false); //kinh doanh lai
                    gridControl1.DataSource = SanPhamController.GetAllList();
                    break;

                case "DELETE":
                    if (MessageBox.Show("Bạn có muốn xóa sản phẩm này không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        SanPhamController.Del(strSanPhamID);
                        gridControl1.DataSource = SanPhamController.GetAllList();
                    }
                    break;

                case "COPY":     //sao chep san pham
                    SanPham itemCopy = SanPhamController.GetItem(strSanPhamID);
                    if (itemCopy != null)
                    {
                        frmAddSanPham f = new frmAddSanPham();
                        f.itemCopy = itemCopy;
                        f.formMode = "Copy";
                        f.ShowDialog(this);
                        gridControl1.DataSource = SanPhamController.GetAllList();
                    }
                    break;

                default:
                    break;
                }
            }
        }
예제 #3
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            //sửa thông tin sản phẩm
            int intRow = gridView1.FocusedRowHandle;

            if (intRow >= 0)
            {
                string  strSanPhamID = gridView1.GetRowCellValue(intRow, "SanPhamID").ToString();
                SanPham item         = SanPhamController.GetItem(strSanPhamID);
                if (item != null)
                {
                    frmAddSanPham f = new frmAddSanPham();
                    f.formMode = "edit";
                    f.itemCopy = item;
                    f.ShowDialog(this);
                    gridControl1.DataSource    = SanPhamController.GetAllList(); // làm mới lại dữ liệu
                    gridView1.FocusedRowHandle = intRow;
                }
            }
        }
예제 #4
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            frmAddSanPham f = new frmAddSanPham();

            f.ShowDialog();
        }