private void btnSched_Click(object sender, EventArgs e) { dbProvider db = new dbProvider(); int a = 0; int idSched = a; string id = dsp_id2.Text; string doctor = doc_ID.Text; string remarks = txt_remarks.Text; string date = sdate_txt.Text; string time = time_txt.Text; string thisTime = thistime.Text; string stat = "Pending"; if (id == "" || doctor == "" || remarks == "" || date == "" || time == "") { MessageBox.Show("Please complete the schedule form!"); } else if (id != "" || doctor != "" || remarks != "" || date != "" || time != "") { db.addSched(idSched, id, doctor, remarks, date, time, thisTime, stat); MessageBox.Show("Patient succesfully scheduled!"); this.Close(); } }
private void btn_MedAdd_Click(object sender, EventArgs e) { dbProvider db = new dbProvider(); int b = 0; int idMed = b; int idemp = Convert.ToInt32(dsp_id.Text); string tongue = txt_tongue.Text; string palate = txt_palate.Text; string tonsil = txt_tonsil.Text; string lips = txt_lips.Text; string floor = txt_floorOfMouth.Text; string cheeks = txt_cheeks.Text; string allergy = txt_allergy.Text; string heart = txt_HeartDisease.Text; string blood = txt_BloodDyscracia.Text; string diabetes = txt_Diabetes.Text; string kidney = txt_kidney.Text; string liver = txt_liver.Text; string hygiene = txt_hygiene.Text; string others = txt_others.Text; db.addMed(idMed, idemp, tongue, palate, tonsil, lips, floor, cheeks, allergy, heart, blood, diabetes, kidney, liver, hygiene, others); MessageBox.Show("Sucessfuly Updated!"); db.Populate(ptnt_view, @"SELECT * FROM clinic.tbl_patient WHERE 1"); goBack(); }
private void btn_BasicUpdate_Click(object sender, EventArgs e) { dbProvider db = new dbProvider(); SystemSounds.Exclamation.Play(); DialogResult dialog = MessageBox.Show("You are sure to update patients information?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialog == DialogResult.Cancel) { } else if (dialog == DialogResult.OK) { string fname = dsp_fname.Text; string lname = dsp_lname.Text; string mi = dsp_mi.Text; string bday = select_bday.Text.ToString(); string gender = select_gender.Text.ToString(); string addCrnt = dsp_currAdd.Text; string addPer = dsp_perAdd.Text; string Wnum = dsp_wnum.Text; string Hnum = dsp_hnum.Text; string Mnum = dsp_mnum.Text; if (fname == "" || lname == "" || mi == "" || bday == "" || gender == "" || addCrnt == "" || Mnum == "") { MessageBox.Show("Please complete the form!"); } else if (fname != "" || lname != "" || mi != "" || bday != "" || gender != "" || addCrnt != "" || Mnum != "") { string command = "UPDATE clinic.tbl_patient SET Ptnt_Fname='" + fname + "', Ptnt_Minitial='" + mi + "', Ptnt_Lname='" + lname + "', Ptnt_bday='" + bday + "', Ptnt_CurntAdd='" + addCrnt + "', Ptnt_pmntAdd='" + addPer + "', Ptnt_HomeNum='" + Hnum + "', Ptnt_WorkNum='" + Wnum + "', Ptnt_MobileNum='" + Mnum + "' where Ptnt_id ='" + this.dsp_id.Text + "'"; con = new MySqlConnection(conString()); cmd = new MySqlCommand(command, con); try { con.Open(); reader = cmd.ExecuteReader(); MessageBox.Show("Succesfully Updated!"); while (reader.Read()) { } db.Populate(ptnt_view, @"SELECT * FROM clinic.tbl_patient WHERE 1"); goBack(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
//public string conString() //{ // return ""; ; //} private void btnCreate_Click(object sender, EventArgs e) { MySqlConnection con = new MySqlConnection("Server=localhost;user id = dbconnection; password = 09353276080; Database = clinic"); con.Open(); MySqlCommand cmd = new MySqlCommand("select * from users where username=@Name", con); cmd.Parameters.AddWithValue("@Name", txt_uname.Text); MySqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { MessageBox.Show("Username already taken!"); txt_uname.Text = ""; } else { dbProvider db = new dbProvider(); int a = 0; int idemp = a; string fname = txt_fname.Text; string lname = txt_lname.Text; string uname = txt_uname.Text; string pass = txt_repass.Text; string gender = txt_gender.Text.ToString(); string acctype = txt_AccountType.Text.ToString(); string pos = txt_position.Text.ToString(); string stat = txt_stat.Text.ToString(); string active = "Y"; string number = contact_number.Text; //encrypt string layer1 = db.getMD5(pass); string layer2 = db.getMD5(layer1); string layer3 = db.getMD5(layer2); string layer4 = db.getMD5(layer3); string layer5 = db.getMD5(layer4); if (fname == "" || lname == "" || uname == "" || pass == "" || gender == "" || stat == "" || number == "" || acctype == "" || pos == "") { MessageBox.Show("Please complete the form!"); } else if (fname != "" || lname != "" || uname != "" || pass != "" || gender != "" || stat != "" || number != "" || acctype != "" || pos != "") { if (txt_pass.Text != txt_repass.Text) { MessageBox.Show("Password did not match!"); txt_pass.Text = ""; txt_repass.Text = ""; } else { db.add(idemp, fname, lname, uname, layer5, number, gender, acctype, pos, stat, active); MessageBox.Show("Account sucessfuly registered!"); this.Close(); } } } }