public long CreateTransaction(long senderId, long recipientId, bool isAnonymous, TransactionState state, string comment, bool?fromPool = null) { if (senderId == recipientId) { throw new Exception("Sender and receiver can't be the same"); } try { using (var context = new GritCoinEntities()) { var SENDER = context.EMPLOYEE.FirstOrDefault(EMP => EMP.EMPLOYEE_ID == senderId); if (!fromPool.HasValue || fromPool.Value == false) { fromPool = SENDER != null && SENDER.ELIGIBLE_FLAG == "N" ? true : false; } var TRANSACTION = new TRANSACTIONS { TRANSACTION_ID = GetSequenceNextValue(context, "GRITCOIN.TRANSACTIONS_SEQ"), ANONYMOUS_FLAG = isAnonymous ? "Y" : "N", EFFECTIVE_DATE = DateTime.Now, CYCLE_ID = CurrentCycle.CycleId, RECIPIENT = recipientId, SENDER = senderId, SYSTEM_CHANGE_DATE = DateTime.Now, TRANSACTION_STATE = state.ToString(), NOTE = comment, FROM_POOL_FLAG = fromPool.HasValue && fromPool.Value ? "Y" : "N" }; context.AddToTRANSACTIONS(TRANSACTION); context.SaveChanges(); return(TRANSACTION.TRANSACTION_ID); } } catch { throw; } }
internal static IList <TRANSACTIONS> FindTransactionsDay() { using (IDalTransaction dal = new DalTransaction()) { DateTime date = DateTime.Today; IList <TRANSACTIONS> result = new List <TRANSACTIONS>(); IList <SPP_TransactionsDay_Result> tDay = dal.GetAllTransactionDay(date); for (int i = 0; i < tDay.Count(); i++) { TRANSACTIONS transac = new TRANSACTIONS { idTransaction = tDay[i].idTransaction, transactionDateBegin = tDay[i].transactionDateBegin, transactionDateEnd = tDay[i].transactionDateEnd, total = tDay[i].total, discountGlobal = tDay[i].discountGlobal, isReturn = tDay[i].isReturn, terminalId = tDay[i].terminalId, shopId = tDay[i].shopId, customerId = tDay[i].customerId, statusId = tDay[i].statusId, userId = tDay[i].userId }; result.Add(transac); } return(result); } }
public int CreateTransaction(int terminal, string vendorId, int shop, int customer) { STATUS status = db.STATUSs.Where(s => s.nameStatus.ToLower() == "open").Single(); TRANSACTIONS tr = new TRANSACTIONS { transactionDateBegin = DateTime.Now, transactionDateEnd = DateTime.Parse("2000-01-01 00:00:00"), terminalId = terminal, userId = vendorId, shopId = shop, statusId = status.idStatus, customerId = customer }; db.TRANSACTIONSs.Add(tr); db.SaveChanges(); return(tr.idTransaction); }
public int CreateTransaction(int terminal) { STATUS status = db.STATUSs.Where(s => s.nameStatus.ToLower() == "open").Single(); // to do --> provisoire vendorId = 1, shopId = 1, customerId = 1, messageId = 1 languageId = 1 TRANSACTIONS tr = new TRANSACTIONS { transactionDateBegin = DateTime.Now, transactionDateEnd = DateTime.Parse("2000-01-01 00:00:00"), terminalId = terminal, vendorId = 1, shopId = 1, statusId = status.idStatus, customerId = 1, messageId = 1, languageMessage = 1 }; db.TRANSACTIONSs.Add(tr); db.SaveChanges(); return(tr.idTransaction); }
private void buttonOK_Click(object sender, EventArgs e) { if (!checkBoxApprove.Checked) { MessageBox.Show("Необхідна згода з вимогами публічної пропозиції!", "Увага!"); return; } if (textBoxCard1.Text == "" || textBoxCard2.Text == "" || textBoxCard3.Text == "" || textBoxCard4.Text == "" || textBoxCVV.Text == "" || comboBoxYear.Text == "" || comboBoxMonth.Text == "" || textBoxCard2.Text == null || textBoxCard3.Text == null || textBoxCard4.Text == null || textBoxCVV.Text == null || textBoxCard1.Text == null || comboBoxMonth.Text == null || comboBoxYear.Text == null) { MessageBox.Show("Заповнення усіх полів необхідне!", "Помилка"); return; } if (textBoxCard1.Text.Length != 4 || textBoxCard2.Text.Length != 4 || textBoxCard3.Text.Length != 4 || textBoxCard4.Text.Length != 4) { MessageBox.Show("Вказаний номер картки не є коректним", "Помилка"); return; } if (textBoxCVV.Text.Length != 3) { MessageBox.Show("Некоректний формат CVV"); return; } DateTime date = new DateTime(Convert.ToInt32("20" + comboBoxYear.Text), Convert.ToInt32(comboBoxMonth.Text), 1); var transaction = new TRANSACTIONS { T_DATE = System.DateTime.Now, T_EXPIRE_DATE = date, T_RRN = textBoxCard1.Text + textBoxCard2.Text + textBoxCard3.Text + textBoxCard4.Text }; ctx.TRANSACTIONS.Add(transaction); ctx.SaveChanges(); transaction_id = transaction.T_ID; finished = true; MessageBox.Show("Транзакцію успішно виконано!"); this.Close(); }
//// GET: Transacs/Details/5 //[Authorize(Roles = "admin")] //[Authorize(Roles = "manager")] //[Authorize(Roles = "vendor")] public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TRANSACTIONS transaction = db.TRANSACTIONSs.Find(id); if (transaction == null) { return(HttpNotFound()); } return(View(transaction)); }
//// GET: Transacs/Create //public ActionResult Create() //{ // ViewBag.customerId = new SelectList(db.CUSTOMERs, "customerId", "customerId"); // ViewBag.shopId = new SelectList(db.SHOPs, "idShop", "phone"); // ViewBag.statusId = new SelectList(db.STATUSs, "idStatus", "nameStatus"); // ViewBag.terminalId = new SelectList(db.TERMINALs, "idTerminal", "nameTerminal"); // ViewBag.userId = new SelectList(db.USERINFOs, "userId", "nameUser"); // return View(); //} //// POST: Transacs/Create //// Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour //// plus de détails, voir https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Create([Bind(Include = "idTransaction,transactionDateBegin,transactionDateEnd,total,discountGlobal,isReturn,terminalId,shopId,customerId,statusId,userId")] TRANSACTIONS transaction) //{ // if (ModelState.IsValid) // { // db.TRANSACTIONSs.Add(transaction); // db.SaveChanges(); // return RedirectToAction("Index"); // } // ViewBag.customerId = new SelectList(db.CUSTOMERs, "customerId", "customerId", transaction.customerId); // ViewBag.shopId = new SelectList(db.SHOPs, "idShop", "phone", transaction.shopId); // ViewBag.statusId = new SelectList(db.STATUSs, "idStatus", "nameStatus", transaction.statusId); // ViewBag.terminalId = new SelectList(db.TERMINALs, "idTerminal", "nameTerminal", transaction.terminalId); // ViewBag.userId = new SelectList(db.USERINFOs, "userId", "nameUser", transaction.userId); // return View(transaction); //} //// GET: Transacs/Edit/5 //public ActionResult Edit(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // TRANSACTIONS transaction = db.TRANSACTIONSs.Find(id); // if (transaction == null) // { // return HttpNotFound(); // } // ViewBag.customerId = new SelectList(db.CUSTOMERs, "customerId", "customerId", transaction.customerId); // ViewBag.shopId = new SelectList(db.SHOPs, "idShop", "phone", transaction.shopId); // ViewBag.statusId = new SelectList(db.STATUSs, "idStatus", "nameStatus", transaction.statusId); // ViewBag.terminalId = new SelectList(db.TERMINALs, "idTerminal", "nameTerminal", transaction.terminalId); // ViewBag.userId = new SelectList(db.USERINFOs, "userId", "nameUser", transaction.userId); // return View(transaction); //} //// POST: Transacs/Edit/5 //// Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour //// plus de détails, voir https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Edit([Bind(Include = "idTransaction,transactionDateBegin,transactionDateEnd,total,discountGlobal,isReturn,terminalId,shopId,customerId,statusId,userId")] TRANSACTIONS transaction) //{ // if (ModelState.IsValid) // { // db.Entry(transaction).State = EntityState.Modified; // db.SaveChanges(); // return RedirectToAction("Index"); // } // ViewBag.customerId = new SelectList(db.CUSTOMERs, "customerId", "customerId", transaction.customerId); // ViewBag.shopId = new SelectList(db.SHOPs, "idShop", "phone", transaction.shopId); // ViewBag.statusId = new SelectList(db.STATUSs, "idStatus", "nameStatus", transaction.statusId); // ViewBag.terminalId = new SelectList(db.TERMINALs, "idTerminal", "nameTerminal", transaction.terminalId); // ViewBag.userId = new SelectList(db.USERINFOs, "userId", "nameUser", transaction.userId); // return View(transaction); //} // GET: Transacs/Delete/5 //[Authorize(Roles = "admin")] //[Authorize(Roles = "manager")] public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TRANSACTIONS tRANSACTIONS = db.TRANSACTIONSs.Find(id); if (tRANSACTIONS == null) { return(HttpNotFound()); } return(View(tRANSACTIONS)); }
public ActionResult DeleteConfirmed(TRANSACTIONS tr, int id) { TRANSACTIONS transaction = db.TRANSACTIONSs.Find(id); if (tr.cancelDescritpion != null) { transaction.cancelDescritpion = tr.cancelDescritpion; transaction.statusId = db.STATUSs.Where(s => s.nameStatus == "deleted").Select(st => st.idStatus).Single(); db.Entry(transaction).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.noReason = "Un motif est obligatoire"; return(View(transaction)); }
internal static string FindTotalByTransacId(string nTransac) { TRANSACTIONS transac = FindTransactionById(nTransac); return(transac.total.ToString()); }