partial void Sale_Details_Updating(Sale_Detail entity) { var value = (from val in Sales where val.Sale_ID.Equals(entity.Sale.Sale_ID) select val).FirstOrDefault(); value.Total = 0; entity.Sale = calculateTotal(value); //if sale detail value is changed then //recount total and update it. }
partial void Sale_Details_Inserted(Sale_Detail entity) { entity.Product.Stock_In_hand -= entity.Quantity; // subtracting the stock issued. }