Пример #1
0
        public DataTableSuccessMessage LoanAccounts()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string name          = HttpContext.Current.Request.Form["searchName"];
                string lduration     = HttpContext.Current.Request.Form["searchLDuration"];
                string ptype         = HttpContext.Current.Request.Form["searchPType"];
                string searchAddress = HttpContext.Current.Request.Form["searchBranch"];
                var    loan          =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ILoanAccountDb>()
                    .PagedSearchByNameAndAcctNumber(name, lduration, ptype, searchAddress, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    loan.Select(
                        y =>
                        new
                {
                    ID          = y.Id,
                    ACctName    = y.AccountName,
                    ACctNo      = y.AccountNumber,
                    AcctType    = Enum.GetName(typeof(AccountType), y.LinkedAccount.AccountType),
                    AMnt        = y.LoanAmount,
                    Duration    = y.LoanDuration,
                    Interest    = y.LoanInterest,
                    BAlance     = y.Balance,
                    StartDate   = y.LoanStartDate,
                    DueDate     = y.LoanDueDate,
                    PaymentType = Enum.GetName(typeof(PaymentSchedule), y.PaymentSchedule),
                    NoOFDays    = y.NumberOfDays,
                    Status      = Enum.GetName(typeof(LoanStatus), y.LoanStatus)
                }).ToArray();
                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #2
0
        public DataTableSuccessMessage TellerPosting()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string   searchAccountName     = HttpContext.Current.Request.Form["searchCustomerAccountName"];
                string   searchTillAccountName = HttpContext.Current.Request.Form["searchTillAccountName"];
                string   searchAccountNumber   = HttpContext.Current.Request.Form["searchAccountNumber"];
                DateTime searchDate            = Convert.ToDateTime(HttpContext.Current.Request.Form["searchDate"]);
                var      tellerPosting         =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ITellerPostingDb>()
                    .PagedSearchByAccountNameAndAccountNumber(searchAccountName, searchTillAccountName, searchAccountNumber, searchDate, start, length,
                                                              out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    tellerPosting.Select(
                        y =>
                        new
                {
                    ID = y.Id,
                    TRansactionDate       = y.TransactionDate,
                    CustomerAccountName   = y.CustomerAccounts.AccountName,
                    CustomerAccountNumber = y.CustomerAccounts.AccountNumber,
                    TillAccountName       = y.GlAccount.GlAccountName,
                    PostingType           = Enum.GetName(typeof(PostingType), y.PostingType),
                    NArration             = y.Narration,
                    AMount = y.Amount
                }).ToArray();

                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #3
0
        public DataTableSuccessMessage GlPosting()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string searchGlName = HttpContext.Current.Request.Form["searchGLName"];
                string searchCode   = HttpContext.Current.Request.Form["searchGLCode"];
                ////string searchDate = HttpContext.Current.Request.Form["searchDate"];
                var glPosting =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlPostingDb>()
                    .PagedSearchByGLNameAndCode(searchGlName, searchCode, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    glPosting.Select(
                        y =>
                        new
                {
                    ID                = y.Id,
                    ActualDate        = y.DateAdded,
                    TRansactionDate   = y.TransactionDate,
                    DebitAccountName  = y.GlAccountToDebit.GlAccountName,
                    DebitAccountCode  = y.GlAccountToDebit.GlAccountCodes,
                    CreditAccountName = y.GlAccountToCredit.GlAccountName,
                    CreditAccountCode = y.GlAccountToCredit.GlAccountCodes,
                    DEbitNarration    = y.DebitNarration,
                    CReditNarration   = y.CreditNarration,
                    AMount            = y.Amount
                }).ToArray();

                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #4
0
        public DataTableSuccessMessage GlAccount()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string searchGlName   = HttpContext.Current.Request.Form["searchGLName"];
                string searchGlCode   = HttpContext.Current.Request.Form["searchGLCode"];
                string searchGlBranch = HttpContext.Current.Request.Form["searchGLBranch"];
                string searchCategory = HttpContext.Current.Request.Form["searchCategory"];
                var    glAccount      =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlAccountDb>()
                    .PagedSearchByGLNameAndCategory(searchGlName, searchGlCode, searchGlBranch, searchCategory, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    glAccount.Select(
                        y =>
                        new
                {
                    ID          = y.Id,
                    AccountName = y.GlAccountName,
                    AccountCode = y.GlAccountCodes,
                    Category    = y.GlCategory.GlCategoryName,
                    Branch      = y.Branch.BranchName,
                    BAlance     = y.Balance,
                    Edit        =
                        @"<button type='button' onclick=""edit('" + y.Id +
                        @"');"" class=""btn btn-info btn-xs"">Edit</button>"
                }).ToArray();

                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #5
0
        public DataTableSuccessMessage CustomerAccounts()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string name          = HttpContext.Current.Request.Form["searchName"];
                string searchAddress = HttpContext.Current.Request.Form["searchAddress"];
                var    customers     =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ICustomerAccountsDb>()
                    .PagedSearchByFirstNameAndLastName(name, searchAddress, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    customers.Select(
                        y =>
                        new
                {
                    ID          = y.Id,
                    FIRSTName   = y.FirstName,
                    LASTName    = y.LastName,
                    OTHERNames  = y.OtherNames,
                    EMail       = y.Email,
                    GENder      = y.Gender.ToString(),
                    AddAccounts =
                        @"<button type='button' onclick=""Redirect('" + y.Id +
                        @"');"" class=""btn btn-info btn-xs"">Add Account</button>"
                }).ToArray();
                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #6
0
        public DataTableSuccessMessage Users()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string searchfName  = HttpContext.Current.Request.Form["searchFName"];
                string searchlName  = HttpContext.Current.Request.Form["searchLName"];
                string searchbranch = HttpContext.Current.Request.Form["searchBranch"];
                var    users        =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IUserDb>()
                    .PagedSearchByNameAndBranch(searchfName, searchlName, searchbranch, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    users.Select(
                        y =>
                        new
                {
                    ID          = y.Id,
                    Fname       = y.FirstName,
                    LName       = y.LastName,
                    URole       = y.UserRole.ToString(),
                    BRanch      = y.Branch.BranchName,
                    ViewDetails =
                        @"<button type='button' onclick=""viewDetails('" + y.Id +
                        @"');"" class=""btn btn-info btn-xs"">View Details</button>"
                }).ToArray();
                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #7
0
        public DataTableSuccessMessage OnUsWithdrawal()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string searchName     = HttpContext.Current.Request.Form["searchName"];
                string searchId       = HttpContext.Current.Request.Form["searchName"];
                string searchLocation = HttpContext.Current.Request.Form["searchCode"];
                var    terminals      =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IOnUsWithdrawalDb>()
                    .PagedSearchByName_IDAndLocation(searchName, searchId, searchLocation, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    terminals.Select(
                        y =>
                        new
                {
                    ID           = y.Id,
                    TerminalName = y.Name,
                    TerminaLID   = y.TerminalID,
                    ViewDetails  =
                        @"<button type='button' onclick=""viewDetails('" + y.Id +
                        @"');"" class=""btn btn-info btn-xs"">View Details</button>"
                }).ToArray();
                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #8
0
        public DataTableSuccessMessage GlCategory()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string name       = HttpContext.Current.Request.Form["searchName"];
                string glcategory = HttpContext.Current.Request.Form["searchGlAcctCategory"];
                var    glCategory =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlCategoryDb>()
                    .PagedSearchByNameAndGlAcctCategory(name, glcategory, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                result.data            =
                    glCategory.Select(
                        y =>
                        new
                {
                    ID                  = y.Id,
                    GLCATEGORYName      = y.GlCategoryName,
                    MAINACCOUNTCategory = y.MainAccountCategory.ToString(),
                    ViewDetails         =
                        @"<button type='button' onclick=""viewDetails('" + y.Id +
                        @"');"" class=""btn btn-info btn-xs"">View Details</button>"
                }).ToArray();
                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }
Пример #9
0
        //public DataTableSuccessMessage CustomerLoanAccount()
        //{
        //    try
        //    {
        //        int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
        //        int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
        //        int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
        //        int total;
        //        //string search = HttpContext.Current.Request.Form["search[value]"];
        //        string searchAccountNumber = HttpContext.Current.Request.Form["searchAccountNumber"];
        //        string searchAccountName = HttpContext.Current.Request.Form["searchAccountName"];
        //        var customersAccounts =
        //            Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<ICustomerAccountDb>()
        //                .PagedSearchByAccountNameAndAccountNumber(searchAccountName, searchAccountNumber, start, length,
        //                    out total);
        //        //add button

        //        var result = new DataTableSuccessMessage();
        //        result.draw = draw;
        //        result.recordsFiltered = customersAccounts.Count;
        //        result.recordsTotal = total;
        //        result.data =
        //            customersAccounts.Select(
        //                y =>
        //                    new
        //                    {
        //                        ID = y.Id,
        //                        AccountNumber = y.AccountNumber,
        //                        AcccountName = y.CustomerAccountName,
        //                        AccountType = y.AccountType.ToString(),
        //                        Branch = y.Branch.Name,
        //                        Balance = y.Balance,
        //                        LinkToLoanAccount =
        //                            @"<button type='button' onclick=""linkAccount('" + y.Id +
        //                            @"');"" class=""btn btn-info btn-xs"">Link Account to Loan</button>"
        //                    }).ToArray();
        //        return result;
        //    }
        //    catch (Exception ex)
        //    {
        //        return new DataTableSuccessMessage()
        //        {
        //            error = ex.Message
        //        };
        //    }
        //}

        public DataTableSuccessMessage CustomerAccountForView()
        {
            try
            {
                int draw = Convert.ToInt32(HttpContext.Current.Request.Form["draw"]);
                int start = Convert.ToInt32(HttpContext.Current.Request.Form["start"]);
                int length = Convert.ToInt32(HttpContext.Current.Request.Form["length"]);
                int total, querytotal;
                //string search = HttpContext.Current.Request.Form["search[value]"];
                string name   = HttpContext.Current.Request.Form["searchName"];
                string type   = HttpContext.Current.Request.Form["searchType"];
                string branch = HttpContext.Current.Request.Form["searchBranch"];
                string searchAccountNumber = HttpContext.Current.Request.Form["searchAddress"];
                var    customerAccount     =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ICustomerAccountsDb>()
                    .PagedSearchByNameAndAccountNumber(name, type, branch, searchAccountNumber, start, length, out querytotal, out total);
                //add button

                var result = new DataTableSuccessMessage();
                result.draw            = draw;
                result.recordsFiltered = querytotal;
                result.recordsTotal    = total;
                for (int i = 0; i < customerAccount.Count; i++)
                {
                    if (customerAccount[i].IsClosed)
                    {
                        result.data =
                            customerAccount.Select(
                                y =>
                                new
                        {
                            ID            = y.Id,
                            ACCountNumber = y.AccountNumber,
                            ACCountName   = y.AccountName,
                            ACCountType   = y.AccountType.ToString(),
                            BAlance       = y.Balance,
                            ViewDetails   =
                                @"<button type='button' onclick=""viewDetails('" + y.Id +
                                @"');"" class=""btn btn-info btn-xs"">View Details</button>",
                            CloseAccount = y.IsClosed ?
                                           @"<button type='button' id ='close' disabled='disabled' class =""btn btn-danger btn-xs"">Closed</button>"
                                        : @"<button type='button' onclick=""closeAccount('" + y.Id +
                                           @"');"" class=""status-" +
                                           y.Id + @" btn btn-danger btn-xs"">Close Account</button>",
                            OpenAccount = y.IsClosed == false ?
                                          @"<button type='button' disabled='disabled' class =""btn btn-info btn-xs"">Open</button>"
                                   : @"<button type='button' onclick=""openAccount('" + y.Id +
                                          @"');"" class=""status-" +
                                          y.Id + @" btn btn-info btn-xs"">Open Account</button>"

                                          //@"<button type='button' onclick=""closeAccount('" + y.Id +
                                          //@"');"" class=""status-" +
                                          //y.Id + @" btn btn-danger btn-xs"">Closed</button>"
                        }).ToArray();
                    }
                    // $('.status-' + id).html('Closed').addClass('btn-danger').removeClass('btn-info');
                    else
                    {
                        result.data =
                            customerAccount.Select(
                                y =>
                                new
                        {
                            ID            = y.Id,
                            ACCountNumber = y.AccountNumber,
                            ACCountName   = y.AccountName,
                            ACCountType   = y.AccountType.ToString(),
                            BAlance       = y.Balance,
                            ViewDetails   =
                                @"<button type='button' onclick=""viewDetails('" + y.Id +
                                @"');"" class=""btn btn-info btn-xs"">View Details</button>",
                            CloseAccount = y.IsClosed ?
                                           @"<button type='button' disabled='disabled' class =""btn btn-danger btn-xs"">Closed</button>"
                                        : @"<button type='button' onclick=""closeAccount('" + y.Id +
                                           @"');"" class=""status-" +
                                           y.Id + @" btn btn-danger btn-xs"">Close Account</button>",

                            OpenAccount = y.IsClosed == false ?
                                          @"<button type='button' disabled='disabled' class =""btn btn-info btn-xs"">Open</button>"
                                   : @"<button type='button' onclick=""openAccount('" + y.Id +
                                          @"');"" class=""status-" +
                                          y.Id + @" btn btn-info btn-xs"">Open Account</button>"

                                          //CloseAccount =
                                          //     @"<button type='button' onclick=""closeAccount('" + y.Id +
                                          //     @"');"" class=""status-" +
                                          //     y.Id + @" btn btn-danger btn-xs"">Close Account</button>"
                        }).ToArray();
                    }
                }


                return(result);
            }
            catch (Exception ex)
            {
                return(new DataTableSuccessMessage()
                {
                    error = ex.Message
                });
            }
        }