Example #1
0
        private void InitialloadGrid()
        {
            try
            {
                List <GetProductStock>          GridList = new List <GetProductStock>();
                BusinessObjects.GetProductStock spObj    = new GetProductStock();
                GridList = spObj.getProdAlongWithStockQuantity_All(con);

                List <M_Product_BS>          cObjList = new List <M_Product_BS>();
                BusinessObjects.M_Product_BS cObj     = new M_Product_BS();
                cObjList = cObj.GetProducts(con);
                //MessageBox.Show(cObjList.Count.ToString());

                //this is to set the category name

                List <Category_BS> catList = new List <Category_BS>();
                Category_BS        catObj  = new Category_BS();
                catList = catObj.GetCategory(con);
                foreach (Category_BS itemCat in catList)
                {
                    foreach (GetProductStock itemProd in GridList)
                    {
                        if (itemProd.category == itemCat.ID)
                        {
                            itemProd.catObj = itemCat;
                        }
                    }
                }

                int i = 0;
                tblProduct.Rows.Clear();


                foreach (GetProductStock item in GridList)
                {
                    if (item.TotalQuantity > 3)
                    {
                        continue;
                    }
                    tblProduct.Rows.Add();
                    tblProduct.Rows[i].Cells[0].Value = item.ID;
                    tblProduct.Rows[i].Cells[1].Value = item.name;
                    tblProduct.Rows[i].Cells[2].Value = item.catObj.name;
                    tblProduct.Rows[i].Cells[3].Value = item.cost;
                    tblProduct.Rows[i].Cells[4].Value = item.unitPrice;

                    tblProduct.Rows[i].Cells[5].Value = item.warranty;
                    tblProduct.Rows[i].Cells[6].Value = item.TotalQuantity;



                    i++;
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 private void InitialloadGrid()
 {
     try
     {
         BusinessObjects.GetProductStock spObj = new GetProductStock();
         BusinessObjects.M_Product_BS    cObj  = new M_Product_BS();
         cObjList = cObj.GetProducts(con);
         Category_BS catObj = new Category_BS();
         catList = catObj.GetCategory(con);
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        private void loadGrid()
        {
            try
            {
                BusinessObjects.M_Product_BS cObj = new M_Product_BS();
                cObjList = cObj.GetProducts(con);
                //MessageBox.Show(cObjList.Count.ToString());
                Category_BS catObj = new Category_BS();
                catList = catObj.GetCategory(con);
                foreach (Category_BS itemCat in catList)
                {
                    foreach (M_Product_BS itemProd in cObjList)
                    {
                        if (itemProd.category == itemCat.ID)
                        {
                            itemProd.catObj = itemCat;
                        }
                    }
                }

                int i = 0;
                tblProduct.Rows.Clear();

                //MessageBox.Show(cObjList.Count.ToString());
                foreach (M_Product_BS item in cObjList)
                {
                    tblProduct.Rows.Add();
                    tblProduct.Rows[i].Cells[0].Value = item.ID;
                    tblProduct.Rows[i].Cells[1].Value = item.name;
                    tblProduct.Rows[i].Cells[2].Value = item.catObj.name;
                    tblProduct.Rows[i].Cells[3].Value = item.cost;
                    tblProduct.Rows[i].Cells[4].Value = item.unitPrice;

                    tblProduct.Rows[i].Cells[5].Value = item.warranty;
                    tblProduct.Rows[i].Cells[6].Value = "Edit";



                    i++;
                }
                autoComplete();
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
 private void loadGrid()
 {
     try
     {
         BusinessObjects.Category_BS        cObj     = new Category_BS();
         List <BusinessObjects.Category_BS> cObjList = new List <Category_BS>();
         cObjList = cObj.GetCategory(con);
         int i = 0;
         grdCategory.Rows.Clear();
         foreach (Category_BS item in cObjList)
         {
             grdCategory.Rows.Add();
             grdCategory.Rows[i].Cells[0].Value = item.ID;
             grdCategory.Rows[i].Cells[1].Value = item.name;
             i++;
         }
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
        private void autoComplete()
        {
            try
            {
                txtPID.AutoCompleteMode     = AutoCompleteMode.Suggest;
                txtPID.AutoCompleteSource   = AutoCompleteSource.CustomSource;
                txtPName.AutoCompleteMode   = AutoCompleteMode.Suggest;
                txtPName.AutoCompleteSource = AutoCompleteSource.CustomSource;

                AutoCompleteStringCollection stringColl  = new AutoCompleteStringCollection();
                AutoCompleteStringCollection stringColl2 = new AutoCompleteStringCollection();

                BusinessObjects.M_Product_BS cObj = new M_Product_BS();
                cObjList = cObj.GetProducts(con);
                Category_BS catObj = new Category_BS();
                catList = catObj.GetCategory(con);

                foreach (M_Product_BS item in cObjList)
                {
                    stringColl.Add(item.ID.ToString());
                    stringColl2.Add(item.name);
                }


                txtPID.AutoCompleteCustomSource   = stringColl;
                txtPName.AutoCompleteCustomSource = stringColl2;
                cmbPCat.DataSource = null;
                cmbPCat.DataSource = catList;

                cmbPCat.DisplayMember = "name";
                cmbPCat.ValueMember   = "ID";
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "System Error " + ex.Message, "MetroMessageBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }