public static bool UpdateOrderMeasurementSizes(Guid orderID, OrderMeasurement itm, ref SQLWrapper sw) { bool returnValue = false; SqlParameter[] param = { new SqlParameter("OrderID",typeof(Guid)) }; param[0].Value = orderID; sw.ExecuteStoredProcedureInTransaction("ORD_DeleteOrderMeasureSizes", param); if (itm.OrderMJacketSize != null) { for (int i = 0; i <= itm.OrderMJacketSize.Count - 1; i++) { param = prepareParams(orderID, 1, itm.OrderMJacketSize[i]); sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderSize", param); } } if (itm.OrderMSlackVestTopCoatSize != null) { for (int i = 0; i <= itm.OrderMSlackVestTopCoatSize.Count - 1; i++) { param = prepareParams(orderID, 2, itm.OrderMSlackVestTopCoatSize[i]); sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderSize", param); } } if (itm.OrderMShirtSize != null) { for (int i = 0; i <= itm.OrderMShirtSize.Count - 1; i++) { param = prepareParams(orderID, 3, itm.OrderMShirtSize[i]); sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderSize", param); } } return returnValue; }
public static bool UpdateOrderMeasurementSizes(Guid orderID, OrderMeasurement itm) { bool returnValue = false; SQLWrapper sw = new SQLWrapper(); sw.BeginTransaction(); try { UpdateOrderMeasurementSizes(orderID, itm, ref sw); sw.CommitTransaction(); returnValue = true; } catch { sw.RollBackTransaction(); } finally { sw = null; } return returnValue; }