Server IP : 103.118.17.23 / Your IP : 216.73.216.32 Web Server : Microsoft-IIS/10.0 System : Windows NT RESELLERPLESK22 10.0 build 20348 (Windows Server 2016) AMD64 User : IWAM_plesk(default) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/vhosts/mesa.org.in/httpdocs/ |
Upload File : |
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Text; using System.IO; using System.Text.RegularExpressions; using System.Web.Services; using System.Net.Mail; using System.Net; public partial class grievance_form : System.Web.UI.Page { cnn cn = new cnn(); DataSet ds; string x; DataRow drow; int record = 0; public void qry(string x) { try { ds = new DataSet(); cn.da = new System.Data.SqlClient.SqlDataAdapter(x, cn.cn); cn.cbd.DataAdapter = cn.da; cn.da.MissingSchemaAction = MissingSchemaAction.AddWithKey; cn.da.Fill(ds); } catch (Exception) { //toolStripStatusLabel1.Text = ex.Message.ToString(); } } protected void Page_Load(object sender, EventArgs e) { x = "select * from incr"; qry(x); DataSet cont = new DataSet(); cn.da.Fill(cont); int x1; x1 = cont.Tables[0].Rows.Count - 1; if (x1 == -1) { record = 1; } else { record = Convert.ToInt32(cont.Tables[0].Rows[x1].ItemArray[1]); record += 1; } lblincr.Text = record.ToString(); x = "insert visitor_no into incr ='" + lblincr.Text + "'"; qry(x); cn.cmd.CommandType = CommandType.Text; cn.cmd.CommandText = "update incr set visitor_no ='" + lblincr.Text + "' where id= 1"; cn.cn.Open(); cn.cmd.Connection = cn.cn; cn.cmd.ExecuteNonQuery(); cn.cn.Close(); if (!IsPostBack) { GetHMenuData(); } } protected void btnRegister_Click(object sender, EventArgs e) { if (Page.IsValid) { btnRegister.Text = "Submit"; string constr = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ToString(); // connection string SqlConnection SQLConn = new SqlConnection(constr); string queryValidate = "Select * from Grievance where email='" + txtemail.Text + "'"; DataTable objdt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(queryValidate, SQLConn); SqlDataAdapter SQLAAdapter = new SqlDataAdapter("select * from Grievance", SQLConn); da.Fill(objdt); DataTable DTT = new DataTable(); // SQLAAdapter.Fill(DTT); string gender = string.Empty; if (rbMale.Checked) { gender = "Male"; } else if (rbFemale.Checked) { gender = "Female"; } if (objdt.Rows.Count > 0) { lblmessage.Text = "* Email Already Exists."; } string Lodge_Grievance = string.Empty; //string agree = string.Empty; //if (agYes.Checked) //{ // agree = "Yes"; //} //else { string SQLquery1 = "INSERT INTO Grievance(name, email, mobile, Gender,department,grievance,docs) VALUES ('" + txtname.Text + "', '" + txtemail.Text + "', '" + txtmobile.Text + "','" + gender + "','" + txtdepartment.Text + "','" + txtgrievance.Text + "','" + FileUpload1.FileName + "')"; SqlCommand cmd = new SqlCommand(SQLquery1, SQLConn); cmd.CommandType = CommandType.Text; // Label1.Text = "Records inserted successfully"; SQLConn.Open(); cmd.ExecuteNonQuery(); SendActivationEmail(); Session["username"] = txtemail.Text; if (FileUpload1.HasFile) { string strPath = Server.MapPath("~"); strPath = strPath + "\\uploads/grievance\\"; Directory.CreateDirectory(strPath); strPath = strPath + "\\"; FileUpload1.SaveAs(strPath + FileUpload1.FileName); } if (FileUpload1.HasFile) { if (FileUpload1.PostedFile.ContentLength < 2097152) { try { Label2.Text = "File name: " + FileUpload1.PostedFile.FileName + "<br>" + FileUpload1.PostedFile.ContentLength + " kb<br>" + "Content type: " + FileUpload1.PostedFile.ContentType; } catch (Exception ex) { Label2.Text = "ERROR: " + ex.Message.ToString(); } } else { Label2.Text = "File size exceeds maximum limit 2 MB."; } } SQLConn.Close(); // SendActivationEmail(); lblmessage.Text = "Thank You for submitting Grievance we will reply soon ........"; } } } private void SendActivationEmail() { string constr = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ToString(); // connection string using (MailMessage mm = new MailMessage("info@mesa.org.in", txtemail.Text)) { mm.Subject = "Mahadevrao Wandre Polytechnic "; string body = "Hello " + txtname.Text.Trim() + ","; body += "<br /><br />Thank you for sign up on Mahadevrao Wandre Polytechnic Grievance Redressal Form"; body += "<br /></a>"; body += "<br /> Name : " + txtname.Text.Trim() + "</a>"; body += "<br />Email : " + txtemail.Text.Trim() + "</a>"; body += "<br /> Mobile: " + txtmobile.Text.Trim() + "</a>"; body += "<br />Department: '" + txtdepartment.Text.Trim() + "'</a>"; body += "<br />Grievance " + txtgrievance.Text.Trim() + "</a>"; body += "<br />" + string.Format("Gender: {0}", rbMale.Checked ? "Male" : "Female"); if (FileUpload1.HasFile) { string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); mm.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, fileName)); } body += "<br />Mahadevrao Wandre Polytechnic</a>"; body += "<br />Support Team</a>"; body += "<br /><br />Thanks</a>"; body += "<br /><br />"; mm.Body = body; mm.IsBodyHtml = true; //MailAddress copy = new MailAddress("1747principal@msbte.com"); //mm.CC.Add(copy); SmtpClient smtp = new SmtpClient(); smtp.Host = "mail.mesa.org.in"; //smtp.EnableSsl = true; NetworkCredential NetworkCred = new NetworkCredential("info@mesa.org.in", "M3p07%ws4"); smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port =25; smtp.Send(mm); } } private void GetHMenuData() { DataTable table = new DataTable(); x = "select id, menu, parent_id, url from Hmenudetails ORDER by Sequence ASC"; qry(x); cn.da.Fill(table); DataView view = new DataView(table); view.RowFilter = "parent_id is NULL"; foreach (DataRowView row in view) { MenuItem menuItem = new MenuItem(row["menu"].ToString(), row["id"].ToString()); menuItem.NavigateUrl = row["url"].ToString(); MenuBar.Items.Add(menuItem); AddChildItems1(table, menuItem); } } private void AddChildItems1(DataTable table, MenuItem menuItem) { DataView viewItem = new DataView(table); viewItem.RowFilter = "parent_id=" + menuItem.Value; foreach (DataRowView childView in viewItem) { MenuItem childItem = new MenuItem(childView["menu"].ToString(), childView["id"].ToString()); childItem.NavigateUrl = childView["url"].ToString(); menuItem.ChildItems.Add(childItem); AddChildItems1(table, childItem); } } }