Example #1
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";
 }
Example #3
0
    protected void btn1_Click(object sender, EventArgs e)
    {
        nsgetwell.clsusr obj = new nsgetwell.clsusr();
        Int32            cod;
        char             rol;

        cod = obj.logincheck(txteml.Text, txtpwd.Text, out rol);
        if (cod == -1)
        {
            lblusr.Text = "Email Password Incorrect";
        }
        else
        {
            FormsAuthenticationTicket tk = new FormsAuthenticationTicket
                                               (1, txteml.Text, DateTime.Now, DateTime.Now
                                               .AddHours(2), false, rol.ToString());
            String     st = FormsAuthentication.Encrypt(tk);
            HttpCookie ck = new HttpCookie(
                FormsAuthentication.FormsCookieName, st);
            Response.Cookies.Add(ck);

            Session["cod"] = cod;
            if (rol == 'A')
            {
                Response.Redirect("admin/frmcty.aspx");
            }
            else if (rol == 'D')
            {
                Response.Redirect("doctor/frmprf.aspx");
            }
            else
            {
                if (Session["dcod"] == null)
                {
                    Response.Redirect("index.aspx");
                }
                else
                {
                    Response.Redirect("frmappreq.aspx");
                }
            }
        }
    }