public IHttpActionResult PutTransactionHeader(long id, TransactionHeader transactionHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != transactionHeader.TransactionId) { return(BadRequest()); } db.Entry(transactionHeader).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TransactionHeaderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void DeleteMainRow() { if (TransactionHeader != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { if (TransactionHeader.Iserial != 0) { if (AllowDelete) { Loading = true; Client.DeleteTblGlobalRetailBusinessBudgetAsync( new TblGlobalRetailBusinessBudget().InjectFrom(TransactionHeader) as TblGlobalRetailBusinessBudget); } else { MessageBox.Show("You are Not Allowed to Delete"); } } else { TransactionHeader.InjectFrom(new TblGlobalRetailBusinessBudgetViewModel()); TransactionHeader.DetailsList.Clear(); } } } }
public static string FindByUserId(int userId) { List <TransactionHeader> result = new List <TransactionHeader>(); var headers = TransactionRepository.FindByUserId(userId); if (headers.Count < 1) { return(""); } else { foreach (var header in headers) { List <TransactionDetail> finalDetail = new List <TransactionDetail>(); List <TransactionDetail> transactionDetails = TransactionRepository.FindDetailByHeaderId(header.Id); foreach (var detail in transactionDetails) { Product product = ProductRepository.FindByProductId(detail.ProductId); finalDetail.Add(TransactionFactory.CreateDetail(header.Id, product, detail.Quantity)); } TransactionHeader finalHeader = TransactionFactory.CreateHeader(header.Id, header.UserId, header.TransactionDate, finalDetail); result.Add(finalHeader); } return(JsonHandler.Encode(result)); } }
private void btnPost_ItemClick(object sender, ItemClickEventArgs e) { try { if (lines.GetAll().Where(l => l.transCode == TransactionCode).Count() > 0) { int userCode = int.Parse(Thread.CurrentPrincipal.Identity.Name.ToString()); PostedTransactionsManager postLines = new PostedTransactionsManager(); foreach (TransactionLines item in lines.GetAll().Where(l => l.transCode == TransactionCode)) { postLines.AddPostedTransactionDetails(TransactionCode, DateTime.Now, userCode, item.accCode, item.DebitAmount == null ? null : item.DebitAmount, item.CreditAmount == null ? null : item.CreditAmount); postLines.AddPostedTransactionDetails((long)item.transCode, DateTime.Now, userCode, item.offsetAccCode, item.DebitAmount == null ? item.CreditAmount : null, item.CreditAmount == null ? item.DebitAmount : null); } TransactionHeaderManager headerManager = new TransactionHeaderManager(); TransactionHeader header = headerManager.Get(TransactionCode); header.IsPosted = true; headerManager.Update(header); btnAddNew.Enabled = btnDelete.Enabled = btnPost.Enabled = false; panelControl1.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Parses the service response into transaction data. /// </summary> /// <param name="data">The collection of transaction data.</param> /// <param name="foundTransCount">The the number of found transactions.</param> /// <param name="transHeader">The transaction header data.</param> /// <param name="transItems">The transaction items data.</param> /// <param name="transLoyaltyCardNumber">The transaction loyalty card number.</param> private static void GetTransactionDataFromResponse(ReadOnlyCollection <object> data, ref int foundTransCount, ref TransactionHeader transHeader, ref TransactionItem[] transItems, ref string transLoyaltyCardNumber) { // Parse response data foundTransCount = Convert.ToInt32(data[0]); // The response contract on success case: // Data[0] - number of transaction found, // Data[1] - transaction header // Data[2] - transaction items // Data[3] - loyalty card number ("" if not available) if (foundTransCount == 1 && data.Count == 4) { // Parse transaction header transHeader = TransactionHeader.Deserialize((string)data[1]); // Parse transaction items transItems = SerializationHelper.DeserializeObjectFromXml <TransactionItem[]>((string)data[2]); // Convert amount and quantity signs in the transaction items foreach (var transItem in transItems) { transItem.NetPrice = transItem.NetPrice * -1; transItem.NetAmount = transItem.NetAmount * -1; transItem.NetAmountInclusiveTax = transItem.NetAmountInclusiveTax * -1; transItem.TaxAmount = transItem.TaxAmount * -1; transItem.Quantity = transItem.Quantity * -1; transItem.ReturnQuantity = transItem.ReturnQuantity * -1; } // Parse loyalty card number transLoyaltyCardNumber = (string)data[3]; } }
public ExplanationWindow(TransactionHeader transactionHeader) { InitializeComponent(); _transactionHeader = transactionHeader; //txtExplanation.Text = _transactionHeader.Explanation; txtExplanation.DataContext = _transactionHeader; }
public async Task <IActionResult> PutTransactionHeader([FromRoute] long id, [FromBody] TransactionHeader transactionHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != transactionHeader.TransactionHeaderID) { return(BadRequest()); } _context.Entry(transactionHeader).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TransactionHeaderExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public VoucherDataEntryWindow(IVoucher voucherView, TransactionHeader transactionHeader, TransactionDetail transactionDetail) { InitializeComponent(); _member = new Member(); _account = new Account(); _transactionDetail = (TransactionDetail)transactionDetail.Clone(); DataContext = _transactionDetail; HeaderGrid.DataContext = transactionHeader; _voucherView = voucherView; _transactionHeader = transactionHeader; // set proper button caption if (_transactionDetail.TransactionDetailId > 0) { UpdateButton.Content = "Update"; FormTitle.Content = Title = "Update Current Detail"; } else { UpdateButton.Content = "Insert"; FormTitle.Content = Title = "Insert New Detail"; } }
public static bool Checkout(int userId) { List <Cart> carts = GetThisUserCart(userId); if (carts.Count == 0) { return(false); } else { TransactionHeader transactionHeader = TransactionHeaderFactory.Create(userId); if (TransactionHeaderRepository.InsertTransactionHeader(transactionHeader)) { int headerId = transactionHeader.Id; for (int i = 0; i < carts.Count(); i++) { TransactionDetail transactionDetail = TransactionDetailFactory.Create(headerId, carts[i].ProductId, carts[i].Quantity); TransactionDetailRepository.InsertTransactionDetail(transactionDetail); } for (int i = 0; i < carts.Count(); i++) { CartRepository.RemoveCart(carts[i]); } return(true); } return(false); } }
protected void gvCatatan_RowDeleting(object sender, GridViewDeleteEventArgs e) { Debug.WriteLine("row delete " + e.RowIndex); TransactionHeader th = currTable[e.RowIndex]; TransactionController.DeleteTransaction(th); initTable(); }
public static TransactionHeader Create(int userId) { TransactionHeader transactionHeader = new TransactionHeader(); transactionHeader.UserId = userId; transactionHeader.TransactionDate = DateTime.Now; return(transactionHeader); }
public ActionResult DeleteConfirmed(long id) { TransactionHeader transactionHeader = db.TransactionHeaders.Find(id); db.TransactionHeaders.Remove(transactionHeader); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Execute(object requestMessage, ref object responseMessage, TransactionHeader transactionHeader) { //device already registered //no user registed with this id SoftTokenRegistrationRequest request = requestMessage as SoftTokenRegistrationRequest; SoftTokenRegistrationResponse response = responseMessage as SoftTokenRegistrationResponse; VpUser user = null; //verify userId, password, otp using (VeriBranchDataEntities dataEntities = new VeriBranchDataEntities()) { user = dataEntities.VpUser.Where(obj => obj.UserName.Equals(request.CustomerId)).FirstOrDefault(); } if (user == null) { throw new VPBusinessException("NoUserWithThisId"); } // move the below method to Login Manager //VerifyUserIdPassword(request, response, transactionHeader); response.AuthrnticationSuccess = LoginManager.VerifyUserIdPassword(request.CustomerId, request.Password, transactionHeader); VerifyOTP(request, response, transactionHeader, user); VerifyCardAccountAndPin(request, response, transactionHeader, user); if (response.AuthrnticationSuccess) { VpOtpDevice device = new VpOtpDevice() { CreateBy = Convert.ToString(user.ID), CreateDate = DateTime.Now, OtpType = 4, SerialNumber = request.DeviceId, Status = 2, ModifyBy = "", ModifyDate = DateTime.Now, }; using (VeriBranchDataEntities dataEntities = new VeriBranchDataEntities()) { if (dataEntities.VpOtpDevice.Where(obj => obj.SerialNumber == request.DeviceId).Count() > 0) { throw new VPBusinessException("DeviceAlreadyRegistered"); } dataEntities.VpOtpDevice.Add(device); dataEntities.SaveChanges(); VPSoftTokenRegistration softTokenRegistration = new VPSoftTokenRegistration() { DeviceId = device.ID, Password = HashHelper.Hash(request.STPassword, string.Empty, HashTypeEnum.Md5), UserId = user.ID, Preference = request.UseFingerPrint.ToString(), }; dataEntities.VPSoftTokenRegistration.Add(softTokenRegistration); dataEntities.SaveChanges(); } } }
/// <summary> /// Serializes the specified transaction header. /// </summary> /// <param name="transactionHeader">The transaction header.</param> /// <returns>TransactionHeader serialized into a string.</returns> public static string Serialize(TransactionHeader transactionHeader) { if (transactionHeader == null) { return(null); } return(SerializationHelper.SerializeObjectToXml <TransactionHeader>(transactionHeader)); }
public static TypeInfo TypeFactory(TransmissionHeader transmissionHeader, TransactionHeader transactionHeader, ResponseHeader responseHeader) { if (transactionHeader != null && transactionHeader.TransactionCode_4 == "B1" && transactionHeader.VersionReleaseNumber_3 == "D0") { return(typeof(TSB1).GetTypeInfo()); } throw new Exception("Message is not supported."); }
public static TransactionHeader CreateTransactionHeader(int buyerId, int showId, DateTime showTime, DateTime createdAt) { TransactionHeader trHeader = new TransactionHeader(); trHeader.BuyerId = buyerId; trHeader.ShowId = showId; trHeader.ShowTime = showTime; trHeader.CreatedAt = createdAt; return(trHeader); }
public static bool DeleteTransaction(TransactionHeader currTransaction) { if (currTransaction != null) { db.TransactionHeaders.Remove(currTransaction); db.SaveChanges(); return(true); } return(false); }
public static bool DeleteHeader(TransactionHeader trHeader) { if (trHeader != null) { db.TransactionHeaders.Remove(trHeader); db.SaveChanges(); return(true); } return(false); }
public ActionResult Edit([Bind(Include = "TransactionId,SenderId,TransactionDt")] TransactionHeader transactionHeader) { if (ModelState.IsValid) { db.Entry(transactionHeader).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SenderId = new SelectList(db.Accounts, "AccountId", "AccountNumber", transactionHeader.SenderId); return(View(transactionHeader)); }
public static bool InsertTransactionHeader(TransactionHeader transactionHeader) { if (transactionHeader != null) { db.TransactionHeaders.Add(transactionHeader); db.SaveChanges(); return(true); } return(false); }
public IHttpActionResult GetTransactionHeader(long id) { TransactionHeader transactionHeader = db.TransactionHeaders.Find(id); if (transactionHeader == null) { return(NotFound()); } return(Ok(transactionHeader)); }
public IHttpActionResult PostTransactionHeader(TransactionHeader transactionHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TransactionHeaders.Add(transactionHeader); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = transactionHeader.TransactionId }, transactionHeader)); }
public ActionResult Create([Bind(Include = "TransactionId,SenderId,TransactionDt")] TransactionHeader transactionHeader) { if (ModelState.IsValid) { db.TransactionHeaders.Add(transactionHeader); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SenderId = new SelectList(db.Accounts, "AccountId", "AccountNumber", transactionHeader.SenderId); return(View(transactionHeader)); }
public static bool UpdateTransaction(TransactionHeader currTransaction) { if (currTransaction != null) { db.SaveChanges(); return(true); } else { return(false); } }
public static TransactionHeader Create(int userId, int typeId, string description, int price) { TransactionHeader t = new TransactionHeader(); t.userId = userId; t.transactionTypeId = typeId; t.itemDescription = description; t.price = price; t.created_at = DateTime.Now; t.updated_at = DateTime.Now; return(t); }
public static int InsertTransactionHeader(TransactionHeader trHeader) { if (trHeader != null) { db.TransactionHeaders.Add(trHeader); db.SaveChanges(); return(trHeader.Id); } else { return(-1); } }
public static bool InsertTransaction(TransactionHeader newTransaction) { if (newTransaction != null) { db.TransactionHeaders.Add(newTransaction); db.SaveChanges(); return(true); } else { return(false); } }
public static int InsertTransactionHeader(int buyerId, int showId, DateTime showTime, DateTime createdAt) { TransactionHeader trHeader = TransactionFactory.CreateTransactionHeader(buyerId, showId, showTime, createdAt); if (trHeader != null) { return(TransactionRepository.InsertTransactionHeader(trHeader)); } else { return(-1); } }
public static TransactionHeader GetHeaderTransactionById(int trHeaderId) { TransactionHeader trHeader = TransactionRepository.GetTransactionHeaderById(trHeaderId); if (trHeader != null) { return(trHeader); } else { return(null); } }
// GET: Transactions/Delete/5 public ActionResult Delete(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TransactionHeader transactionHeader = db.TransactionHeaders.Find(id); if (transactionHeader == null) { return(HttpNotFound()); } return(View(transactionHeader)); }