예제 #1
0
 public TransactionPartyBinder(TransactionPartyEntity transactionPartyEntity)
 {
     Id            = transactionPartyEntity.Id;
     Code          = transactionPartyEntity.Code;
     Description   = transactionPartyEntity.Description;
     AddedDateTime = transactionPartyEntity.CreatedDateTime;
 }
예제 #2
0
 public TransactionBinder(TransactionEntity transactionEntity, TransactionPartyEntity transactionPartyEntity)
 {
     ReferenceNumber      = transactionEntity.ReferenceNumber;
     TransactionPartyCode = transactionPartyEntity.Code;
     Amount = ((transactionEntity.IsIncome ? 1 : -1) * transactionEntity.Amount).ToString("0.00");
     TransactionDateTime = transactionEntity.TransactionDateTime;
 }
 public ScheduleTransactionBinder(SheduledTransactionList transactionEntity, TransactionPartyEntity transactionPartyEntity)
 {
     ReferenceNumber      = transactionEntity.ReferenceNumber;
     TransactionPartyCode = transactionPartyEntity.Code;
     Amount = ((transactionEntity.IsIncome ? 1 : -1) * transactionEntity.Amount).ToString("0.00");
     TransactionDateTime = transactionEntity.NextTransactionDate.ToString("dd-MM-yyyy h:mm tt");
     Type = "Scheduled";
 }
예제 #4
0
 public TransactionLogBinder(TransactionLogEntity transactionLog, TransactionPartyEntity transactionParty)
 {
     TransactionDate      = transactionLog.TransactionDateTime;
     Remarks              = transactionLog.Remarks;
     Amount               = (transactionLog.IsIncome ? transactionLog.Amount : -1.0 * transactionLog.Amount).ToString("0.00");
     Balance              = (transactionLog.FinalBalance).ToString("0.00");
     TransactionPartyCode = transactionParty.Code;
 }
        public async Task DeleteTransactionPartyAsync(int id)
        {
            await _transactionPartyModel.DeleteTransactionPartyAsync(id);

            IList <TransactionPartyEntity> transactionParties = TransactionParties.ToList();
            TransactionPartyEntity         transactionParty   = transactionParties.First(tp => tp.Id == id);

            transactionParty.IsActive = false;
            TransactionParties        = transactionParties;
        }
예제 #6
0
 public TransactionBinder(TransactionEntity transactionEntity, TransactionPartyEntity transactionPartyEntity)
 {
     ReferenceNumber        = transactionEntity.ReferenceNumber;
     TransactionParty       = transactionPartyEntity.Code;
     Amount                 = ((transactionEntity.IsIncome ? 1 : -1) * transactionEntity.Amount).ToString("0.00");
     IsScheduledTransaction = transactionEntity.ScheduledTransactionId == null ? "No" : "Yes";
     TransactionDateTime    = transactionEntity.TransactionDateTime;
     Remarks                = transactionEntity.Remarks;
     PerformedBy            = transactionEntity.IsUserPerformed ? "User" : "System";
 }
예제 #7
0
 public ScheduleTransactionBinder(SheduledTransactionList transactionEntity, TransactionPartyEntity transactionPartyEntity)
 {
     ReferenceNumber     = transactionEntity.ReferenceNumber;
     TransactionParty    = transactionPartyEntity.Code;
     Amount              = ((transactionEntity.IsIncome ? 1 : -1) * transactionEntity.Amount).ToString("0.00");
     RepeatType          = transactionEntity.RepeatType;
     NextTransactionDate = transactionEntity.NextTransactionDate;
     Remarks             = transactionEntity.Remarks;
     EndTransactionDate  = transactionEntity.EndDateTime.ToString();
 }
 public ScheduleTransactionBinder(SheduledTransactionList transactionEntity, TransactionPartyEntity transactionPartyEntity)
 {
     ReferenceNumber     = transactionEntity.ReferenceNumber;
     TransactionParty    = transactionPartyEntity.Code;
     Amount              = ((transactionEntity.IsIncome ? 1 : -1) * transactionEntity.Amount).ToString("0.00");
     RepeatType          = transactionEntity.RepeatType;
     NextTransactionDate = transactionEntity.NextTransactionDate;
     Remarks             = transactionEntity.Remarks;
     EndTransactionDate  = transactionEntity.InfiniteSchedule ? "Never" :transactionEntity.EndDateTime.ToString();
     Status              = transactionEntity.IsActive ? "Active" : "Disabled";
 }
