Ejemplo n.º 1
0
        protected void lvTransactionDetail_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            var id = Guid.Parse(e.NewValues["ID"].ToString());
            var transactionId = Guid.Parse(e.NewValues["TransactionID"].ToString());
            decimal amount;

            decimal.TryParse(e.NewValues["Amount"] == null ? "0" : e.NewValues["Amount"].ToString(), out amount);
            var transactionDetail = new TransactionDetail
                                                                    {
                                                                        ID = id,
                                                                        TransactionID = transactionId,
                                                                        TransactionDetailTypeID = int.Parse(e.NewValues["TransactionDetailTypeID"].ToString()),
                                                                        Amount = decimal.Parse(e.NewValues["Amount"].ToString()),
                                                                        Title = e.NewValues["Title"] as string,
                                                                        Note = e.NewValues["Note"] as string
                                                                    };

            lvTransactionDetail.EditIndex = -1;
            _presenter.UpdateTransactionDetail(transactionDetail);
            _presenter.BindTransactionDetailFromCache();
        }
Ejemplo n.º 2
0
 public void UpdateTransactionDetail(TransactionDetail transactionDetail)
 {
     DeleteTransactionDetail(transactionDetail.ID);
     InsertTransactionDetail(transactionDetail);
 }
Ejemplo n.º 3
0
        protected void lvTransactionDetail_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            decimal amount;
            decimal.TryParse(e.Values["Amount"] == null ? "0" : e.Values["Amount"].ToString(), out amount);
            var transactionDetail = new TransactionDetail
                                                                    {
                                                                        ID = Guid.NewGuid(),
                                                                        TransactionID = Transaction != null ? Transaction.ID : Guid.Empty,
                                                                        Amount = amount,
                                                                        TransactionDetailTypeID = int.Parse(e.Values["TransactionDetailTypeID"].ToString()),
                                                                        Title = e.Values["Title"] as string,
                                                                        Note = e.Values["Note"] as string
                                                                    };

            _presenter.InsertTransactionDetail(transactionDetail);
            _presenter.BindTransactionDetailFromCache();
        }
Ejemplo n.º 4
0
 public void InsertTransactionDetail(TransactionDetail transactionDetail)
 {
     _view.Transaction.TransactionDetails.Add(transactionDetail);
 }