Exemple #1
0
 public static bool UpdateOrderFinishedSizes(Guid orderID, OrderFinishedSize itm, ref SQLWrapper sw)
 {
     bool returnValue = false;
     SqlParameter[] param =
     {
         new SqlParameter("OrderID",typeof(Guid))
     };
     param[0].Value = orderID;
     sw.ExecuteStoredProcedureInTransaction("ORD_DeleteOrderFinishedSizes", param);
     if (itm.OrderFSJacketSize != null)
     {
         for (int i = 0; i <= itm.OrderFSJacketSize.Count - 1; i++)
         {
             param = prepareParams(orderID, 4, itm.OrderFSJacketSize[i]);
             sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderSize", param);
         }
     }
     if (itm.OrderFSSlackVestTopCoatSize != null)
     {
         for (int i = 0; i <= itm.OrderFSSlackVestTopCoatSize.Count - 1; i++)
         {
             param = prepareParams(orderID, 5, itm.OrderFSSlackVestTopCoatSize[i]);
             sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderSize", param);
         }
     }
     if (itm.OrderFSShirtSize != null)
     {
         for (int i = 0; i <= itm.OrderFSShirtSize.Count - 1; i++)
         {
             param = prepareParams(orderID, 6, itm.OrderFSShirtSize[i]);
             sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderSize", param);
         }
     }
     return returnValue;
 }
Exemple #2
0
        public static bool DeleteOrder(OrderHeader orderID)
        {
            bool returnValue = false;
            SQLWrapper sw = new SQLWrapper();
            sw.BeginTransaction();
            try
            {
                SqlParameter[] param =
            {
                new SqlParameter("OrderID",typeof(Guid))
            };
                param[0].Value = orderID;
                sw.ExecuteStoredProcedureInTransaction("ORD_DeleteOrder", param);

                sw.CommitTransaction();
                returnValue = true;
            }
            catch
            {
                sw.RollBackTransaction();
            }
            finally
            {
                sw = null;
            }
            return returnValue;
        }
Exemple #3
0
        public static bool AddOrder(OrderHeader order)
        {
            bool returnValue = false;
            SqlParameter[] param;
            SQLWrapper sw = new SQLWrapper();
            sw.BeginTransaction();
            try
            {
                param = prepareSQLParameters(order, true);
                sw.ExecuteStoredProcedureInTransaction("ORD_AddOrderHeader", param);
                order.OrderID = (Guid)param[0].Value;

                addUpdateChildTablesForOrder(order, ref sw);

                sw.CommitTransaction();
                returnValue = true;
            }
            catch
            {
                sw.RollBackTransaction();
            }
            finally
            {
                sw = null;
            }
            return returnValue;
        }
 public static bool AddOrderMaterial(Guid orderID, OrderMaterialItem itm, ref SQLWrapper sw)
 {
     bool returnValue = false;
     SqlParameter[] param = prepareParams(orderID, itm);
     returnValue = sw.ExecuteStoredProcedureInTransaction("ORD_AddUpdateOrderMaterial",param);
     return returnValue;
 }
Exemple #5
0
 public static bool DeleteRestOfTheOrderPayments(Guid orderID, string otherThanSequenceNumbers, ref SQLWrapper sw)
 {
     SqlParameter[] param =
     {
         new SqlParameter("OrderID",typeof(Guid )),
         new SqlParameter("Sequences",typeof(string )),
     };
     param[0].Value = orderID;
     param[1].Value = otherThanSequenceNumbers;
     return sw.ExecuteStoredProcedureInTransaction("ORD_DeleteOrderPayments", param);
 }
Exemple #6
0
 public static bool UpdateOrderFinishedSizes(Guid orderID, OrderFinishedSize itm)
 {
     bool returnValue = false;
     SQLWrapper sw = new SQLWrapper();
     sw.BeginTransaction();
     try
     {
         UpdateOrderFinishedSizes(orderID, itm, ref sw);
         sw.CommitTransaction();
         returnValue = true;
     }
     catch
     {
         sw.RollBackTransaction();
     }
     finally
     {
         sw = null;
     }
     return returnValue;
 }
Exemple #7
0
 public static bool AddUpdateOrderPayment(Guid orderID, IOrderPaymentItem paymentItem,ref SQLWrapper sw)
 {
     SqlParameter[] param = prepareParameters(orderID,paymentItem);
     return sw.ExecuteStoredProcedureInTransaction("ORD_AddUpdateOrderPayment", param);
 }
Exemple #8
0
        private static void addUpdateChildTablesForOrder(OrderHeader order, ref SQLWrapper sw)
        {
            string sequences = "";
            // payments
            if (order.Payments != null)
            {
                if (order.Payments.PaymentDetails != null)
                {
                    for (int i = 0; i <= order.Payments.PaymentDetails.Count - 1; i++)
                    {
                        if (!sequences.Trim().Equals(""))
                        {
                            sequences += ",";
                        }
                        sequences += order.Payments.PaymentDetails[i].Sequence.ToString();
                        PaymentsDAL.AddUpdateOrderPayment(order.OrderID, order.Payments.PaymentDetails[i], ref sw);
                    }
                }
            }
            PaymentsDAL.DeleteRestOfTheOrderPayments(order.OrderID, sequences, ref sw);
            sequences = "";

            // finished sizes
            if (order.FinishedSize != null)
            {
                OrderSizeDAL.UpdateOrderFinishedSizes(order.OrderID, order.FinishedSize, ref sw);
            }

            // measurement sizes
            if (order.MeasurementDetails != null)
            {
                OrderSizeDAL.UpdateOrderMeasurementSizes(order.OrderID, order.MeasurementDetails, ref sw);
            }

            // material details
            if (order.OrderMaterials != null)
            {
                sequences = "";
                for (int i = 0; i <= order.OrderMaterials.Count; i++)
                {
                    if (!sequences.Trim().Equals(""))
                    {
                        sequences += ",";
                    }
                    sequences += order.OrderMaterials[i].Sequence.ToString();
                    OrderMaterialsDAL.AddOrderMaterial(order.OrderID, order.OrderMaterials[i], ref sw);
                }
            }
            OrderMaterialsDAL.DeleteRestOfTheOrderMaterials(order.OrderID, sequences, ref sw);
        }