Esempio n. 1
0
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                if (String.IsNullOrEmpty(fundcodetb.Text) || String.IsNullOrEmpty(fundnametb.Text))
                {
                    MessageBox.Show("Please input fund code and fund name");
                }
                else if (String.IsNullOrEmpty(voucherprefixtb.Text))
                {
                    MessageBox.Show("Please enter voucher prefix");
                }
                else if (db.Funds.Any(m => m.FundCode == fundcodetb.Text))
                {
                    MessageBox.Show("The fund code is already used");
                }
                else if (db.Funds.Any(m => m.FundName == fundnametb.Text))
                {
                    MessageBox.Show("The fund name is already used");
                }
                else
                {
                    ImusCityGovernmentSystem.Model.Fund fund = new Model.Fund();
                    fund.FundCode   = fundcodetb.Text;
                    fund.FundName   = fundnametb.Text;
                    fund.FundPrefix = voucherprefixtb.Text;
                    fund.IsActive   = true;
                    db.Funds.Add(fund);
                    db.SaveChanges();
                    Mouse.OverrideCursor = null;

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Added new fund in the database. FUND CODE: " + fundcodetb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);

                    MessageBox.Show("New item added successfully.");

                    SystemClass.ClearTextBoxes(this);
                }
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }

            Mouse.OverrideCursor = null;
        }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                if (String.IsNullOrEmpty(bankcodetb.Text) || String.IsNullOrEmpty(banknametb.Text))
                {
                    MessageBox.Show("Please input bank code and bank name");
                }
                else if (String.IsNullOrEmpty(branchtb.Text))
                {
                    MessageBox.Show("Please enter branch name");
                }
                else if (db.Banks.Any(m => m.BankCode == bankcodetb.Text))
                {
                    MessageBox.Show("The bank code is already used");
                }
                else
                {
                    ImusCityGovernmentSystem.Model.Bank bank = new Model.Bank();
                    bank.BankCode = bankcodetb.Text;
                    bank.BankName = banknametb.Text;
                    bank.Branch   = branchtb.Text;
                    bank.IsActive = true;
                    db.Banks.Add(bank);
                    db.SaveChanges();
                    Mouse.OverrideCursor = null;

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Added new bank in the database. BANK CODE: " + bankcodetb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);

                    MessageBox.Show("New item added successfully.");

                    SystemClass.ClearTextBoxes(this);
                }
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }

            Mouse.OverrideCursor = null;
        }
Esempio n. 3
0
 public void ResetFields()
 {
     SystemClass.ClearTextBoxes(this);
     currentimage.Source        = null;
     imagecapture.Source        = null;
     voucherNumbertb.Text       = "";
     checknumbertb.Text         = "";
     checkdatetb.Text           = null;
     companynametb.Text         = "";
     checkdescriptiontb.Text    = "";
     banktb.Text                = "";
     amountb.Text               = "";
     digitalsignatureimg.Source = null;
     LoadCheckList();
 }
Esempio n. 4
0
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                Mouse.OverrideCursor = Cursors.Wait;
                if (String.IsNullOrEmpty(fnametb.Text) || String.IsNullOrEmpty(lnametb.Text))
                {
                    Mouse.OverrideCursor = null;
                    MessageBox.Show("Please input first name and last name field!");
                }
                else if (String.IsNullOrEmpty(mobilenotb.Text))
                {
                    MessageBox.Show("Please input mobile number");
                }
                else
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    PayeeRepresentative  pr = new PayeeRepresentative();
                    pr.FirstName  = fnametb.Text;
                    pr.MiddleName = mnametb.Text;
                    pr.LastName   = lnametb.Text;
                    pr.MobileNo   = mobilenotb.Text;
                    pr.Landline   = landlinetb.Text;
                    db.PayeeRepresentatives.Add(pr);
                    db.SaveChanges();
                    Mouse.OverrideCursor = null;

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Added new payee representative in the database. NAME: " + fnametb.Text + " " + lnametb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                    MessageBox.Show("Representative addedd successfully!");
                    SystemClass.ClearTextBoxes(this);
                }
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
            Mouse.OverrideCursor = null;
        }
