Esempio n. 1
0
        public UserControlD1()
        {
            InitializeComponent();

            //format listview
            listView1.View = View.Details;
            listView1.Columns.Add("Results");
            listView1.Columns[0].Width = -2;
            listView1.GridLines        = true;
            listView1.HeaderStyle      = System.Windows.Forms.ColumnHeaderStyle.None;

            //create base values for timeDrop
            timeComboBox.SelectedItem = null;
            timeComboBox.SelectedText = "---Time---";
            timeComboBox.Items.Add("8:00:00 AM");
            timeComboBox.Items.Add("10:00:00 AM");
            timeComboBox.Items.Add("1:00:00 PM");
            timeComboBox.Items.Add("3:00:00 PM");

            //set the minimum date to be selected to be today
            dateTimePicker1.MinDate = DateTime.Today;

            docID = docObj.calculateID(docObj.getUserName());
        }
Esempio n. 2
0
        //method used to getNotices to display all notices to a doctor
        public List <string> getNotices()
        {
            //objects and variables used
            //username is only used to get id
            //id is used in query
            DoctorClass docObj  = new DoctorClass();
            Patient     patObj  = new Patient();
            string      docUser = docObj.getUserName();
            string      docID   = docObj.calculateID(docUser);


            //connection
            string          myConnection = connectionCLass;
            MySqlConnection myConn       = new MySqlConnection(myConnection);

            //query
            //in the case of a doctor's notices
            string query = "SET FOREIGN_KEY_CHECKS=0; SELECT * FROM wzb_notice WHERE Send_to = @docID " +
                           "AND (Type_is = 'RD' OR Type_is = 'AD' OR Type_is = 'PD' OR Type_is = 'DD');SET FOREIGN_KEY_CHECKS=1";
            MySqlCommand cmd = new MySqlCommand(query, myConn);

            cmd.Parameters.AddWithValue("@docID", docID);
            MySqlDataReader myReader;

            //list to store notices
            List <string> noticeList = new List <string>();

            try
            {
                myConn.Open();
                myReader = cmd.ExecuteReader();
                while (myReader.Read())
                {
                    //store values
                    ID   = myReader["ID"].ToString();
                    type = myReader["Type_is"].ToString();

                    //check type and convert to string
                    //----------
                    // Group
                    //----------

                    // Doctor
                    //----------
                    // Set Appt ------------------------ A
                    // Grant/Reject Refills ------------ R

                    // Patient
                    //----------
                    // Request Phone Call -------------- P
                    // Doctor Asks for Medical Permis -- M

                    //----------
                    // Individual
                    //----------
                    // Pharmacy Recevies Refill Req ---- E
                    // Pharmacy Receives New Presc ----- N
                    // When Medicine is Ready ---------- W
                    // Doctor DIscuss with Pharmacy ---- D
                    if (type == "R")
                    {
                        type = "Refill Request";
                    }
                    else if (type == "P")
                    {
                        type = "Phone Call Request";
                    }
                    else
                    {
                        type = "Appointment Request";
                    }

                    to   = myReader["Send_to"].ToString();
                    from = myReader["Received_from"].ToString();

                    from = patObj.getPatientName(from);

                    message = myReader["Message"].ToString();

                    //build a string to add to to listview
                    noticeList.Add("Notice ID: " + ID + "  |  " + type + "  |  From: " + from + "  |  Message: " + message);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                myConn.Close();
            }

            //return the list of string objects
            return(noticeList);
        }