Exemple #1
0
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     optionalpayee.IsEnabled = false;
     if (SystemClass.CheckConnection())
     {
         ImusCityHallEntities db = new ImusCityHallEntities();
         payeecb.ItemsSource       = db.Payees.Where(m => m.IsActive == true).OrderBy(m => m.CompanyName).ToList();
         payeecb.DisplayMemberPath = "CompanyName";
         payeecb.SelectedValuePath = "PayeeID";
         foreach (var item in Enum.GetValues(typeof(PaymentType)))
         {
             paymenttypecb.Items.Add(item);
         }
         paymenttypecb.SelectedIndex    = 0;
         paymenttypecb.IsEnabled        = false;
         departmentcb.ItemsSource       = db.Departments.OrderBy(m => m.DepartmentName).ToList();
         departmentcb.DisplayMemberPath = "DepartmentName";
         departmentcb.SelectedValuePath = "DepartmentID";
         voucheritemsdg.ItemsSource     = voucherList;
         voucherprefixtb.Text           = VoucherPrefix();
         IncrementAdviceNo();
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
Exemple #2
0
        public void RankUpdate()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        var find = db.EmployeeRanks.Find(RankID);
                        find.EmployeeRankName = txtName.Text;
                        find.RankCode         = txtCode.Text;
                        db.SaveChanges();

                        var audit = new AuditTrailModel
                        {
                            Activity   = "Updated an item in employee rank list. RANK ID: " + RankID.ToString(),
                            ModuleName = this.GetType().Name,
                            EmployeeID = App.EmployeeID
                        };

                        SystemClass.InsertLog(audit);
                        MessageBox.Show("Rank updated successfully", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db       = new ImusCityHallEntities();
                FundBank             fundBank = db.FundBanks.Find(fundBankId);
                fundname.Text = string.Join("/", fundBank.AccountNumber, fundBank.Fund.FundName, fundBank.Bank.BankCode);
                List <DamageCheck> damageCheckList = new List <DamageCheck>();
                foreach (var item in db.DamageChecks.Where(m => m.FundBankID == fundBankId))
                {
                    var damageCheck = new DamageCheck()
                    {
                        DamageCheckId = item.DamageCheckId,
                        CheckNumber   = item.CheckNumber,
                        CreatedDate   = item.CreatedDate
                    };

                    damageCheckList.Add(damageCheck);
                }
                damgecheckdg.ItemsSource       = damageCheckList.OrderBy(m => m.CheckNumber);
                damgecheckdg.SelectedValuePath = "DamageCheckId";
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                List <VoucherItemsModel> voucherList  = new List <VoucherItemsModel>();
                ImusCityHallEntities     db           = new ImusCityHallEntities();
                Disbursement             disbursement = db.Disbursements.Find(DisbursementID);
                vouchernotb.Text = disbursement.VoucherNo;
                payeetb.Text     = disbursement.Payee == null ? disbursement.PayeeName : disbursement.Payee.CompanyName;

                paymenttypetb.Text = disbursement.PaymentType;
                decimal totalAmount = disbursement.DisbursementItems.Sum(m => m.Amount);
                voucheramounttb.Text = String.Format("{0:n}", totalAmount);

                foreach (var item in disbursement.DisbursementItems)
                {
                    var voucherItem = new VoucherItemsModel()
                    {
                        Explanation = item.Explanation,
                        Amount      = String.Format("{0:n}", item.Amount)
                    };
                    voucherList.Add(voucherItem);
                }
                voucheritemsdg.ItemsSource = voucherList;
                checkdesctb.Text           = voucherList.FirstOrDefault().Explanation;

                LoadFund();
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #5
0
        private void searchbtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (String.IsNullOrEmpty(searchtb.Text))
                {
                }
                else
                {
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Searched item in ID card list. SEARCH KEY: " + searchtb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                }

                ImusCityHallEntities db = new ImusCityHallEntities();
                cardslb.ItemsSource       = db.IdentificationCardTypes.Where(m => m.CardType.Contains(searchtb.Text) && m.IsActive == true).OrderBy(m => m.CardType).ToList();
                cardslb.DisplayMemberPath = "CardType";
                cardslb.SelectedValuePath = "IdentificationCardTypeID";
            }
        }
        private void searchbtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                if (String.IsNullOrEmpty(searchtb.Text))
                {
                }
                else
                {
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Searched item in the payee list. SEARCH KEY: " + searchtb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };
                    SystemClass.InsertLog(audit);
                }

                payeelb.ItemsSource       = db.Payees.Where(m => m.CompanyName.Contains(searchtb.Text) && m.IsActive == true).OrderByDescending(m => m.PayeeID).ToList();
                payeelb.DisplayMemberPath = "CompanyName";
                payeelb.SelectedValuePath = "PayeeID";
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        public void GetSearchedList(string searchkey)
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    RList = new List <RankList>();
                    using (var db = new ImusCityHallEntities())
                    {
                        var get = db.EmployeeRanks.Where(m => m.EmployeeRankName.Contains(searchkey)).OrderBy(m => m.EmployeeRankName).ToList();

                        foreach (var item in get)
                        {
                            RankList rl = new RankList();
                            rl.RankID   = item.EmployeeRankID;
                            rl.RankName = item.EmployeeRankName;
                            rl.RankCode = item.RankCode;
                            RList.Add(rl);
                        }
                        dgRankList.ItemsSource = RList.OrderByDescending(m => m.RankID);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #8
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                ImusCityGovernmentSystem.Model.Customer customer = db.Customers.Find(id);
                this.Title = string.Join(" ", customer.FirstName, customer.LastName, "Transactions");
                List <CustomerTransactionsEntity> transactionlist = new List <CustomerTransactionsEntity>();
                var result = db.GetCustomerTransactions(id);
                foreach (var item in result)
                {
                    var transaction = new CustomerTransactionsEntity
                    {
                        Activity        = item.Activity,
                        TransactionDate = item.TransactionDate.Value.ToShortDateString()
                    };

                    transactionlist.Add(transaction);
                }
                customernamelbl.Content           = string.Join(" ", customer.FirstName, customer.LastName);
                customerTransactiondg.ItemsSource = transactionlist;
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                divisioncb.ItemsSource       = db.Divisions.Where(m => m.IsActive == true).OrderBy(m => m.DivisionCode).ToList();
                divisioncb.DisplayMemberPath = "DivisionCode";
                divisioncb.SelectedValuePath = "DivisionID";
                divisioncb.SelectedIndex     = 0;

                positioncb.ItemsSource       = db.EmployeePositions.Where(m => m.Active == true).OrderBy(m => m.EmployeePositionName).ToList();
                positioncb.DisplayMemberPath = "EmployeePositionName";
                positioncb.SelectedValuePath = "EmployeePositionID";
                positioncb.SelectedIndex     = 0;

                statuscb.ItemsSource       = db.EmployeeStatus.OrderBy(m => m.EmployeeStatusName).ToList();
                statuscb.DisplayMemberPath = "EmployeeStatusName";
                statuscb.SelectedValuePath = "EmployeeStatusID";
                statuscb.SelectedIndex     = 0;

                genderdp.SelectedIndex      = 0;
                civilstatuscb.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #10
0
        public List <Employee> LoadEmployees(string searchKey)
        {
            List <Employee> employeeList = new List <Employee>();

            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();


                if (String.IsNullOrEmpty(searchKey))
                {
                    foreach (var employee in db.Employees.Where(m => m.EmployeeNo != "123456" && m.EmployeeNo != "0000001"))
                    {
                        employee.FirstName = string.Join(" ", employee.FirstName, employee.LastName);
                        employeeList.Add(employee);
                    }
                }
                else
                {
                    foreach (var employee in db.Employees.Where(m => (m.FirstName.Contains(searchKey) || m.MiddleName.Contains(searchKey) || m.LastName.Contains(searchKey)) && m.EmployeeNo != "123456" && m.EmployeeNo != "0000001"))
                    {
                        employee.FirstName = string.Join(" ", employee.FirstName, employee.LastName);
                        employeeList.Add(employee);
                    }
                }


                return(employeeList);
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
                return(employeeList);
            }
        }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                ImusCityGovernmentSystem.Model.FundBank  account   = db.FundBanks.Find(FundBankID);
                ImusCityGovernmentSystem.Model.BankTrail banktrail = new BankTrail();

                if (String.IsNullOrEmpty(amounttb.Text))
                {
                    MessageBox.Show("Please enter the amount to be adjusted");
                }
                else
                {
                    switch (adjustmenttypecb.Text.Substring(0, 1))
                    {
                    case "D":
                        if (Convert.ToDecimal(amounttb.Text) > account.CurrentBalance)
                        {
                            MessageBox.Show("Cannot be debited, you will have an insufficients funds");
                            return;
                        }
                        account.CurrentBalance -= Convert.ToDecimal(amounttb.Text);
                        banktrail.DebitCredit   = "D";
                        break;

                    case "C":
                        account.CurrentBalance += Convert.ToDecimal(amounttb.Text);
                        banktrail.DebitCredit   = "C";
                        break;
                    }
                    banktrail.FundBankID  = FundBankID;
                    banktrail.Amount      = Convert.ToDecimal(amounttb.Text);
                    banktrail.EntryName   = nameof(BankTrailEntry.Adjustment);
                    banktrail.CheckID     = null;
                    banktrail.EntryNameID = (int)BankTrailEntry.Adjustment;
                    banktrail.EmployeeID  = App.EmployeeID;
                    banktrail.DateCreated = DateTime.Now;
                    db.BankTrails.Add(banktrail);

                    db.SaveChanges();


                    var audit = new AuditTrailModel
                    {
                        Activity   = "Adjusted current amount of FUNDBANK ID: " + FundBankID.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                    MessageBox.Show("Adjustment added succesfully");
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #12
0
        private void searchbtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                Mouse.OverrideCursor             = Cursors.Wait;
                employeelistlb.ItemsSource       = LoadEmployees(searchtb.Text);
                employeelistlb.DisplayMemberPath = "FirstName";
                employeelistlb.SelectedValuePath = "EmployeeID";
                employeelistlb.SelectedIndex     = 0;

                if (String.IsNullOrEmpty(searchtb.Text))
                {
                }
                else
                {
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Searched item in the employee list. SEARCH KEY: " + searchtb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };
                    SystemClass.InsertLog(audit);
                }

                Mouse.OverrideCursor = null;
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #13
0
        private void editbtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                if (employeelistlb.SelectedValue == null)
                {
                    MessageBox.Show("Please select an employee to edit!");
                }
                else
                {
                    EditEmployeeWindow editemp = new EditEmployeeWindow();
                    editemp.EmployeeID = (int)employeelistlb.SelectedValue;
                    editemp.ShowDialog();

                    employeelistlb.ItemsSource       = LoadEmployees(searchtb.Text);
                    employeelistlb.DisplayMemberPath = "FirstName";
                    employeelistlb.SelectedValuePath = "EmployeeID";
                    employeelistlb.SelectedIndex     = 0;
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        public void CustomerFinder(string fname, string mname, string lname)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities  db           = new ImusCityHallEntities();
                List <CustomerEntity> customerList = new List <CustomerEntity>();
                var result = from p in db.Customers orderby p.FirstName where (p.FirstName.Contains(fname) || p.MiddleName.Contains(mname) || p.LastName.Contains(lname)) || p.IsActive == true select p;
                foreach (var item in result)
                {
                    var customer = new CustomerEntity
                    {
                        CustomerId = item.CustomerID,
                        Name       = item.FirstName + " " + item.MiddleName + " " + item.LastName,
                        DateAdded  = item.DateAdded.Value.ToShortDateString()
                    };
                    customerList.Add(customer);
                }

                customerdg.ItemsSource       = customerList;
                customerdg.SelectedValuePath = "CustomerId";
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
            Mouse.OverrideCursor = null;
        }
 private void editbtn_Click(object sender, RoutedEventArgs e)
 {
     Mouse.OverrideCursor = Cursors.Wait;
     if (SystemClass.CheckConnection())
     {
         if (payeelb.SelectedValue == null)
         {
             Mouse.OverrideCursor = null;
             MessageBox.Show("Please select a payee to edit");
         }
         else
         {
             ImusCityHallEntities db   = new ImusCityHallEntities();
             EditPayeeWindow      edit = new EditPayeeWindow();
             Mouse.OverrideCursor = null;
             edit.PayeeID         = (int)payeelb.SelectedValue;
             Mouse.OverrideCursor = null;
             edit.ShowDialog();
             db = new ImusCityHallEntities();
             payeelb.ItemsSource       = db.Payees.Where(m => m.IsActive == true).OrderByDescending(m => m.PayeeID).ToList();
             payeelb.DisplayMemberPath = "CompanyName";
             payeelb.SelectedValuePath = "PayeeID";
         }
     }
     else
     {
         Mouse.OverrideCursor = null;
     }
     Mouse.OverrideCursor = null;
 }
Exemple #16
0
        public void GetSearchedList(string searchkey)
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    DList = new List <DivisionList>();
                    using (var db = new ImusCityHallEntities())
                    {
                        var get = db.Divisions.Where(m => m.IsActive == true && (m.DivisionName.Contains(searchkey) || m.DivisionCode.Contains(searchkey))).OrderBy(m => m.DivisionName).ToList();

                        foreach (var item in get)
                        {
                            DivisionList dl = new DivisionList();
                            dl.DivisionID     = item.DivisionID;
                            dl.DivisionCode   = item.DivisionCode;
                            dl.DivisionName   = item.DivisionName;
                            dl.DepartmentName = item.Department.DepartmentName;
                            DList.Add(dl);
                        }
                        dgDivisionList.ItemsSource       = DList.OrderByDescending(m => m.DivisionID);
                        dgDivisionList.SelectedValuePath = "DivisionID";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void deletebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (payeelb.SelectedValue != null)
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    int id = (int)payeelb.SelectedValue;
                    ImusCityGovernmentSystem.Model.Payee payee = db.Payees.Find(id);
                    payee.IsActive = false;
                    db.SaveChanges();
                    db = new ImusCityHallEntities();
                    payeelb.ItemsSource       = db.Payees.Where(m => m.IsActive == true).OrderByDescending(m => m.PayeeID).ToList();
                    payeelb.DisplayMemberPath = "CompanyName";
                    payeelb.SelectedValuePath = "PayeeID";

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Deleted item in the payee list. PAYEE ID: " + id.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };
                    SystemClass.InsertLog(audit);
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #18
0
        private void deletebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (dgDivisionList.SelectedValue != null)
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    int id = (int)dgDivisionList.SelectedValue;
                    ImusCityGovernmentSystem.Model.Division division = db.Divisions.Find(id);
                    division.IsActive = false;
                    db.SaveChanges();
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Deleted an item in the division list. DIV ID: " + id.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                    GetList();
                }
                else
                {
                    MessageBox.Show("Please select an item");
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
 private void editbtn_Click(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         try
         {
             using (var db = new ImusCityHallEntities())
             {
                 if (dgRankList.SelectedItem != null)
                 {
                     var            selectedItem = ((RankList)dgRankList.SelectedItem);
                     EditRankWindow ud           = new EditRankWindow();
                     ud.RankID = selectedItem.RankID;
                     ud.ShowDialog();
                     TextClear();
                     GetList();
                 }
                 else
                 {
                     MessageBox.Show("No rank Selected", "System Warning!", MessageBoxButton.OK, MessageBoxImage.Information);
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
Exemple #20
0
        private void searchbtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (String.IsNullOrEmpty(txtSearch.Text))
                {
                }
                else
                {
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Searched item in the division list. SEARCH KEY: " + txtSearch.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };
                    SystemClass.InsertLog(audit);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }



            GetSearchedList(txtSearch.Text);
        }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                foreach (var item in Enum.GetValues(typeof(CheckStatus)))
                {
                    if (item.ToString() == "Released" && item.ToString() == "Created")
                    {
                    }
                    else
                    {
                        checkstatuscb.Items.Add(item);
                    }
                }

                ImusCityHallEntities db = new ImusCityHallEntities();
                ImusCityGovernmentSystem.Model.Check check = db.Checks.Find(CheckID);
                checknumbertb.Text          = check.CheckNo;
                checkdatecreateddp.Text     = check.DateCreated.Value.ToShortDateString();
                checkstatuscb.SelectedIndex = check.Status.HasValue ? check.Status.Value : 0;
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        public void LoadPayeeRepresentative()
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                gd.Clear();
                db = new ImusCityHallEntities();
                var representative = db.PayeeRepresentativeViews.Where(m => m.PayeeID == null).OrderBy(m => m.PayeeRepresentativeName).ToList();
                foreach (var dr in representative)
                {
                    PayeeRepresentativeClass i = new PayeeRepresentativeClass()
                    {
                        Name = dr.PayeeRepresentativeName.ToString(),
                        Id   = dr.PayeeRepID
                    };
                    gd.Add(i);
                }

                represetativelb.ItemsSource       = gd;
                represetativelb.SelectedValuePath = "Id";
                represetativelb.Items.Refresh();
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #23
0
        private void deletebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (cardslb.SelectedValue != null)
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    int id = (int)cardslb.SelectedValue;
                    ImusCityGovernmentSystem.Model.IdentificationCardType card = db.IdentificationCardTypes.Find(id);
                    card.IsActive = false;
                    db.SaveChanges();
                    LoadCards();

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Deleted item in the fund list. BANK ID: " + id.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };
                    SystemClass.InsertLog(audit);
                }
                else
                {
                    MessageBox.Show("Please select an item");
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void LoadSelected(int id)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db      = new ImusCityHallEntities();
                FundBank             account = db.FundBanks.Find(id);

                bankcb.ItemsSource       = db.Banks.OrderBy(m => m.BankName).ToList();
                bankcb.DisplayMemberPath = "BankName";
                bankcb.SelectedValuePath = "BankID";
                bankcb.SelectedValue     = account.BankID;

                fundcb.ItemsSource       = db.Funds.OrderBy(m => m.FundName).ToList();
                fundcb.DisplayMemberPath = "FundName";
                fundcb.SelectedValuePath = "FundID";
                fundcb.SelectedValue     = account.FundID;

                accountnumbertb.Text   = account.AccountNumber;
                startingbalancetb.Text = String.Format("{0:n}", account.StartingBalance);
                currentbalancetb.Text  = String.Format("{0:n}", account.CurrentBalance);
                advicenumbertb.Text    = account.AdviceNo.HasValue ? account.AdviceNo.ToString() : "";
                flooramounttb.Text     = String.Format("{0:n}", account.AmountLimit);
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #25
0
        public void LoadDivision()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        var find = db.Divisions.Find(DivisionID);

                        txtCode.Text = find.DivisionCode;
                        txtName.Text = find.DivisionName;
                        departmentcb.SelectedValue = find.DepartmentID;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
 private void savebtn_Click(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         if (payeecb.SelectedValue == null)
         {
             MessageBox.Show("Please select payee");
         }
         else
         {
             ImusCityHallEntities db             = new ImusCityHallEntities();
             PayeeRepresentative  representative = db.PayeeRepresentatives.Find(id);
             representative.FirstName  = fnametb.Text;
             representative.MiddleName = mnametb.Text;
             representative.LastName   = lnametb.Text;
             representative.MobileNo   = mobilenotb.Text;
             representative.Landline   = landlinetb.Text;
             representative.PayeeID    = (int)payeecb.SelectedValue;
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            List <Disbursement> disbursementList = new List <Disbursement>();

            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                foreach (var item in db.Disbursements)
                {
                    var disbursement = new Disbursement()
                    {
                        DisbursementID = item.DisbursementID,
                        VoucherNo      = item.VoucherNo,
                        PayeeName      = item.Payee == null ? item.PayeeName : item.Payee.CompanyName
                    };
                    disbursementList.Add(disbursement);
                }
                voucherlistdg.ItemsSource       = disbursementList;
                voucherlistdg.SelectedValuePath = "DisbursementID";
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #28
0
        private void editbtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (SystemClass.CheckConnection())
            {
                if (fundlb.SelectedValue == null)
                {
                    Mouse.OverrideCursor = null;
                    MessageBox.Show("Please select an item!");
                }
                else
                {
                    ImusCityHallEntities db   = new ImusCityHallEntities();
                    EditFundWindow       edit = new EditFundWindow();
                    edit.FundID          = (int)fundlb.SelectedValue;
                    Mouse.OverrideCursor = null;
                    edit.ShowDialog();
                    db = new ImusCityHallEntities();
                    fundlb.ItemsSource       = db.Funds.Where(m => m.IsActive == true).OrderByDescending(m => m.FundID).ToList();
                    fundlb.DisplayMemberPath = "FundName";
                    fundlb.SelectedValuePath = "FundID";
                }
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }


            Mouse.OverrideCursor = null;
        }
        public void LoadItems()
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                var result = from p in db.Checks
                             select new
                {
                    CheckID          = p.CheckID,
                    CheckNumber      = p.CheckNo,
                    VoucherNumber    = p.Disbursement.VoucherNo,
                    FundName         = p.Disbursement.FundBank.Fund.FundPrefix + "-" + p.Disbursement.FundBank.Fund.FundCode + "-" + p.Disbursement.FundBank.Bank.BankCode,
                    CompanyName      = p.Disbursement.Payee == null ? p.Disbursement.PayeeName : p.Disbursement.Payee.CompanyName,
                    CheckDescription = p.CheckDescription,
                    Amount           = p.Amount,
                    Status           = p.Status == 0 ? "Created" : p.Status == 1 ? "Cancelled" : p.Status == 2 ? "Released" : p.Status == 4 ? "Deleted" : "Deleted",
                    CreatedDate      = p.DateCreated
                };

                checklistdg.ItemsSource       = result.OrderByDescending(m => m.CheckID).ToList();
                checklistdg.SelectedValuePath = "CheckID";
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Exemple #30
0
        public void IncrementAdviceNo()
        {
            if (SystemClass.CheckConnection())
            {
                bool isForAudit = false;

                ImusCityHallEntities db = new ImusCityHallEntities();

                var accountlist = db.FundBanks.ToList();
                foreach (var x in accountlist.Where(m => m.IsActive == true && m.IsProcessed == false))
                {
                    x.IsProcessed = true;
                    x.AdviceNo    = (x.AdviceNo + 1);
                    isForAudit    = true;
                    db.SaveChanges();
                }

                if (isForAudit == true)
                {
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Advice No Incremented successful.",
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }