Ejemplo n.º 1
0
 private void LoadPaymentModes()
 {
     try
     {
         var paymentModes = ServiceProvider.Instance().GetPaymentModeServices().GetPaymentModes();
         if (paymentModes == null || paymentModes.Any())
         {
             ddlPaymentMode.DataSource = new List <PaymentMode>();
             ddlPaymentMode.DataBind();
             ddlPaymentMode.Items.Insert(0, new ListItem(" -- List is empty -- ", "0"));
             ddlPaymentMode.SelectedIndex = 0;
         }
         ddlPaymentMode.DataSource     = paymentModes;
         ddlPaymentMode.DataValueField = "PaymentModeId";
         ddlPaymentMode.DataTextField  = "Name";
         ddlPaymentMode.DataBind();
         ddlPaymentMode.Items.Insert(0, new ListItem(" -- Select Payment Mode -- ", "0"));
         ddlPaymentMode.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         ConfirmAlertBox1.ShowMessage("Payment Modes could not be loaded", ConfirmAlertBox.PopupMessageType.Error);
     }
 }
        protected void DgUserInitiatedTransactionsItemCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                dgUserInitiatedTransactions.SelectedIndex = e.Item.ItemIndex;

                long id = (DataCheck.IsNumeric(dgUserInitiatedTransactions.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgUserInitiatedTransactions.DataKeys[e.Item.ItemIndex].ToString()) : 0;

                if (id < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                var transaction = ServiceProvider.Instance().GetExpenseTransactionServices().GetExpenseTransaction(id);

                if (transaction == null || transaction.ExpenseTransactionId < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                LoadTransactionItems(transaction);
            }
            catch
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin. Please try again soon or contact your site Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
Ejemplo n.º 3
0
        private bool LoadDepartments()
        {
            try
            {
                dgDepartments.DataSource = new List <Department>();
                dgDepartments.DataBind();

                var departmentsList = ServiceProvider.Instance().GetDepartmentServices().GetOrderedDepartments();

                if (departmentsList == null)
                {
                    ConfirmAlertBox1.ShowMessage("Department list is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    return(false);
                }

                if (!departmentsList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Department list is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    return(false);
                }

                dgDepartments.DataSource = departmentsList;
                dgDepartments.DataBind();
                Session["_departmentsList"] = departmentsList;
                return(true);
            }
            catch (Exception ex)
            {
                ErrorDisplayProcessDepartment.ShowError("An unknown error was encountered. Please try again soon or contact the Admin.");
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                throw;
            }
        }
Ejemplo n.º 4
0
        private bool LoadExpenseCategories()
        {
            try
            {
                var expenseCategoriesList = ServiceProvider.Instance().GetExpenseCategoryServices().GetOrderedExpenseCategories();

                if (expenseCategoriesList == null)
                {
                    ConfirmAlertBox1.ShowMessage("Expense Category list is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    dgExpCatCollections.DataSource = new List <ExpenseCategory>();
                    dgExpCatCollections.DataBind();
                    return(false);
                }

                if (!expenseCategoriesList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Expense Category list is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    dgExpCatCollections.DataSource = new List <ExpenseCategory>();
                    dgExpCatCollections.DataBind();
                    return(false);
                }
                dgExpCatCollections.DataSource = expenseCategoriesList;
                dgExpCatCollections.DataBind();
                Session["_expenseCategoriesList"] = expenseCategoriesList;
                return(true);
            }
            catch (Exception ex)
            {
                ErrorDisplayProcessExpenseCategory.ShowError("An unknown error was encountered. Please try again soon or contact the Admin.");
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                throw;
            }
        }
        private void SetTransactionsStyle()
        {
            try
            {
                if (dgUserInitiatedTransactions.Items.Count > 0)
                {
                    for (var i = 0; i < dgUserInitiatedTransactions.Items.Count; i++)
                    {
                        var approvedLabel = ((Label)dgUserInitiatedTransactions.Items[i].FindControl("lblUserTransactionStatus"));

                        //var approvedDeleteImage = ((ImageButton)dgUserInitiatedTransactions.Items[i].FindControl("imgDelete"));

                        if (approvedLabel.Text == "Approved")
                        {
                            approvedLabel.Style.Add("color", "darkcyan");
                            approvedLabel.Style.Add("font-weight", "bold");
                        }
                    }
                }
            }
            catch
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
        protected void BtnMultiVoucherDateFilterClick(object sender, EventArgs e)
        {
            var option = int.Parse(ddlMultiVoucherFilterOption.SelectedValue);

            if (option < 0)
            {
                ConfirmAlertBox1.ShowMessage("Please select a filter Status.", ConfirmAlertBox.PopupMessageType.Error);
                return;
            }

            var startDate = txtMultiVoucherStartDate.Text.Trim();
            var endDate   = txtMultiVoucherEndDate.Text.Trim();

            if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(endDate))
            {
                ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error);
                return;
            }

            if (!ValidateVouchersByDateArguments(startDate, endDate))
            {
                return;
            }

            if (!GetTVouchersByDateRange(startDate, endDate))
            {
                dgVouchers.DataSource = new List <ExpenseTransactionPaymentHistory>();
                dgVouchers.DataBind();
            }
        }
Ejemplo n.º 7
0
        private bool LoadUnits()
        {
            try
            {
                dgUnits.DataSource = new List <xPlug.BusinessObject.Unit>();
                dgUnits.DataBind();

                var unitList = ServiceProvider.Instance().GetUnitServices().GetAllOrderedUnits();

                if (unitList == null || !unitList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Unit list is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    return(false);
                }

                dgUnits.DataSource = unitList;
                dgUnits.DataBind();
                return(true);
            }
            catch (Exception ex)
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                throw;
            }
        }
        private void LoadFilteredExpenseItems()
        {
            try
            {
                if (int.Parse(ddlAccountsHeads.SelectedValue) > 0)
                {
                    var filteredExpenseItemsList = ServiceProvider.Instance().GetExpenseItemServices().GetOrderedExpenseItemsByAccountsHeadId(int.Parse(ddlAccountsHeads.SelectedValue));

                    if (!filteredExpenseItemsList.Any())
                    {
                        ConfirmAlertBox1.ShowMessage("No record found.", ConfirmAlertBox.PopupMessageType.Error);
                        dgExpenseItem.DataSource = new List <ExpenseItem>();
                        dgExpenseItem.DataBind();
                        return;
                    }

                    Session["_filteredExpenseItemsList"] = null;
                    Session["_filteredExpenseItemsList"] = filteredExpenseItemsList;
                    Limit = int.Parse(ddlLimit.SelectedValue);
                    FillRepeater <ExpenseItem>(dgExpenseItem, "_filteredExpenseItemsList", Navigation.None, Limit, LoadMethod);
                }
            }
            catch (Exception)
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
Ejemplo n.º 9
0
        private void LoadBeneficiaryType()
        {
            try
            {
                var beneficiaryTypes =
                    ServiceProvider.Instance().GetBeneficiaryTypeServices().GetActiveBeneficiaryTypes();
                if (beneficiaryTypes == null || !beneficiaryTypes.Any())
                {
                    ddlBeneficiaryType.DataSource = new List <BeneficiaryType>();
                    ddlBeneficiaryType.DataBind();
                    ddlBeneficiaryType.Items.Insert(0, new ListItem(" -- List is empty -- ", "0"));
                    ddlBeneficiaryType.SelectedIndex = 0;
                }

                ddlBeneficiaryType.DataSource     = beneficiaryTypes;
                ddlBeneficiaryType.DataValueField = "BeneficiaryTypeId";
                ddlBeneficiaryType.DataTextField  = "Name";
                ddlBeneficiaryType.DataBind();
                ddlBeneficiaryType.Items.Insert(0, new ListItem(" -- Select Beneficiary Type -- ", "0"));
                ddlBeneficiaryType.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please contact the Administrator", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
        protected void BtnDateFilterClick(object sender, EventArgs e)
        {
            var option = int.Parse(ddlFilterOption.SelectedValue);

            if (option < 0)
            {
                ConfirmAlertBox1.ShowMessage("Please select a filter Status.", ConfirmAlertBox.PopupMessageType.Error);
                return;
            }

            if (string.IsNullOrEmpty(txtStart.Text.Trim()) || string.IsNullOrEmpty(txtEndDate.Text.Trim()))
            {
                ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error);
                return;
            }

            if (!ValidateDateControls())
            {
                return;
            }

            if (!GetTransactionsByDate())
            {
                return;
            }
            SetTransactionsStyle();
        }
        private void LoadAccountsHeads()
        {
            try
            {
                var accountsHeadsList = ServiceProvider.Instance().GetAccountsHeadServices().GetActiveOrderedAccountsHeads();

                if (!accountsHeadsList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Accounts Heads list is empty.", ConfirmAlertBox.PopupMessageType.Error);
                    ddlAccountsHeads.DataSource = new List <AccountsHead>();
                    ddlAccountsHeads.DataBind();
                    ddlAccountsHeads.Items.Insert(0, new ListItem("--List is empty--", "0"));
                    ddlAccountsHeads.SelectedIndex = 0;
                    return;
                }

                ddlAccountsHeads.DataSource     = accountsHeadsList;
                ddlAccountsHeads.DataValueField = "AccountsHeadId";
                ddlAccountsHeads.DataTextField  = "Title";
                ddlAccountsHeads.DataBind();
                ddlAccountsHeads.Items.Insert(0, new ListItem("---Select an Accounts Head---", "0"));
                ddlAccountsHeads.SelectedIndex = 0;
            }

            catch (Exception)
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
Ejemplo n.º 12
0
        protected void DdlBeneficiariesIndexChanged(object sender, EventArgs e)
        {
            try
            {
                btnUpdatePayment.CommandArgument = "0";
                if (int.Parse(ddlBeneficiaries.SelectedValue) < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Please select a Beneficiary", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }
                LoadPaymentModes();
                LoadBank();
                if (!LoadTransactionPayments())
                {
                    return;
                }

                divBeneficiary.Visible  = false;
                divPaymentTrack.Visible = true;
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
Ejemplo n.º 13
0
 private void UpdateWithChqueOnly(ExpenseTransactionPayment transactionPayment)
 {
     try
     {
         var expenseTransaction = transactionPayment.ExpenseTransaction;
         txtChequeTotalPayableAmount.Text = expenseTransaction.TotalApprovedAmount.ToString(CultureInfo.InvariantCulture);
         txtOldChequeBalance.Text         = transactionPayment.Balance.ToString(CultureInfo.InvariantCulture);
         lgChequeUpdate.InnerText         = transactionPayment.ExpenseTransaction.ExpenseTitle;
         btnSubmit.Text                   = "Update";
         btnSubmit.CommandArgument        = "2";
         btnUpdatePayment.CommandArgument = "2";
         ErrorDispChequePayment.ClearError();
         txtChequeAmountToPay.Value              = String.Empty;
         ddChequeBank.SelectedIndex              = 0;
         txtUpdatePaymentComment.Text            = string.Empty;
         txtChequNo.Value                        = String.Empty;
         mpeSelectDateRangePopup.CancelControlID = btnChequeClose.ID;
         mpeSelectDateRangePopup.PopupControlID  = dvChequePayment.ID;
         mpeSelectDateRangePopup.Show();
         Session["_expenseTransactionPayment"] = transactionPayment;
         ErrorDispChequePayment.ShowSuccess("Transaction Payment Information was successfully updated. \nPlease kindly continue the update by providing the needed cheque information, <b>OR</b> click the <b>Close</b> button to make updates later.");
     }
     catch (Exception)
     {
         ConfirmAlertBox1.ShowMessage("Transaction cash Payment Information was successfully updated but an error was encountered while trying to initialize the cheque payment process. \nPlease try again or contact the Administrator.", ConfirmAlertBox.PopupMessageType.Error);
     }
 }
Ejemplo n.º 14
0
 private void LoadBank()
 {
     try
     {
         var banks = ServiceProvider.Instance().GetBankServices().GetBanks();
         if (banks == null || !banks.Any())
         {
             ddChequeBank.DataSource = new List <Bank>();
             ddChequeBank.DataBind();
             ddChequeBank.Items.Insert(0, new ListItem("-- List is empty --", "0"));
             ddChequeBank.SelectedIndex = 0;
             return;
         }
         ddChequeBank.DataSource     = banks;
         ddChequeBank.DataTextField  = "BankName";
         ddChequeBank.DataValueField = "BankId";
         ddChequeBank.DataBind();
         ddChequeBank.Items.Insert(0, new ListItem("-- Select Bank --", "0"));
         ddChequeBank.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         ConfirmAlertBox1.ShowMessage("Bank List could not be retrieved. Please try again soon or contact the Administrator.", ConfirmAlertBox.PopupMessageType.Error);
     }
 }
Ejemplo n.º 15
0
        private void GetCurrentTransactionPayments()
        {
            try
            {
                dgAllTransactionPayments.DataSource = new List <ExpenseTransactionPayment>();
                dgAllTransactionPayments.DataBind();

                var transactionPaymentsByDate = ServiceProvider.Instance().GetExpenseTransactionPaymentServices().GetCurrentTransactionPayments(DateMap.GetLocalDate());

                if (!transactionPaymentsByDate.Any())
                {
                    return;
                }

                Session["_expTransactionPaymentReportList"] = null;
                Session["_expTransactionPaymentReportList"] = transactionPaymentsByDate;

                Limit = int.Parse(ddlLimit.SelectedValue);
                FillRepeater <ExpenseTransactionPayment>(dgAllTransactionPayments, "_expTransactionPaymentReportList", Navigation.None, Limit, LoadMethod);
                LoadTransactionPaymentFooter();
                SetTransactionStyle();
            }
            catch (Exception ex)
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
            }
        }
Ejemplo n.º 16
0
        private bool LoadBeneficiaries()
        {
            try
            {
                var beneficiariesList = ServiceProvider.Instance().GetBeneficiaryServices().GetAllBeneficiaries();

                if (beneficiariesList == null || !beneficiariesList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Beneficiary list is empty", ConfirmAlertBox.PopupMessageType.Error);
                    dgBeneficiaries.DataSource = new List <Beneficiary>();
                    dgBeneficiaries.DataBind();
                    return(false);
                }

                dgBeneficiaries.DataSource = beneficiariesList;
                dgBeneficiaries.DataBind();
                return(true);
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please contact the Administrator.", ConfirmAlertBox.PopupMessageType.Error);
                return(false);
            }
        }
Ejemplo n.º 17
0
        private void SetTransactionStyle()
        {
            try
            {
                if (dgAllTransactionPayments.Items.Count > 0)
                {
                    for (var i = 0; i < dgAllTransactionPayments.Items.Count; i++)
                    {
                        var approvedLabel   = ((Label)dgAllTransactionPayments.Items[i].FindControl("lblTransactionStatus"));
                        var linkViewHistory = ((LinkButton)dgAllTransactionPayments.Items[i].FindControl("lblViewHistory"));
                        if (approvedLabel.Text == "Completed")
                        {
                            approvedLabel.Style.Add("color", "darkcyan");
                            approvedLabel.Style.Add("font-weight", "bold");
                        }

                        if (approvedLabel.Text == "Uncompleted")
                        {
                            approvedLabel.Style.Add("color", "maroon");
                            approvedLabel.Style.Add("font-weight", "bold");
                        }

                        linkViewHistory.Style.Add("color", "rgba(35, 6, 35, 0.65)");
                    }
                }
            }
            catch
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
        private void LoadTransactions()
        {
            dgUserInitiatedTransactions.DataSource = new List <ExpenseTransaction>();
            dgUserInitiatedTransactions.DataBind();
            List <ExpenseTransaction> expTransactionList;

            if (HttpContext.Current.User.IsInRole("PortalAdmin"))
            {
                expTransactionList = ServiceProvider.Instance().GetExpenseTransactionServices().GetCurrentApprovedOrVoidedExpenseTransactions();
            }
            else
            {
                var userId = new PortalServiceManager().GetUserIdByUsername(HttpContext.Current.User.Identity.Name);
                if (userId < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Your user details could not be retrieved.", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }
                expTransactionList = ServiceProvider.Instance().GetExpenseTransactionServices().GetPortalUserCurrentApprovedOrVoidedExpenseTransactions(userId);
            }

            if (expTransactionList == null || !expTransactionList.Any())
            {
                return;
            }

            Session["_approvedOrVoidedExpTransactionList"] = null;
            Session["_approvedOrVoidedExpTransactionList"] = expTransactionList;

            Limit = int.Parse(ddlLimit.SelectedValue);
            FillRepeater <ExpenseTransaction>(dgUserInitiatedTransactions, "_approvedOrVoidedExpTransactionList", Navigation.None, Limit, LoadMethod);
            SetTransactionsStyle();
        }
Ejemplo n.º 19
0
        private void LoadTransactionTypes()
        {
            try
            {
                var transactionTypesList = ServiceProvider.Instance().GetExpenseTypeServices().GetActiveExpenseTypes();

                if (!transactionTypesList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("The Expense Types List is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                ddlExpenseType.DataSource     = transactionTypesList;
                ddlExpenseType.DataTextField  = "Name";
                ddlExpenseType.DataValueField = "ExpenseTypeId";
                ddlExpenseType.DataBind();
                ddlExpenseType.Items.Insert(0, new ListItem("--Select Expense Type--", "0"));
                ddlExpenseType.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
        private void LoadExpenseCategories()
        {
            try
            {
                var filteredExpenseCategoriesList = ServiceProvider.Instance().GetExpenseCategoryServices().GetAllActiveExpenseCategories();

                if (!filteredExpenseCategoriesList.Any())
                {
                    ddlExpenseCategory.DataSource = new List <AccountsHead>();
                    ddlExpenseCategory.DataBind();
                    ddlExpenseCategory.Items.Insert(0, new ListItem("--List is empty--", "0"));
                    ddlExpenseCategory.SelectedIndex = 0;
                    return;
                }

                ddlExpenseCategory.DataSource     = filteredExpenseCategoriesList;
                ddlExpenseCategory.DataValueField = "ExpenseCategoryId";
                ddlExpenseCategory.DataTextField  = "Title";
                ddlExpenseCategory.DataBind();
                ddlExpenseCategory.Items.Insert(0, new ListItem("---Select an Expense Category---", "0"));
                ddlExpenseCategory.SelectedIndex = 0;
            }
            catch
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
Ejemplo n.º 21
0
        private bool LoadDepartments()
        {
            try
            {
                var filteredDepartmentsList = ServiceProvider.Instance().GetDepartmentServices().GetActiveOrderedDepartments();

                if (filteredDepartmentsList == null || !filteredDepartmentsList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Department list is empty", ConfirmAlertBox.PopupMessageType.Error);
                    ddlDepartment.DataSource = new List <Department>();
                    ddlDepartment.Items.Insert(0, new ListItem("--List is empty--", "0"));
                    ddlDepartment.SelectedIndex = 0;
                    return(false);
                }

                ddlDepartment.DataSource     = filteredDepartmentsList;
                ddlDepartment.DataTextField  = "Name";
                ddlDepartment.DataValueField = "DepartmentId";
                ddlDepartment.DataBind();
                ddlDepartment.Items.Insert(0, new ListItem("--Select Department--", "0"));
                ddlDepartment.SelectedIndex = 0;
                return(true);
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
                return(false);
            }
        }
Ejemplo n.º 22
0
        protected void BtnGeneratePaymentReportchClick(object sender, EventArgs e)
        {
            if (!ValidateControls())
            {
                ConfirmAlertBox1.ShowMessage("No Record Found!", ConfirmAlertBox.PopupMessageType.Error);
                dgAllTransactionPayments.DataSource = new List <ExpenseTransaction>();
                dgAllTransactionPayments.DataBind();
                return;
            }

            var collection = GetTransactionPaymentsByDate();

            if (collection == null || !collection.Any())
            {
                ConfirmAlertBox1.ShowMessage("No Record Found!", ConfirmAlertBox.PopupMessageType.Error);
                dgAllTransactionPayments.DataSource = new List <ExpenseTransaction>();
                dgAllTransactionPayments.DataBind();
                return;
            }
            dgAllTransactionPayments.DataSource = collection;
            dgAllTransactionPayments.DataBind();
            hDepartment.InnerText = ddlPaymentDepartment.SelectedItem.Text;
            LoadTransactionsFooter();
            SetTransactionStyle();
        }
Ejemplo n.º 23
0
        private bool AddExpenseCategory()
        {
            try
            {
                var newxpenseCategory = new ExpenseCategory
                {
                    Title  = txtTitle.Text.Trim(),
                    Code   = txtCode.Text.Trim(),
                    Status = chkCategory.Checked ? 1 : 0
                };

                var k = ServiceProvider.Instance().GetExpenseCategoryServices().AddExpenseCategoryCheckDuplicate(newxpenseCategory);

                if (k < 1)
                {
                    if (k == -3)
                    {
                        ConfirmAlertBox1.ShowMessage("Expense Category Information already exists.", ConfirmAlertBox.PopupMessageType.Error);
                        return(false);
                    }
                    ConfirmAlertBox1.ShowMessage("Expense Category Information could not be added.", ConfirmAlertBox.PopupMessageType.Error);
                    return(false);
                }

                ConfirmAlertBox1.ShowSuccessAlert("ExpenseCategory Information was added to successfully.");
                return(true);
            }
            catch (Exception ex)
            {
                ErrorDisplayProcessExpenseCategory.ShowError("An unknown error was encountered. Please try again soon or contact the Admin.");
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                return(false);
            }
        }
Ejemplo n.º 24
0
        private void LoadTransactionPaymentHistory(long expenseTransactionId)
        {
            try
            {
                dgPaymentHistory.DataSource = new List <ExpenseTransactionPaymentHistory>();
                dgPaymentHistory.DataBind();

                var paymentsHistoryList = ServiceProvider.Instance().GetExpenseTransactionPaymentHistoryServices().GetExpenseTransactionPaymentHistoriesByExpenseTransactionId(expenseTransactionId);

                if (paymentsHistoryList == null || !paymentsHistoryList.Any())
                {
                    ConfirmAlertBox1.ShowMessage("There is no Payment log for the selected Transaction.", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                dgPaymentHistory.DataSource = paymentsHistoryList;
                dgPaymentHistory.DataBind();
                LoadTransactionPaymentHistoryFooter();
                var transaction = paymentsHistoryList.ElementAtOrDefault(0);
                if (transaction != null)
                {
                    hTitle.InnerHtml          = transaction.ExpenseTransaction.ExpenseTitle;
                    lblHistoryTitle.InnerHtml = transaction.ExpenseTransaction.ExpenseTitle;
                }

                dvView.Visible       = true;
                dvAllContent.Visible = false;
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
        private void LoadTransactionItems(ExpenseTransaction transaction)
        {
            rdVoidTransaction.Checked = false;
            rdVoidItems.Checked       = false;

            try
            {
                var transactionItems = ServiceProvider.Instance().GetTransactionItemServices().GetTransactionItemsByExpenseTransaction(transaction.ExpenseTransactionId);

                if (transactionItems == null || !transactionItems.Any())
                {
                    ConfirmAlertBox1.ShowMessage("Transaction Items could not be retrieved.", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                var dSource = transactionItems.ElementAt(0).Key.ToList();

                lblTransactionTitle.Text         = transaction.ExpenseTitle;
                lblRequestedAmmount.InnerText    = "N" + NumberMap.GroupToDigits(transaction.TotalTransactionAmount.ToString(CultureInfo.InvariantCulture));
                lblApprovedTotalAmount.InnerText = "N" + NumberMap.GroupToDigits(transaction.TotalApprovedAmount.ToString(CultureInfo.InvariantCulture));
                dgExpenseItem.DataSource         = dSource;
                dgExpenseItem.DataBind();
                LoadTransactionsFooter();
                Session["_transaction"]      = transaction;
                Session["_transactionItems"] = dSource;
                dvTransactionItems.Visible   = true;
                dvUserEntries.Visible        = false;
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
Ejemplo n.º 26
0
        protected void DgAllTransactionPaymentsCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                dgAllTransactionPayments.SelectedIndex = e.Item.ItemIndex;

                long id = (DataCheck.IsNumeric(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString()) : 0;

                if (id < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                var expenseTransactionPayment = ServiceProvider.Instance().GetExpenseTransactionPaymentServices().GetExpenseTransactionPayment(id);

                if (expenseTransactionPayment == null || expenseTransactionPayment.ExpenseTransactionId < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                LoadTransactionPaymentHistory(expenseTransactionPayment.ExpenseTransactionId);
                //dvTransactionPayments.Visible = false;
                //dvTransactionPaymentHistory.Visible = true;
                dvView.Visible       = true;
                dvAllContent.Visible = false;
            }

            catch
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }
        private bool Mailsender(string to, string subject, string body)
        {
            try
            {
                var emailUtility = new ExpensemanagerEmailSenderUtility();
                var config       = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
                var settings     = (System.Net.Configuration.MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");

                if (settings != null)
                {
                    var fromAddress = new MailAddress(settings.Smtp.From);
                    ThreadPool.QueueUserWorkItem(s =>
                    {
                        if (!emailUtility.SendMail(fromAddress, to, subject, body, settings.Smtp.Network.UserName, settings.Smtp.Network.Password))
                        {
                            ConfirmAlertBox1.ShowMessage("A notification could not be sent for your Transaction request due to some technical issues.\n Approval of your request may be delayed.", ConfirmAlertBox.PopupMessageType.Error);
                            return;
                        }
                    });
                    return(true);
                }

                return(false);
            }
            catch (Exception)
            {
                ConfirmAlertBox1.ShowMessage("Your Transactions request notification could not be sent. Approval of your request might be delayed.", ConfirmAlertBox.PopupMessageType.Error);
                return(false);
            }
        }
Ejemplo n.º 28
0
        private bool ValidateControls()
        {
            try
            {
                var period = int.Parse(ddlPaymentPeriod.SelectedValue);

                if (period < 1)
                {
                    ConfirmAlertBox1.ShowMessage("Please Select a Period.", ConfirmAlertBox.PopupMessageType.Error);
                    return(false);
                }

                if (period == 3)
                {
                    if (string.IsNullOrEmpty(txtPaymentStart.Text.Trim()) && string.IsNullOrEmpty(txtPaymentEndDate.Text.Trim()))
                    {
                        ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error);
                        return(false);
                    }

                    if (string.IsNullOrEmpty(txtPaymentStart.Text.Trim()) || string.IsNullOrEmpty(txtPaymentStart.Text.Trim()))
                    {
                        ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error);
                        return(false);
                    }

                    if (!string.IsNullOrEmpty(txtPaymentStart.Text.Trim()))
                    {
                        if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtPaymentStart.Text.Trim())))
                        {
                            ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error);
                            return(false);
                        }
                    }


                    if (!string.IsNullOrEmpty(DateMap.ReverseToServerDate(txtPaymentEndDate.Text.Trim())))
                    {
                        if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtPaymentEndDate.Text.Trim())))
                        {
                            ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error);
                            return(false);
                        }
                    }

                    if (!DateMap.IsEarlyDate(DateMap.ReverseToServerDate(txtPaymentStart.Text.Trim()), DateMap.ReverseToServerDate(txtPaymentEndDate.Text.Trim())))
                    {
                        ConfirmAlertBox1.ShowMessage("The 'From' date should not be LATER than the 'To' date.", ConfirmAlertBox.PopupMessageType.Error);
                        return(false);
                    }
                }

                return(true);
            }
            catch
            {
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
                return(false);
            }
        }
Ejemplo n.º 29
0
        private bool AddDepartment()
        {
            try
            {
                var newDepartment = new Department
                {
                    Name   = txtName.Text.Trim(),
                    Status = chkDepartment.Checked ? 1 : 0
                };

                var k = ServiceProvider.Instance().GetDepartmentServices().AddDepartmentCheckDuplicate(newDepartment);

                if (k < 1)
                {
                    if (k == -3)
                    {
                        ConfirmAlertBox1.ShowMessage("Department Information already exists.", ConfirmAlertBox.PopupMessageType.Error);
                        return(false);
                    }
                    ConfirmAlertBox1.ShowMessage("Department Information could not be added.", ConfirmAlertBox.PopupMessageType.Error);
                    return(false);
                }

                ConfirmAlertBox1.ShowSuccessAlert("Department Information was added to successfully.");
                return(true);
            }
            catch (Exception ex)
            {
                ErrorDisplayProcessDepartment.ShowError("An unknown error was encountered. Please try again soon or contact the Admin.");
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                throw;
            }
        }
Ejemplo n.º 30
0
        private void LoadBeneficiaries()
        {
            try
            {
                ddlBeneficiaries.DataSource = new List <Beneficiary>();
                ddlBeneficiaries.DataBind();
                ddlBeneficiaries.Items.Insert(0, new ListItem("-- List is empty --", "0"));
                ddlBeneficiaries.SelectedIndex = 0;

                var filteredBeneficiaries = ServiceProvider.Instance().GetBeneficiaryServices().GetBeneficiariesWithUnCompletedTransactionPayments();


                if (filteredBeneficiaries == null || !filteredBeneficiaries.Any())
                {
                    ConfirmAlertBox1.ShowMessage("The Beneficiary list is empty!", ConfirmAlertBox.PopupMessageType.Error);
                    return;
                }

                ddlBeneficiaries.DataSource     = filteredBeneficiaries;
                ddlBeneficiaries.DataValueField = "BeneficiaryId";
                ddlBeneficiaries.DataTextField  = "FullName";
                ddlBeneficiaries.DataBind();
                ddlBeneficiaries.Items.Insert(0, new ListItem("-- Select a Beneficiary --", "0"));
                ddlBeneficiaries.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error);
            }
        }