public ActionResult forgot_password(FormCollection fm)
        {
            dr.d_dob = fm["ctl00$ContentPlaceHolder1$dob_text"];
            dr.d_mob = fm["ctl00$ContentPlaceHolder1$mobile_text"];
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "recover_password";
            cmd.Parameters.AddWithValue("@mob", dr.d_mob);
            cmd.Parameters.AddWithValue("@dob", dr.d_dob);
            DataTable dt = db.getdata(cmd);

            TempData["Result"] = "Recovery Failed! Check your Date of birth and Mobile number";
            if (dt.Rows.Count > 0)
            {
                SqlCommand cmd1 = new SqlCommand();
                cmd1.CommandText = "get_user_mailid";
                cmd1.Parameters.AddWithValue("@id", dt.Rows[0][0].ToString());
                DataTable dt1 = db.getdata(cmd1);
                TempData["Result"] = m.sentmail(dt.Rows[0][1].ToString(), dt.Rows[0][2].ToString(), dt1.Rows[0][0].ToString());
            }
            return(RedirectToAction("login_user"));
        }
        public ActionResult newpatient_reg(FormCollection fm)
        {   //RANDOM PASSWORD//
            Random rd = new Random();
            string ps = rd.Next(000000, 999999).ToString() + Session["logid"].ToString();

            uc.usern = fm["ctl00$ContentPlaceHolder1$UnameText"];
            string mail = fm["ctl00$ContentPlaceHolder1$mailText"];

            uc.passd    = ps;
            uc.usertype = "Patient";


            SqlCommand cmd2 = new SqlCommand();

            cmd2.CommandText = "maxid_in_login";
            db.maxid(cmd2);

            pa.did = Convert.ToInt32(Session["logid"]);
            SqlCommand cmd1 = new SqlCommand();

            cmd1.CommandText = "add_patient";
            cmd1.Parameters.AddWithValue("@uid", db.maxid(cmd2));
            cmd1.Parameters.AddWithValue("@uname", uc.usern);
            cmd1.Parameters.AddWithValue("@passw", uc.passd);
            cmd1.Parameters.AddWithValue("@utype", uc.usertype);
            cmd1.Parameters.AddWithValue("@did", pa.did);
            cmd1.Parameters.AddWithValue("@date", System.DateTime.Now);
            db.execute(cmd1);

            //FORWARD PASSWORD TO PATIENT//

            string s = mg.sentmail(uc.usern, uc.passd, mail);


            return(RedirectToAction("doc_add_patient"));//show succes or failure along//
        }