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);
            }
        }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (String.IsNullOrEmpty(cardnametb.Text))
                {
                    MessageBox.Show("Please enter card type name");
                }
                else
                {
                    ImusCityHallEntities   db   = new ImusCityHallEntities();
                    IdentificationCardType card = db.IdentificationCardTypes.Find(id);
                    card.CardType = cardnametb.Text;
                    db.SaveChanges();
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Updated an item in identification card list. CARD ID : " + id.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                    MessageBox.Show("Card updated successfully!");
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Пример #3
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);
        }
Пример #4
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);
            }
        }
        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);
            }
        }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (newpasswordpb.Password != confirmpasswordpb.Password)
                {
                    MessageBox.Show("Password mismatch!");
                }
                else
                {
                    Employee   employee       = db.Employees.Find(App.EmployeeID);
                    AspNetUser asp            = db.AspNetUsers.FirstOrDefault(m => m.UserName == employee.EmployeeNo);
                    var        passwordHasher = new Microsoft.AspNet.Identity.PasswordHasher();
                    asp.PasswordHash = passwordHasher.HashPassword(confirmpasswordpb.Password);
                    db.SaveChanges();
                    MessageBox.Show("Password updated successfully!");

                    var audit = new AuditTrailModel
                    {
                        Activity   = "User changes his/her password.",
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        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);
            }
        }
Пример #8
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);
            }
        }
Пример #9
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);
            }
        }
Пример #10
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";
            }
        }
Пример #11
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);
            }
        }
