Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: M3dic/M3dic
        private void adminLogin()
        {
            Register_LoginMYSQL   _LoginMYSQL    = new Register_LoginMYSQL();
            List <List <string> > AdminsRegister = _LoginMYSQL.checkAdminLogin();
            List <string>         CurrentAdmin   = new List <string>();

            try
            {
                CurrentAdmin = AdminsRegister.Find(x => x[0] == textBox1.Text && x[1] == textBox2.Text);
            }
            catch (Exception)
            {
            }
            if (CurrentAdmin == null)
            {
                MessageBox.Show("Invalid Admins details, please contact support!", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MessageBox.Show($"Welcome Admin {CurrentAdmin[2]} ", "Welcome admin", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            Admin child = new Admin(CurrentAdmin[2], CurrentAdmin[0], CurrentAdmin[3], CurrentAdmin[1]); //create new isntance of form

            child.FormClosed += new FormClosedEventHandler(child_FormClosed);                            //add handler to catch when child form is closed
            child.Show();                                                                                //show child
            this.Hide();                                                                                 //hide parent
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: M3dic/M3dic
        private void receptionistLogin()
        {
            Register_LoginMYSQL   _LoginMYSQL         = new Register_LoginMYSQL();
            List <List <string> > receptionistLogin   = _LoginMYSQL.checkReceptionistLogin();
            List <string>         currentreceptionist = new List <string>();

            try
            {
                currentreceptionist = receptionistLogin.Find(x => x[0] == textBox1.Text && x[1] == textBox2.Text);
            }
            catch (Exception)
            {
            }
            if (currentreceptionist == null)
            {
                MessageBox.Show("Invalid Receptionist details, please contact Admin!", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MessageBox.Show($"Welcome Receptionist {currentreceptionist[2]} ", "Welcome Receptionist", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            Receptionist child = new Receptionist(currentreceptionist[2], currentreceptionist[0], currentreceptionist[3], currentreceptionist[1]); //create new isntance of form

            child.FormClosed += new FormClosedEventHandler(child_FormClosed);                                                                      //add handler to catch when child form is closed
            child.Show();                                                                                                                          //show child
            this.Hide();                                                                                                                           //hide parent
        }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: M3dic/M3dic
        private void doctorlogin()
        {
            Register_LoginMYSQL   _LoginMYSQL        = new Register_LoginMYSQL();
            List <List <string> > doctorregistration = _LoginMYSQL.checkDoctorLogin();
            List <string>         currentdoctor      = new List <string>();

            try
            {
                currentdoctor = doctorregistration.Find(x => x[0] == textBox1.Text && x[1] == textBox2.Text);
            }
            catch (Exception)
            {
            }
            if (currentdoctor == null)
            {
                MessageBox.Show("Invalid Doctor details, please contact Admin!", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MessageBox.Show($"Welcome Doctor {currentdoctor[2]} ", "Welcome doctor", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            Doctor child = new Doctor(currentdoctor[2], currentdoctor[0], currentdoctor[3], currentdoctor[1], currentdoctor[4]); //create new isntance of form

            child.FormClosed += new FormClosedEventHandler(child_FormClosed);                                                    //add handler to catch when child form is closed
            child.Show();                                                                                                        //show child
            this.Hide();                                                                                                         //hide parent
        }
Exemplo n.º 4
0
        private void button33_Click(object sender, EventArgs e)//upgrade patient information
        {
            if (textBox21.Text != null)
            {
                Register_LoginMYSQL changeINFO = new Register_LoginMYSQL();
                changeINFO.updateinformation(textBox21.Text, textBox25.Text, textBox28.Text, textBox32.Text, textBox24.Text, textBox27.Text, textBox31.Text);
                MessageBox.Show("Information updated successfully", "Information Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Please select from the table down", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            string          query       = "datasource=35.194.46.32;port=3306;username=m3dic;password=\"M3dic\"";
            MySqlConnection conDataBase = new MySqlConnection(query);
            MySqlCommand    cmdDataBase = new MySqlCommand("select sequre_number as 'Special ID', first_name as 'First Name', last_name as 'Last Name',CNIC,Gender , phone_number as 'Phone', date,placed,address,city  from M3dic.register", conDataBase);

            try
            {
                MySqlDataAdapter sda = new MySqlDataAdapter();
                sda.SelectCommand = cmdDataBase;
                DataTable dbdataset = new DataTable();
                sda.Fill(dbdataset);
                BindingSource bSorce = new BindingSource();
                bSorce.DataSource        = dbdataset;//setting db table to grid source
                dataGridView4.DataSource = bSorce;
                sda.Update(dbdataset);
            }
            catch (Exception)
            {
                MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void PharmacistLogin()
        {
            //doing ph login
            Register_LoginMYSQL   _LoginMYSQL         = new Register_LoginMYSQL();
            List <List <string> > pharmacyLogin       = _LoginMYSQL.chackPharmacyLogin();//getting PH users
            List <string>         currentreceptionist = new List <string>();

            try
            {
                currentreceptionist = pharmacyLogin.Find(x => x[0] == textBox1.Text && x[1] == textBox2.Text);//comparing with input
            }
            catch (Exception)
            {
            }
            if (currentreceptionist == null)//if it is null => not valid input
            {
                MessageBox.Show("Invalid Pharmacist details, please contact Admin!", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MessageBox.Show($"Welcome Pharmacist {currentreceptionist[2]} ", "Welcome Pharmacist", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            //opening PH form
            pharmacist child = new pharmacist(currentreceptionist[2], currentreceptionist[0], currentreceptionist[3], currentreceptionist[1]); //create new isntance of form

            child.FormClosed += new FormClosedEventHandler(child_FormClosed);                                                                  //add handler to catch when child form is closed
            child.Show();                                                                                                                      //show child
            this.Hide();                                                                                                                       //hide parent
        }
Exemplo n.º 6
0
        private void button14_Click(object sender, EventArgs e)
        {
            if (textBox21.Text != null)
            {
                Register_LoginMYSQL changeINFO = new Register_LoginMYSQL();
                changeINFO.DeletePerson(textBox21.Text);
                MessageBox.Show("Information updated successfully", "Information Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Please select from the table down", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            string          query       = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\"";
            MySqlConnection conDataBase = new MySqlConnection(query);
            MySqlCommand    cmdDataBase = new MySqlCommand($"select placed_appointment, patient_id as 'Special ID', patient_name as 'Name',dignose ,floor_placed, room_placed,bed_number ,appointment_data,appointment_time from M3dic.patients_appointment where doctor_name = '{this.name}' order by patient_name", conDataBase);

            try
            {
                MySqlDataAdapter sda = new MySqlDataAdapter();
                sda.SelectCommand = cmdDataBase;
                DataTable dbdataset = new DataTable();
                sda.Fill(dbdataset);
                BindingSource bSorce = new BindingSource();
                bSorce.DataSource        = dbdataset;
                dataGridView5.DataSource = bSorce;
                sda.Update(dbdataset);
            }
            catch (Exception)
            {
                MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
        private void button5_Click(object sender, EventArgs e)
        {
            Clera();
            Random rand = new Random();
            Register_LoginMYSQL newRegister = new Register_LoginMYSQL();
            int num = rand.Next(1000, 9999);

            while (newRegister.FindID().Contains(num))
            {
                num = rand.Next(1000, 9999);
            }
            textBox3.Text  = "P" + num;
            textBox6.Text  = textBox3.Text;
            panel3.Visible = true;
        }
Exemplo n.º 8
0
        private void button8_Click(object sender, EventArgs e)
        {
            if (!isValidInput())
            {
                MessageBox.Show("Please enter correct input", "Incorrect input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                Register_LoginMYSQL newRegister = new Register_LoginMYSQL();
                string gender = null;
                if (textBox10.Text != "")
                {
                    if (checkemail(textBox10.Text))
                    {
                        send_messaga(textBox10.Text, textBox3.Text, textBox9.Text);
                    }
                }

                if (radioButton1.Checked)
                {
                    gender = radioButton1.Text;
                }
                else if (radioButton2.Checked)
                {
                    gender = radioButton2.Text;
                }
                else if (radioButton3.Checked)
                {
                    gender = radioButton3.Text;
                }

                newRegister.Insert(textBox4.Text, textBox5.Text, textBox6.Text, gender, int.Parse(textBox8.Text), textBox9.Text + " " + textBox13.Text,
                                   textBox7.Text, textBox10.Text, textBox11.Text, textBox12.Text, textBox3.Text, textBox1.Text);

                MessageBox.Show("Registration as patient, ready!", "Registration ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
                panel3.Visible = false;
                Clera();
            }
            catch (Exception)
            {
                MessageBox.Show("Please enter correct input", "Incorrect input", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 9
0
        }//ok

        private bool checkemail(string text)
        {
            Register_LoginMYSQL newRegister = new Register_LoginMYSQL();

            if (!IsValidEmail(text))
            {
                MessageBox.Show("Please enter valid email and check the notes", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            if (newRegister.SearchEmails().Contains(text))
            {
                List <string> ll            = newRegister.FindPassword().Find(x => x[2] == text);
                string        sequre_number = ll[0];
                string        password      = ll[1];
                resend_email(text, sequre_number, password);
                return(true);
            }
            return(false);
        }//ok
Exemplo n.º 10
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             dataGridView1.CurrentRow.Selected = true;
             textBox8.Text = dataGridView1.Rows[e.RowIndex].Cells["Special ID"].FormattedValue.ToString();
         }
         Register_LoginMYSQL infopatient  = new Register_LoginMYSQL();
         List <string>       infopatients = infopatient.patientINFO(textBox8.Text);
         textBox6.Text = infopatients[0];
         textBox4.Text = infopatients[1];
         textBox7.Text = infopatients[3];
         textBox5.Text = infopatients[4];
         textBox1.Text = infopatients[6];
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 11
0
        private void sendAdminPassword(string adminemail)
        {
            Register_LoginMYSQL newRegister = new Register_LoginMYSQL();

            List <string> admin = newRegister.checkAdminLogin().Find(x => x[3] == adminemail);//getting admin with entered email

            if (admin == null)
            {
                MessageBox.Show("Please check the entered admin email", "Incorrect admin email", MessageBoxButtons.OK, MessageBoxIcon.Question);
                return;
            }
            //otherwise getting his details needed for the form
            string sequre_number = admin[0];
            string password      = admin[1];

            try
            {
                SmtpClient client = new SmtpClient();
                client.Port                  = 587;
                client.Host                  = "smtp.gmail.com";
                client.EnableSsl             = true;
                client.Timeout               = 10000;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "08857490200");
                //sending email to email
                MailMessage mm = new MailMessage("*****@*****.**", $"{adminemail}", "You have already account", $"\nUser: {sequre_number} \nPassword: {password}");
                mm.BodyEncoding = UTF8Encoding.UTF8;
                mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

                client.Send(mm);

                MessageBox.Show("Check admin email for special ID and password", "Email sent", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }//sending email to the correct input
            catch (Exception)
            {
                MessageBox.Show("Please correct Admin email or contact support!", "Email error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 12
0
 private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             dataGridView2.CurrentRow.Selected = true;
             textBox17.Text = dataGridView2.Rows[e.RowIndex].Cells["Special ID"].FormattedValue.ToString();
             textBox20.Text = dataGridView2.Rows[e.RowIndex].Cells["dignose"].FormattedValue.ToString();
         }
         label27.Text = textBox17.Text + " - Diagnose";
         Register_LoginMYSQL infopatient  = new Register_LoginMYSQL();
         List <string>       infopatients = infopatient.patientINFO(textBox17.Text);
         textBox15.Text = infopatients[0];
         textBox13.Text = infopatients[1];
         textBox11.Text = infopatients[2];
         textBox16.Text = infopatients[3];
         textBox14.Text = infopatients[4];
         textBox12.Text = infopatients[5];
         textBox10.Text = infopatients[6];
         doctorSQL     checkforPRID = new doctorSQL();
         List <string> ID           = checkforPRID.checkPRID(textBox17.Text);
         if (ID.Count == 0)//no such prescription
         {
             label65.Text  = checkforPRID.lastprid();
             label66.Text  = DateTime.Today.ToString();
             button13.Text = "GENERATE PRESCRIPTION";
         }
         else
         {
             label65.Text  = ID[0];
             label66.Text  = ID[1];
             button13.Text = "UPDATE";
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 13
0
 private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dataGridView3.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             dataGridView3.CurrentRow.Selected = true;
             textBox45.Text = dataGridView3.Rows[e.RowIndex].Cells["patient_id"].FormattedValue.ToString();
             textBox39.Text = dataGridView3.Rows[e.RowIndex].Cells["appointment_data"].FormattedValue.ToString();
             textBox38.Text = dataGridView3.Rows[e.RowIndex].Cells["appointment_time"].FormattedValue.ToString();
         }
         Register_LoginMYSQL infopatient  = new Register_LoginMYSQL();
         List <string>       infopatients = infopatient.patientINFOtt(textBox45.Text);
         textBox43.Text = infopatients[0];
         textBox41.Text = infopatients[1];
         textBox44.Text = infopatients[2];
         textBox42.Text = infopatients[3];
         textBox40.Text = infopatients[4];
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 14
0
Arquivo: Form1.cs Projeto: M3dic/M3dic
        private bool forgottenpassword(string text)
        {
            Register_LoginMYSQL newRegister = new Register_LoginMYSQL();

            if (newRegister.SearchEmails().Contains(text))
            {
                List <string> ll            = newRegister.FindPassword().Find(x => x[2] == text);
                string        sequre_number = ll[0];
                string        password      = ll[1];
                try
                {
                    SmtpClient client = new SmtpClient();
                    client.Port                  = 587;
                    client.Host                  = "smtp.gmail.com";
                    client.EnableSsl             = true;
                    client.Timeout               = 10000;
                    client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "08857490200");

                    MailMessage mm = new MailMessage("*****@*****.**", $"{text}", "You have already account", $"\nUser: {sequre_number} \nPassword: {password}");
                    mm.BodyEncoding = UTF8Encoding.UTF8;
                    mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

                    client.Send(mm);

                    MessageBox.Show("Check email for Id and password", "Email sent", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    //MessageBox.Show("Please correct email or contact support!", "Email error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(true);
            }
            return(false);
        }