Пример #1
0
        public List <string> execute()
        {
            convertDate();
            string       query = "Select u_id from user where concat(first_name, ' ', last_name) = @fn;";
            MySqlCommand a     = new MySqlCommand(query);

            a.Parameters.AddWithValue("@fn", doctor);
            dbConnector.setValues(a, "07");
            databaseResponse = dbConnector.executeQuery();

            string       query2 = "INSERT INTO appointmentbookingdetail (physician_id,patient_id,date,time,cause) values (@physician_id,@patient_id,@date,@time,'regular check up');";
            MySqlCommand b      = new MySqlCommand(query2);

            b.Parameters.AddWithValue("@physician_id", databaseResponse[0]);
            b.Parameters.AddWithValue("@patient_id", patient);
            b.Parameters.AddWithValue("@date", apptDate);
            b.Parameters.AddWithValue("@time", apptTime);
            dbConnector.setValues(b, "03");
            databaseResponse.Clear();
            databaseResponse = dbConnector.executeQuery();

            //bookHelper(databaseResponse[0]);
            sendBack.Add("07");
            sendBack.Add(databaseResponse[0]);
            return(sendBack);
        }
Пример #2
0
        public List <string> execute()
        {
            string       query = "delete from appointmentbookingdetail where appointment_id = @appointment_id ;";
            MySqlCommand a     = new MySqlCommand(query);

            a.Parameters.AddWithValue("@appointment_id", apptID);
            dbConnector.setValues(a, "03");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("03");
            sendBack.Add(databaseResponse[0]);

            return(sendBack);
        }
Пример #3
0
        public List <string> execute()
        {
            string       query = "select forum_id,content,post_date,post_time from question_Forum;";
            MySqlCommand a     = new MySqlCommand(query);

            dbConnector.setValues(a, "08");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("08");
            for (int i = 0; i < databaseResponse.Count; i++)
            {
                sendBack.Add(databaseResponse[i]);
            }
            return(sendBack);
        }
Пример #4
0
        public List <string> execute()
        {
            string       query = "SELECT concat(first_name,' ',last_name) from user where role='D';";
            MySqlCommand a     = new MySqlCommand(query);

            dbConnector.setValues(a, "04");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("04");
            for (int i = 0; i < databaseResponse.Count; i++)
            {
                sendBack.Add(databaseResponse[i]);
            }

            return(sendBack);
        }
Пример #5
0
        public List <string> execute()
        {
            string       query = "select appointment_id,physician_id,date,time,cause from appointmentbookingdetail where patient_id=@patient_id order by appointment_id desc;";
            MySqlCommand a     = new MySqlCommand(query);

            a.Parameters.AddWithValue("@patient_id", username);
            dbConnector.setValues(a, "02");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("02");
            for (int i = 0; i < databaseResponse.Count; i++)
            {
                sendBack.Add(databaseResponse[i]);
            }

            return(sendBack);
        }
Пример #6
0
        public List <string> execute()
        {
            string       query = "select time from appointmentbookingdetail a join user u on u.u_id=a.physician_id where concat(first_name, ' ', last_name) = @fn and  date = @date;";
            MySqlCommand a     = new MySqlCommand(query);

            a.Parameters.AddWithValue("@date", apptDate);
            a.Parameters.AddWithValue("@fn", doctor);
            dbConnector.setValues(a, "06");
            databaseResponse = dbConnector.executeQuery();
            foreach (string s in databaseResponse)
            {
                sendBack.Remove(s);
            }
            sendBack.Insert(0, "06");
            return(sendBack);
        }