Esempio n. 5
0
 private void clearbtn_Click(object sender, RoutedEventArgs e)
 {
     SystemClass.ClearTextBoxes(this);
 }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (SystemClass.CheckConnection())
            {
                if (String.IsNullOrEmpty(payeenotb.Text) || String.IsNullOrEmpty(companynametb.Text) || String.IsNullOrEmpty(companyaddresstb.Text))
                {
                    Mouse.OverrideCursor = null;
                    MessageBox.Show("Please input company name, company address and payee number");
                }
                else if (gd.Where(m => m.IsSelected == true).Count() == 0)
                {
                    Mouse.OverrideCursor = null;
                    MessageBox.Show("Please select at least one representative for the payee!");
                }
                else
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    if (db.Payees.FirstOrDefault(m => m.PayeeNo == payeenotb.Text) != null)
                    {
                        Mouse.OverrideCursor = null;
                        MessageBox.Show("Payee number already exist!");
                    }
                    else
                    {
                        ImusCityGovernmentSystem.Model.Payee payee = new Model.Payee();
                        payee.PayeeNo        = payeenotb.Text;
                        payee.CompanyName    = companynametb.Text;
                        payee.CompanyAddress = companyaddresstb.Text;
                        payee.TIN            = tinnotb.Text;
                        payee.LandlineNo     = contactnotb.Text;
                        payee.IsActive       = true;
                        db.Payees.Add(payee);
                        db.SaveChanges();


                        foreach (var list in gd.Where(m => m.IsSelected == true))
                        {
                            PayeeRepresentative pr = db.PayeeRepresentatives.Find(list.Id);
                            pr.PayeeID = payee.PayeeID;
                            db.SaveChanges();
                        }
                        Mouse.OverrideCursor = null;

                        var audit = new AuditTrailModel
                        {
                            Activity   = "Added new payee in the database. PAYEE NO." + payeenotb.Text,
                            ModuleName = this.GetType().Name,
                            EmployeeID = App.EmployeeID
                        };

                        SystemClass.InsertLog(audit);
                        MessageBox.Show("Payee added successfully!");
                        SystemClass.ClearTextBoxes(this);
                        LoadPayeeRepresentative();
                    }
                }
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
            Mouse.OverrideCursor = null;
        }
Esempio n. 7
0
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                if (fundcb.SelectedValue == null)
                {
                    MessageBox.Show("Please select fund");
                }
                else if (bankcb.SelectedValue == null)
                {
                    MessageBox.Show("Please select bank");
                }
                else if (String.IsNullOrEmpty(accountnumbertb.Text))
                {
                    MessageBox.Show("Please input account number");
                }
                else if (db.FundBanks.Any(m => m.AccountNumber == accountnumbertb.Text))
                {
                    MessageBox.Show("The account number is already used");
                }
                else if (String.IsNullOrEmpty(startingbalancetb.Text))
                {
                    MessageBox.Show("Please input starting balance");
                }
                else if (String.IsNullOrEmpty(advicenumbertb.Text))
                {
                    MessageBox.Show("Please input advice number");
                }
                else if (String.IsNullOrEmpty(flooramounttb.Text))
                {
                    MessageBox.Show("Please input floor amount");
                }
                else
                {
                    ImusCityGovernmentSystem.Model.FundBank account = new FundBank();
                    account.FundID          = (int)fundcb.SelectedValue;
                    account.BankID          = (int)bankcb.SelectedValue;
                    account.AccountNumber   = accountnumbertb.Text;
                    account.CurrentBalance  = Convert.ToDecimal(startingbalancetb.Text);
                    account.StartingBalance = Convert.ToDecimal(startingbalancetb.Text);
                    account.IsActive        = true;
                    account.DateAdded       = DateTime.Now;
                    account.AdviceNo        = Convert.ToInt32(advicenumbertb.Text);
                    account.IsProcessed     = true;
                    account.AmountLimit     = Convert.ToDecimal(flooramounttb.Text);
                    db.FundBanks.Add(account);

                    ImusCityGovernmentSystem.Model.BankTrail banktrail = new BankTrail();
                    banktrail.DebitCredit = "D";
                    banktrail.FundBankID  = account.FundBankID;
                    banktrail.Amount      = Convert.ToDecimal(startingbalancetb.Text);
                    banktrail.EntryName   = nameof(BankTrailEntry.FundCreation);
                    banktrail.CheckID     = null;
                    banktrail.EntryNameID = (int)BankTrailEntry.FundCreation;
                    banktrail.EmployeeID  = App.EmployeeID;
                    banktrail.DateCreated = DateTime.Now;
                    db.BankTrails.Add(banktrail);

                    db.SaveChanges();

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Added new bank account in the database. FUNDBANK ID: " + account.FundBankID.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);

                    MessageBox.Show("Account added successfully");
                    SystemClass.ClearTextBoxes(this);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }