Beispiel #1
0
        public Models.QueueRollModel GetQueueRoll(Models.QueueRollModel QueueRoll)
        {
            var dbCon = DBConnection;

            if (dbCon.IsConnect())
            {
                string query  = string.Format("SELECT rollid, queueid, employeeid, taskid, startdate, stopdate, minutes, rate FROM queueroll where rollid={0}", QueueRoll.RollId);
                var    cmd    = new MySqlCommand(query, dbCon.Connection);
                var    reader = cmd.ExecuteReader();

                EmployeeQueries EmployeeQuery = new EmployeeQueries();
                TaskQueries     TaskQuery     = new TaskQueries();
                while (reader.Read())
                {
                    QueueRoll.RollId     = int.Parse(reader["rollid"].ToString());
                    QueueRoll.QueueId    = int.Parse(reader["queueid"].ToString());
                    QueueRoll.EmployeeId = int.Parse(reader["employeeid"].ToString());
                    QueueRoll.TaskId     = int.Parse(reader["taskid"].ToString());
                    QueueRoll.Employee   = EmployeeQuery.GetEmployee(QueueRoll.EmployeeId);
                    QueueRoll.Task       = TaskQuery.GetTask(QueueRoll.TaskId);
                }
                dbCon.Close();
            }

            return(QueueRoll);
        }
Beispiel #2
0
        public List <Models.QueueRollModel> GetQueuesRoll()
        {
            List <Models.QueueRollModel> QueuesRoll = new List <Models.QueueRollModel>();
            var dbCon = DBConnection;

            if (dbCon.IsConnect())
            {
                string          query         = string.Format("SELECT rollid, queueid, employeeid, taskid, startdate, stopdate, minutes, rate FROM queueroll");
                var             cmd           = new MySqlCommand(query, dbCon.Connection);
                var             reader        = cmd.ExecuteReader();
                EmployeeQueries EmployeeQuery = new EmployeeQueries();
                TaskQueries     TaskQuery     = new TaskQueries();
                while (reader.Read())
                {
                    Models.QueueRollModel Queue = new Models.QueueRollModel
                    {
                        QueueId    = int.Parse(reader["queueid"].ToString()),
                        EmployeeId = int.Parse(reader["employeeid"].ToString()),
                        TaskId     = int.Parse(reader["taskid"].ToString()),
                        Employee   = EmployeeQuery.GetEmployee(int.Parse(reader["employeeid"].ToString())),
                        Task       = TaskQuery.GetTask(int.Parse(reader["taskid"].ToString()))
                    };

                    QueuesRoll.Add(Queue);
                }
                dbCon.Close();
            }

            return(QueuesRoll);
        }
        public Models.QueueModel GetQueue(Models.QueueModel Queue)
        {
            var dbCon = DBConnection;

            if (dbCon.IsConnect())
            {
                string query  = string.Format("SELECT queueid, employeeid, taskid FROM queue where queueid={0}", Queue.QueueId);
                var    cmd    = new MySqlCommand(query, dbCon.Connection);
                var    reader = cmd.ExecuteReader();

                EmployeeQueries EmployeeQuery = new EmployeeQueries();
                TaskQueries     TaskQuery     = new TaskQueries();
                while (reader.Read())
                {
                    Queue.QueueId    = int.Parse(reader["Queueid"].ToString());
                    Queue.EmployeeId = int.Parse(reader["employeeid"].ToString());
                    Queue.TaskId     = int.Parse(reader["taskid"].ToString());
                    Queue.Employee   = EmployeeQuery.GetEmployee(Queue.EmployeeId);
                    Queue.Task       = TaskQuery.GetTask(Queue.TaskId);
                }
                dbCon.Close();
            }

            return(Queue);
        }
        public List <Models.QueueModel> GetQueues(int EmployeeId, bool isAdmin)
        {
            List <Models.QueueModel> Queues = new List <Models.QueueModel>();
            var dbCon = DBConnection;

            if (dbCon.IsConnect())
            {
                string query = "";
                if (isAdmin == true)
                {
                    query = string.Format("SELECT queueid, employeeid, taskid FROM queue");
                }
                else
                {
                    query = string.Format("SELECT queueid, employeeid, taskid FROM queue where employeeid=" + EmployeeId);
                }


                var             cmd           = new MySqlCommand(query, dbCon.Connection);
                var             reader        = cmd.ExecuteReader();
                EmployeeQueries EmployeeQuery = new EmployeeQueries();
                TaskQueries     TaskQuery     = new TaskQueries();
                while (reader.Read())
                {
                    Models.QueueModel Queue = new Models.QueueModel
                    {
                        QueueId    = int.Parse(reader["Queueid"].ToString()),
                        EmployeeId = int.Parse(reader["description"].ToString()),
                        TaskId     = int.Parse(reader["rate"].ToString()),
                        Employee   = EmployeeQuery.GetEmployee(int.Parse(reader["employeeid"].ToString())),
                        Task       = TaskQuery.GetTask(int.Parse(reader["taskid"].ToString()))
                    };

                    Queues.Add(Queue);
                }
                dbCon.Close();
            }

            return(Queues);
        }