protected void btn_submit_Click(object sender, EventArgs e) { string dt2 = Convert.ToString(dt); string dt4 = dt2.Substring(0, 10); x.conopen(); qry = "select * from paper where pname='" + txtpname.Text + "'"; dtt = x.ser(qry); if (dtt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into paper values('" + txtpname.Text + "','" + dt4 + "')"; x.iud(qry); x.conclose(); Panel1.Visible = true; x.qry = "SELECT que as Question,ans1 as Ans1, ans2 as Ans2, ans3 as Ans3, ans4 as Ans4,type as Type FROM question WHERE sid =" + subject.SelectedValue + " AND cid =" + chapter.SelectedValue; x.ds = x.fillgrid(x.qry); GridView1.DataSource = x.ds.Tables[0]; GridView1.DataBind(); } else { lbl_sub.Text = "This Paper Name Is Already exist"; Response.AddHeader("refresh", "2;url=generatepaper.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { if (subject.SelectedItem.Text == "--Select subject--" || chapter.SelectedItem.Text == "--Select chapter--" || type.SelectedItem.Text == "--Select Type--") { lbl_sub.Text = "DropDown Must Be Select...!!!"; } else { x.conopen(); qry = "select * from question where que='" + txtques.Text + "'"; dt = x.ser(qry); if (dt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into question values ('" + subject.SelectedValue + "','" + chapter.SelectedValue + "','" + txtques.Text + "','" + txtans1.Text + "','" + txtans2.Text + "','" + txtans3.Text + "','" + txtans4.Text + "','" + txtca.Text + "','" + type.SelectedItem.Text + "')"; x.iud(qry); x.conclose(); lbl_sub.Text = "Question is added....."; clear(); Response.AddHeader("refresh", "2;url=question.aspx"); } else { lbl_sub.Text = "Question Is Already Added"; Response.AddHeader("refresh", "2;url=question.aspx"); } } }
void add_ques(string tab_name) { for (int i = 0; i < GridView1.Rows.Count; i++) { chk = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chkques"); if (chk.Checked) { qry = "select * from selectedquestion where sqid=" + (i + 1); dt.Clear(); dt = x.ser(qry); if (dt.Rows.Count > 0) { x.conopen(); qry = "insert into " + tab_name + " values(" + dt.Rows[0]["sqid"].ToString() + ",'" + dt.Rows[0]["ques"].ToString() + "','" + dt.Rows[0]["ans1"].ToString() + "','" + dt.Rows[0]["ans2"].ToString() + "','" + dt.Rows[0]["ans3"].ToString() + "','" + dt.Rows[0]["ans4"].ToString() + "')"; x.iud(qry); x.conclose(); } } } }
protected void btn_submit_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from chapter where cname='" + txtchname.Text + "'"; dt = x.ser(qry); if (dt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into chapter values ('" + DropDownList2.SelectedValue + "','" + txtchname.Text + "')"; x.iud(qry); x.conclose(); lbl_sub.Text = "Chapter is added..."; clear(); Response.AddHeader("refresh", "2;url=chapter.aspx"); } else { lbl_sub.Text = "Question Is Already Added"; Response.AddHeader("refresh", "2;url=chapter.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from subject where sname='" + txtsubname.Text + "'"; dt = x.ser(qry); if (dt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into subject values ('" + txtsubname.Text + "')"; x.iud(qry); x.conclose(); lbl_sub.Text = "subject is added..."; clear(); Response.AddHeader("refresh", "2;url=subject.aspx"); } else { lbl_sub.Text = "Subject Is Already Added"; Response.AddHeader("refresh", "2;url=subject.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { string Gender; Gender = RadioButtonList1.SelectedItem.Value; x.conopen(); qry = "select * from faculty_mster where email_id='" + txtemail.Text + "' or fname='" + txtfname.Text + "'"; dt = x.ser(qry); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/ " + txtfname.Text + str)); fname = txtfname.Text + str; } if (dt.Rows.Count == 0) { x.conclose(); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); if (chk.Contains(str)) { try { string body = this.PopulateBody(txtemail.Text, txtfname.Text, System.DateTime.Now.ToString(), pass); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/" + txtfname.Text + str)); MailMessage Msg = new MailMessage(); Msg.From = new MailAddress(txtemail.Text); Msg.To.Add(txtemail.Text); Msg.Subject = "Please Change your Password After Login"; Msg.Body = body; Msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "admin@5511"); smtp.EnableSsl = true; smtp.Send(Msg); Msg = null; string Password = "******"; string Msg1 = "Register-Successed..."; string OPTINS = "Paper_Generation"; string MobileNumber = txtmob_no.Text; string type = "3"; string strUrl = "https://www.bulksmsgateway.in/sendmessage.php?user=sarthak29&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + 3; System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readStream = new StreamReader(s); string dataString = readStream.ReadToEnd(); response.Close(); s.Close(); readStream.Close(); //Response.Write("Sent"); /*string Password = "******"; * string Msg1 = "Register-Successed..."; * string OPTINS = "Paper_Generation"; * string MobileNumber = txtmob_no.Text; * string type = "3"; * string strUrl = "https://www.bulksmsgateway.in/sendmessage.php?user=ansh7117&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + 3; * System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); * HttpWebResponse response = (HttpWebResponse)request.GetResponse(); * Stream s = (Stream)response.GetResponseStream(); * StreamReader readStream = new StreamReader(s); * string dataString = readStream.ReadToEnd(); * response.Close(); * s.Close(); * readStream.Close();*/ // Response.Write("Sent"); lbl_sub.Text = "Your Password Details Sent to your mail"; string date1 = txtdob.Text.Substring(0, 10); x.conopen(); qry = "insert into faculty_mster values ('" + txtfname.Text + "','" + txtlname.Text + "','" + date1.ToString() + "','" + Gender + "','" + txtcity.Text + "','" + txtmob_no.Text + "','" + txtemail.Text + "','" + pass.ToString() + "','" + fname + "')"; x.iud(qry); x.conclose(); x.conopen(); qry = "insert into admin_master values('" + txtfname.Text + "','" + txtemail.Text + "','" + pass.ToString() + "')"; x.iud(qry); x.conclose(); clear(); } catch (Exception ex) { lbl_sub.Text = "Connection Error Please Try Agian..."; } } else { lbl_sub.Text = "Please Select Image File Only"; } } else { lbl_sub.Text = "Please Select the File"; } } else { // x.conclose(); lbl_sub.Text = "You Are Already Registered. Now you will be redirect to login page"; // lbl_sub.Text = "This Enrollment Number Is Already Registered...."; //Response.AddHeader("Refresh", "5;url=Login.aspx"); } Response.AddHeader("refresh", "5;url=faculty.aspx"); }
protected void btn_submit_Click(object sender, EventArgs e) { string Gender = "M"; if (r2.Checked) { Gender = "F"; } x.conopen(); qry = "select * from student_mster where email_id='" + txtemail.Text + "'"; dt = x.ser(qry); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/ " + txtusn_no.Text + str)); fname = txtusn_no.Text + str; } else { } if (dt.Rows.Count == 0) { x.conclose(); if (MyCaptcha1.IsValid) { string pass = RandomString(8); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); if (chk.Contains(str.ToLower())) { string body = this.PopulateBody(txtemail.Text, txtfname.Text, System.DateTime.Now.ToString(), pass); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/" + txtusn_no.Text + str)); MailMessage Msg = new MailMessage(); Msg.From = new MailAddress(txtemail.Text); Msg.To.Add(txtemail.Text); Msg.Subject = "Please Change your Password After Login"; Msg.Body = body; Msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "admin@5511"); smtp.EnableSsl = true; smtp.Send(Msg); Msg = null; string Password = "******"; string Msg1 = "Register_Successed..."; string OPTINS = "SMTLIB"; string MobileNumber = txtmob_no.Text; string type = "3"; string strUrl = "http://bulksmsgateway.in/sendmessage.php?user=yashjari&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + type; System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readStream = new StreamReader(s); string dataString = readStream.ReadToEnd(); response.Close(); s.Close(); readStream.Close(); lbl_error.Text = "Your Password Details Sent to your mail"; Response.AddHeader("Refresh", "5;url=Login.aspx"); x.conopen(); qry = "insert into student_mster values ('" + txtusn_no.Text + "','" + txtfname.Text + "','" + txtaddress.Text + "','" + txtmob_no.Text + "','" + txtemail.Text + "','" + Gender + "','" + txtdob.Text + "','" + DropDownList1.SelectedValue + "','" + pass.ToString() + "','" + fname + "')"; x.iud(qry); x.conclose(); } else { lbl_error.Text = "Please Select Image File Only"; } } else { lbl_error.Text = "Please Select the File"; } } else { lbl_error.Text = "Captcha is Wrong"; } } else { // x.conclose(); lbl_error.Text = "You Are Already Registered. Now you will be redirect to login page"; Response.AddHeader("Refresh", "5;url=Login.aspx"); } }