public void AddTLI(TransactionLineItem value) { DBConnect db = new DBConnect(); bool isOpen = db.OpenConnection(); if (isOpen) { MySqlConnection conn = db.GetConn(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = @"INSERT INTO TransactionLineItem(ProductID, ProductName, ProductPrice, ProductType, ProductDiscount, TransactionID) VALUES(@ProductID, @ProductName, @ProductPrice, @ProductType, @ProductDiscount, @TransactionID)"; cmd.Parameters.AddWithValue("@ProductID", value.productID); cmd.Parameters.AddWithValue("@ProductName", value.productName); cmd.Parameters.AddWithValue("@ProductPrice", value.productPrice); cmd.Parameters.AddWithValue("@ProductType", value.productType); cmd.Parameters.AddWithValue("@ProductDiscount", value.productDiscount); cmd.Parameters.AddWithValue("@TransactionID", value.transactionID); cmd.Prepare(); cmd.ExecuteNonQuery(); //close connection db.CloseConnection(); } }
public TransactionLineItem GetTransactionLineItem(int productID) { DBConnect db = new DBConnect(); bool isOpen = db.OpenConnection(); if (isOpen) { MySqlConnection conn = db.GetConn(); string stm = "SELECT * FROM TransactionLineItem WHERE ProductID = @ProductID"; MySqlCommand cmd = new MySqlCommand(stm, conn); cmd.Parameters.AddWithValue("@ProductID", productID); cmd.Prepare(); using MySqlDataReader rdr = cmd.ExecuteReader(); rdr.Read(); TransactionLineItem transactionlineitem = new TransactionLineItem() { productID = rdr.GetInt32(0), productName = rdr.GetString(1), productPrice = rdr.GetDouble(2), productType = rdr.GetString(3), productDiscount = rdr.GetDouble(4), transactionID = rdr.GetInt32(5) }; db.CloseConnection(); return(transactionlineitem); } else { return(new TransactionLineItem()); } }
public void AddTransactionLineItem(TransactionLineItem item) { if (!Items.Contains(item)) { Items.Add(item); } else { // Item added that already exists, that means that the qty has changed. UpdateVisualization(); } }
public void AddTLI(TransactionLineItem value) { string cs = @"URI = file:C:\Users\birdc\source\repos\TitleTownCards\TTCDatabase.db"; using var con = new SQLiteConnection(cs); con.Open(); using var cmd = new SQLiteCommand(con); cmd.CommandText = @"INSERT INTO TransactionLineItem(ProductID, ProductName, ProductPrice, ProductType, ProductDiscount, TransactionID) VALUES(@ProductID, @ProductName, @ProductPrice, @ProductType, @ProductDiscount, @TransactionID)"; cmd.Parameters.AddWithValue("@ProductID", value.productID); cmd.Parameters.AddWithValue("@ProductName", value.productName); cmd.Parameters.AddWithValue("@ProductPrice", value.productPrice); cmd.Parameters.AddWithValue("@ProductType", value.productType); cmd.Parameters.AddWithValue("@ProductDiscount", value.productDiscount); cmd.Parameters.AddWithValue("@TransactionID", "1"); cmd.Prepare(); cmd.ExecuteNonQuery(); }
public void Put(int id, [FromBody] TransactionLineItem value) { }
public void Post([FromBody] TransactionLineItem value) { IAddTransactionLineItem insertObject = new AddTransactionLineItemData(); insertObject.AddTLI(value); }
/// <summary> /// Create settlement service contract TransactionLineItem from eagle business transaction model /// </summary> /// <param name="transactionLineItem">TransactionLineItem</param> /// <returns>SettlementServiceContract.TransactionLineItem</returns> private static SettlementServiceContract.TransactionLineItem CreateServiceContractTransactionLineItem( TransactionLineItem transactionLineItem) { return new SettlementServiceContract.TransactionLineItem() { ActionCode = transactionLineItem.ActionCode, Amount = transactionLineItem.Amount, Authcode = transactionLineItem.Authcode, AuthorisedPaymentId = transactionLineItem.AuthorisedPaymentId, IvrApplied = transactionLineItem.IvrApplied, MerchantFee = transactionLineItem.MerchantFee, PaymentGatewayTransactionId = transactionLineItem.PaymentGatewayTransactionId, PaymentServiceProviderFee = transactionLineItem.PaymentServiceProviderFee, PayPalApplied = transactionLineItem.PayPalApplied, ReservationId = transactionLineItem.ReservationId, ResponseTransactionId = transactionLineItem.ResponseTransactionId, TransactionDate = transactionLineItem.TransactionDate, PaymentGatewayName = transactionLineItem.PaymentGatewayName }; }
protected void GetTransactionLines(ref List<TransactionLineItem> transList) { string sku = ""; string thecartID = Session["yourcart"].ToString(); DataSet dsPromo = doQuery("SELECT * FROM CartPromos CP, NetSuitePromos NSP WHERE " + "CP.CodeID=NSP.NetSuiteID AND CP.CartSession='" + thecartID + "'"); DataSet dsCartParent = doQuery("SELECT * FROM Cart C, NetSuiteProducts NSP WHERE " + "C.NID=NSP.NID AND isParent = 'True' AND CartSessionID='" + thecartID + "'"); DataSet dsProduct1 = doQuery("SELECT * FROM NetSuiteProducts WHERE NID='" + dsCartParent.Tables[0].Rows[0]["NID"].ToString().Trim().ToUpper() + "'"); DataSet dsCart = doQuery("SELECT * FROM Cart C WHERE C.CartSessionID='" + thecartID + "'"); DataSet dsCartNotParent = doQuery("SELECT * FROM Cart C, NetSuiteBoxes NSB WHERE " + "NSB.NID=C.SubProductID AND C.isParent='False' AND C.CartSessionID='" + thecartID + "' ORDER BY C.BoxID"); DataView dvParents = new DataView(doQuery("SELECT * FROM NetSuiteProducts").Tables[0], "", "", DataViewRowState.CurrentRows); DataSet dsProdCount = doQuery("SELECT DISTINCT ID, NID, Quantity, isParent, SubProductID, " + "ParentID FROM Cart WHERE CartSessionID='" + thecartID + "' AND isParent ='True'"); DataView dv = new DataView(dsCart.Tables[0], "", "", DataViewRowState.CurrentRows); DataView dvSub = new DataView(dsCartNotParent.Tables[0], "", "", DataViewRowState.CurrentRows); for (int i = 0; i < dsCartParent.Tables[0].Rows.Count; i++) { TransactionLineItem transLine = new TransactionLineItem(); string tempSKU = dsCartParent.Tables[0].Rows[i]["SKU"].ToString().Trim(); dvSub.RowFilter = "ParentID=" + dsCartParent.Tables[0].Rows[i]["ID"].ToString(); if (!bool.Parse(dsCartParent.Tables[0].Rows[i]["isLoneSKU"].ToString())) { for (int j = 0; j < dvSub.Count; j++) { tempSKU += dvSub[j]["SKU"].ToString().Trim(); } sku += " [i: " + i.ToString() + ", tempSKU: " + tempSKU + "]<br/>"; } string itemID = doQuery("SELECT * FROM NetSuiteGroupItem WHERE ItemName='" + tempSKU + "'").Tables[0].Rows[0]["ItemID"].ToString(); decimal price = decimal.Parse("0.00"); dv.RowFilter = "ID=" + dsCartParent.Tables[0].Rows[i]["ID"].ToString(); if ((NDAL.DataTypes.PriceLevels)Session["UserType"] == PriceLevels.Educational) { price = CalculatePrice(tempSKU, int.Parse(dv[0]["Quantity"].ToString()), NDAL.DataTypes.PriceLevels.Educational); } else { price = CalculatePrice(tempSKU, int.Parse(dv[0]["Quantity"].ToString()), NDAL.DataTypes.PriceLevels.MSRP); } transLine.Amount = (price * decimal.Parse(dv[0]["Quantity"].ToString())).ToString(); transLine.Description = "Online order"; DataSet dsPromo2 = doQuery("SELECT * FROM CartPromos CP, NetSuitePromos NSP WHERE " + "CP.CodeID=NSP.NetSuiteID AND CP.CartSession='" + thecartID + "'"); if (dsPromo.Tables.Count > 0) if (dsPromo.Tables[0].Rows.Count > 0) { transLine.DiscountPercent = TheDiscountPercent.Text = dsPromo2.Tables[0].Rows[0]["PercentDiscount"].ToString(); } else { transLine.DiscountPercent = "0%"; } else transLine.DiscountPercent = "0%"; transLine.ItemID = itemID; transLine.PriceLevel = (NDAL.DataTypes.PriceLevels)Session["UserType"]; transLine.CommissionClass = Classes.Classroom; //need this to make it work: per bug 1504 //how do we know the item type? transLine.ItemType = "itemgroup"; //will this always be only 'Standard' or 'Educational'? transLine.Quantity = dv[0]["Quantity"].ToString(); transLine.Rate = price.ToString(); //transLine.Tax = "0.00";//=============================================TAKE CARE OF FROM AVATAX //how do we know the shippment location? ** LST - This should default to the Tualatin Warehouse, denotes where the inventory will be deducted from. transLine.Location = Locations.TualatinWarehouse; transList.Add(transLine); //} } }