예제 #9
0
 public TransactionLogBinder(TransactionLogEntity transactionLog, TransactionPartyEntity transactionParty)
 {
     TransactionDate  = transactionLog.TransactionDateTime.ToString("dd-MM-yyyy h:mm tt");
     Remarks          = transactionLog.Remarks;
     Amount           = (transactionLog.IsIncome ? transactionLog.Amount : -1.0 * transactionLog.Amount).ToString("0.00");
     Balance          = (transactionLog.FinalBalance).ToString("0.00");
     TransactionParty = transactionParty.Code;
     isDeleted        = transactionLog.IsDeletedTransaction == true ? "Yes" : "No";
     Type             = transactionLog.ScheduledTransactionId == null ? "One Time" : "Scheduled";
     CreatedDate      = transactionLog.CreatedDateTime.ToString("dd-MM-yyyy h:mm tt");
     PerformedBy      = transactionLog.IsUserPerformed ? "User" : "System";
 }
        public async Task GenarateTransactionReportAsync()
        {
            IList <string> lines = new List <string>();
            IEnumerable <TransactionEntity> transactions = Transactions.Where(t => t.IsActive).OrderByDescending(t => t.TransactionDateTime);

            lines.Add("ReferenceNumber,TransactionDateTime,TransactionPartyCode,Amount,PerformedBy,Remarks");
            foreach (TransactionEntity transaction in transactions)
            {
                TransactionPartyEntity partyEntity = TransactionParties.First(tp => tp.Id == transaction.TransactionPartyId);
                lines.Add($"{transaction.ReferenceNumber},{transaction.TransactionDateTime.ToString("yyyy-MM-dd h:mm:ss tt")},{partyEntity.Code},{(transaction.Amount * (transaction.IsIncome ? 1 : -1)).ToString("0.00")},{(transaction.IsUserPerformed ? "User" : "System")},{transaction.Remarks}");
            }
            await _transactionModel.GenarateTransactionReportAsync(lines);
        }
예제 #11
0
        public void UpdateTransactionLogBinders()
        {
            IList <TransactionLogBinder> transactionLogBinders = new List <TransactionLogBinder>();

            IEnumerable <TransactionLogEntity> tranLogs = _applicationService.TransactionLogs.OrderBy(t => t.TransactionDateTime);

            foreach (TransactionLogEntity transactionLog in tranLogs)
            {
                TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == transactionLog.TransactionPartyId);
                transactionLogBinders.Add(new TransactionLogBinder(transactionLog, transactionParty));
            }

            _transactionLogs        = new BindingList <TransactionLogBinder>(transactionLogBinders);
            dataGridView.DataSource = _transactionLogs;
        }
예제 #12
0
        public async Task <int> InsertTransactionPartyAsync(TransactionPartyEntity transactionPartyEntity)
        {
            string query = "INSERT INTO `TransactionParty`" +
                           "(`Code`,`Description`,`CreatedDateTime`) " +
                           "VALUES (@Code,@Description,@CreatedDateTime);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Code", transactionPartyEntity.Code),
                new KeyValuePair <string, object>("@Description", transactionPartyEntity.Description),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionPartyEntity.CreatedDateTime))
            };

            return(await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true));
        }
