protected void teacher_acknowledgement() { string strSelect = "SELECT EmailId FROM Teachermaster WHERE TeacherId ='" + tId + "'"; string emailId = null; SqlCommand cmdSel = new SqlCommand(strSelect, con); SqlDataReader dr; if (con.State != ConnectionState.Open) { con.Open(); } dr = cmdSel.ExecuteReader(); while (dr.Read()) { emailId = dr["EmailId"].ToString(); } EmailRelay f = new EmailRelay("smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); string msg = "Congratulaions..!!Your request for virtual class has been approved..on Date:-" + date + " between " + "Class Starting Time:-" + stime + " to " + "Class Ending Time:-" + etime + " ." + " " + "Set IP_ADDRESS:192.168.1.101 and PORT_NUMBER:8080 for video broadcasting."; if (f.SendMail("*****@*****.**", emailId, "Virtual Classroom", msg, "Virtual Class Request Approved", true) == true) { //lblMessage.Text = "Password has been sent to your registered E-mail ID..!! "; } else { //lblMessage.Text = "Not send..please try again"; } con.Close(); }
//This class expects a JSON string public Message(ApiKeyController apiKeycontroller, EmailRelay relay, IHostingEnvironment hostingEnvironment, EmailTransmission transmission) { Transmission = transmission; _ApiKeyController = apiKeycontroller; _relay = relay; _hostingEnvironment = hostingEnvironment; }
protected void request_denied_Click(object sender, EventArgs e) { if (con.State != ConnectionState.Open) { con.Open(); } try { string EmailId = Session["uname"].ToString(); string strDel = "DELETE FROM TeacherTemp WHERE EmailId='" + EmailId + "'"; EmailRelay f = new EmailRelay("smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); if (f.SendMail("*****@*****.**", EmailId, "Virtual Classroom", "Sorry...!!your request has been refused..!!", "Request rejected", true) == true) { // lblMessage.Text = "Password has been sent to your registered E-mail ID..!! "; } else { //lblMessage.Text = "Not send..please try again"; } SqlCommand cmdDel = new SqlCommand(strDel, con); cmdDel.ExecuteNonQuery(); Response.Redirect("../afterlogin/TeacherApproval.aspx"); con.Close(); } catch (Exception exp3) { lblerrmsg.Text = exp3.Message; } }
protected void request_denied_Click(object sender, EventArgs e) { try { string classId = Session["ClassId"].ToString(); if (con.State != ConnectionState.Open) { con.Open(); } string strDel = "DELETE FROM VirtualClassRequest WHERE ClassId='" + classId + "'"; SqlCommand cmdDel = new SqlCommand(strDel, con); cmdDel.ExecuteNonQuery(); con.Close(); string strSelect = "SELECT EmailId FROM Teachermaster WHERE TeacherId ='" + tId + "'"; string emailId = null; SqlCommand cmdSel = new SqlCommand(strSelect, con); SqlDataReader dr; if (con.State != ConnectionState.Open) { con.Open(); } dr = cmdSel.ExecuteReader(); while (dr.Read()) { emailId = dr["EmailId"].ToString(); } con.Close(); EmailRelay f = new EmailRelay("smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); string msg = "Sorry..!! We are unable to arrange class on time and date specified by you..!! Please take another slot for virtual class..!!"; if (f.SendMail("*****@*****.**", emailId, "Virtual Classroom", msg, "Virtual Class Request Disapproved", true) == true) { //lblMessage.Text = "Password has been sent to your registered E-mail ID..!! "; } else { //lblMessage.Text = "Not send..please try again"; } Response.Redirect("../afterlogin/ClassRequests.aspx"); } catch (Exception exp2) { lblerrmsg.Text = exp2.Message; } }
protected void student_acknowledgement() { string strSelect = "SELECT EmailId FROM Studentmaster WHERE Course ='" + crs + "'"; SqlCommand cmdSel = new SqlCommand(strSelect, con); SqlDataReader dr; ArrayList list_email = new ArrayList(); if (con.State != ConnectionState.Open) { con.Open(); } dr = cmdSel.ExecuteReader(); while (dr.Read()) { list_email.Add(dr["EmailId"].ToString()); } int i = 0; string[] emailIds = new string[list_email.Count]; foreach (string mailId in list_email) { emailIds[i] = mailId; i++; } for (i = 0; i < emailIds.Length; i++) { EmailRelay f = new EmailRelay("smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); string msg = "Your class of " + crs + " " + "has been arranged on " + date + " between " + "Class Starting Time:-" + stime + " to " + "Class Ending Time:-" + etime; if (f.SendMail("*****@*****.**", emailIds[i], "Virtual Classroom", msg, "Virtual Class Schedule", true) == true) { //lblMessage.Text = "Password has been sent to your registered E-mail ID..!! "; } else { //lblMessage.Text = "Not send..please try again"; } } con.Close(); }
void insert_record(string fn, string ln, string dob, string gen, string em, string pwd, string cpwd, string cont, string coun, string st, string cit, string fld, string uni , string upid, string flif, string pp, string pfnm, string crs, string crsd, string cred, string crdes, string cpic, string cpicf) { try { String strIns = "Insert into Teachermaster (Firstname,Lastname,Dateofbirth,Gender,EmailId,Password,Confirm_Password,Contactnumber,Country,State,City,Field,University_college,UploadId,fileid,Profilepic,filename,Course,CourseSDate,CourseEDate,CourseDesc,Course_cover,Cover_filename) values ('" + fn + "','" + ln + "','" + dob + "','" + gen + "','" + em + "','" + pwd + "','" + cpwd + "','" + cont + "','" + coun + "','" + st + "','" + cit + "','" + fld + "','" + uni + "','" + upid + "','" + flif + "','" + pp + "','" + pfnm + "','" + crs + "','" + crsd + "','" + cred + "','" + crdes + "','" + cpic + "','" + cpicf + "')"; if (con1.State != ConnectionState.Open) { con1.Open(); } SqlCommand cmdIns = new SqlCommand(strIns, con1); cmdIns.ExecuteNonQuery(); string strDel = "DELETE FROM TeacherTemp WHERE EmailId='" + EmailId + "'"; pwd = Decrypt(pwd); EmailRelay f = new EmailRelay("smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); if (f.SendMail("*****@*****.**", EmailId, "Virtual Classroom", "Congratulations. Your Request has been approved.!! You can now login now using your user-name and password. User name is=" + em + " and your password is " + pwd, "Request Approved", true) == true) { // lblMessage.Text = "Password has been sent to your registered E-mail ID..!! "; } else { //lblMessage.Text = "Not send..please try again"; } SqlCommand cmdDel = new SqlCommand(strDel, con1); cmdDel.ExecuteNonQuery(); con1.Close(); Response.Redirect("../afterlogin/TeacherApproval.aspx"); } catch (Exception exp3) { lblerrmsg.Text = exp3.Message; } }
protected void btnPass_Click(object sender, EventArgs e) { string strConnection = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|Datadirectory|\VirtualClassroom.mdf;Integrated Security=True;User Instance=True"; string checkuser; if (rbselectuser.SelectedValue == "Student") { checkuser = "******"; } else { checkuser = "******"; } if (checkuser.Equals("Student")) { try { string mailid = txtEmail.Text.ToString(); string strSelect = "SELECT EmailId,Password FROM Studentmaster WHERE EmailId ='" + mailid + "'"; SqlConnection connection = new SqlConnection(strConnection); SqlCommand command = new SqlCommand(strSelect, connection); DataSet dsPwd = new DataSet(); SqlDataAdapter dAdapter = new SqlDataAdapter(command); connection.Open(); dAdapter.Fill(dsPwd); connection.Close(); if (dsPwd.Tables[0].Rows.Count > 0) { string username, password, final; username = dsPwd.Tables[0].Rows[0]["EmailId"].ToString(); password = Decrypt(dsPwd.Tables[0].Rows[0]["Password"].ToString()); final = "User-Name:" + username + "\nPassword:"******"smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); if (f.SendMail("*****@*****.**", mailid, "Virtual Classroom", final, "Password Recovery", true) == true) { lblMessage.Text = "Password has been sent to your registered E-mail ID..!! "; } else { lblMessage.Text = "Not send..please try again"; } } else { } } catch (Exception exp1) { lblMessage.Text = "Exception1"; } } else { try { string mailid = txtEmail.Text.ToString(); string strSelect = "SELECT EmailId,Password FROM Teachermaster WHERE EmailId ='" + mailid + "'"; SqlConnection connection = new SqlConnection(strConnection); SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.Text; command.CommandText = strSelect; //SqlParameter email = new SqlParameter(mailid, SqlDbType.VarChar, 50); //email.Value = txtEmail.Text.Trim().ToString(); //command.Parameters.Add(email); //Create Dataset to store results and DataAdapter to fill Dataset SqlDataReader dr; connection.Open(); command = new SqlCommand(strSelect, connection); dr = command.ExecuteReader(); while (dr.Read()) { string username, password, final; username = dr["EmailId"].ToString(); password = Decrypt(dr["Password"].ToString()); connection.Close(); //password = dsPwd.Tables[0].Rows[0]["Password"].ToString(); final = "\t User-Name:-" + username + "\n\t Password:"******"smtp.gmail.com", "*****@*****.**", "virtualclassroom123"); if (f.SendMail("*****@*****.**", mailid, "Virtual Classroom", final, "Password Recovery", true) == true) { lblMessage.Text = "Password has been sent to your registered E-mail ID..!!--> <a href='Home.aspx'>Home</a>"; } else { lblMessage.Text = "Not send..please try again"; } } } catch (Exception exp2) { lblMessage.Text = exp2.ToString(); } } }