示例#1
0
        public Transaction dtoToDomain(TransactionDto dto, Transaction domain)
        {
            // domain.Id = dto.Id; No need to set the ID
            domain.Occurence = dto.Occurence;
            if (dto.OnDate != null)
            {
                domain.OnDate = (int)dto.OnDate;
            }
            else
            {
                domain.OnDate = null;
            }

            domain.ExpireDate     = dto.ExpireDate;
            domain.OnMonth        = dto.OnMonth;
            domain.RecurrenceType = dto.RecurrenceType;
            domain.Title          = dto.Title;
            domain.Type           = dto.Type;
            domain.Amount         = dto.Amount;
            domain.CreatedDate    = dto.CreatedDate;
            domain.ExpireDate     = domain.ExpireDate;

            return(domain);
        }
示例#2
0
        private void onBtnEditClick(object sender, EventArgs e)
        {
            int      id             = Convert.ToInt32(this.selectedRow.Cells["Id"].Value);
            string   title          = Convert.ToString(this.selectedRow.Cells["Title"].Value);
            double   amount         = Convert.ToDouble(this.selectedRow.Cells["Amount"].Value);
            DateTime date           = Convert.ToDateTime(this.selectedRow.Cells["Date"].Value);
            DateTime expireDate     = Convert.ToDateTime(this.selectedRow.Cells["ExpireDate"].Value);
            string   type           = Convert.ToString(this.selectedRow.Cells["Type"].Value);
            string   occurence      = Convert.ToString(this.selectedRow.Cells["Occurence"].Value);
            string   recurrenceType = Convert.ToString(this.selectedRow.Cells["RecurrenceType"].Value);
            int      onDate         = Convert.ToInt32(this.selectedRow.Cells["OnDate"].Value);
            string   onMonth        = Convert.ToString(this.selectedRow.Cells["OnMonth"].Value);
            string   status         = Convert.ToString(this.selectedRow.Cells["Status"].Value);

            TransactionDto model = new TransactionDto();

            model.Id             = id;
            model.Title          = title;
            model.Amount         = amount;
            model.CreatedDate    = date;
            model.ExpireDate     = expireDate;
            model.Type           = type;
            model.Occurence      = occurence;
            model.RecurrenceType = recurrenceType;
            model.OnDate         = onDate;
            model.OnMonth        = onMonth;

            if (!AppConstant.DRAFT.Equals(status))
            {
                model.DbEntityId = id;
            }

            FormNewTransaction formNewTransaction = new FormNewTransaction(model);

            formNewTransaction.Show();
        }
示例#3
0
 public FormNewTransaction(TransactionDto model)
 {
     this.model = model;
     InitializeComponent();
 }
示例#4
0
        /* private void onGridCellClick(object sender, DataGridViewCellEventArgs e)
         * {
         *   if (e.RowIndex != -1) //Header row index will be zero
         *   {
         *       //Highlte the row
         *       dataGridTransaction.Rows[dataGridTransaction.CurrentRow.Index].Selected = true;
         *       DataGridViewRow selectedRow = dataGridTransaction.Rows[e.RowIndex];
         *       populateFromDataGridRow(selectedRow);
         *   }
         * }*/

        private void populateFromDataGridRow(DataGridViewRow selectedRow)
        {
            TransactionDto dto = TransactionTransformer.Instance.dataGridRowToDto(selectedRow);

            populateFormFromDto(dto);
        }
示例#5
0
 public FormNewTransaction()
 {
     this.model = new TransactionDto();
     InitializeComponent();
 }