Пример #7
0
        public List <string> execute()
        {
            string       query = "Select concat(first_name,' ',last_name) from user u join login l on u.u_id=l.u_id where l.u_id=@u_id and binary l.password = @password;";
            MySqlCommand a     = new MySqlCommand(query);

            a.Parameters.AddWithValue("@u_id", username);
            a.Parameters.AddWithValue("@password", password);
            //databaseCommunicator myDB = new databaseCommunicator(a, "01");
            dbConnector.setValues(a, "01");
            databaseResponse = dbConnector.executeQuery();
            //databaseResponse = myDB.executeQuery();
            sendBack.Add("01");
            sendBack.Add(databaseResponse[0]);
            sendBack.Add(databaseResponse[1]);

            return(sendBack);
        }
Пример #8
0
        public List <string> execute()
        {
            string query = "Insert into question_Forum(mem_id,content,post_date,post_time) "
                           + "VALUES(@mem_id, @content, @post_date, @post_time);";
            MySqlCommand a = new MySqlCommand(query);

            a.Parameters.AddWithValue("@mem_id", postID);
            a.Parameters.AddWithValue("@content", content);
            a.Parameters.AddWithValue("@post_date", postDate);
            a.Parameters.AddWithValue("@post_time", postTime);
            dbConnector.setValues(a, "03");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("10");
            sendBack.Add(databaseResponse[0]);

            return(sendBack);
        }
Пример #9
0
        public List <string> execute()
        {
            string query = "select 'anonymous',content,post_date,post_time from reply_Forum join user on u_id=mem_id "
                           + "WHERE role = 'U'and p_forum_id = @p_forum_id union "
                           + "SELECT concat(first_name, ' ', last_name),content,post_date,post_time from reply_Forum join user on u_id = mem_id "
                           + "WHERE role = 'D' and p_forum_id = @p_forum_id order by post_time;";
            MySqlCommand a = new MySqlCommand(query);

            a.Parameters.AddWithValue("@p_forum_id", postID);
            dbConnector.setValues(a, "09");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("09");
            for (int i = 0; i < databaseResponse.Count; i++)
            {
                sendBack.Add(databaseResponse[i]);
            }
            return(sendBack);
        }
Пример #10
0
        public List <string> execute()
        {
            Console.WriteLine("NewReply executing...");
            string query = "Insert into reply_Forum(p_forum_id,mem_id,content,post_date,post_time) "
                           + "VALUES(@p_forum_id, @mem_id, @content, @post_date, @post_time);";
            MySqlCommand a = new MySqlCommand(query);

            a.Parameters.AddWithValue("@p_forum_id", postID);
            a.Parameters.AddWithValue("@mem_id", username);
            a.Parameters.AddWithValue("@content", content);
            a.Parameters.AddWithValue("@post_date", postDate);
            a.Parameters.AddWithValue("@post_time", postTime);
            dbConnector.setValues(a, "03");
            databaseResponse = dbConnector.executeQuery();
            sendBack.Add("11");
            sendBack.Add(databaseResponse[0]);

            return(sendBack);
        }
Пример #11
0
        public List <string> execute()
        {
            string query = "Select Date(date), concat(first_name,' ', last_name) as name "
                           + " from appointmentbookingdetail a join user u on u.u_id = a.physician_id "
                           + " where concat(first_name, ' ', last_name) = @fn and date >= current_date "
                           + " group by physician_id,date having count(date) = 8 ;";
            MySqlCommand a = new MySqlCommand(query);

            a.Parameters.AddWithValue("@fn", doctor);
            dbConnector.setValues(a, "05");
            databaseResponse = dbConnector.executeQuery();
            string x, y;

            for (int i = 0; i < databaseResponse.Count; i++)
            {
                x = databaseResponse[i];
                y = x.Split(' ').First();
                dateList.Add(y);
            }
            DateTime dat = DateTime.Today;

            for (int i = 0; i <= 30; i++)
            {
                DateTime d1 = dat.AddDays(i);
                string   d  = d1.ToString();
                string   e  = d.Split(' ').First();
                sendBack.Add(e);
            }
            foreach (string date in dateList)
            {
                sendBack.Remove(date);
            }

            sendBack.Insert(0, "05");
            return(sendBack);
        }