protected void Button16_Click(object sender, EventArgs e) { try { DateTime date = DateTime.Now; string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand("SELECT MAX(Prescription_ID) FROM Prescription"); int preid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("INSERT INTO Prescription(Prescription_ID,Medical_officer,Issue_date,Issue_month,Issue_year,Medicine,Dosage,Notes,Patient_ID,date) VALUES(@Prescription_ID,@Medical_officer,@Issue_date,@Issue_month,@Issue_year,@Medicine,@Dosage,@Notes,@Patient_ID,@date)"); dw.SetSqlCommandParameters("Prescription_ID", preid); dw.SetSqlCommandParameters("Medical_officer", DropDownList17.SelectedValue); dw.SetSqlCommandParameters("Issue_date", DropDownList18.SelectedValue); dw.SetSqlCommandParameters("Issue_month", DropDownList19.SelectedValue); dw.SetSqlCommandParameters("Issue_year", DropDownList20.SelectedValue); dw.SetSqlCommandParameters("Medicine", DropDownList21.SelectedValue.Trim()); dw.SetSqlCommandParameters("Dosage", TextBox22.Text.Trim()); dw.SetSqlCommandParameters("Notes", TextBox27.Text.Trim()); dw.SetSqlCommandParameters("Patient_ID", ApptP_ID); dw.SetSqlCommandParameters("date", date); dw.Insert(); DropDownList21.SelectedIndex = 0; TextBox22.Text = ""; TextBox27.Text = ""; this.Button14_ModalPopupExtender.Show(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { uid = Session["User_ID"].ToString(); uname = Session["User_name"].ToString(); pid = Session["Patient_ID"].ToString(); } catch { Response.Redirect("~/Account/Login.aspx"); } string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); try { // Doctor Table ==================================================================================== dw.SetDataAdapter(@"select * from Doctor where User_ID='" + uid + "' "); DataTable dt = dw.GetDataTable(); string name = (dt.Rows[0][8].ToString()).Trim() + " " + (dt.Rows[0][9].ToString()).Trim(); lblName.Text = name; //Name lblPhn.Text = "User " + (dt.Rows[0][1].ToString()).Trim(); //UID } catch { } }
protected void Button13_Click(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); string labid = Session["lab_id"].ToString(); dw.SetCommand("UPDATE Labreport SET Medical_officer=@moff, Patient_ID=@pid, Issue_date=@isd, Issue_month=@ism, Issue_year=@isy, Report_type=@rtype WHERE Lab_report_ID='" + labid + "'"); //dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("moff", DropDownList13.SelectedValue); dw.SetSqlCommandParameters("pid", ApptP_ID); dw.SetSqlCommandParameters("isd", DropDownList14.SelectedValue); dw.SetSqlCommandParameters("ism", DropDownList15.SelectedValue); dw.SetSqlCommandParameters("isy", DropDownList16.SelectedValue); dw.SetSqlCommandParameters("rtype", "Urine"); dw.Update(); dw.SetCommand("UPDATE Urinereport SET Glucose=@Glucose, Protein=@Protein, Crystal=@Crystal, Acidity=@Acidity, Other=@Other WHERE Lab_report_ID='" + labid + "'"); dw.SetSqlCommandParameters("Glucose", TextBox16.Text.Trim()); dw.SetSqlCommandParameters("Protein", TextBox17.Text.Trim()); dw.SetSqlCommandParameters("Crystal", TextBox18.Text.Trim()); dw.SetSqlCommandParameters("Acidity", TextBox20.Text.Trim()); dw.SetSqlCommandParameters("Other", TextBox23.Text.Trim()); dw.Update(); Response.Redirect("~/User/Doctor/Dashboard.aspx"); } catch { } }
protected void Button11_Click(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); string labid = Session["lab_id"].ToString(); dw.SetCommand("UPDATE Labreport SET Medical_officer=@moff, Patient_ID=@pid, Issue_date=@isd, Issue_month=@ism, Issue_year=@isy, Report_type=@rtype WHERE Lab_report_ID='" + labid + "'"); //dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("moff", DropDownList7.SelectedValue); dw.SetSqlCommandParameters("pid", ApptP_ID); dw.SetSqlCommandParameters("isd", DropDownList10.SelectedValue); dw.SetSqlCommandParameters("ism", DropDownList11.SelectedValue); dw.SetSqlCommandParameters("isy", DropDownList12.SelectedValue); dw.SetSqlCommandParameters("rtype", "Cholestrol"); dw.Update(); dw.SetCommand("UPDATE Colestoroll SET LDL=@LDL, HDL=@HDL, Triglicerides=@Triglicerides, VLDL_Cholesterol=@VLDL_Cholesterol, Total_Cholesterol=@Total_Cholesterol, Other=@Other WHERE Lab_report_ID='" + labid + "'"); dw.SetSqlCommandParameters("LDL", TextBox9.Text.Trim()); dw.SetSqlCommandParameters("HDL", TextBox10.Text.Trim()); dw.SetSqlCommandParameters("Triglicerides", TextBox11.Text.Trim()); dw.SetSqlCommandParameters("VLDL_Cholesterol", TextBox12.Text.Trim()); dw.SetSqlCommandParameters("Total_Cholesterol", TextBox13.Text.Trim()); dw.SetSqlCommandParameters("Other", TextBox19.Text.Trim()); dw.Update(); Response.Redirect("~/User/Doctor/Dashboard.aspx"); } catch { } }
protected void Button6_Click(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); string labid = Session["lab_id"].ToString(); dw.SetCommand("UPDATE Labreport SET Medical_officer=@moff, Patient_ID=@pid, Issue_date=@isd, Issue_month=@ism, Issue_year=@isy, Report_type=@rtype WHERE Lab_report_ID='" + labid + "'"); //dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("moff", DropDownList1.SelectedValue); dw.SetSqlCommandParameters("pid", ApptP_ID); dw.SetSqlCommandParameters("isd", DropDownList3.SelectedValue); dw.SetSqlCommandParameters("ism", DropDownList4.SelectedValue); dw.SetSqlCommandParameters("isy", DropDownList6.SelectedValue); dw.SetSqlCommandParameters("rtype", "Blood"); dw.Update(); dw.SetCommand("UPDATE Bloodreport SET Red_blood_cells=@redbcell, White_blood_cells=@whitebcell, Glucose=@glu, Blood_type=@btype, Hemoglobin=@hemog, Platelets=@plate, Other=@other WHERE Lab_report_ID='" + labid + "'"); dw.SetSqlCommandParameters("redbcell", TextBox2.Text.Trim()); dw.SetSqlCommandParameters("whitebcell", TextBox3.Text.Trim()); dw.SetSqlCommandParameters("glu", TextBox5.Text.Trim()); dw.SetSqlCommandParameters("btype", TextBox24.Text.Trim()); dw.SetSqlCommandParameters("hemog", TextBox6.Text.Trim()); dw.SetSqlCommandParameters("plate", TextBox8.Text.Trim()); dw.SetSqlCommandParameters("other", TextBox7.Text.Trim()); dw.Update(); Response.Redirect("~/User/Doctor/Dashboard.aspx"); } catch { } }
protected void Button2_Click1(object sender, EventArgs e) { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand(@"UPDATE namal SET Mobile_number=@Mobile_number,Home_telephone_number=@Home_telephone_number,office_number=@office_number,Address=@Address,Country=@Country,Province=@Province,ZIPcode=@ZIPcode,EmName=@EmName,EmConMob=@EmConMob where User_ID='" + uid + "' "); dw.SetSqlCommandParameters("@Mobile_number", TextBox7.Text.Trim()); dw.SetSqlCommandParameters("@Home_telephone_number", TextBox8.Text.Trim()); dw.SetSqlCommandParameters("@office_number", TextBox9.Text.Trim()); dw.SetSqlCommandParameters("@Address", TextBox10.Text.Trim()); dw.SetSqlCommandParameters("@Country", DropDownList7.SelectedIndex); dw.SetSqlCommandParameters("@Province", DropDownList6.SelectedIndex); dw.SetSqlCommandParameters("@ZIPcode", TextBox11.Text.Trim()); dw.SetSqlCommandParameters("@EmName", TextBox12.Text.Trim()); dw.SetSqlCommandParameters("@EmConMob", TextBox13.Text.Trim()); dw.Update(); }
protected void btnPP_Click(object sender, EventArgs e) { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetDataAdapter(@"SELECT * FROM Admin WHERE User_ID='" + uid + "' "); DataTable dt = dw.GetDataTable(); if (dw != null) { try { //dw.SetCommand(@"UPDATE Admin SET Working_hospital=@Working_hospital,Trained_area=@Trained_area,Salary=@Salary,First_name=@First_name,Last_name=@Last_name where User_ID='" + uid + "' "); dw.SetCommand(@"UPDATE Admin SET Working_hospital=@Working_hospital,Salary=@Salary,First_name=@First_name,Last_name=@Last_name where User_ID='" + uid + "' "); dw.SetSqlCommandParameters("@Working_hospital", DropDownList13.SelectedValue.Trim()); //dw.SetSqlCommandParameters("@Trained_area", DropDownList12.SelectedValue.Trim()); dw.SetSqlCommandParameters("@Salary", TextBox14.Text.Trim()); dw.SetSqlCommandParameters("@First_name", TextBox1.Text.Trim()); dw.SetSqlCommandParameters("@Last_name", TextBox2.Text.Trim()); dw.Update(); dw.SetCommand(@"UPDATE namal SET Title=@Title,Gender=@Gender,DOBy=@DOBy,DOBd=@DOBd,DOBm=@DOBm,NIC=@NIC,PassportN=@PassportN where User_ID='" + uid + "' "); dw.SetSqlCommandParameters("@Title", DropDownList1.SelectedIndex); dw.SetSqlCommandParameters("@Gender", DropDownList11.SelectedValue.Trim()); dw.SetSqlCommandParameters("@DOBy", DropDownList5.SelectedValue.Trim()); dw.SetSqlCommandParameters("@DOBd", DropDownList3.SelectedValue.Trim()); dw.SetSqlCommandParameters("@DOBm", DropDownList4.SelectedValue.Trim()); dw.SetSqlCommandParameters("@NIC", TextBox3.Text.Trim()); dw.SetSqlCommandParameters("@PassportN", TextBox4.Text.Trim()); dw.Update(); Response.Write("<script language=javascript>alert('Update Success!')</script>"); } catch (Exception) { Response.Write("<script language=javascript>alert('Updation Failed!')</script>"); } } else { Response.Write("<script language=javascript>alert('No Records Found!')</script>"); } }
protected void Button10_Click1(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand("SELECT MAX(Lab_report_ID) FROM Labreport"); int labid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("SELECT MAX(Colestoroll_ID) FROM Colestoroll"); int cholid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("INSERT INTO Labreport(Lab_report_ID,Medical_officer,Patient_ID ,Issue_date,Issue_month,Issue_year,Report_type) VALUES(@lid,@moff,@pid,@isd,@ism,@isy,@rtype)"); dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("moff", DropDownList7.SelectedValue); dw.SetSqlCommandParameters("pid", ApptP_ID); dw.SetSqlCommandParameters("isd", DropDownList10.SelectedValue); dw.SetSqlCommandParameters("ism", DropDownList11.SelectedValue); dw.SetSqlCommandParameters("isy", DropDownList12.SelectedValue); dw.SetSqlCommandParameters("rtype", "Cholestrol"); dw.Insert(); dw.SetCommand("INSERT INTO Colestoroll(Lab_report_ID ,Colestoroll_ID,LDL,HDL,Triglicerides,VLDL_Cholesterol,Total_Cholesterol,Pat_ID,Other) VALUES(@Lab_report_ID,@Colestoroll_ID,@LDL,@HDL ,@Triglicerides,@VLDL_Cholesterol,@Total_Cholesterol,@Pat_ID,@Other)"); dw.SetSqlCommandParameters("Lab_report_ID", labid); dw.SetSqlCommandParameters("Colestoroll_ID", cholid); dw.SetSqlCommandParameters("LDL", TextBox9.Text.Trim()); dw.SetSqlCommandParameters("HDL", TextBox10.Text.Trim()); dw.SetSqlCommandParameters("Triglicerides", TextBox11.Text.Trim()); dw.SetSqlCommandParameters("VLDL_Cholesterol", TextBox12.Text.Trim()); dw.SetSqlCommandParameters("Total_Cholesterol", TextBox13.Text.Trim()); dw.SetSqlCommandParameters("Pat_ID", TextBox4.Text.Trim()); dw.SetSqlCommandParameters("Other", TextBox19.Text.Trim()); dw.Insert(); Response.Redirect("~/User/Doctor/Dashboard.aspx"); } catch { } }
protected void Button12_Click(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand("SELECT MAX(Lab_report_ID) FROM Labreport"); int labid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("SELECT MAX(Urine_report_ID) FROM Urinereport"); int urid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("INSERT INTO Labreport(Lab_report_ID,Medical_officer,Patient_ID ,Issue_date,Issue_month,Issue_year,Report_type) VALUES(@lid,@moff,@pid,@isd,@ism,@isy,@rtype)"); dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("moff", DropDownList13.SelectedValue); dw.SetSqlCommandParameters("pid", ApptP_ID); dw.SetSqlCommandParameters("isd", DropDownList14.SelectedValue); dw.SetSqlCommandParameters("ism", DropDownList15.SelectedValue); dw.SetSqlCommandParameters("isy", DropDownList16.SelectedValue); dw.SetSqlCommandParameters("rtype", "Urine"); dw.Insert(); dw.SetCommand("INSERT INTO Urinereport(Urine_report_ID ,Lab_report_ID,Glucose,Protein,Crystal,Acidity,Pat_ID,Other) VALUES(@Urine_report_ID,@Lab_report_ID,@Glucose,@Protein,@Crystal,@Acidity,@Pat_ID,@Other)"); dw.SetSqlCommandParameters("Urine_report_ID", urid); dw.SetSqlCommandParameters("Lab_report_ID", labid); dw.SetSqlCommandParameters("Glucose", TextBox16.Text.Trim()); dw.SetSqlCommandParameters("Protein", TextBox17.Text.Trim()); dw.SetSqlCommandParameters("Crystal", TextBox18.Text.Trim()); dw.SetSqlCommandParameters("Acidity", TextBox20.Text.Trim()); dw.SetSqlCommandParameters("Pat_ID", TextBox15.Text.Trim()); dw.SetSqlCommandParameters("Other", TextBox13.Text.Trim()); dw.Insert(); Response.Redirect("~/User/Doctor/Dashboard.aspx"); } catch { } }
protected void Button10_Click(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand("SELECT MAX(Lab_report_ID) FROM Labreport"); int labid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("SELECT MAX(Blood_report_ID) FROM Bloodreport"); int bloodrepid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("INSERT INTO Labreport(Lab_report_ID,Medical_officer,Patient_ID ,Issue_date,Issue_month,Issue_year,Report_type) VALUES(@lid,@moff,@pid,@isd,@ism,@isy,@rtype)"); dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("moff", DropDownList1.SelectedValue); dw.SetSqlCommandParameters("pid", ApptP_ID); dw.SetSqlCommandParameters("isd", DropDownList3.SelectedValue); dw.SetSqlCommandParameters("ism", DropDownList4.SelectedValue); dw.SetSqlCommandParameters("isy", DropDownList6.SelectedValue); dw.SetSqlCommandParameters("rtype", "Blood"); dw.Insert(); dw.SetCommand("INSERT INTO Bloodreport(Blood_report_ID ,Lab_report_ID,Red_blood_cells,White_blood_cells,Glucose,Blood_type,Hemoglobin,Platelets,Other) VALUES(@bid,@lid,@redbcell,@whitebcell ,@glu,@btype,@hemog,@plate,@other)"); dw.SetSqlCommandParameters("bid", bloodrepid); dw.SetSqlCommandParameters("lid", labid); dw.SetSqlCommandParameters("redbcell", TextBox2.Text.Trim()); dw.SetSqlCommandParameters("whitebcell", TextBox3.Text.Trim()); dw.SetSqlCommandParameters("glu", TextBox5.Text.Trim()); dw.SetSqlCommandParameters("btype", TextBox24.Text.Trim()); dw.SetSqlCommandParameters("hemog", TextBox6.Text.Trim()); dw.SetSqlCommandParameters("plate", TextBox8.Text.Trim()); dw.SetSqlCommandParameters("other", TextBox7.Text.Trim()); dw.Insert(); Response.Redirect("~/User/Doctor/Dashboard.aspx"); } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { uid = Session["User_ID"].ToString(); uname = Session["User_name"].ToString(); pid = Session["Patient_ID"].ToString(); ApptP_ID = Session["ApptPat_ID"].ToString(); TextBox1.Text = ApptP_ID.Trim(); TextBox4.Text = ApptP_ID.Trim(); TextBox14.Text = ApptP_ID.Trim(); TextBox15.Text = ApptP_ID.Trim(); } catch { Response.Redirect("~/User/Doctor/Appointments.aspx"); } // Start ================================================== string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); int message = 0; try { // Patient Table ==================================================================================== dw.SetDataAdapter(@"select * from patient where Patient_ID='" + ApptP_ID + "' "); DataTable dt = dw.GetDataTable(); string name = (dt.Rows[0][3].ToString()).Trim() + " " + (dt.Rows[0][4].ToString()).Trim(); lblName.Text = name; //Name lblPhn.Text = "User " + (dt.Rows[0][1].ToString()).Trim(); //UID Session["ApptU_ID"] = (dt.Rows[0][1].ToString()).Trim(); //UID ApptU_ID = Session["ApptU_ID"].ToString(); lblPatHelNo.Text = (dt.Rows[0][0].ToString()).Trim(); //PID lblPatWeight.Text = (dt.Rows[0][6].ToString()).Trim(); //weight lblPatHeight.Text = (dt.Rows[0][5].ToString()).Trim(); //height float HeightinM = float.Parse(lblPatHeight.Text) / 100; float bmi = float.Parse(lblPatWeight.Text) / (HeightinM * HeightinM); lblPatBmi.Text = bmi.ToString("0.00"); //Change BMI color according to value if (float.Parse(lblPatBmi.Text) >= 25) { lblPatBmi.ForeColor = System.Drawing.Color.Red; } else if (float.Parse(lblPatBmi.Text) < 18.5) { lblPatBmi.ForeColor = System.Drawing.Color.Orange; } else { lblPatBmi.ForeColor = System.Drawing.Color.Green; } H1.Value = (dt.Rows[0][7].ToString()).Trim(); //bGroup int g = Int32.Parse(H1.Value); DropDownList2.SelectedIndex = g; lblPatBloodGrp.Text = DropDownList2.Text; H1.Value = (dt.Rows[0][9].ToString()).Trim(); //smoke int j = Int32.Parse(H1.Value); DropDownList8.SelectedIndex = j; lblSmoke.Text = DropDownList8.SelectedValue; H1.Value = (dt.Rows[0][10].ToString()).Trim(); //AlPeriod int k = Int32.Parse(H1.Value); DropDownList9.SelectedIndex = k; lblAlcohol.Text = DropDownList9.SelectedValue; lblWatInt.Text = (dt.Rows[0][11].ToString()).Trim(); //WaterIntake }catch {} try{ // Namal Table ==================================================================================== DataTable dt = dw.GetDataTable(); dw.SetDataAdapter(@"select * from namal where User_ID='" + ApptU_ID + "' "); dt = dw.GetDataTable(); H1.Value = (dt.Rows[0][9].ToString()).Trim(); //year int f = Int32.Parse(H1.Value); DropDownList5.SelectedIndex = f; int age = 2018 - Int32.Parse(DropDownList5.SelectedValue); lblPatAge.Text = age.ToString(); lblPatNic.Text = (dt.Rows[0][12].ToString()).Trim(); //nic lblPatConMob.Text = (dt.Rows[0][5].ToString()).Trim(); //mobile lblPatConHom.Text = (dt.Rows[0][4].ToString()).Trim(); //home } catch { } // end ========================================== }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { string a = GridView1.SelectedRow.Cells[5].Text.Trim(); string repid = GridView1.SelectedRow.Cells[0].Text.Trim(); Session["lab_id"] = repid; //Session["ApptPat_ID"] = a; string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); switch (a) { case "Blood": btnBloodInsert.Visible = false; Button6.Visible = true; TextBox1.Text = ApptP_ID; TextBox24.Text = lblPatBloodGrp.Text; //Clear previous records DropDownList1.SelectedIndex = 0; DropDownList3.SelectedIndex = 0; DropDownList4.SelectedIndex = 0; DropDownList6.SelectedIndex = 88; TextBox2.Text = ""; TextBox3.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox8.Text = ""; TextBox7.Text = ""; //string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); //DataWorksClass dw = new DataWorksClass(constring); try { dw.SetDataAdapter(@"select * from Labreport where Lab_report_ID='" + repid + "' "); DataTable dt = dw.GetDataTable(); DropDownList1.SelectedValue = (dt.Rows[0][1].ToString()).Trim(); DropDownList3.SelectedValue = (dt.Rows[0][3].ToString()).Trim(); DropDownList4.SelectedValue = (dt.Rows[0][4].ToString()).Trim(); DropDownList6.SelectedValue = (dt.Rows[0][5].ToString()).Trim(); } catch { } try { dw.SetDataAdapter(@"select * from Bloodreport where Lab_report_ID='" + repid + "' "); DataTable dt = dw.GetDataTable(); TextBox2.Text = (dt.Rows[0][2].ToString()).Trim(); TextBox3.Text = (dt.Rows[0][3].ToString()).Trim(); TextBox5.Text = (dt.Rows[0][4].ToString()).Trim(); TextBox6.Text = (dt.Rows[0][6].ToString()).Trim(); TextBox8.Text = (dt.Rows[0][7].ToString()).Trim(); TextBox7.Text = (dt.Rows[0][8].ToString()).Trim(); } catch { } this.ModalPopupExtender1.Show(); break; case "Cholestrol": Button10.Visible = false; Button11.Visible = true; TextBox4.Text = ApptP_ID; //Clear previous records DropDownList7.SelectedIndex = 0; DropDownList10.SelectedIndex = 0; DropDownList11.SelectedIndex = 0; DropDownList12.SelectedIndex = 88; TextBox9.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; TextBox12.Text = ""; TextBox13.Text = ""; TextBox19.Text = ""; //string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); //DataWorksClass dw = new DataWorksClass(constring); try { dw.SetDataAdapter(@"select * from Labreport where Lab_report_ID='" + repid + "' "); DataTable dt = dw.GetDataTable(); DropDownList7.SelectedValue = (dt.Rows[0][1].ToString()).Trim(); DropDownList10.SelectedValue = (dt.Rows[0][3].ToString()).Trim(); DropDownList11.SelectedValue = (dt.Rows[0][4].ToString()).Trim(); DropDownList12.SelectedValue = (dt.Rows[0][5].ToString()).Trim(); } catch { } try { dw.SetDataAdapter(@"select * from Colestoroll where Lab_report_ID='" + repid + "' "); DataTable dt = dw.GetDataTable(); TextBox9.Text = (dt.Rows[0][2].ToString()).Trim(); TextBox10.Text = (dt.Rows[0][3].ToString()).Trim(); TextBox11.Text = (dt.Rows[0][4].ToString()).Trim(); TextBox12.Text = (dt.Rows[0][5].ToString()).Trim(); TextBox13.Text = (dt.Rows[0][6].ToString()).Trim(); TextBox19.Text = (dt.Rows[0][8].ToString()).Trim(); } catch { } this.ModalPopupExtender2.Show(); break; case "Urine": Button12.Visible = false; Button13.Visible = true; TextBox15.Text = ApptP_ID; //Clear previous records DropDownList13.SelectedIndex = 0; DropDownList14.SelectedIndex = 0; DropDownList15.SelectedIndex = 0; DropDownList16.SelectedIndex = 88; TextBox16.Text = ""; TextBox17.Text = ""; TextBox18.Text = ""; TextBox20.Text = ""; TextBox23.Text = ""; //string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); //DataWorksClass dw = new DataWorksClass(constring); try { dw.SetDataAdapter(@"select * from Labreport where Lab_report_ID='" + repid + "' "); DataTable dt = dw.GetDataTable(); DropDownList13.SelectedValue = (dt.Rows[0][1].ToString()).Trim(); DropDownList14.SelectedValue = (dt.Rows[0][3].ToString()).Trim(); DropDownList15.SelectedValue = (dt.Rows[0][4].ToString()).Trim(); DropDownList16.SelectedValue = (dt.Rows[0][5].ToString()).Trim(); } catch { } try { dw.SetDataAdapter(@"select * from Urinereport where Lab_report_ID='" + repid + "' "); DataTable dt = dw.GetDataTable(); TextBox16.Text = (dt.Rows[0][2].ToString()).Trim(); TextBox17.Text = (dt.Rows[0][3].ToString()).Trim(); TextBox18.Text = (dt.Rows[0][4].ToString()).Trim(); TextBox20.Text = (dt.Rows[0][5].ToString()).Trim(); TextBox23.Text = (dt.Rows[0][7].ToString()).Trim(); } catch { } this.ModalPopupExtender3.Show(); break; } }
protected void Button1_Click(object sender, EventArgs e) { // Start ================================================== string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); int message = 0; try { // Doctor Table ==================================================================================== dw.SetDataAdapter(@"select * from Doctor where User_ID='" + uid + "' "); DataTable dt = dw.GetDataTable(); string name = (dt.Rows[0][8].ToString()).Trim() + " " + (dt.Rows[0][9].ToString()).Trim(); lblName.Text = name; //Name lblPhn.Text = "User " + (dt.Rows[0][1].ToString()).Trim(); //UID TextBox1.Text = (dt.Rows[0][8].ToString()).Trim(); //Fname TextBox2.Text = (dt.Rows[0][9].ToString()).Trim(); //Lname DropDownList12.SelectedValue = (dt.Rows[0][4].ToString()).Trim(); //Specialization DropDownList13.SelectedValue = (dt.Rows[0][3].ToString()).Trim(); //Hospital TextBox14.Text = (dt.Rows[0][5].ToString()).Trim(); //Salary }catch {} try{ // Namal Table ==================================================================================== dw.SetDataAdapter(@"select * from namal where User_ID='" + uid + "' "); DataTable dt = dw.GetDataTable(); H1.Value = (dt.Rows[0][7].ToString()).Trim(); //Title int a = Int32.Parse(H1.Value); DropDownList1.SelectedIndex = a; H1.Value = (dt.Rows[0][6].ToString()).Trim(); //gender int b = Int32.Parse(H1.Value); DropDownList11.SelectedIndex = b; DropDownList3.SelectedValue = (dt.Rows[0][10].ToString()).Trim(); //date DropDownList4.SelectedValue = (dt.Rows[0][11].ToString()).Trim(); //month DropDownList5.SelectedValue = (dt.Rows[0][9].ToString()).Trim(); //year TextBox3.Text = (dt.Rows[0][12].ToString()).Trim(); //nic TextBox4.Text = (dt.Rows[0][8].ToString()).Trim(); //passport message = 1; }catch {} try{ dw.SetDataAdapter(@"select * from namal where User_ID='" + uid + "' "); DataTable dt = dw.GetDataTable(); TextBox7.Text = (dt.Rows[0][5].ToString()).Trim(); //mobile TextBox8.Text = (dt.Rows[0][4].ToString()).Trim(); //home TextBox9.Text = (dt.Rows[0][13].ToString()).Trim(); //office TextBox10.Text = (dt.Rows[0][3].ToString()).Trim(); //address H1.Value = (dt.Rows[0][14].ToString()).Trim(); //country int h = Int32.Parse(H1.Value); DropDownList7.SelectedIndex = h; H1.Value = (dt.Rows[0][15].ToString()).Trim(); //province int i = Int32.Parse(H1.Value); DropDownList6.SelectedIndex = i; TextBox11.Text = (dt.Rows[0][16].ToString()).Trim(); //zip TextBox12.Text = (dt.Rows[0][21].ToString()).Trim(); //EmName TextBox13.Text = (dt.Rows[0][22].ToString()).Trim(); //EmConMob message = 1; }catch {} try{ if (lblName.Text != "") { //Response.Write("<script language=javascript>alert('Search Success!')</script>"); message = 0; } else { Response.Write("<script language=javascript>alert('No Records Found!')</script>"); message = 0; lblName.Text = "N/A"; lblPhn.Text = "N/A"; DropDownList1.SelectedIndex = 0; TextBox1.Text = ""; TextBox2.Text = ""; DropDownList11.SelectedIndex = 0; DropDownList3.SelectedIndex = 0; DropDownList4.SelectedIndex = 0; DropDownList5.SelectedIndex = 0; TextBox3.Text = ""; TextBox4.Text = ""; DropDownList12.SelectedIndex = 0; DropDownList13.SelectedIndex = 0; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; TextBox10.Text = ""; DropDownList7.SelectedIndex = 0; DropDownList6.SelectedIndex = 0; TextBox11.Text = ""; TextBox12.Text = ""; TextBox13.Text = ""; TextBox14.Text = ""; } } catch (Exception ex) { if (message == 1) { Response.Write("<script language=javascript>alert('Modification Needed!')</script>"); } else { Response.Write("<script language=javascript>alert('Invalid Entry!')</script>"); lblName.Text = "N/A"; lblPhn.Text = "N/A"; DropDownList1.SelectedIndex = 0; TextBox1.Text = ""; TextBox2.Text = ""; DropDownList11.SelectedIndex = 0; DropDownList3.SelectedIndex = 0; DropDownList4.SelectedIndex = 0; DropDownList5.SelectedIndex = 0; TextBox3.Text = ""; TextBox4.Text = ""; DropDownList12.SelectedIndex = 0; DropDownList13.SelectedIndex = 0; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; TextBox10.Text = ""; DropDownList7.SelectedIndex = 0; DropDownList6.SelectedIndex = 0; TextBox11.Text = ""; TextBox12.Text = ""; TextBox13.Text = ""; TextBox14.Text = ""; } } // end ========================================== }
protected void Button3_Click2(object sender, EventArgs e) { try { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetDataAdapter(@"select * from namal where User_ID='" + uid + "' "); DataTable dt = dw.GetDataTable(); cPass = (dt.Rows[0][2].ToString()).Trim(); //current pass string newPass = TextBox17.Text.Trim(); string newPassConf = TextBox18.Text.Trim(); if (TextBox16.Text.Trim() == cPass) { if (newPass == newPassConf) { dw.SetCommand(@"UPDATE namal SET Password=@Password where User_ID='" + uid + "' "); dw.SetSqlCommandParameters("@Password", TextBox17.Text.Trim()); dw.Update(); Label32.Text = ""; Label33.Text = ""; //Email Start...................................................... dw.SetCommand("SELECT E_mail FROM namal WHERE User_ID = @uid"); dw.SetSqlCommandParameters("uid", uid); string email = dw.GetSingleData().Trim(); string npass = TextBox17.Text.Trim(); dw.SetCommand("SELECT First_name FROM Doctor WHERE User_ID = @uid"); dw.SetSqlCommandParameters("uid", uid); string fname = dw.GetSingleData().Trim(); MailMessage mm = new MailMessage("*****@*****.**", email); //(your gmail,receiver gmail) mm.Subject = "KDU CMS | Password Reset!"; //Subject mm.Body = "<b>" + "Dear " + fname + "," + "</b> <br>" + "Your password has been changed on KDU Online Channelling and Management System." + "<br> <br>" + "<table>" + "<tr>" + "<td>" + "Your changed Password " + "</td>" + "<td>" + "<b>" + npass + "</b>" + "</td>" + "</tr>" + "</table>" + "<br> <br>" + "<i>" + "Important! Keep your password in a secure place. After remembering your password, permanantly delete this email for your account's safty." + "</i>" + "<br> <br>" + "<table>" + "<tr>" + "<td>" + "<img src=\"https://preview.ibb.co/kaGrEf/logo.png\" width=\"50px\">" + " " + "</td>" + "<td>" + "<b>" + "KDU Channeling Center," + "<br>" + "General Sir John Kotelawala Defence University," + "<br>" + "Southern Campus," + "<br>" + "Sooriyawewa." + "<br>" + "+94718810575" + "</b>" + "</td>" + "</tr>" + "</table>"; //Message //+"<table>"+ // "<tr>"+ // "<td>" + "Your Channel Number " + "</td>" + // "<td>" + "<b>" + channelno + "</b>" + "</td>" + // "</tr>"+ // "<tr>" + // "<td>" + "Your Reserved Date " + "</td>" + // "<td>" + "<b>" + TextBox3.Text.Trim() + "</b>" + "</td>" + // "</tr>" + // "<tr>" + // "<td>" + "Doctor " + "</td>" + // "<td>" + "<b>" + TextBox2.Text.Trim() + "</b>" + "</td>" + // "</tr>" + // "<tr>" + // "<td>" + "Specialization " +"</td>" + // "<td>" + "<b>" + TextBox4.Text.Trim() + "</b>" + "</td>" + // "</tr>" + //"</table>"+ //+"<table>" + // "<tr>" + // "<td>" + "<img src=\"https://preview.ibb.co/kaGrEf/logo.png\" width=\"50px\">" + " " + "</td>" + // "<td>" + "<b>" + "KDU Channeling Center,"+"<br>"+"General Sir John Kotelawala Defence University,"+"<br>"+"Southern Campus,"+"<br>"+"Sooriyawewa."+"<br>"+"+94718810575"+"</b>" + "</td>" + // "</tr>" + //"</table>" + mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; NetworkCredential networkcred = new NetworkCredential("*****@*****.**", "KDU123cms");//(your gmail & gmail password) smtp.UseDefaultCredentials = true; smtp.Credentials = networkcred; smtp.Port = 587; smtp.Send(mm); //Response.Write("<script language=javascript>alert('BOOKING SUCCESSFULL! CHECK YOUR EMAILS!')</script>"); Response.Redirect("~/User/Doctor/Account.aspx"); //---------------------------------End Email } else { Label33.Text = ""; Label32.Text = "Password does not match!"; } } else { Label33.Text = "Incorrect Password!"; Label32.Text = ""; } } catch { } }
protected void btnreg_Click(object sender, EventArgs e) { string type = drpStaffType.SelectedValue.Trim(); // ====================================================================================================================== case 1 string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand("SELECT count(User_ID) FROM namal WHERE User_name = @uname"); dw.SetSqlCommandParameters("uname", txtuname.Text.Trim()); int count1 = Convert.ToInt32(dw.GetSingleData().Trim()); if (count1 < 1) { dw.SetCommand("SELECT MAX(User_ID) FROM namal"); int count = Convert.ToInt32(dw.GetSingleData()) + 1; if (txtpassword.Text.Trim() == txtconfirmpassword.Text.Trim()) { const int MIN_LENGTH = 8; const int MAX_LENGTH = 15; if (txtpassword.Text == null) { throw new ArgumentNullException(); } bool meetsLengthRequirements = txtpassword.Text.Trim().Length >= MIN_LENGTH && txtpassword.Text.Trim().Length <= MAX_LENGTH; bool hasUpperCaseLetter = false; bool hasLowerCaseLetter = false; bool hasDecimalDigit = false; if (meetsLengthRequirements) { foreach (char c in txtpassword.Text.Trim()) { if (char.IsUpper(c)) { hasUpperCaseLetter = true; } else if (char.IsLower(c)) { hasLowerCaseLetter = true; } else if (char.IsDigit(c)) { hasDecimalDigit = true; } } bool isValid = meetsLengthRequirements && hasUpperCaseLetter && hasLowerCaseLetter && hasDecimalDigit ; if (isValid == true) { dw.SetCommand("INSERT INTO namal(User_ID,User_name,Password,E_mail,Type) VALUES (@uid,@uname,@pass,@email,@type)"); dw.SetSqlCommandParameters("uid", count.ToString()); dw.SetSqlCommandParameters("uname", txtuname.Text.Trim()); dw.SetSqlCommandParameters("pass", txtpassword.Text.Trim()); dw.SetSqlCommandParameters("email", txtemail.Text.Trim()); dw.SetSqlCommandParameters("type", type); dw.Insert(); switch (type) { case "doctor": dw.SetCommand("select max(Doctor_ID) from Doctor"); int did = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("INSERT INTO Doctor(Doctor_ID,User_ID) VALUES (@did,@uid)"); dw.SetSqlCommandParameters("did", did); dw.SetSqlCommandParameters("uid", count); dw.Insert(); break; case "nurse": dw.SetCommand("SELECT MAX(Nurse_ID) FROM Nurse"); int nid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("insert into Nurse(Nurse_ID,User_ID) VALUES (@nid,@uid)"); dw.SetSqlCommandParameters("nid", nid); dw.SetSqlCommandParameters("uid", count); dw.Insert(); break; case "admin": dw.SetCommand("SELECT MAX(Admin_ID) FROM Admin"); int aid = Convert.ToInt32(dw.GetSingleData()) + 1; dw.SetCommand("insert into Admin(Admin_ID,User_ID) VALUES (@aid,@uid)"); dw.SetSqlCommandParameters("aid", aid); dw.SetSqlCommandParameters("uid", count); dw.Insert(); break; } //Email Start...................................................... string email = txtemail.Text.Trim(); string pass = txtpassword.Text.Trim(); string uname = txtuname.Text.Trim(); MailMessage mm = new MailMessage("*****@*****.**", email); //(your gmail,receiver gmail) mm.Subject = "KDU CMS | Registration Success!"; //Subject mm.Body = "<b>" + "Dear " + txtuname.Text.Trim() + "," + "</b> <br>" + "You have registered on KDU Online Channelling and Management System." + "<br> <br>" + "<table>" + "<tr>" + "<td>" + "Your Username " + "</td>" + "<td>" + "<b>" + uname + "</b>" + "</td>" + "</tr>" + "</table>" + "<br> <br>" + "<i>" + "Important! Keep your username and password in a secure place." + "</i>" + "<br> <br>" + "<table>" + "<tr>" + "<td>" + "<img src=\"https://preview.ibb.co/kaGrEf/logo.png\" width=\"50px\">" + " " + "</td>" + "<td>" + "<b>" + "KDU Channeling Center," + "<br>" + "General Sir John Kotelawala Defence University," + "<br>" + "Southern Campus," + "<br>" + "Sooriyawewa." + "<br>" + "+94718810575" + "</b>" + "</td>" + "</tr>" + "</table>"; //Message mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; NetworkCredential networkcred = new NetworkCredential("*****@*****.**", "KDU123cms"); //(your gmail & gmail password) smtp.UseDefaultCredentials = true; smtp.Credentials = networkcred; smtp.Port = 587; smtp.Send(mm); //---------------------------------End Email txtuname.Text = ""; txtpassword.Text = ""; txtemail.Text = ""; txtconfirmpassword.Text = ""; Response.Write("<script language=javascript>alert('SUCCESSFULLY REGISTERED!!!')</script>"); Response.Redirect("~/User/Admin/AdminDefault.aspx"); } else { string ss = "PASSWORD SHOULD BE INCLUDED LOWER CASES AND UPPER CASES"; lbl1.Visible = true; lbl1.Text = ss; } } else { string ss = "Password Length should be in 8 to 15"; lbl1.Visible = true; lbl1.Text = ss; } } else { string ss = "PASSWORDS ARE NOT MATCHING!!!!"; lbl2.Visible = true; lbl2.Text = ss; } } else { string ss = "THIS USER NAME ALREADY IN USE"; lbl3.Visible = true; lbl3.Text = ss; } }
protected void btnlogin_Click(object sender, EventArgs e) { string constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString(); DataWorksClass dw = new DataWorksClass(constring); dw.SetCommand(@"select count(User_ID) from namal where User_name=@username and Password = @password"); dw.SetSqlCommandParameters("username", txtuname.Text.Trim()); dw.SetSqlCommandParameters("password", txtpassword.Text.Trim()); int count = Convert.ToInt32(dw.GetSingleData()); dw.SetCommand("SELECT MAX(id) FROM loginlog"); int i = Convert.ToInt32(dw.GetSingleData()) + 1; DateTime d = DateTime.Now; string date = d.ToString("yyyy-MM-dd"); string time = d.ToString("hh:mm:ss"); //validating the user if (count == 1) { dw.SetDataAdapter(@"select Type,User_name,User_ID from namal where User_name=@username and Password = @password"); dw.SetDataAdapterParameters("username", txtuname.Text.Trim()); dw.SetDataAdapterParameters("password", txtpassword.Text.Trim()); DataTable dt = dw.GetDataTable(); string uname = (dt.Rows[0][1].ToString()).Trim(); string type = (dt.Rows[0][0].ToString()).Trim(); string uid = (dt.Rows[0][2].ToString()).Trim(); Session["User_ID"] = uid; Session["type"] = type; dw.SetCommand("SELECT Patient_ID FROM Patient WHERE User_ID = @uid"); dw.SetSqlCommandParameters("uid", uid); string pid = dw.GetSingleData().Trim(); Session["Patient_ID"] = pid; //filling login log table dw.SetCommand("INSERT INTO loginlog (id,username,attempt,date,time,type) VALUES (@id,@uname,@attempt,@date,@time,@type)");//,, dw.SetSqlCommandParameters("id", i); dw.SetSqlCommandParameters("uname", txtuname.Text.Trim()); dw.SetSqlCommandParameters("attempt", "success"); dw.SetSqlCommandParameters("date", date); dw.SetSqlCommandParameters("time", time); dw.SetSqlCommandParameters("type", type); dw.Insert(); Session["User_name"] = uname; //checking the type of users switch (type) { case "doctor": dw.SetCommand("SELECT Doctor_ID FROM Doctor WHERE User_ID = @uid"); dw.SetSqlCommandParameters("uid", uid); string did = dw.GetSingleData().Trim(); Session["Doctor_ID"] = did; if (CheckBox1.Checked) { Session["ok"] = "go"; } else { Session["ok"] = null; } Session["User_name"] = uname; Response.Redirect("~/User/Doctor/Appointments.aspx"); break; case "patient": if (CheckBox1.Checked) { Session["ok"] = "go"; } else { Session["ok"] = null; } Session["User_name"] = uname; Response.Redirect("~/Default.aspx"); break; case "admin": dw.SetCommand("SELECT Admin_ID FROM Admin WHERE User_ID = @uid"); dw.SetSqlCommandParameters("uid", uid); string aid = dw.GetSingleData().Trim(); Session["Admin_ID"] = aid; if (CheckBox1.Checked) { Session["ok"] = "go"; } else { Session["ok"] = null; } Session["User_name"] = uname; Response.Redirect("~/User/Admin/AdminDefault.aspx"); break; case "nurse": dw.SetCommand("SELECT Nurse_ID FROM Nurse WHERE User_ID = @uid"); dw.SetSqlCommandParameters("uid", uid); string nid = dw.GetSingleData().Trim(); Session["Nurse_ID"] = nid; if (CheckBox1.Checked) { Session["ok"] = "go"; } else { Session["ok"] = null; } Session["User_name"] = uname; Response.Redirect("~/User/Nurse/NurseDefault.aspx"); break; } } else { //print a error msg when user try to login without providing user credentials and in here userlogs table not filling if (txtuname.Text == "" || txtpassword.Text == "") { Response.Write("<script language=javascript>alert('PLZ FILL THE USERNAME AND PASSWORD FIELDS!!!!')</script>"); } else if (txtuname.Text != "" || txtpassword.Text != "") { //filing loginlog table dw.SetCommand("INSERT INTO loginlog (id,username,attempt,date,time,type) VALUES (@id,@uname,@attempt,@date,@time,@type)");//,, dw.SetSqlCommandParameters("id", i); dw.SetSqlCommandParameters("uname", txtuname.Text.Trim()); dw.SetSqlCommandParameters("attempt", "not success"); dw.SetSqlCommandParameters("date", date); dw.SetSqlCommandParameters("time", time); dw.SetSqlCommandParameters("type", "unbound"); dw.Insert(); Response.Write("<script language=javascript>alert('WRONG CREDENTIALS!!!!')</script>"); } } }