Example #1
0
        /// <summary>
        /// Method that retrieves the encrypted password from the table based on
        /// username
        /// </summary>
        /// <param name="userName">UserName</param>
        /// <returns>The encrypted password of the user</returns>
        public string GetEncPassword(string userName)
        {
            //Getting all rows in Users table
            ItemFinderDataSet.UsersDataTable rows = _usersAdapter.GetData();

            //Cast from DataRow to UserRow
            var filteredRows = (ItemFinderDataSet.UsersRow[])rows.Select($"UserName='******'");

            //Returning the password if the returned length of rows is only 1
            return(filteredRows.Length == 1 ? filteredRows[0].Password : null);
        }
 /// <summary>
 /// Gets the payrole report.
 /// </summary>
 /// <param name="sessionID">The sessionID of the current session</param>
 /// <param name="startTime">The start time of the report.</param>
 /// <param name="endTime">The end time of the report.</param>
 /// <returns></returns>
 public PayroleReport GetPayroleReport(string sessionID, DateTime startTime, DateTime endTime)
 {
     PayroleReport re = new PayroleReport();
     UsersTableAdapter uta = new UsersTableAdapter();
     RolePayrateTableAdapter rta = new RolePayrateTableAdapter();
     var payoutTable = rta.GetData();
     var employees = uta.GetData();
     decimal totalPayout = 0;
     re.Employees = new List<EmployeePayout>();
     foreach (var employee in employees)
     {
         EmployeePayout ep = GetEmployeePayout(employee, startTime, endTime, payoutTable);
         if (ep != null)
         {
             totalPayout += ep.TotalPayment;
             re.Employees.Add(ep);
         }
     }
     re.TotalPayout = totalPayout;
     re.StartReportTimeframe = startTime;
     re.EndReportTimeframe = endTime;
     return re;
 }
 /// <summary>
 /// Gets all employees.
 /// </summary>
 /// <param name="sessionID">The sessionID of the current session</param>
 /// <returns></returns>
 public List<EmployeeData> GetAllEmployees(string sessionID)
 {
     UsersTableAdapter uta = new UsersTableAdapter();
     List<EmployeeData> re = new List<EmployeeData>();
     var rows = uta.GetData();
     foreach (var row in rows)
     {
         EmployeeData ed = new EmployeeData();
         ed.id = row.ID;
         ed.name = row.FirstName + " " + row.LastName;
         ed.roles = getRoles(row.ID);
         ed.username = row.Username;
         re.Add(ed);
     }
     return re;
 }
Example #4
0
 private void RefreshGrid()
 {
     grdUsers.DataSource = adpUsers.GetData();
     grdUsers.DataBind();
 }