Ejemplo n.º 1
0
        private void productBarcodeTextBox_TextChanged(object sender, EventArgs e)
        {
            try
            {
                Product product = new Product();
                product.productBarcode = productBarcodeTextBox.Text;

                DataSet ds = account_Bo.getSoldProduct(productBarcodeTextBox.Text,"");
                productMetroGrid2.DataSource = ds.Tables[0];
                if (productBarcodeTextBox.Text != "")
                {
                    returnStock_btn.Enabled = true;
                }
                else
                {
                    returnStock_btn.Enabled = false;
                }

                if (productMetroGrid2.Rows.Count > 1)
                {
                    totalProductlabel.Text = (productMetroGrid2.Rows.Count).ToString();
                }
                else if (productMetroGrid2.Rows.Count == 1)
                {
                    totalProductlabel.Text = "1";
                }
                else
                {
                    totalProductlabel.Text = "0";
                }
                double p_amount = 0;
                double s_amount = 0;
                double profit = 0;

                for (int i = 0; i < productMetroGrid2.Rows.Count; i++)
                {
                    p_amount += Convert.ToDouble(productMetroGrid2.Rows[i].Cells[8].Value.ToString());
                    s_amount += Convert.ToDouble(productMetroGrid2.Rows[i].Cells[9].Value.ToString());
                    profit += Convert.ToDouble(productMetroGrid2.Rows[i].Cells[10].Value.ToString());
                }
                p_label.Text = p_amount.ToString() + " TK";
                s_label.Text = s_amount.ToString() + " TK";
                pro_label.Text = profit.ToString() + " TK";

            }
            catch
            {
                returnStock_btn.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        private void returnStock_btn_Click(object sender, EventArgs e)
        {
            Product product = new Product();
            try
            {

                if (MessageBox.Show("Are you sure?", "Return to Stock", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    product.productName = productMetroGrid2.CurrentRow.Cells[0].Value.ToString();
                    product.productBrand = productMetroGrid2.CurrentRow.Cells[1].Value.ToString();
                    product.productUnitPrice = productMetroGrid2.CurrentRow.Cells[8].Value.ToString();
                    product.productShortDescription = productMetroGrid2.CurrentRow.Cells[4].Value.ToString();
                    product.productEntryDate = productMetroGrid2.CurrentRow.Cells[5].Value.ToString();
                    product.productBarcode = productMetroGrid2.CurrentRow.Cells[6].Value.ToString();
                    product.productEntrier = productMetroGrid2.CurrentRow.Cells[7].Value.ToString();
                    product.importerName = productMetroGrid2.CurrentRow.Cells[3].Value.ToString();
                    product.importerInvoiceNo = productMetroGrid2.CurrentRow.Cells[2].Value.ToString();
                    product.soldPrice = productMetroGrid2.CurrentRow.Cells[9].Value.ToString();
                    account_Bo.setProduct(product);
                    account_Bo.deleteSoldProduct(productMetroGrid2.CurrentRow.Cells[6].Value.ToString());
                    productMetroGrid2.DataSource = "";
                    returnStock_btn.Enabled = false;
                    productBarcodeTextBox.Clear();
                }

            }
            catch
            {
                MessageBox.Show("Please select a item");
            }
        }
Ejemplo n.º 3
0
        private void update_btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (returnName_txt.Text != "")
                {
                    Product product = new Product();
                    product.productName = returnName_txt.Text;
                    product.productBrand = returnBrand_txt.Text;
                    product.productUnitPrice = returnUnitPrice_txt.Text;
                    product.productShortDescription = returnShortdescription_txt.Text;
                    product.productEntryDate = returnEntrydate_txt.Text;
                    product.productBarcode = returnBarcode_txt.Text;
                    product.importerName = returnImporterName_txt.Text;
                    product.importerInvoiceNo = returnInvoiceNo_txt.Text;
                    product.soldPrice = returnMrp_TextBox.Text;
                    product.productEntrier = userNametextBox.Text;
                    if (MessageBox.Show("Are you sure?", "Update Product", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        account_Bo.updateProduct(product);
                        MessageBox.Show("Product Update Successfully Done");
                        returnBarcode_txt.Clear();
                        returnBrand_txt.Clear();
                        returnImporterName_txt.Clear();
                        returnInvoiceNo_txt.Clear();
                        returnName_txt.Clear();
                        returnEntrydate_txt.Clear();
                        returnUnitPrice_txt.Clear();
                        returnShortdescription_txt.Clear();
                        returnMrp_TextBox.Clear();

                        try
                        {

                            product.productName = returnName_txt.Text;
                            product.productBrand = returnBrand_txt.Text;
                            product.productUnitPrice = returnUnitPrice_txt.Text;
                            product.productShortDescription = returnShortdescription_txt.Text;
                            product.productEntryDate = returnEntrydate_txt.Text;
                            product.productBarcode = returnBarcode_txt.Text;
                            product.importerName = returnImporterName_txt.Text;
                            product.importerInvoiceNo = returnInvoiceNo_txt.Text;
                            product.soldPrice = returnMrp_TextBox.Text;
                            product.productEntrier = userNametextBox.Text;
                            DataSet ds = account_Bo.getProduct(product);
                            productMetroGrid.DataSource = ds.Tables[0];

                            if (productMetroGrid.Rows.Count > 1)
                            {
                                Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                            }
                            else if (productMetroGrid.Rows.Count == 1)
                            {
                                Mlabel.Text = "1 result found";
                            }
                            else
                            {
                                Mlabel.Text = "No result found";
                            }
                        }
                        catch
                        {

                        }
                    }

                }
                else
                {
                    MessageBox.Show("Please select a item first");
                }
            }
            catch
            {

            }
        }
Ejemplo n.º 4
0
        private void returnClient_Button_Click(object sender, EventArgs e)
        {
            try
            {
                if (returnName_txt.Text != "" && reference_textBox.Text != "" && cause_textBox.Text != "" )
                {
                    Product product = new Product();

                    product.productName = returnName_txt.Text;
                    product.productBrand = returnBrand_txt.Text;
                    product.productUnitPrice = returnUnitPrice_txt.Text;
                    product.productShortDescription = returnShortdescription_txt.Text;
                    product.productEntryDate = returnEntrydate_txt.Text;
                    product.productBarcode = returnBarcode_txt.Text;
                    product.importerName = returnImporterName_txt.Text;
                    product.importerInvoiceNo = returnInvoiceNo_txt.Text;

                    product.productEntrier = productMetroGrid.CurrentRow.Cells[7].Value.ToString();

                    product.soldPrice = productMetroGrid.CurrentRow.Cells[9].Value.ToString();
                    if (MessageBox.Show("Are you sure?", "Return to Stock", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        account_Bo.setProduct(product);
                        account_Bo.deleteReturnCompanyProduct(returnBarcode_txt.Text);
                        MessageBox.Show("Product Return to Stock Successfully Done");
                        returnBarcode_txt.Clear();
                        returnBrand_txt.Clear();
                        returnImporterName_txt.Clear();
                        returnInvoiceNo_txt.Clear();
                        returnName_txt.Clear();
                        returnEntrydate_txt.Clear();
                        returnUnitPrice_txt.Clear();
                        returnShortdescription_txt.Clear();
                        returnMrp_TextBox.Clear();
                        reference_textBox.Clear();
                        cause_textBox.Clear();

                        try
                        {

                            DataSet ds = account_Bo.getReturnCompanyProduct("", "");
                            productMetroGrid.DataSource = ds.Tables[0];

                            if (productMetroGrid.Rows.Count > 1)
                            {
                                Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                            }
                            else if (productMetroGrid.Rows.Count == 1)
                            {
                                Mlabel.Text = "1 result found";
                            }
                            else
                            {
                                Mlabel.Text = "No result found";
                            }
                        }
                        catch
                        {

                        }
                    }

                }
                else
                {
                    MessageBox.Show("Please select a item first and fill the information fully");
                }
            }
            catch
            {

            }
        }
Ejemplo n.º 5
0
        private void removefromCartbutton_Click(object sender, EventArgs e)
        {
            Product product = new Product();
            try
            {
                if (returnBarcode_txt.Text != "")
                {

                    if (MessageBox.Show("Are you sure?", "Remove from cart", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {

                        product = account_Bo.getTempProductBySerialNoforReentry(returnSerial_txt.Text);
                        account_Bo.setProduct(product);
                        account_Bo.deleteTempProduct(returnSerial_txt.Text);
                        account_Bo.deleteSoldProduct(returnSerial_txt.Text);
                        reloadshoppingCartDataGridview();
                        calculateTotal();
                        try
                        {

                            product.productSerialNo = productSerialNoTextBox.Text;
                            product.productName = productNameTextBox.Text;
                            product.productModel = productModelNoTextBox.Text;
                            product.productBrand = productBrandTextBox.Text;
                            product.importerID = productImporterIDTextBox.Text;
                            product.productAvailableWarrenty = productWarrentyTextBox.Text;
                            product.productUnitPrice = "";
                            product.productShortDescription = "";
                            product.productLongDescription = "";
                            product.productEntryDate = "";
                            product.productBarcode = productBarcodeTextBox.Text;
                            product.productEntrier = "";
                            product.importerName = importerNamemetroTextBox.Text;
                            product.importerInvoiceNo = importerInvoiceNoTextBox.Text;
                            product.productBatchNo = productBatchmetroTextBox.Text;

                            DataSet ds = account_Bo.getProduct(product);
                            productMetroGrid.DataSource = ds.Tables[0];

                            if (productMetroGrid.Rows.Count > 1)
                            {
                                Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                            }
                            else if (productMetroGrid.Rows.Count == 1)
                            {
                                Mlabel.Text = "1 result found";
                            }
                            else
                            {
                                Mlabel.Text = "No result found";
                            }
                        }
                        catch
                        {

                        }
                        returnBarcode_txt.Text = productMetroGrid.CurrentRow.Cells[11].Value.ToString();
                        soldPrice_txt.Text = productMetroGrid.CurrentRow.Cells[2].Value.ToString();
                        purchasePrice_txt.Text = productMetroGrid.CurrentRow.Cells[1].Value.ToString();
                        returnSerial_txt.Text = productMetroGrid.CurrentRow.Cells[0].Value.ToString();

                        returnBarcode_txt.Clear();
                        soldPrice_txt.Clear();
                        purchasePrice_txt.Clear();
                        returnSerial_txt.Clear();
                        nettotalmetroTextBox.Clear();
                        discountmetroTextBox.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("Please select a item");
                }
            }
            catch
            {

            }
        }
        private void save_btn_Click(object sender, EventArgs e)
        {
            Product product = new Product();
            try
            {
                if (productShortDescriptiontextBox.Text != "" && productLongDescriptionTextBox.Text != "" && productSerialNoTextBox.Text != "" && productNameTextBox.Text != "" && productModelNoTextBox.Text != "" && productBrandTextBox.Text != "" && productWarrentyTextBox.Text != "" && productUnitPriceTextBox.Text != "" && productImporterIDTextBox.Text != "" && importerInvoiceNoTextBox.Text != "" && importerNamemetroTextBox.Text != "")
                {
                    product.productSerialNo = productSerialNoTextBox.Text;
                    product.productName = productNameTextBox.Text;
                    product.productModel = productModelNoTextBox.Text;
                    product.productBrand = productBrandTextBox.Text;
                    product.importerID = productImporterIDTextBox.Text;
                    product.productAvailableWarrenty = productWarrentyTextBox.Text;
                    product.productUnitPrice = productUnitPriceTextBox.Text;
                    product.productShortDescription = productShortDescriptiontextBox.Text;
                    product.productLongDescription = productLongDescriptionTextBox.Text;
                    product.productEntryDate = productEntryDTP.Text;
                    product.productBarcode = productBarcodeTextBox.Text;
                    product.productEntrier = member.userName;
                    product.importerName = importerNamemetroTextBox.Text;
                    product.importerInvoiceNo = importerInvoiceNoTextBox.Text;
                    product.productBatchNo = productBatchmetroTextBox.Text;
                    if (MessageBox.Show("Are you sure?", "Entry Product", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        if (account_Bo.setProduct(product))
                        {
                            MessageBox.Show("Product entry successfully done");
                            productSerialNoTextBox.Clear();
                            productNameTextBox.Clear();
                            productModelNoTextBox.Clear();
                            productBrandTextBox.Clear();
                            productImporterIDTextBox.Clear();
                            productWarrentyTextBox.ResetText();
                            productUnitPriceTextBox.Clear();
                            productShortDescriptiontextBox.Clear();
                            productLongDescriptionTextBox.Clear();
                            productBarcodeTextBox.Clear();
                            importerNamemetroTextBox.Clear();
                            importerInvoiceNoTextBox.Clear();
                            productBatchmetroTextBox.Clear();
                        }
                        else
                        {
                            MessageBox.Show("This product serial no is already exists!!!");
                        }
                    }

                }
                else
                {
                    MessageBox.Show("Please enter the information fully");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 7
0
        private void AddToCart_btn_Click(object sender, EventArgs e)
        {
            Member m = account_Bo.getMember(userName);
            Product product = new Product();
            try
            {

                    if (returnBarcode_txt.Text != "")
                    {
                        if (soldPrice_txt.Text != "")
                        {
                            product.productSerialNo = productMetroGrid.CurrentRow.Cells[0].Value.ToString();
                            product.productName = productMetroGrid.CurrentRow.Cells[1].Value.ToString();
                            product.productModel = productMetroGrid.CurrentRow.Cells[2].Value.ToString();
                            product.productBrand = productMetroGrid.CurrentRow.Cells[3].Value.ToString();
                            product.importerInvoiceNo = productMetroGrid.CurrentRow.Cells[4].Value.ToString();
                            product.importerID = productMetroGrid.CurrentRow.Cells[5].Value.ToString();
                            product.importerName = productMetroGrid.CurrentRow.Cells[6].Value.ToString();
                            product.productAvailableWarrenty = productMetroGrid.CurrentRow.Cells[7].Value.ToString();
                            product.productShortDescription = productMetroGrid.CurrentRow.Cells[8].Value.ToString();
                            product.productLongDescription = productMetroGrid.CurrentRow.Cells[9].Value.ToString();
                            product.productEntryDate = productMetroGrid.CurrentRow.Cells[10].Value.ToString();
                            product.productBarcode = productMetroGrid.CurrentRow.Cells[11].Value.ToString();
                            product.productEntrier = productMetroGrid.CurrentRow.Cells[12].Value.ToString();
                            product.productUnitPrice = productMetroGrid.CurrentRow.Cells[13].Value.ToString();
                            product.productBatchNo = productMetroGrid.CurrentRow.Cells[14].Value.ToString();
                            product.soldPrice = soldPrice_txt.Text;
                            product.soldDate = firstdateTimePicker.Text;
                            product.profit = (Convert.ToDouble(soldPrice_txt.Text) - Convert.ToDouble(purchasePrice_txt.Text)).ToString();
                            if (MessageBox.Show("Are you sure?", "Add to cart", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                            {
                                double p = Convert.ToDouble(purchasePrice_txt.Text);
                                double s = Convert.ToDouble(soldPrice_txt.Text);
                                double r = s - p;
                                if (r < 0 && m.type == "A")
                                {

                                    if (MessageBox.Show("Are you sure?", "Product selling on loss", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                                    {
                                        try
                                        {
                                            account_Bo.setTempProduct(product,userName);

                                            reloadshoppingCartDataGridview();

                                            account_Bo.deleteProduct(product.productSerialNo);

                                            product.productSerialNo = productSerialNoTextBox.Text;
                                            product.productName = productNameTextBox.Text;
                                            product.productModel = productModelNoTextBox.Text;
                                            product.productBrand = productBrandTextBox.Text;
                                            product.importerID = productImporterIDTextBox.Text;
                                            product.productAvailableWarrenty = productWarrentyTextBox.Text;
                                            product.productUnitPrice = "";
                                            product.productShortDescription = "";
                                            product.productLongDescription = "";
                                            product.productEntryDate = "";
                                            product.productBarcode = productBarcodeTextBox.Text;
                                            product.productEntrier = "";
                                            product.importerName = importerNamemetroTextBox.Text;
                                            product.importerInvoiceNo = importerInvoiceNoTextBox.Text;
                                            product.productBatchNo = productBatchmetroTextBox.Text;

                                            DataSet ds = account_Bo.getProduct(product);
                                            productMetroGrid.DataSource = ds.Tables[0];

                                            if (productMetroGrid.Rows.Count > 1)
                                            {
                                                Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                                            }
                                            else if (productMetroGrid.Rows.Count == 1)
                                            {
                                                Mlabel.Text = "1 result found";
                                            }
                                            else
                                            {
                                                Mlabel.Text = "No result found";
                                            }

                                            calculateTotal();
                                        }
                                        catch
                                        {

                                        }

                                        soldPrice_txt.Clear();
                                        returnBarcode_txt.Clear();
                                        purchasePrice_txt.Clear();
                                        returnSerial_txt.Clear();

                                    }

                                }
                                else if(r >= 0 && (m.type=="A" || m.type=="M"))
                                {
                                    try
                                    {
                                        account_Bo.setTempProduct(product,userName);

                                        reloadshoppingCartDataGridview();

                                        account_Bo.deleteProduct(product.productSerialNo);

                                        product.productSerialNo = productSerialNoTextBox.Text;
                                        product.productName = productNameTextBox.Text;
                                        product.productModel = productModelNoTextBox.Text;
                                        product.productBrand = productBrandTextBox.Text;
                                        product.importerID = productImporterIDTextBox.Text;
                                        product.productAvailableWarrenty = productWarrentyTextBox.Text;
                                        product.productUnitPrice = "";
                                        product.productShortDescription = "";
                                        product.productLongDescription = "";
                                        product.productEntryDate = "";
                                        product.productBarcode = productBarcodeTextBox.Text;
                                        product.productEntrier = "";
                                        product.importerName = importerNamemetroTextBox.Text;
                                        product.importerInvoiceNo = importerInvoiceNoTextBox.Text;
                                        product.productBatchNo = productBatchmetroTextBox.Text;

                                        DataSet ds = account_Bo.getProduct(product);
                                        productMetroGrid.DataSource = ds.Tables[0];

                                        if (productMetroGrid.Rows.Count > 1)
                                        {
                                            Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                                        }
                                        else if (productMetroGrid.Rows.Count == 1)
                                        {
                                            Mlabel.Text = "1 result found";
                                        }
                                        else
                                        {
                                            Mlabel.Text = "No result found";
                                        }

                                        calculateTotal();
                                    }
                                    catch
                                    {

                                    }

                                    soldPrice_txt.Clear();
                                    returnBarcode_txt.Clear();
                                    purchasePrice_txt.Clear();
                                    returnSerial_txt.Clear();
                                }
                                else
                                {
                                    MessageBox.Show("Please enter the selling price greater or equal purchase price");
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please enter the selling price ");
                        }

                    }
                    else
                    {
                        MessageBox.Show("Please select a item");
                    }

            }
            catch
            {

            }
        }
        private void delete_Button_Click(object sender, EventArgs e)
        {
            try
            {
                if (returnName_txt.Text != "")
                {
                    Product product = new Product();
                    product.productSerialNo = returnSerial_txt.Text;
                    product.productName = returnName_txt.Text;
                    product.productModel = returnModelNo_txt.Text;
                    product.productBrand = returnBrand_txt.Text;
                    product.importerID = returnImporterID_txt.Text;
                    product.productAvailableWarrenty = returnwarrenty_txt.Text;
                    product.productUnitPrice = returnUnitPrice_txt.Text;
                    product.productShortDescription = returnShortdescription_txt.Text;
                    product.productLongDescription = returnLongDescription_txt.Text;
                    product.productEntryDate = returnEntrydate_txt.Text;
                    product.productBarcode = returnBarcode_txt.Text;
                    product.productEntrier = userName;
                    product.importerName = returnImporterName_txt.Text;
                    product.importerInvoiceNo = returnInvoiceNo_txt.Text;
                    product.productBatchNo = returnBatch_txt.Text;

                    if (MessageBox.Show("Are you sure?", "Update Product", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        account_Bo.deleteProduct(product.productSerialNo);
                        MessageBox.Show("Product Delete Successfully Done");
                        returnBarcode_txt.Clear();
                        returnBatch_txt.Clear();
                        returnBrand_txt.Clear();
                        returnImporterID_txt.Clear();
                        returnImporterName_txt.Clear();
                        returnInvoiceNo_txt.Clear();
                        returnModelNo_txt.Clear();
                        returnName_txt.Clear();
                        returnSerial_txt.Clear();
                        returnwarrenty_txt.Clear();
                        returnEntrydate_txt.Clear();
                        returnUnitPrice_txt.Clear();
                        returnShortdescription_txt.Clear();
                        returnLongDescription_txt.Clear();

                        try
                        {

                            product.productSerialNo = productSerialNoTextBox.Text;
                            product.productName = productNameTextBox.Text;
                            product.productModel = productModelNoTextBox.Text;
                            product.productBrand = productBrandTextBox.Text;
                            product.importerID = productImporterIDTextBox.Text;
                            product.productAvailableWarrenty = productWarrentyTextBox.Text;
                            product.productUnitPrice = productUnitPriceTextBox.Text;
                            product.productShortDescription = productShortDescriptiontextBox.Text;
                            product.productLongDescription = productLongDescriptionTextBox.Text;
                            product.productEntryDate = productEntryDTP.Text;
                            product.productBarcode = productBarcodeTextBox.Text;
                            product.productEntrier = userName_txt.Text;
                            product.importerName = importerNamemetroTextBox.Text;
                            product.importerInvoiceNo = importerInvoiceNoTextBox.Text;
                            product.productBatchNo = productBatchmetroTextBox.Text;

                            DataSet ds = account_Bo.getProduct(product);
                            productMetroGrid.DataSource = ds.Tables[0];

                            if (productMetroGrid.Rows.Count > 1)
                            {
                                Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                            }
                            else if (productMetroGrid.Rows.Count == 1)
                            {
                                Mlabel.Text = "1 result found";
                            }
                            else
                            {
                                Mlabel.Text = "No result found";
                            }
                        }
                        catch
                        {

                        }
                    }

                }
                else
                {
                    MessageBox.Show("Please select a item first");
                }
            }
            catch
            {

            }
        }
        private void reset_btn_Click(object sender, EventArgs e)
        {
            if (returnReference_txt.Text != "" && returnName_txt.Text != "")
            {
                Product product = new Product();
                product.productSerialNo = productMetroGrid.CurrentRow.Cells[0].Value.ToString();
                product.productName = productMetroGrid.CurrentRow.Cells[1].Value.ToString();
                product.productModel = productMetroGrid.CurrentRow.Cells[2].Value.ToString();
                product.productBrand = productMetroGrid.CurrentRow.Cells[3].Value.ToString();
                product.importerInvoiceNo = productMetroGrid.CurrentRow.Cells[4].Value.ToString();
                product.importerID = productMetroGrid.CurrentRow.Cells[5].Value.ToString();
                product.importerName = productMetroGrid.CurrentRow.Cells[6].Value.ToString();
                product.productAvailableWarrenty = productMetroGrid.CurrentRow.Cells[7].Value.ToString();
                product.productShortDescription = productMetroGrid.CurrentRow.Cells[8].Value.ToString();
                product.productLongDescription = productMetroGrid.CurrentRow.Cells[9].Value.ToString();
                product.productEntryDate = productMetroGrid.CurrentRow.Cells[10].Value.ToString();
                product.productBarcode = productMetroGrid.CurrentRow.Cells[11].Value.ToString();
                product.productEntrier = productMetroGrid.CurrentRow.Cells[12].Value.ToString();
                product.productUnitPrice =productMetroGrid.CurrentRow.Cells[13].Value.ToString();
                product.productBatchNo = productMetroGrid.CurrentRow.Cells[14].Value.ToString();

                if (MessageBox.Show("Are you sure?","Return to importer",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)==DialogResult.Yes)
                {
                    account_Bo.setReturnProduct(product, returnReference_txt.Text,dateTimePicker1.Text);
                    account_Bo.deleteProduct(product.productSerialNo);
                    returnBarcode_txt.Clear();
                    returnBatch_txt.Clear();
                    returnBrand_txt.Clear();
                    returnImporterID_txt.Clear();
                    returnImporterName_txt.Clear();
                    returnModelNo_txt.Clear();
                    returnName_txt.Clear();
                    returnReference_txt.Clear();
                    returnSerial_txt.Clear();

                    try
                    {

                        product.productSerialNo = productSerialNoTextBox.Text;
                        product.productName = productNameTextBox.Text;
                        product.productModel = productModelNoTextBox.Text;
                        product.productBrand = productBrandTextBox.Text;
                        product.importerID = productImporterIDTextBox.Text;
                        product.productAvailableWarrenty = productWarrentyTextBox.Text;
                        product.productUnitPrice = productUnitPriceTextBox.Text;
                        product.productShortDescription = productShortDescriptiontextBox.Text;
                        product.productLongDescription = productLongDescriptionTextBox.Text;
                        product.productEntryDate = productEntryDTP.Text;
                        product.productBarcode = productBarcodeTextBox.Text;
                        product.productEntrier = userName_txt.Text;
                        product.importerName = importerNamemetroTextBox.Text;
                        product.importerInvoiceNo = importerInvoiceNoTextBox.Text;
                        product.productBatchNo = productBatchmetroTextBox.Text;

                        DataSet ds = account_Bo.getProduct(product);
                        productMetroGrid.DataSource = ds.Tables[0];

                        if (productMetroGrid.Rows.Count > 1)
                        {
                            Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                        }
                        else if (productMetroGrid.Rows.Count == 1)
                        {
                            Mlabel.Text = "1 result found";
                        }
                        else
                        {
                            Mlabel.Text = "No result found";
                        }
                    }
                    catch
                    {

                    }
                }

            }
            else
            {
                MessageBox.Show("Please enter the reference");
            }
        }
Ejemplo n.º 10
0
        private void removefromCartbutton_Click(object sender, EventArgs e)
        {
            Product product = new Product();
            try
            {
                if (returnBarcode_txt.Text != "")
                {

                    if (MessageBox.Show("Are you sure?", "Remove from cart", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {

                        product = account_Bo.getTempProductBySerialNoforReentry(returnBarcode_txt.Text);
                        account_Bo.setProduct(product);
                        account_Bo.deleteTempProduct(returnBarcode_txt.Text);
                        reloadshoppingCartDataGridview();
                        calculateTotal();
                        try
                        {

                            Product sproduct = new Product();
                            sproduct.productBarcode = "";
                            sproduct.productBatchNo = "";
                            DataSet ds = account_Bo.getProduct(sproduct);
                            productMetroGrid.DataSource = ds.Tables[0];

                            if (productMetroGrid.Rows.Count > 1)
                            {
                                Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                            }
                            else if (productMetroGrid.Rows.Count == 1)
                            {
                                Mlabel.Text = "1 result found";
                            }
                            else
                            {
                                Mlabel.Text = "No result found";
                            }
                        }
                        catch
                        {

                        }
                        returnBarcode_txt.Clear();
                        soldPrice_txt.Clear();
                        purchasePrice_txt.Clear();
                        returnName_txt.Clear();
                        nettotalmetroTextBox.Clear();
                        discountmetroTextBox.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("Please select a item");
                }
            }
            catch
            {

            }
        }
Ejemplo n.º 11
0
        private void AddToCart_btn_Click(object sender, EventArgs e)
        {
            Product product = new Product();
            try
            {
                if (returnBarcode_txt.Text != "")
                {
                    if (soldPrice_txt.Text != "")
                    {

                        product.productName = productMetroGrid.CurrentRow.Cells[0].Value.ToString();
                        product.productBrand =  productMetroGrid.CurrentRow.Cells[1].Value.ToString();
                        product.productUnitPrice =  productMetroGrid.CurrentRow.Cells[8].Value.ToString();
                        product.productShortDescription =  productMetroGrid.CurrentRow.Cells[4].Value.ToString();
                        product.productEntryDate =  productMetroGrid.CurrentRow.Cells[5].Value.ToString();
                        product.productBarcode =  productMetroGrid.CurrentRow.Cells[6].Value.ToString();
                        product.importerName =  productMetroGrid.CurrentRow.Cells[3].Value.ToString();
                        product.importerInvoiceNo =  productMetroGrid.CurrentRow.Cells[2].Value.ToString();
                        product.soldPrice = productMetroGrid.CurrentRow.Cells[9].Value.ToString();
                        product.productEntrier =  productMetroGrid.CurrentRow.Cells[7].Value.ToString();
                        product.soldDate = firstdateTimePicker.Text;

                        product.profit = (Convert.ToDouble(soldPrice_txt.Text) - Convert.ToDouble(purchasePrice_txt.Text)).ToString();
                        if (MessageBox.Show("Are you sure?", "Add to cart", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                        {

                           try
                           {
                                    account_Bo.setTempProduct(product);

                                    reloadshoppingCartDataGridview();

                                    account_Bo.deleteProduct(product.productBarcode);

                                    Product sproduct = new Product();
                                    sproduct.productBarcode = "";
                                    sproduct.productBatchNo = "";
                                    DataSet ds = account_Bo.getProduct(sproduct);
                                    productMetroGrid.DataSource = ds.Tables[0];

                                    if (productMetroGrid.Rows.Count > 1)
                                    {
                                        Mlabel.Text = (productMetroGrid.Rows.Count).ToString() + " results found";
                                    }
                                    else if (productMetroGrid.Rows.Count == 1)
                                    {
                                        Mlabel.Text = "1 result found";
                                    }
                                    else
                                    {
                                        Mlabel.Text = "No result found";
                                    }

                                    calculateTotal();
                                }
                                catch
                                {

                                }
                                soldPrice_txt.Clear();
                                returnBarcode_txt.Clear();
                                purchasePrice_txt.Clear();
                                returnName_txt.Clear();
                            }
                        }

                }
                else
                {
                    MessageBox.Show("Please select a item");
                }
            }
            catch
            {

            }
        }