//save user that is not an employee
        protected bool saveNonEmployee(string firstname, string lastname, bool resetneeded, bool status, byte UID)
        {
            bool success = false;

            using (EDM.DataSource model = new EDM.DataSource())
            {
                EDM.tbl_Sup_Employees a = new EDM.tbl_Sup_Employees()
                {
                    FirstName   = firstname,
                    LastName    = lastname,
                    IsActive    = status,
                    ResetNeeded = resetneeded,
                    UID         = UID,
                    IsEmployee  = false,
                    CreatedBy   = MISC.getUserID(),
                    CreatedOn   = DateTime.Now
                };
                model.tbl_Sup_Employees.Add(a);
                try
                {
                    model.SaveChanges();
                    success = true;
                }
                catch (Exception exec)
                {
                    MISC.writetoAlertLog(exec.ToString());
                    ShowMessage("Something went wrong and the user could not be created. Kindly try again and if the error persists, refer to the error log for details.", MessageType.Error);
                }
            }
            return(success);
        }
        //insert employee
        public short insert_Employee(string firstName, string lastName, string otherName, DateTime dateHired, byte areaID, Int16 locationID, byte departmentID, byte positionID, byte shiftID, bool isStandbyEmployee, bool isActive, string employeeNumber, byte userID)
        {
            short employeeID = 0;

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    using (EDM.DataSource model = new EDM.DataSource())
                    {
                        //Insert transaction
                        EDM.tbl_Sup_Employees a = new EDM.tbl_Sup_Employees();
                        {
                            a.FirstName      = firstName == "" ? null : firstCharToUpper(firstName);
                            a.LastName       = firstCharToUpper(lastName);
                            a.OtherName      = otherName == "" ? null : firstCharToUpper(otherName);
                            a.DateHired      = dateHired;
                            a.AreaID         = areaID == 0 ? null : (byte?)areaID;
                            a.LocationID     = locationID == 0 ? null : (Int16?)locationID;
                            a.DepartmentID   = departmentID == 0 ? null : (byte?)departmentID;
                            a.PositionID     = positionID == 0 ? null : (byte?)positionID;
                            a.ShiftID        = shiftID == 0 ? null : (byte?)shiftID;
                            a.IsStandbyStaff = isStandbyEmployee;
                            a.IsActive       = isActive;
                            a.EmployeeNumber = employeeNumber;
                            a.IsEmployee     = true;
                            a.CreatedBy      = userID;
                            a.CreatedOn      = DateTime.Now;
                        };
                        model.tbl_Sup_Employees.Add(a);
                        model.SaveChanges();

                        //Get the absenceid
                        employeeID = (from b in model.tbl_Sup_Employees
                                      where b.EmployeeNumber == employeeNumber
                                      select b.EmployeeID
                                      ).FirstOrDefault();

                        //Insert AuditTrail
                        EDM.tbl_AuditLog z = new EDM.tbl_AuditLog();
                        {
                            z.SourceID     = employeeID;
                            z.TableName    = "tbl_Sup_Employees";
                            z.AuditProcess = "Created Employee Record - " + employeeNumber;
                            z.DateTime     = DateTime.Now;
                            z.UserID       = userID;
                        };
                        model.tbl_AuditLog.Add(z);
                        model.SaveChanges();
                    }
                    //commit transaction
                    ts.Complete();
                    successfulCommit = true;
                }
            }
            catch (Exception exec)
            {
                employeeID       = 0;
                successfulCommit = false;
                MISC.writetoAlertLog(exec.ToString());
            }
            return(employeeID);
        }