Esempio n. 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure want to update record?", "Update", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                productBLL = new ProductManagementBLL();

                string NAME     = txt_PName.Text;
                string CODE     = txt_PCode.Text;
                string COMPANY  = txt_PCompany.Text;
                string STOCKU   = txt_PStock.Text;
                string CATEGORY = cmbCategory.Text;

                int pAdmin = 1;

                ProductDTO DTO = new ProductDTO(pid, NAME, CODE, COMPANY, STOCKU, pAdmin, CATEGORY);

                productBLL.updateRecord(DTO);
                clearAllFields();
                this.Hide();
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProductManagementBLL pmBll = new ProductManagementBLL();

            grdProducts.DataSource = pmBll.ListProduct();
            grdProducts.DataBind();
        }
        // ================================== end textboxes method ===============


        private void insert_Add_button_Click(object sender, EventArgs e)
        {
            //pm = new ProductManagement();
            productBLL = new ProductManagementBLL();


            string pName  = insert_PName_textBox.Text;
            string pCode  = insert_PCode_textBox.Text;
            string pComp  = insert_PCompany_textBox.Text;
            string pStock = insert_PStockU_textBox.Text;
            string pPCat  = insert_PCategory_comboBox.Text;

            if (pName != "" & pCode != "" & pComp != "" & pStock != "" & pPCat != "")
            {
                Int64 pBAdmin = 1;

                ProductDTO pDTO = new ProductDTO(0, pName, pCode, pComp, pStock, pBAdmin, pPCat);

                productBLL.insertRecord(pDTO);

                clearAllTextBoxes();
            }
            else
            {
                MessageBox.Show("Please Fill All The Fields!");
            }
        }
Esempio n. 4
0
        void deleteProductOfOrder(string product)
        {
            ProductDTO DTO = new ProductDTO(1, product);

            productBLL = new ProductManagementBLL();
            Int64 productID = productBLL.prodNameToID(DTO);

            OrderProductDTO opDTO = new OrderProductDTO(orderId, productID);

            opBLL = new OrderProductBLL();
            opBLL.delete(opDTO);
        }
Esempio n. 5
0
        private void cmbCategory_SelectionChangeCommitted(object sender, EventArgs e)
        {
            string catname = cmbCategory.Text;

            cmbProduct.Items.Clear();
            ProductDTO pDto = new ProductDTO(1, "", "", "", "", 1, catname);

            productBLL = new ProductManagementBLL();
            ArrayList arr = productBLL.searchProdOfCategory(pDto);

            foreach (object o in arr)
            {
                ProductDTO dtp = (ProductDTO)o;
                cmbProduct.Items.Add(dtp.PNAME);
            }
        }
Esempio n. 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string pname     = cmbProduct.Text;
            string pcategory = cmbCategory.Text;
            string pQuantity = tbQuantity.Text;
            string pSize     = cmbSize.Text;

            ProductDTO dto = new ProductDTO(0, pname, "", "", "", 1, pcategory); ////// To

            productBLL = new ProductManagementBLL();                             ///////////////////////////  Convert product name
            Int64 productID = productBLL.prodNameToID(dto);                      /////////////////////////////////////   to ID

            OrderProductDTO oDTO = new OrderProductDTO(orderId, productID, pQuantity, pSize);

            orderProductBLL = new OrderProductBLL();
            orderProductBLL.insert(oDTO);
            ClearAllFields();
        }
Esempio n. 7
0
        void getAllProducts()
        {
            productBLL = new ProductManagementBLL();
            ArrayList arr = productBLL.getAllProducts();

            foreach (object o in arr)
            {
                ProductDTO dto = (ProductDTO)o;

                int a = dataGridView.Rows.Add();
                dataGridView.Rows[a].Cells[0].Value = dto.PID;
                dataGridView.Rows[a].Cells[1].Value = dto.PNAME;
                dataGridView.Rows[a].Cells[2].Value = dto.PCODE;
                dataGridView.Rows[a].Cells[3].Value = dto.PCOMPANY;
                dataGridView.Rows[a].Cells[4].Value = dto.PSTOCKUNIT;
                dataGridView.Rows[a].Cells[5].Value = dto.PCATEGORY;
            }
        }
Esempio n. 8
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure want to delete record?", "Delete", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                productBLL = new ProductManagementBLL();

                ProductDTO DTO = new ProductDTO(pid, "", "", "", "", 0, "");

                productBLL.deleteRecord(DTO);

                clearAllFields();
                this.Hide();
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
Esempio n. 9
0
        void loadProductsOfOrder()
        {
            opDTO = new OrderProductDTO(orderId);
            opBLL = new OrderProductBLL();
            ArrayList arr = opBLL.search(opDTO);

            dataGridView.Rows.Clear();
            dataGridView.Refresh();

            foreach (object o in arr)
            {
                OrderProductDTO orderDTO = (OrderProductDTO)o;

                ProductDTO DTO = new ProductDTO(orderDTO.PRODUCTID);
                productBLL = new ProductManagementBLL();
                string productName = productBLL.prodIdToName(DTO);

                int a = dataGridView.Rows.Add();
                dataGridView.Rows[a].Cells[0].Value = productName;
                dataGridView.Rows[a].Cells[1].Value = orderDTO.QUANTITY;
                dataGridView.Rows[a].Cells[2].Value = orderDTO.SIZE;
            }
        }
Esempio n. 10
0
        // =================================== search in database type in textbox ============================

        private void nameForSearchtextBox_TextChanged(object sender, EventArgs e)
        {
            productBLL = new ProductManagementBLL();

            string name = nameForSearchtextBox.Text;

            ArrayList arr = productBLL.searchRecord(name, name);

            dataGridView.Rows.Clear();
            dataGridView.Refresh();

            foreach (object o in arr)
            {
                ProductDTO dto = (ProductDTO)o;

                int a = dataGridView.Rows.Add();
                dataGridView.Rows[a].Cells[0].Value = dto.PID;
                dataGridView.Rows[a].Cells[1].Value = dto.PNAME;
                dataGridView.Rows[a].Cells[2].Value = dto.PCODE;
                dataGridView.Rows[a].Cells[3].Value = dto.PCOMPANY;
                dataGridView.Rows[a].Cells[4].Value = dto.PSTOCKUNIT;
                dataGridView.Rows[a].Cells[5].Value = dto.PCATEGORY;
            }
        }
Esempio n. 11
0
        public ProductDTO(Int64 id, string name, string code, string company, string stUnit, Int64 pBA, string pCat)
        {
            ProductManagementBLL pBLL = new ProductManagementBLL();

            pID = id;  pName = name; pCode = code; pCompany = company; pStockUnit = stUnit; pBAdmin = pBA; pCategory = pCat;
        }