Exemplo n.º 1
0
 private void txtProductName_TextChanged(object sender, EventArgs e)
 {
     try
     {
         BusinessManager BM = new BusinessManager();
         BOProduct       BO = new BOProduct();
         BO.ProductName = txtProductName.Text.Trim();
         DataTable dt = BM.BALSearchInventoryData(BO);
         dataGridView1.DataSource = dt;
         DataGridViewColumn col1 = dataGridView1.Columns[0];
         DataGridViewColumn col2 = dataGridView1.Columns[1];
         DataGridViewColumn col3 = dataGridView1.Columns[2];
         DataGridViewColumn col4 = dataGridView1.Columns[3];
         DataGridViewColumn col5 = dataGridView1.Columns[4];
         DataGridViewColumn col6 = dataGridView1.Columns[5];
         DataGridViewColumn col7 = dataGridView1.Columns[6];
         DataGridViewColumn col8 = dataGridView1.Columns[7];
         col1.Width = 75;
         col2.Width = 80;
         col3.Width = 150;
         col4.Width = 115;
         col5.Width = 75;
         col6.Width = 75;
         col7.Width = 90;
         col8.Width = 105;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        public void MapEFToBO()
        {
            var     mapper = new DALProductMapper();
            Product entity = new Product();

            entity.SetProperties("A", "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), true, 1m, true, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, "A", 1, "A", 1, 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", 1m, "A", 1, "A");

            BOProduct response = mapper.MapEFToBO(entity);

            [email protected]().Be("A");
            response.Color.Should().Be("A");
            response.DaysToManufacture.Should().Be(1);
            response.DiscontinuedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.FinishedGoodsFlag.Should().Be(true);
            response.ListPrice.Should().Be(1m);
            response.MakeFlag.Should().Be(true);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.ProductID.Should().Be(1);
            response.ProductLine.Should().Be("A");
            response.ProductModelID.Should().Be(1);
            response.ProductNumber.Should().Be("A");
            response.ProductSubcategoryID.Should().Be(1);
            response.ReorderPoint.Should().Be(1);
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.SafetyStockLevel.Should().Be(1);
            response.SellEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SellStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Size.Should().Be("A");
            response.SizeUnitMeasureCode.Should().Be("A");
            response.StandardCost.Should().Be(1m);
            response.Style.Should().Be("A");
            response.Weight.Should().Be(1);
            response.WeightUnitMeasureCode.Should().Be("A");
        }
Exemplo n.º 3
0
        public void PassImageToDatabase(Image img)
        {
            byte[]    bytes     = ImageToByteArray(img);
            DBManager DALOBject = new DBManager();
            BOProduct BO        = new BOProduct();

            DALOBject.InsertIntoConfig(BO);
        }
Exemplo n.º 4
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            BusinessManager BM = new BusinessManager();
            BOProduct       BO = new BOProduct();

            BO.ProductName           = txtSearchProductName.Text;
            dataGridView1.DataSource = BM.BALSearchInvoiceData(BO);
        }
Exemplo n.º 5
0
        private void LoadGrid()
        {
            olvcTexture.DataSource = BOFactory.GetBO(BOIDEnum.Texture).GetValieValue("ID", "Name");
            olvcGroup.DataSource   = BOFactory.GetBO(BOIDEnum.ProductGroup).GetValieValue("ID", "Name");

            m_proList = (BOProduct)BOFactory.GetBO(BOIDEnum.Product);
            List <ProductMD> listObj = Utilities.ConvertList <ProductMD>(m_proList.GetDataList());

            objList.SetObjects(listObj);
        }
Exemplo n.º 6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                BusinessManager BM  = new BusinessManager();
                BOSales         BOS = new BOSales();
                BOProduct       BOP = new BOProduct();
                BOInventory     BOI = new BOInventory();
                BOS.GrandTotal   = txtGrandTotal.Text;
                BOS.TotalPayment = txtTotalPayment.Text;
                BOS.PaymentDue   = txtPaymentDue.Text;
                BOS.Remarks      = txtRemarks.Text;
                BOS.InvoiceNo    = txtInvoiceNo.Text;

                try
                {
                    BM.BALUpdateSales(BOS);

                    for (int i = 0; i <= listView1.Items.Count - 1; i++)
                    {
                        BOP.ProductQuantity = listView1.Items[i].SubItems[4].Text;
                        BOP.Price           = listView1.Items[i].SubItems[3].Text;
                        BOP.TotalAmount     = listView1.Items[i].SubItems[5].Text;
                        BOS.InvoiceNo       = txtInvoiceNo.Text;
                        BOP.ConfigID        = listView1.Items[i].SubItems[1].Text;
                        BM.BALUpdateProductSold(BOS, BOP);
                    }

                    for (int i = 0; i <= listView1.Items.Count - 1; i++)
                    {
                        BOS.InvoiceNo       = txtInvoiceNo.Text;
                        BOP.ConfigID        = listView1.Items[i].SubItems[1].Text;
                        BOP.ProductQuantity = listView1.Items[i].SubItems[4].Text;
                        BOP.Price           = listView1.Items[i].SubItems[3].Text;
                        BOP.TotalAmount     = listView1.Items[i].SubItems[5].Text;
                        BM.BALInsertIntoProductSold(BOS, BOP);
                    }

                    for (int i = 0; i <= listView1.Items.Count - 1; i++)
                    {
                        BOI.TotalPrice = listView1.Items[i].SubItems[5].Text;
                        BOP.ConfigID   = listView1.Items[i].SubItems[1].Text;
                        BM.BALUpdateInventoryTotalPrice(BOI, BOP);
                    }
                    dataGridView1.DataSource = BM.BALGetInvoiceData();
                    btnUpdate.Enabled        = false;
                    MessageBox.Show("Successfully updated", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                if (txtProductName.Text == "")
                {
                    MessageBox.Show("Please select a product name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtProductName.Focus();
                    return;
                }

                if (txtQuantity.Text == "")
                {
                    MessageBox.Show("Please enter a quantity", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtQuantity.Focus();
                    return;
                }
                try
                {
                    BusinessManager BM  = new BusinessManager();
                    BOProduct       BOP = new BOProduct();
                    BOInventory     BOI = new BOInventory();
                    BOP.ConfigID      = txtConfigID.Text;
                    BOI.InventoryDate = dtpInventoryDate.Text;
                    auto_generate();
                    BOI.InventoryID = txtInventoryID.Text;
                    BOI.Quantity    = txtQuantity.Text;
                    BOI.TotalPrice  = txtTotalPrice.Text;
                    bool res = BM.BALVerifyInventoryName(BOP);

                    if (res == true)
                    {
                        MessageBox.Show("Record already exists!" + "\n" + "Please update the stock of product", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        int rowsAffected = BM.BALInsertIntoInventory(BOP, BOI);

                        if (rowsAffected > 0)
                        {
                            MessageBox.Show("Successfully saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            btnRegister.Enabled = false;
                            getData();
                            //frmMainMenu frm = new frmMainMenu();
                            //frm.GetData();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 8
0
        private void NewProductMDRetProc(Form form, object data)
        {
            BOProduct proBo = (BOProduct)data;

            if (proBo == null)
            {
                return;
            }
            ProductMD proMd = (ProductMD)proBo.GetBOTable();

            objList.AddObject(proMd);
        }
Exemplo n.º 9
0
        public void MapBOToModelList()
        {
            var       mapper = new BOLProductMapper();
            BOProduct bo     = new BOProduct();

            bo.SetProperties(1, "A", "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), true, 1m, true, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", 1, "A", 1, 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", 1m, "A", 1, "A");
            List <ApiProductResponseModel> response = mapper.MapBOToModel(new List <BOProduct>()
            {
                { bo }
            });

            response.Count.Should().Be(1);
        }
Exemplo n.º 10
0
        private void UpdateProMdRetProc(Form form, object data)
        {
            BOProduct proBo = (BOProduct)data;

            if (proBo == null)
            {
                return;
            }
            ProductMD proMd = (ProductMD)proBo.GetBOTable();
            IList     list  = (IList)objList.Objects;
            ProductMD md    = (ProductMD)list[objList.LastHitInfo.RowIndex];

            md.CopyFrom(proMd);
            objList.RefreshObject(md);
        }
Exemplo n.º 11
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     try
     {
         BusinessManager BM = new BusinessManager();
         BOProduct       BO = new BOProduct();
         BO.TextBox = textBox1.Text.Trim();
         dataGridView1.DataSource = BM.BALSearchCustomerDataRecord2(BO).Tables["Customer"].DefaultView;
         DataGridViewColumn col = dataGridView1.Columns[1];
         col.Width = 115;
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 12
0
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     try
     {
         BusinessManager BM = new BusinessManager();
         BOProduct       BO = new BOProduct();
         BO.ProductName = txtSearch.Text;
         DataSet ds = BM.BALSearchInventory(BO);
         dataGridView1.DataSource = ds.Tables["Inventory"].DefaultView;
         dataGridView1.DataSource = ds.Tables["Config"].DefaultView;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BusinessManager BM = new BusinessManager();
            BOProduct       BO = new BOProduct();

            BO.Picture = BM.ImageToByteArray(pictureBox1.Image);
            int rowsAffected = BM.BALSaveStoreImage(BO);

            if (rowsAffected > 0)
            {
                MessageBox.Show("Successfully saved. Please restart the application for the changes to take effect.", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Couldn't be saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void txtProductName_TextChanged(object sender, EventArgs e)
 {
     try
     {
         BusinessManager BM = new BusinessManager();
         BOProduct       BO = new BOProduct();
         BO.ProductName = txtProductName.Text.Trim();
         DataTable dt = BM.BALSearchConfigData1(BO);
         dataGridView1.DataSource = dt;
         DataGridViewColumn col1 = dataGridView1.Columns[1];
         DataGridViewColumn col2 = dataGridView1.Columns[2];
         col1.Width = 200;
         col2.Width = 300;
         dataGridView1.Columns[4].Visible = false;
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void txtSearchCategory_TextChanged(object sender, EventArgs e)
 {
     try
     {
         BusinessManager BM = new BusinessManager();
         BOProduct       BO = new BOProduct();
         BO.ProductCategory = txtSearchCategory.Text.Trim();
         DataTable dt = BM.BALSearchbyCategoryName(BO);
         dataGridView1.DataSource = dt;
         DataGridViewColumn col1 = dataGridView1.Columns[0];
         DataGridViewColumn col2 = dataGridView1.Columns[1];
         DataGridViewColumn col3 = dataGridView1.Columns[2];
         col1.Width = 215;
         col2.Width = 215;
         col3.Width = 215;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                try
                {
                    BOProduct       BO = new BOProduct();
                    BusinessManager BM = new BusinessManager();
                    BO.ProductName     = txtProductName.Text.Trim();
                    BO.ProductCategory = cboxProductCategory.Text.Trim();
                    BO.ProductCompany  = cboxCompany.Text.Trim();
                    bool res = BM.BALVerifyProductName(BO);

                    if (res == true)
                    {
                        MessageBox.Show("Product name already exits. Please enter a new product name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtProductName.Text = "";
                        txtProductName.Focus();
                    }
                    else
                    {
                        int rowsAffected = BM.BALInsertProductName(BO);
                        if (rowsAffected > 0)
                        {
                            MessageBox.Show("Successfully saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            //Autocomplete();
                            txtProductName.Text      = "";
                            cboxCompany.Text         = "";
                            cboxProductCategory.Text = "";
                            txtProductName.Focus();
                            btnSave.Enabled = false;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 17
0
        private void frmProduct_Load(object sender, EventArgs e)
        {
            BOProduct mktBo = (BOProduct)m_bo;

            if (this.ExchangeParam == null)
            {
                //mktBo.Init();
                this.FormMode = NanCrm.FormMode.Add;
            }
            else
            {
                this.FormMode = this.ExchangeParam.Mode;
                if (this.ExchangeParam.Data != null)
                {
                    ProductMD md = (ProductMD)this.ExchangeParam.Data;
                    mktBo.SetBOTable(md);
                }
                if (this.ExchangeParam.ReturnProc != null)
                {
                    this.ReturnProc = this.ExchangeParam.ReturnProc;
                }
            }
            UpdateData(false);
        }
Exemplo n.º 18
0
        public void BALUpdateInventoryTotalPrice(BOInventory Inventory, BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            DALObject.UpdateInventoryTotalPrice(Inventory, Product);
        }
Exemplo n.º 19
0
        public bool BALVerifyCategoryName(BOProduct Category)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.VerifyCategoryName(Category));
        }
Exemplo n.º 20
0
        public int BALSaveStoreImage(BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.SaveStoreImage(Product));
        }
Exemplo n.º 21
0
        public void BALInsertIntoProductSold(BOSales Sales, BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            DALObject.InsertIntoProductSold(Sales, Product);
        }
Exemplo n.º 22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                try
                {
                    if (txtCustID.Text == "")
                    {
                        MessageBox.Show("Please retrieve Customer ID", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtCustID.Focus();
                        return;
                    }

                    if (txtVAT.Text == "")
                    {
                        MessageBox.Show("Please enter VAT percentage", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtVAT.Focus();
                        return;
                    }

                    if (txtTotalPayment.Text == "")
                    {
                        MessageBox.Show("Please enter total payment", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtTotalPayment.Focus();
                        return;
                    }
                    if (listView1.Items.Count == 0)
                    {
                        MessageBox.Show("Sorry no product added", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    auto_generate_id();
                    BusinessManager BM  = new BusinessManager();
                    BOSales         BOS = new BOSales();
                    BOCustomer      BOC = new BOCustomer();
                    BOProduct       BOP = new BOProduct();
                    BOInventory     BOI = new BOInventory();
                    BOS.InvoiceNo    = txtInvoiceNo.Text;
                    BOS.InvoiceDate  = dtpInvoiceDate.Text;
                    BOC.CustomerID   = txtCustID.Text;
                    BOS.SubTotal     = txtSubTotal.Text;
                    BOS.VATPercent   = txtVAT.Text;
                    BOS.VATAmount    = txtVatAmount.Text;
                    BOS.GrandTotal   = txtGrandTotal.Text;
                    BOS.TotalPayment = txtTotalPayment.Text;
                    BOS.PaymentDue   = txtPaymentDue.Text;
                    BOS.Remarks      = txtRemarks.Text;

                    bool res = BM.BALVerifyInvoiceNumber(BOS);

                    if (res == true)
                    {
                        MessageBox.Show("Invoice No. already exists", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        BM.BALInsertIntoSales(BOS, BOC);
                    }

                    for (int i = 0; i <= listView1.Items.Count - 1; i++)
                    {
                        BOS.InvoiceNo       = txtInvoiceNo.Text;
                        BOP.ConfigID        = listView1.Items[i].SubItems[1].Text;
                        BOP.ProductQuantity = listView1.Items[i].SubItems[4].Text;
                        BOP.Price           = listView1.Items[i].SubItems[3].Text;
                        BOP.TotalAmount     = listView1.Items[i].SubItems[5].Text;
                        BM.BALInsertIntoProductSold(BOS, BOP);
                    }

                    for (int i = 0; i <= listView1.Items.Count - 1; i++)
                    {
                        BOI.Quantity = listView1.Items[i].SubItems[4].Text;
                        BOP.ConfigID = listView1.Items[i].SubItems[1].Text;
                        BM.BALUpdateInventoryQuantity(BOI, BOP);
                    }

                    for (int i = 0; i <= listView1.Items.Count - 1; i++)
                    {
                        BOI.TotalPrice = listView1.Items[i].SubItems[5].Text;
                        BOP.ConfigID   = listView1.Items[i].SubItems[1].Text;
                        BM.BALUpdateInventoryTotalPrice(BOI, BOP);
                    }

                    btnSave.Enabled          = false;
                    btnPrint.Enabled         = true;
                    dataGridView1.DataSource = BM.BALGetInvoiceData();
                    MessageBox.Show("Successfully saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 23
0
        public void BALUpdateProductSold(BOSales Sales, BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            DALObject.UpdateProductSold(Sales, Product);
        }
Exemplo n.º 24
0
        public void BALUpdateInventoryQuantity(BOInventory Inventory, BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            DALObject.UpdateInventoryQuantity(Inventory, Product);
        }
Exemplo n.º 25
0
        public DataTable BALSearchbyCategoryName(BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.SearchbyCategoryName(Product));
        }
Exemplo n.º 26
0
        public int BALDeleteCategory(BOProduct Category)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.DeleteCategory(Category));
        }
Exemplo n.º 27
0
        public bool BALVerifyInventoryName(BOProduct Product)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.VerifyInventoryName(Product));
        }
Exemplo n.º 28
0
        public int BALUpdateCategory(BOProduct Category)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.UpdateCategoryName(Category));
        }
Exemplo n.º 29
0
    public static long InsertProduct(BOProduct objBO)
    {
        DAProduct objDA = new DAProduct();

        return(Convert.ToInt64(objDA.InsertProduct(objBO)));
    }
Exemplo n.º 30
0
        public int BALUpdateIntoInventory(BOProduct Product, BOInventory Inventory)
        {
            DBManager DALObject = new DBManager();

            return(DALObject.UpdateIntoInventory(Product, Inventory));
        }