partial void Purchase_Details_Inserted(Purchase_Detail entity) { //============== product Stock is changing here ======================= entity.Product.Stock_In_hand += entity.Quantity; //adds this quantity to previous stock }
partial void Purchase_Details_Updating(Purchase_Detail entity) { var value = (from val in Purchases where val.Purchase_ID.Equals(entity.Purchase.Purchase_ID) select val).FirstOrDefault(); value.Total = 0; entity.Purchase = update_total(value); //if product detail value is changed then recount total and update it. }