Пример #12
0
        public async Task <IEnumerable <AuditTrailModel> > GetAuditTrailAsync(DateTime from, DateTime to, string terminal, string keyword)
        {
            var cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Keyword", keyword);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            var items = new List <AuditTrailModel>();

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new AuditTrailModel
                    {
                        Id          = dr["Id"].ToString(),
                        Date        = dr["Date"].ToString(),
                        Description = dr["Description"].ToString(),
                        Gate        = dr["Gate"].ToString(),
                        Username    = dr["Username"].ToString(),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
Пример #13
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 btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        if (!String.IsNullOrEmpty(txtAnswer.Text))
                        {
                            var getanswer = db.SecurityQuestionUsers.Where(m => m.EmployeeID == App.EmployeeID && m.SecurityQuestionID == QuestionID).FirstOrDefault();

                            if (getanswer != null)
                            {
                                string inputAnswer = txtAnswer.Text;
                                if (inputAnswer.TrimStart().Trim().TrimEnd().ToLower() == getanswer.Answer.TrimStart().Trim().TrimEnd().ToLower())
                                {
                                    ChangePasswordWindow cp = new ChangePasswordWindow();
                                    cp.Show();
                                    var audit = new AuditTrailModel
                                    {
                                        Activity   = "User answer a security question for Forgot Password.",
                                        ModuleName = this.GetType().Name,
                                        EmployeeID = App.EmployeeID
                                    };

                                    SystemClass.InsertLog(audit);
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show("Incorrect answer.");
                                    return;
                                }
                            }
                            else
                            {
                                MessageBox.Show("Question not available.");
                                return;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please input answer.");
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Пример #15
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;
        }
Пример #16
0
        public void SaveCheckReleased(int Id, int checkId)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                ImusCityGovernmentSystem.Model.CheckRelease released = new CheckRelease();
                released.CustomerID               = Id;
                released.ReleasedDate             = DateTime.Now;
                released.CheckID                  = checkId;
                released.Photo                    = ConvertImageSourceToByte(imagecapture);
                released.DigitalSignature         = ConvertImageSourceToByte(digitalsignatureimg);
                released.ReleasedBy               = App.EmployeeID;
                released.IdentificationCardNumber = idcardnumbertb.Text;
                released.IdentificationCardTypeID = (int)idtypecb.SelectedValue;
                db.CheckReleases.Add(released);

                ImusCityGovernmentSystem.Model.Check check = db.Checks.Find(checkId);
                check.Status = (int)CheckStatus.Released;

                int cardId = (int)idtypecb.SelectedValue;
                CustomerIdentificationCard customerCard = db.CustomerIdentificationCards.FirstOrDefault(m => m.IdentificationCardTypeID == cardId && m.CustomerID == Id && m.IdentificationCardType.IsActive == true);
                if (customerCard != null)
                {
                    customerCard.IdentificationNumber = idcardnumbertb.Text;
                    db.SaveChanges();
                }
                else
                {
                    CustomerIdentificationCard custCard = new CustomerIdentificationCard();
                    custCard.CustomerID = Id;
                    custCard.IdentificationCardTypeID = (int)idtypecb.SelectedValue;
                    custCard.IdentificationNumber     = idcardnumbertb.Text;
                    db.CustomerIdentificationCards.Add(custCard);
                }

                db.SaveChanges();
                MessageBox.Show("Check has been successfully released");
                LoadIdentificationCardType();

                var audit = new AuditTrailModel
                {
                    Activity   = "Released check to CUSTOMER ID: " + released.CustomerID.ToString() + " with CHECK NUMBER: " + released.Check.CheckNo,
                    ModuleName = this.GetType().Name,
                    EmployeeID = App.EmployeeID
                };
                SystemClass.InsertLog(audit);

                ResetFields();
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Пример #17
0
 public void LoadCustomer(string searchkey)
 {
     Mouse.OverrideCursor = Cursors.Wait;
     if (SystemClass.CheckConnection())
     {
         ImusCityHallEntities  db           = new ImusCityHallEntities();
         List <CustomerEntity> customerList = new List <CustomerEntity>();
         if (!String.IsNullOrEmpty(searchtb.Text))
         {
             var result = from p in db.Customers orderby p.FirstName where (p.FirstName.Contains(searchkey) || p.MiddleName.Contains(searchkey) || p.LastName.Contains(searchkey)) && p.IsActive == true select p;
             foreach (var item in result)
             {
                 var customer = new CustomerEntity
                 {
                     CustomerId = item.CustomerID,
                     Name       = item.FirstName + " " + item.MiddleName + " " + item.LastName,
                     Birthdate  = item.Birthdate.HasValue ? item.Birthdate.Value.ToShortDateString() : ""
                 };
                 customerList.Add(customer);
             }
             var audit = new AuditTrailModel
             {
                 Activity   = "Searched item in customer list. SEARCH KEY: " + searchkey,
                 ModuleName = this.GetType().Name,
                 EmployeeID = App.EmployeeID
             };
             SystemClass.InsertLog(audit);
         }
         else
         {
             var result = from p in db.Customers orderby p.FirstName where p.IsActive == true select p;
             foreach (var item in result)
             {
                 var customer = new CustomerEntity
                 {
                     CustomerId = item.CustomerID,
                     Name       = item.FirstName + " " + item.MiddleName + " " + item.LastName,
                     Birthdate  = item.Birthdate.HasValue ? item.Birthdate.Value.ToShortDateString() : ""
                 };
                 customerList.Add(customer);
             }
         }
         customerdg.ItemsSource       = customerList;
         customerdg.SelectedValuePath = "CustomerId";
     }
     else
     {
         Mouse.OverrideCursor = null;
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
     Mouse.OverrideCursor = null;
 }
Пример #18
0
        public void DivisionAdd()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        if (!String.IsNullOrEmpty(txtCode.Text) && !String.IsNullOrEmpty(txtName.Text) && departmentcb.SelectedValue != null)
                        {
                            if (db.Divisions.Any(m => m.DivisionCode == txtCode.Text))
                            {
                                MessageBox.Show("Division code is already used");
                            }
                            else
                            {
                                Model.Division d = new Model.Division();
                                d.DivisionCode = txtCode.Text;
                                d.DivisionName = txtName.Text;
                                d.DepartmentID = (int)departmentcb.SelectedValue;
                                d.IsActive     = true;
                                db.Divisions.Add(d);
                                db.SaveChanges();

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

                                SystemClass.InsertLog(audit);
                                MessageBox.Show("Division added successfully", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                                TextClear();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Fill up necessary fields.", "System Information!", 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);
            }
        }
        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;
        }
Пример #20
0
        public void StatusAdd()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new Model.ImusCityHallEntities())
                    {
                        if (!String.IsNullOrEmpty(txtName.Text) && !String.IsNullOrEmpty(txtCode.Text))
                        {
                            if (db.EmployeeStatus.Any(m => m.EmployeeStatusCode == txtCode.Text))
                            {
                                MessageBox.Show("Employee status code is already used");
                            }
                            else
                            {
                                Model.EmployeeStatu es = new Model.EmployeeStatu();
                                es.EmployeeStatusName = txtName.Text;
                                es.EmployeeStatusCode = txtCode.Text;
                                db.EmployeeStatus.Add(es);
                                db.SaveChanges();

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

                                SystemClass.InsertLog(audit);

                                MessageBox.Show("Status added successfully", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                                TextClear();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Fill up necessary fields.", "System Information!", 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);
            }
        }
Пример #21
0
 private void txtSearch_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         GetSearchedList(txtSearch.Text);
         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);
     }
 }
Пример #22
0
        public void PositionAdd()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        if (!String.IsNullOrEmpty(txtName.Text) && !String.IsNullOrEmpty(txtDesc.Text) && !String.IsNullOrEmpty(cbRank.Text))
                        {
                            Model.EmployeePosition ep = new EmployeePosition();
                            ep.EmployeePositionName = txtName.Text;
                            ep.Description          = txtDesc.Text;
                            ep.EmployeeRankID       = Convert.ToInt32(cbRank.SelectedValue);
                            ep.Active = true;

                            db.EmployeePositions.Add(ep);
                            db.SaveChanges();

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

                            SystemClass.InsertLog(audit);

                            MessageBox.Show("Position added successfully", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                            TextClear();
                        }
                        else
                        {
                            MessageBox.Show("Fill up necessary fields.", "System Information!", 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);
            }
        }
Пример #23
0
        public void CreateCustomer()
        {
            if (SystemClass.CheckConnection())
            {
                if (idtypecb.SelectedValue == null || String.IsNullOrEmpty(idcardnumbertb.Text))
                {
                    MessageBox.Show("Please select identification card presented and id number");
                }
                else
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    ImusCityGovernmentSystem.Model.Customer customer = new Customer();
                    customer.FirstName       = firstnametb.Text;
                    customer.MiddleName      = middlenametb.Text;
                    customer.LastName        = lastnametb.Text;
                    customer.DateAdded       = DateTime.Now;
                    customer.AddedBy         = App.EmployeeID;
                    customer.Birthdate       = birthdatedp.SelectedDate;
                    customer.CompleteAddress = completeaddresstb.Text;
                    customer.IsActive        = true;
                    db.Customers.Add(customer);

                    CustomerIdentificationCard custCard = new CustomerIdentificationCard();
                    custCard.CustomerID = customer.CustomerID;
                    custCard.IdentificationCardTypeID = (int)idtypecb.SelectedValue;
                    custCard.IdentificationNumber     = idcardnumbertb.Text;
                    db.CustomerIdentificationCards.Add(custCard);

                    db.SaveChanges();
                    MessageBox.Show("Data is saved. Please click the save button to continue the transaction");
                    customerId = customer.CustomerID;

                    var audit = new AuditTrailModel
                    {
                        Activity   = "Adde new customer in the database CUSTOMER NAME: " + string.Join(" ", customer.FirstName, customer.MiddleName, customer.LastName),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };
                    SystemClass.InsertLog(audit);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
 private void searchbtn_Click(object sender, RoutedEventArgs e)
 {
     if (String.IsNullOrEmpty(txtSearch.Text))
     {
     }
     else
     {
         var audit = new AuditTrailModel
         {
             Activity   = "Searched item in the empoyee rank list. SEARCH KEY: " + txtSearch.Text,
             ModuleName = this.GetType().Name,
             EmployeeID = App.EmployeeID
         };
         SystemClass.InsertLog(audit);
     }
     GetSearchedList(txtSearch.Text);
 }
Пример #25
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;
        }
        public void PositionUpdate()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        var find = db.EmployeePositions.Find(PositionID);
                        find.EmployeePositionName = txtName.Text;
                        find.Description          = txtDesc.Text;
                        find.EmployeeRankID       = Convert.ToInt32(cbRank.SelectedValue);

                        if (chkActive.IsChecked == true)
                        {
                            find.Active = true;
                        }
                        else
                        {
                            find.Active = false;
                        }
                        db.SaveChanges();

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

                        SystemClass.InsertLog(audit);
                        MessageBox.Show("Position 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);
            }
        }
        public void RankAdd()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        if (!String.IsNullOrEmpty(txtName.Text))
                        {
                            Model.EmployeeRank er = new Model.EmployeeRank();
                            er.EmployeeRankName = txtName.Text;
                            er.RankCode         = txtCode.Text;
                            db.EmployeeRanks.Add(er);
                            db.SaveChanges();

                            var audit = new AuditTrailModel
                            {
                                Activity   = "Added new employee rank in the database. RANK NAME: " + txtName.Text,
                                ModuleName = this.GetType().Name,
                                EmployeeID = App.EmployeeID
                            };

                            SystemClass.InsertLog(audit);

                            MessageBox.Show("Rank added successfully", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                            TextClear();
                        }
                        else
                        {
                            MessageBox.Show("Fill up necessary fields.", "System Information!", 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);
            }
        }
Пример #28
0
        public ActionResult ForgotPassword(User_Forgot_Password userToReset)
        {
            if (ModelState.IsValid)
            {
                var username = userToReset.Username;

                var userModel = new UserModel();
                var resetUser = userModel.GetSpecificUser(username);

                if (resetUser == null)
                {
                    ModelState.AddModelError("", "The Username specified cannot be found! Please try again!");
                }
                else
                {
                    var tempPassword = Membership.GeneratePassword(8, 2);
                    var userFullName = resetUser.First_Name + " " + resetUser.Last_Name;

                    userModel.ChangeUserPassword(resetUser.User_Id, tempPassword);
                    var auditTrail = new AuditTrailModel();
                    auditTrail.InsertAuditTrail(username, "User reset Password" + ":" + userFullName, "SDICMS");

                    var message = "Dear " + userFullName;
                    message += "<br /><br />";
                    message += "A password reset process was requested for your username.<br /><br />";
                    message += "Your new temporary password is: " + tempPassword + "<br /></br />";
                    message += "Please click <a href='" + Url.Action("ResetPassword", "User", null, Request.Url.Scheme, null) + "'>here</a> to reset your password.";

                    var mailSent = Mailer.SendMail(userFullName, resetUser.Email_Address, "Email Reset Request", message);

                    if (mailSent)
                    {
                        ViewBag.Message = string.Format("Reset Instructions was sent to '{0}'. Please review the email and follow the instructions to reset your password", resetUser.Email_Address);
                    }
                    else
                    {
                        ViewBag.Message = "Reset Instructions email could not be sent due to a technical difficulty. Please try again later!";
                    }
                }
            }

            return(View(userToReset));
        }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                int      id             = (int)accountslistlb.SelectedValue;
                FundBank account        = db.FundBanks.Find(id);
                account.FundID        = (int)fundcb.SelectedValue;
                account.BankID        = (int)bankcb.SelectedValue;
                account.AccountNumber = accountnumbertb.Text;
                account.AmountLimit   = Convert.ToDecimal(flooramounttb.Text);
                db.SaveChanges();

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

                SystemClass.InsertLog(audit);
                MessageBox.Show("Account updated succesfully");

                fundcb.IsEnabled          = false;
                bankcb.IsEnabled          = false;
                accountnumbertb.IsEnabled = false;
                flooramounttb.IsEnabled   = false;
                savebtn.IsEnabled         = false;
                editbtn.IsEnabled         = true;


                db = new ImusCityHallEntities();
                accountslistlb.ItemsSource       = db.FundBanks.Where(m => m.IsActive == true).OrderByDescending(m => m.FundBankID).ToList();
                accountslistlb.DisplayMemberPath = "AccountNumber";
                accountslistlb.SelectedValuePath = "FundBankID";
                accountslistlb.SelectedValue     = id;
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void savebtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (SystemClass.CheckConnection())
            {
                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
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    ImusCityGovernmentSystem.Model.Bank bank = db.Banks.Find(BankID);
                    bank.BankCode = bankcodetb.Text;
                    bank.BankName = banknametb.Text;
                    bank.Branch   = branchtb.Text;
                    db.SaveChanges();
                    Mouse.OverrideCursor = null;
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Updated an item in bank list. BANK ID: " + BankID.ToString(),
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                    MessageBox.Show("Bank updated successfully!");
                }
            }
            else
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }

            Mouse.OverrideCursor = null;
        }