コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Label6.Visible = false;
            // string session = Session["Docname"].ToString().Trim();
            session1 = Session["docid"].ToString().Trim();

            //string nu =   GridView1.Rows.Count.ToString();


            Label6.Text = session1;
            dw.SetCommand("SELECT COUNT(Appointmentdate_ID) from Appointment_date WHERE Doctor_ID=@docid");
            dw.SetSqlCommandParameters("docid", Label6.Text.Trim());
            lblNoSessions.Text = dw.GetSingleData();

            dw.SetDataAdapter("SELECT Working_hospital,First_name,Specialized_area FROM Doctor WHERE  Doctor_ID = @docid");
            //dw.SetSqlCommandParameters("fname",session);
            dw.SetDataAdapterParameters("docid", session1);
            DataTable dt       = dw.GetDataTable();
            string    hospital = (dt.Rows[0][0].ToString().Trim()) + " Hospital";
            string    fname    = dt.Rows[0][1].ToString().Trim();
            string    specarea = dt.Rows[0][2].ToString().Trim();
            // string hospital = dw.GetSingleData().ToString().Trim()+" Hospital";
            lblName.Text     = fname;
            lblSpecArea.Text = specarea;
            lblOther.Text    = hospital;
        }
        catch {
            Response.Redirect("~/Default.aspx");
        }
    }
コード例 #2
0
    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 { }
    }
コード例 #3
0
    protected void Button6_Click(object sender, EventArgs e)
    {
        dw.SetDataAdapter("SELECT First_name, Last_name, Height, weight, bloodgroup,Smoking,Alchol,Waterintake,Alchol_intake, Diet FROM Patient WHERE Patient_ID = @pid");
        dw.SetDataAdapterParameters("pid", ApptP_ID);
        DataTable dt5 = dw.GetDataTable();

        txtfname.Text  = dt5.Rows[0][0].ToString().Trim();
        txtlname.Text  = dt5.Rows[0][1].ToString().Trim();
        txtgeight.Text = dt5.Rows[0][2].ToString().Trim();
        txtweight.Text = dt5.Rows[0][3].ToString().Trim();
        ddlbloodgroup.SelectedIndex = Convert.ToInt32(dt5.Rows[0][4].ToString().Trim());
        ddlsmoking.SelectedValue    = dt5.Rows[0][5].ToString().Trim();
        ddlalchol.SelectedValue     = dt5.Rows[0][6].ToString();
        txtwaterintake.Text         = dt5.Rows[0][7].ToString().Trim();
        txtalcholintake.Text        = dt5.Rows[0][8].ToString().Trim();
        ddldiet.SelectedValue       = dt5.Rows[0][9].ToString().Trim();

        dw.SetDataAdapter("SELECT Title, Address, Home_telephone_number, Mobile_number, PassportN, DOBy,DOBd,DOBm,NIC, Country, Province, ZIPcode, office_number from namal WHERE User_ID = @uid");
        dw.SetDataAdapterParameters("uid", ApptU_ID);
        DataTable dt6 = dw.GetDataTable();

        DropDownList1.SelectedValue = dt6.Rows[0][0].ToString().Trim();
        txtaddress.Text             = dt6.Rows[0][1].ToString().Trim();
        txthome.Text              = dt6.Rows[0][2].ToString().Trim();
        txtmobile.Text            = dt6.Rows[0][3].ToString().Trim();
        txtpassno.Text            = dt6.Rows[0][4].ToString().Trim();
        ddlyear.SelectedValue     = dt6.Rows[0][5].ToString().Trim();
        ddldate.SelectedValue     = dt6.Rows[0][6].ToString().Trim();
        ddlmonth.SelectedValue    = dt6.Rows[0][7].ToString().Trim();
        txtnic.Text               = dt6.Rows[0][8].ToString().Trim();
        ddlcountry.SelectedIndex  = Convert.ToInt32(dt6.Rows[0][9].ToString().Trim());
        ddlprovince.SelectedIndex = Convert.ToInt32(dt6.Rows[0][10].ToString().Trim());
        txtzip.Text               = dt6.Rows[0][11].ToString().Trim();
        txtoffice.Text            = dt6.Rows[0][12].ToString().Trim();

        dw.SetDataAdapter("select Name, Contact_number FROM Family WHERE Patient_ID = @pid");
        dw.SetDataAdapterParameters("pid", ApptP_ID);
        DataTable dt7 = dw.GetDataTable();

        txtemergencyname.Text    = dt7.Rows[0][0].ToString().Trim();
        txtemergencycontact.Text = dt7.Rows[0][1].ToString().Trim();
    }
コード例 #4
0
    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>");
        }
    }
コード例 #5
0
    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 ==========================================
    }
コード例 #6
0
    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;
        }
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //string uid = Session["User_ID"].ToString();
            //string uname = Session["User_name"].ToString();
            //string pid = Session["Patient_ID"].ToString();
            string ApptU_ID = Session["ApptU_ID"].ToString();
            string ApptP_ID = Session["ApptPat_ID"].ToString();
            dw.SetDataAdapter("SELECT First_name,Last_name,bloodgroup FROM Patient WHERE Patient_ID = @pid");
            dw.SetDataAdapterParameters("pid", ApptP_ID);
            DataTable dt = dw.GetDataTable();

            lblfname.Text = dt.Rows[0][0].ToString().Trim();
            lbllname.Text = dt.Rows[0][1].ToString().Trim();
            string bgroup = dt.Rows[0][2].ToString().Trim();
            if (bgroup == "0")
            {
                bGroup.Text = "A+";
            }
            else if (bgroup == "1")
            {
                bGroup.Text = "A-";
            }
            else if (bgroup == "2")
            {
                bGroup.Text = "B+";
            }
            else if (bgroup == "3")
            {
                bGroup.Text = "B-";
            }
            else if (bgroup == "4")
            {
                bGroup.Text = "AB+";
            }
            else if (bgroup == "5")
            {
                bGroup.Text = "AB-";
            }
            else if (bgroup == "6")
            {
                bGroup.Text = "O+";
            }
            else if (bgroup == "7")
            {
                bGroup.Text = "O-";
            }


            lblPHN.Text = ApptP_ID;

            dw.SetDataAdapter("SELECT Home_telephone_number, Mobile_number, Address, NIC FROM namal WHERE User_ID = @uid");
            dw.SetDataAdapterParameters("uid", ApptU_ID);
            DataTable dt1 = dw.GetDataTable();

            lblhome.Text    = dt1.Rows[0][0].ToString().Trim();
            lblmobile.Text  = dt1.Rows[0][1].ToString().Trim();
            lblAddress.Text = dt1.Rows[0][2].ToString().Trim();
            lblNIC.Text     = dt1.Rows[0][3].ToString().Trim();
        }
        catch {
            Response.Redirect("~/User/Admin/AdminDefault.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            uid   = Session["User_ID"].ToString();
            uname = Session["User_name"].ToString();
            pid   = Session["Patient_ID"].ToString();
            //       uid = "124";
            //     uname = "namal1";
            //   pid = "2";
        }
        catch {
            Response.Redirect("~/Account/Login.aspx");
        }
        // Patient Table ====================================================================================

        try
        {
            // Patient Table ====================================================================================

            dw.SetDataAdapter(@"select * from patient where Patient_ID='" + pid + "' ");
            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='" + uid + "' ");
            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 { }
    }
コード例 #9
0
    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 ==========================================
    }
コード例 #10
0
    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\">" + "&nbsp; &nbsp;" + "</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\">" + "&nbsp; &nbsp;" + "</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 { }
    }
コード例 #11
0
    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>");
            }
        }
    }