예제 #13
0
        public async Task <int> UpdateTransactionPartyAsync(TransactionPartyEntity transactionPartyEntity)
        {
            string query = "UPDATE `TransactionParty` " +
                           "SET `Code`=@Code,`Description`=@Description " +
                           "WHERE `Id` = @Id";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Code", transactionPartyEntity.Code),
                new KeyValuePair <string, object>("@Description", transactionPartyEntity.Description),
                new KeyValuePair <string, object>("@Id", transactionPartyEntity.Id)
            };

            return(await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true));
        }
        public async Task <TransactionPartyEntity> UpdateTransactionPartyAsync(TransactionPartyEntity transactionParty)
        {
            if (IsTransactionPartyCodeUsedWithoutCurrent(transactionParty.Code, transactionParty.Id))
            {
                throw new Exception("Transaction Party already used");
            }

            await _transactionPartyModel.UpdateTransactionPartyAsync(transactionParty);

            transactionParty = await _transactionPartyModel.GetTransactionPartyByIdAsync(transactionParty.Id);

            IEnumerable <TransactionPartyEntity> transactionParties = await _transactionPartyModel.GetTransactionPartiesAsync();

            TransactionParties = transactionParties;

            return(transactionParty);
        }
예제 #15
0
        private void UpdateTransactionBinders()
        {
            BindingList <TransactionBinder> transactionBinders = new BindingList <TransactionBinder>();

            IEnumerable <TransactionEntity> trans = _applicationService.Transactions.OrderByDescending(t => t.TransactionDateTime);

            foreach (TransactionEntity transaction in trans)
            {
                if (transaction.IsActive)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == transaction.TransactionPartyId);
                    transactionBinders.Add(new TransactionBinder(transaction, transactionParty));
                }
            }

            _transactionBinders     = transactionBinders;
            dataGridView.DataSource = _transactionBinders;
        }
        public async Task <TransactionPartyEntity> InsertTransactionPartyAsync(TransactionPartyEntity transactionParty)
        {
            if (IsTransactionPartyCodeUsed(transactionParty.Code))
            {
                throw new Exception("Transaction Party already used");
            }

            int tpId = await _transactionPartyModel.InsertTransactionPartyAsync(transactionParty);

            transactionParty = await _transactionPartyModel.GetTransactionPartyByIdAsync(tpId);

            IList <TransactionPartyEntity> transactionParties = TransactionParties.ToList();

            transactionParties.Add(transactionParty);
            TransactionParties = transactionParties;

            return(transactionParty);
        }
        private void UpdateTransactionBinders()
        {
            //bind single transactions to datagrid

            BindingList <TransactionBinder> transactionBinders = new BindingList <TransactionBinder>();

            IEnumerable <TransactionEntity> trans = _applicationService.Transactions.OrderByDescending(t => t.TransactionDateTime);

            foreach (TransactionEntity transaction in trans)
            {
                if (transaction.IsActive)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == transaction.TransactionPartyId);
                    transactionBinders.Add(new TransactionBinder(transaction, transactionParty));
                }
            }

            _transactionBinders     = transactionBinders;
            dataGridView.DataSource = _transactionBinders;
            dataGridView.Update();
            dataGridView.Refresh();

            //bind schduled transactions to datagrid

            BindingList <ScheduleTransactionBinder> scheduletransactionBinders = new BindingList <ScheduleTransactionBinder>();

            IEnumerable <SheduledTransactionList> schtrans = _applicationService.SheduledTransactions.OrderByDescending(t => t.NextTransactionDate);

            foreach (SheduledTransactionList schtransaction in schtrans)
            {
                if (!schtransaction.IsDelete)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == schtransaction.TransactionPartyId);
                    scheduletransactionBinders.Add(new ScheduleTransactionBinder(schtransaction, transactionParty));
                }
            }

            _scheduletransactionBinders      = scheduletransactionBinders;
            dataGridViewScheduled.DataSource = _scheduletransactionBinders;
            dataGridViewScheduled.Update();
            dataGridViewScheduled.Refresh();
        }
