Beispiel #1
0
        // Declear a delegate variable
        //public delegate void UpdateProgressBarDelegate(int progress);


        public UserInterface()
        {
            UserVerify.VerifyUser verifyUser = new UserVerify.VerifyUser();
            verifyUser.UserID = Environment.UserName;
            bool userVerify = false;

            try
            {
                userVerify = verifyUser.getUserVerify("dbo.TransferDataToSQLApp_User");
            }
            catch (Exception e)
            {
                logger = LogManager.GetCurrentClassLogger();
                logger.Error(e, "UserVerify String Error");
                MessageBox.Show("Error loading UserVerify String", "ERROR");
            }
            string permissionLevel = verifyUser.PermissionLevel;

            try
            {
                string success = userTables.GetJobTasksTables(verifyUser.UserID);
            }
            catch (Exception se)
            {
                logger = LogManager.GetCurrentClassLogger();
                logger.Error(se, "Error loading database");
                MessageBox.Show("Error loading database", "ERROR");
            }
            DataTable JobsList     = userTables.JobsList;
            DataTable JobTasksList = userTables.JobTasksList;


            if (userVerify)
            {
                InitializeComponent();
                //InitializeBackgroundWorker();

                //populate job postings drop-down menu
                for (int r = 0; r < JobsList.Rows.Count; r++)
                {
                    this.JobPos.Items.Add(JobsList.Rows[r][1].ToString());
                }
                if (JobPos.Items.Count == 1)
                {
                    JobPos.Text = JobsList.Rows[0][1].ToString();
                }
            }

            else
            {
                MessageBox.Show("No Permission", "WARNING");
                Load += (s, e) => Close();
                return;
            }
        }
Beispiel #2
0
        public static List <string> retJobList(UserVerify.VerifyUser user)
        {
            List <string> jobs = new List <string>();

            string permissionLevel = user.PermissionLevel;
            string userID          = user.UserID;

            if (permissionLevel == "1")
            {
                // Populate Job Postings List
                string        connectionString = @"Data Source=D2E1CLDB15\SQL16DEVH;" + "Initial Catalog=HCMHRSystems;" + "Integrated Security=True";
                SqlConnection conn             = new SqlConnection(connectionString);

                conn.Open();

                SqlCommand command = new SqlCommand("dbo.spTransferDataToSQLApp_ListofStepsbyUser", conn);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@userID", "linj3842"); //later on change to userID

                SqlDataReader reader = command.ExecuteReader();


                try
                {
                    while (reader.Read())
                    {
                        jobs.Add(reader["JobDescription"].ToString());
                    }
                }

                catch (Exception e)
                {
                    MessageBox.Show("No available job postings");
                }

                conn.Close();
            }

            else if (permissionLevel == "2")
            {
            }

            return(jobs);
        }