示例#1
0
        public List <clsusrprp> Disp_Rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("dspusr", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader    dr  = cmd.ExecuteReader();
            List <clsusrprp> obj = new List <clsusrprp>();

            while (dr.Read())
            {
                clsusrprp k = new clsusrprp();
                k.usrcod = Convert.ToInt32(dr[0]);
                k.usreml = dr[1].ToString();
                k.usrpwd = dr[2].ToString();
                k.usrphn = dr[4].ToString();
                k.usrrol = Convert.ToChar(dr[5]);
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
示例#2
0
        public List <clsusrprp> Find_Rec(Int32 usrcod)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("fndusr", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@usrcod", usrcod);
            SqlDataReader    dr  = cmd.ExecuteReader();
            List <clsusrprp> obj = new List <clsusrprp>();

            if (dr.HasRows)
            {
                dr.Read();
                clsusrprp k = new clsusrprp();
                k.usrcod = Convert.ToInt32(dr[0]);
                k.usreml = dr[1].ToString();
                k.usrpwd = dr[2].ToString();
                k.usrphn = dr[4].ToString();
                k.usrrol = Convert.ToChar(dr[5]);
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
示例#3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //    1) insert record to tbusr
        nsgetwell.clsusr    obj    = new nsgetwell.clsusr();
        nsgetwell.clsusrprp objprp = new nsgetwell.clsusrprp();
        objprp.usreml    = TextBox2.Text;
        objprp.usrphn    = TextBox3.Text;
        objprp.usrregdat = DateTime.Now;
        objprp.usrrol    = 'D';
        String pwd = Guid.NewGuid().ToString();

        pwd           = pwd.Substring(0, 10);
        objprp.usrpwd = pwd;
        Int32 a = obj.Save_Rec(objprp);

        //  2) fetch usrcod and insert partial details to tbdoc
        nsgetwell.clsdoc    obj1    = new nsgetwell.clsdoc();
        nsgetwell.clsdocprp objprp1 = new nsgetwell.clsdocprp();
        objprp1.docnam    = TextBox1.Text;
        objprp1.docarecod = Convert.ToInt32(DropDownList2.SelectedValue);
        objprp1.docspccod = Convert.ToInt32(DropDownList3.SelectedValue);
        objprp1.docusrcod = a;
        obj1.Save_Rec(objprp1);
        // 3) send email to doctor containing login info
        String bdy = "<a href=index.aspx> Click Here</a> to login to your account." +
                     "<b>Email:</b>" + TextBox2.Text + "<br><b>Password:</b> " + pwd;
        MailMessage mm = new MailMessage("*****@*****.**", TextBox2.Text,
                                         "Login Information", bdy);

        mm.IsBodyHtml = true;
        SmtpClient c = new SmtpClient("mail.connectzone.in", 25);

        c.Send(mm);
        Response.Redirect("frmdoc.aspx");
    }
 protected void btn1_Click(object sender, EventArgs e)
 {
     nsgetwell.clsusr    obj    = new nsgetwell.clsusr();
     nsgetwell.clsusrprp objprp = new nsgetwell.clsusrprp();
     objprp.usreml    = txteml.Text;
     objprp.usrphn    = txtphn.Text;
     objprp.usrpwd    = txtpwd.Text;
     objprp.usrregdat = DateTime.Now;
     objprp.usrrol    = 'U';
     obj.Save_Rec(objprp);
     lblusr.Text = "Registration Successful";
 }
示例#5
0
        public void Delete_Rec(clsusrprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("delusr", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@usrcod", p.usrcod);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
示例#6
0
        public void Update_Rec(clsusrprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("updusr", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@usrcod", p.usrcod);
            cmd.Parameters.AddWithValue("@usreml", p.usreml);
            cmd.Parameters.AddWithValue("@usrpwd", p.usrpwd);
            cmd.Parameters.AddWithValue("@usrregdat", p.usrregdat);
            cmd.Parameters.AddWithValue("@usrphn", p.usrphn);
            cmd.Parameters.AddWithValue("@usrrol", p.usrrol);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
示例#7
0
        public Int32 Save_Rec(clsusrprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("insusr", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@usreml", p.usreml);
            cmd.Parameters.AddWithValue("@usrpwd", p.usrpwd);
            cmd.Parameters.AddWithValue("@usrregdat", p.usrregdat);
            cmd.Parameters.AddWithValue("@usrphn", p.usrphn);
            cmd.Parameters.AddWithValue("@usrrol", p.usrrol);
            cmd.Parameters.Add("@r", SqlDbType.Int).Direction = ParameterDirection
                                                                .ReturnValue;
            cmd.ExecuteNonQuery();
            Int32 a = Convert.ToInt32(cmd.Parameters["@r"].Value);

            cmd.Dispose();
            con.Close();
            return(a);
        }