예제 #18
0
        private async void actionsUserControl_SaveButtonOnClick(object sender, EventArgs e)
        {
            if (IsFormDataValid())
            {
                TransactionPartyBinder bindedValue            = GetSelectedTransactionPartyBinder();
                TransactionPartyEntity transactionPartyEntity = new TransactionPartyEntity()
                {
                    Id              = bindedValue.Id,
                    Code            = codeTextBox.Text,
                    Description     = descriptionTextBox.Text,
                    CreatedDateTime = bindedValue.Id == 0 ? DateTime.Now : bindedValue.AddedDateTime
                };

                if (transactionPartyEntity.Id == 0)
                {
                    await _applicationService.InsertTransactionPartyAsync(transactionPartyEntity);
                }
                else
                {
                    await _applicationService.UpdateTransactionPartyAsync(transactionPartyEntity);
                }
                SetSelectedTransactionPartyBinder();
            }
        }
예제 #19
0
        private void UpdateTransactionBinders(DateTime dtFrom, DateTime dtTo)
        {
            BindingList <TransactionBinder> transactionBinders = new BindingList <TransactionBinder>();

            IEnumerable <TransactionEntity> trans = _applicationService.Transactions.Where(x => x.TransactionDateTime >= dtFrom && x.TransactionDateTime <= dtTo && x.IsActive == true).OrderByDescending(t => t.TransactionDateTime);

            foreach (TransactionEntity transaction in trans)
            {
                if (transaction.IsActive)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == transaction.TransactionPartyId);
                    transactionBinders.Add(new TransactionBinder(transaction, transactionParty));
                }
            }

            _transactionBinders     = transactionBinders;
            dataGridView.DataSource = _transactionBinders;

            //bind schduled transactions to datagrid

            BindingList <ScheduleTransactionBinder> scheduletransactionBinders = new BindingList <ScheduleTransactionBinder>();

            IEnumerable <SheduledTransactionList> schtrans = _applicationService.SheduledTransactions.Where(x => x.NextTransactionDate >= dtFrom && x.NextTransactionDate <= dtTo && x.IsDelete == false).OrderByDescending(t => t.NextTransactionDate);

            foreach (SheduledTransactionList schtransaction in schtrans)
            {
                if (schtransaction.IsActive)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == schtransaction.TransactionPartyId);
                    scheduletransactionBinders.Add(new ScheduleTransactionBinder(schtransaction, transactionParty));
                }
            }

            _scheduletransactionBinders      = scheduletransactionBinders;
            dataGridViewScheduled.DataSource = _scheduletransactionBinders;
        }
        private void UpdateTransactionBinders(DateTime dtFrom, DateTime dtTo)
        {
            BindingList <TransactionBinder>       transactionBinders = new BindingList <TransactionBinder>();
            BindingList <CommonTransactionBinder> transdataobj       = new BindingList <CommonTransactionBinder>();
            BindingList <CommmonTaskBinder>       taskdataobj        = new BindingList <CommmonTaskBinder>();

            IEnumerable <TransactionEntity> trans = _applicationService.Transactions.Where(x => x.TransactionDateTime >= dtFrom.AddDays(-1) && x.TransactionDateTime <= dtTo.AddDays(1)).OrderByDescending(t => t.TransactionDateTime);

            foreach (TransactionEntity transaction in trans)
            {
                if (transaction.IsActive)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == transaction.TransactionPartyId);
                    transactionBinders.Add(new TransactionBinder(transaction, transactionParty));
                }
            }
            foreach (TransactionBinder transaction in transactionBinders)
            {
                CommonTransactionBinder obj = new CommonTransactionBinder();
                obj.Amount               = transaction.Amount;
                obj.ReferenceNumber      = transaction.ReferenceNumber;
                obj.TransactionDateTime  = transaction.TransactionDateTime;
                obj.TransactionPartyCode = transaction.TransactionPartyCode;
                obj.Type = transaction.Type;
                transdataobj.Add(obj);
            }
            // schduled transactions to datagrid

            BindingList <ScheduleTransactionBinder> scheduletransactionBinders = new BindingList <ScheduleTransactionBinder>();

            IEnumerable <SheduledTransactionList> schtrans = _applicationService.SheduledTransactions.Where(x => x.NextTransactionDate >= dtFrom.AddDays(-1) && x.NextTransactionDate <= dtTo.AddDays(1) && x.IsDelete == false).OrderByDescending(t => t.NextTransactionDate);

            foreach (SheduledTransactionList schtransaction in schtrans)
            {
                if (schtransaction.IsActive)
                {
                    TransactionPartyEntity transactionParty = _applicationService.TransactionParties.First(tp => tp.Id == schtransaction.TransactionPartyId);
                    scheduletransactionBinders.Add(new ScheduleTransactionBinder(schtransaction, transactionParty));
                }
            }

            foreach (ScheduleTransactionBinder transaction in scheduletransactionBinders)
            {
                CommonTransactionBinder obj = new CommonTransactionBinder();
                obj.Amount               = transaction.Amount;
                obj.ReferenceNumber      = transaction.ReferenceNumber;
                obj.TransactionDateTime  = transaction.TransactionDateTime;
                obj.TransactionPartyCode = transaction.TransactionPartyCode;
                obj.Type = transaction.Type;
                transdataobj.Add(obj);
            }
            dataGridView.DataSource = transdataobj;

            // single task to datagrid

            BindingList <OneTImeTaskBinder> taskBinders = new BindingList <OneTImeTaskBinder>();
            IEnumerable <OneTimeTasks>      task        = _applicationService.OneTimeTasks.Where(x => x.Effectivedate >= dtFrom && x.Effectivedate <= dtTo).OrderByDescending(t => t.Effectivedate);

            foreach (OneTimeTasks itemtask in task)
            {
                if (!itemtask.IsDelete)
                {
                    taskBinders.Add(new OneTImeTaskBinder(itemtask));
                }
            }

            foreach (OneTImeTaskBinder objtask in taskBinders)
            {
                CommmonTaskBinder obj = new CommmonTaskBinder();
                obj.Duration        = objtask.Duration;
                obj.Comments        = objtask.Comments;
                obj.Effectivedate   = objtask.Effectivedate;
                obj.ReferenceNumber = objtask.ReferenceNumber;
                obj.Type            = objtask.Task_Type;
                obj.Task_Type       = objtask.Type;
                taskdataobj.Add(obj);
            }
            // schduled task to datagrid

            BindingList <ScheduleTaskBinder> scheduletaskBinders = new BindingList <ScheduleTaskBinder>();

            IEnumerable <ScheduledTasks> schtask = _applicationService.ScheduledTasks.Where(x => x.Effectivedate >= dtFrom && x.Effectivedate <= dtTo && x.IsDelete == false).OrderByDescending(t => t.Effectivedate);

            foreach (ScheduledTasks itemtask in schtask)
            {
                if (itemtask.IsActive)
                {
                    scheduletaskBinders.Add(new ScheduleTaskBinder(itemtask));
                }
            }
            foreach (ScheduleTaskBinder objtask in scheduletaskBinders)
            {
                CommmonTaskBinder obj = new CommmonTaskBinder();
                obj.Duration        = objtask.Duration;
                obj.Comments        = objtask.Comments;
                obj.Effectivedate   = objtask.Effectivedate;
                obj.ReferenceNumber = objtask.ReferenceNumber;
                obj.Type            = objtask.Task_Type;
                obj.Task_Type       = objtask.Type;
                taskdataobj.Add(obj);
            }

            dataGridViewTask.DataSource = taskdataobj;
        }
 public TransactionPartyBinder(TransactionPartyEntity transactionPartyEntity)
 {
     Id           = transactionPartyEntity.Id;
     DisplayValue = $"{transactionPartyEntity.Code} - {transactionPartyEntity.Description}";
 }