public static string complite_transaction(AccessControl.AccessManager mgr, Guid tr_idx, Decimal money, string url_template) { Shop.shop_transaction ds = new Shop.shop_transaction(); Shop.shop_transactionTableAdapters.shop_transactionTableAdapter ta = new Shop.shop_transactionTableAdapters.shop_transactionTableAdapter(); ta.Connection = (System.Data.SqlClient.SqlConnection)mgr.Connection; ta.FillByIdx(ds._shop_transaction, tr_idx); if (ds._shop_transaction.Rows.Count == 0) { throw new System.Exception("No such transaction: " + tr_idx.ToString()); } if (ds._shop_transaction[0].amount != money) { throw new System.Exception("You pay - " + money.ToString() + " but must - " + ds._shop_transaction[0].amount.ToString()); } ds._shop_transaction[0].complited = DateTime.Now; ds._shop_transaction[0].state = 1; ta.Update(ds._shop_transaction[0]); String type = ds._shop_transaction[0].type.Trim(); purchase(mgr, ds._shop_transaction[0].idx, type, ds._shop_transaction[0].package_idx, ds._shop_transaction[0].amount); return(String.Format(url_template, ds._shop_transaction[0].idx, type, ds._shop_transaction[0].package_idx)); }
public static void create_transaction(System.Data.SqlClient.SqlConnection conn, Guid tr_idx, int idx, string type, int package_idx, Decimal money) { Shop.shop_transactionTableAdapters.shop_transactionTableAdapter ta = new Shop.shop_transactionTableAdapters.shop_transactionTableAdapter(); ta.Connection = conn; ta.Insert(tr_idx, money, DateTime.Now, DateTime.Now, 0, idx, type, package_idx, ""); }