Beispiel #1
0
        private Dictionary <string, object> prepareOrderParameters(clsMyOrder prOrder)
        {
            Dictionary <string, object> par = new Dictionary <string, object>(7);

            par.Add("OrderPrice", prOrder.OrderPrice);
            par.Add("OrderDate", prOrder.OrderDate);
            par.Add("Quantity", prOrder.Quantity);
            par.Add("CustName", prOrder.CustName);
            par.Add("CustPhone", prOrder.CustPhone);
            par.Add("CustMail", prOrder.CustMail);
            par.Add("SerialNo", prOrder.SerialNo);
            return(par);
        }
Beispiel #2
0
 public string PostOrder(clsMyOrder prOrder)
 {   //insert
     try
     {
         int lcRecCount = clsDbConnection.Execute("INSERT INTO myorder (OrderPrice, OrderDate, Quantity, CustName, CustPhone, CustMail, SerialNo)" +
                                                  "values (@OrderPrice, @OrderDate, @Quantity, @CustName, @CustPhone, @CustMail, @SerialNo)",
                                                  prepareOrderParameters(prOrder));
         if (lcRecCount == 1)
         {
             return("One Order inserted");
         }
         else
         {
             return("Unexpected order insert count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }