Exemple #1
0
        private InventoryItem ItemReader(IDataReader aReader)
        {
            InventoryItem aItem = new InventoryItem();
               try
               {
               aItem.ItemId = Convert.ToInt32(aReader["II_id"]);
               }
               catch
               {

               }
               try
               {
               aItem.ItemName = aReader["II_name"].ToString();
               }
               catch
               {

               }
               try
               {
               aItem.UnitName = aReader["unit_name"].ToString();
               }
               catch
               {

               }

               return aItem;
        }
Exemple #2
0
        public List<InventoryItem> GetItemByCategory(int categoryId)
        {
            List<InventoryItem> aItems = new List<InventoryItem>();
               try
               {
               this.OpenConnection();
               string sqlComm = String.Format(SqlQueries.GetQuery(Query.GetItemByCategory),
                                              categoryId);
               IDataReader aReader = this.ExecuteReader(sqlComm);
               if (aReader != null)
               {
                   while (aReader.Read())
                   {
                       InventoryItem aItem = new InventoryItem();
                       aItem = ItemReader(aReader);
                       aItems.Add(aItem);
                   }
               }

               }
               catch (Exception ex)
               {

               throw new Exception("GetItemByCategory()",ex);
               }

               finally
               {
               this.CloseConnection();
               }
               return aItems;
        }
Exemple #3
0
 private void cmbProductName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbProductName.SelectedIndex >= 0)
     {
         unitLabel.Visible = true;
         InventoryItem aInventoryItem = new InventoryItem();
         aInventoryItem = (InventoryItem)cmbProductName.SelectedItem;
         unitLabel.Text = aInventoryItem.UnitName;
     }
 }
Exemple #4
0
        private void AddFinishedtoRawProductList()
        {
            try
            {
                //  FinishedRawProductListDAO finishedRawProductDAO = new FinishedRawProductListDAO();

                FinishedRawProductListDAO finishedRawProductDAO = new FinishedRawProductListDAO();
                //     CFinishedRawProductList cfinishedproduct = new CFinishedRawProductList();

                if (isModifyRawProduct && txtRawQnty.Tag != null)
                {
                    cFinishedProductList = txtRawQnty.Tag as CFinishedRawProductList;
                }
                else
                {
                    cFinishedProductList = new CFinishedRawProductList();
                }
                InventoryItem aInventoryItem = new InventoryItem();
                aInventoryItem = (InventoryItem)cmbProductName.SelectedItem;

                // cFinishedProductList.FinishedProductID = m_iCat3ID;
                // cFinishedProductList.RawProductID = cCategory3sList[cmbProductName.SelectedIndex].Category3ID;
                // cFinishedProductList.RawProductName = cCategory3sList[cmbProductName.SelectedIndex].Category3Name;
                cFinishedProductList.FinishedProductID = m_iCat3ID;
                cFinishedProductList.RawProductID = aInventoryItem.ItemId;
                cFinishedProductList.RawProductName = aInventoryItem.ItemName;

                //try { cFinishedProductList.Qnty = Convert.ToInt32(txtRawQnty.Text); }
                //catch (Exception e)
                //{
                //}
                try { cFinishedProductList.Qnty = Convert.ToDouble(txtRawQnty.Text); }
                catch (Exception e)
                {
                }

                cFinishedProductList.Remarks = "";

                if (isModifyRawProduct)
                {
                    finishedRawProductDAO.FinishedRawProductListUpdate(cFinishedProductList);
                }
                else
                {
                    try
                    {
                        finishedRawProductDAO.FinishedRawProductListInsert(cFinishedProductList);
                    }
                    catch { }
                }

                RefreshFinishedRawProduct();

                LoadDataGrid();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }