Beispiel #1
0
        private void insertPO_Product(PO PO)
        {
            DataTable dt = (DataTable)dgPOProduct.DataSource;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int quantity = 0;
                decimal price = 0;
                decimal totalPrice = 0;
                decimal serviceCharge = 0;
                bool subCon = false;
                string description = dt.Rows[i]["Description"].ToString();
                string categoryName = dt.Rows[i]["Name"].ToString();
                //Category selectedCategory = BLCategory.GetCategoryById(APCContext, categoryId);
                Category selectedCategory = BLCategory.GetCategoryByExactName(APCContext, categoryName);
                int.TryParse(dt.Rows[i]["Quantity"].ToString(), out quantity);
                decimal.TryParse(dt.Rows[i]["Price"].ToString(), out price);
                decimal.TryParse(dt.Rows[i]["Total"].ToString(), out totalPrice);
                decimal.TryParse(dt.Rows[i]["ServiceCharge"].ToString(), out serviceCharge);
                bool.TryParse(dt.Rows[i]["SubCon"].ToString(), out subCon);

                BLPO_Product.insertPO_Product(APCContext,PO, selectedCategory, description, quantity, price, serviceCharge, totalPrice, subCon);
            }
        }
Beispiel #2
0
 private void deletePO_Product(PO po)
 {
     List<PO_Product> poProductList = BLPO_Product.GetPO_ProductByPOId(APCContext, po.Id);
     for (int i = 0; i < poProductList.Count(); i++)
     {
         int poProductId = 0;
         int.TryParse(poProductList[i].Id.ToString(), out poProductId);
         PO_Product currentPO_Product = BLPO_Product.GetPO_ProductById(APCContext, poProductId);
         if (currentPO_Product != null)
         {
             APCContext.DeleteObject(currentPO_Product);
             APCContext.SaveChanges();
         }
     }
 }