protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { var token = Session["TOKEN"] as string; var user = TokenManager.Identifytoken(token); if (user != null) { //this.BindGrid(); var ID = Request.QueryString["identifier"]; int id = Convert.ToInt32(ID); var context = new MOMEntities(); MOMDETAILS USER = new MOMDETAILS(); USER = context.MOMDETAILS.Single(x => x.KEY == id); } else { Response.Redirect("Login.aspx"); } } //Label1.Text = USER.RESP; //Label2.Text = USER.REVIEWDATE.Date.ToString(); //Label3.Text = USER.STATUS; //Label4.Text = USER.STATUSREM; }
protected void Button2_Click(object sender, EventArgs e) { try { var ID = Request.QueryString["identifier"]; int id = Convert.ToInt32(ID); var context = new MOMEntities(); MOMDETAILS USER = new MOMDETAILS(); USER = context.MOMDETAILS.Single(x => x.KEY == id); var meeting = USER.MOMDETAILS1; List <INVITEESTABLE> INV = context.INVITEESTABLE.Where(x => x.MEETINGID == meeting).ToList(); DETAILSTABLE detail = new DETAILSTABLE(); foreach (var item in INV) { var uid = item.INVITEEID; detail = context.DETAILSTABLE.SingleOrDefault(x => x.UNIQUEID == uid); var email = detail.EMAIL; using (MailMessage mm = new MailMessage("*****@*****.**", email)) { mm.Subject = "MOM DETAILS"; mm.Body = USER.ACTIONPOINT + USER.TASKDESCRIPTION + USER.TARGET; //var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, verifyUrl); mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(); credentials.UserName = "******"; credentials.Password = "******"; smtp.UseDefaultCredentials = true; smtp.Credentials = credentials; smtp.Port = 587; smtp.Send(mm); } } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void Button1_Click(object sender, EventArgs e) { var ID = Request.QueryString["identifier"]; int id = Convert.ToInt32(ID); var context = new MOMEntities(); MOMDETAILS USER = new MOMDETAILS(); USER = context.MOMDETAILS.Single(x => x.KEY == id); var meeting = USER.MOMDETAILS1; MEETINGTABLE Meeting = new MEETINGTABLE(); Meeting = context.MEETINGTABLE.Single(x => x.MEETINGID == USER.MOMDETAILS1); var CPID = Meeting.CHAIRPERSON; DETAILSTABLE cp = new DETAILSTABLE(); cp = context.DETAILSTABLE.Single(x => x.UNIQUEID == CPID); var email = cp.EMAIL; using (MailMessage mm = new MailMessage("*****@*****.**", email)) { mm.Subject = "REMINDER"; //var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, verifyUrl); //mm.Body = USER.ACTIONABLE+" "+ USER.ITEM+" "+ USER.STATUS+" "+ USER.EXPECTEDCLOSURE; mm.Body = USER.ACTIONPOINT + USER.TASKDESCRIPTION + USER.TARGET; mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(); credentials.UserName = "******"; credentials.Password = "******"; smtp.UseDefaultCredentials = true; smtp.Credentials = credentials; smtp.Port = 587; smtp.Send(mm); } }
protected void Button3_Click() { // create some string variables and assign null values var ex_KEY = 1; var ex_TASKDESCRIP = ""; var ex_CURRENTSTAGE = ""; var Text = "22/11/2009"; var ID = Request.QueryString["identifier"]; DateTime ex_EXPECTEDCLOSURE = DateTime.ParseExact(Text, "dd/MM/yyyy", null); // DateTime ex_EXPECTEDCLOSURE = Convert.ToDateTime(""); var ex_RESPONSIBILITY = ""; var ex_ACTIONPOINT = ""; var ex_EMAIL = ""; DateTime ex_TARGET = DateTime.ParseExact(Text, "dd/MM/yyyy", null); var ex_ITEM = ""; var ex_ITSPOC = "" ; //string myfile_name = Path.GetFileName(FileUpload1.PostedFile.FileName); // assign session object data to myfile_name variable string myfile_name = Session["name"].ToString(); // get complete path of excel sheet and assing it Excel_path variable string Excel_path = Server.MapPath(myfile_name); // create connection with excel database OleDbConnection my_con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Excel_path + ";Extended Properties=Excel 8.0;Persist Security Info=False"); my_con.Open(); try { // get the excel file data and assign it in OleDbcoomad object(o_cmd) OleDbCommand o_cmd = new OleDbCommand("select*from [Sheet1$]", my_con); // read the excel file data and assing it o_dr object OleDbDataReader o_dr = o_cmd.ExecuteReader(); while (o_dr.Read()) { if (o_dr[0].ToString() != "") { //get first row data and assign it ex_id variable // ex_KEY = Convert.ToInt32(o_dr[0]); ex_ITSPOC = o_dr[0].ToString(); //get second row data and assign it ex_name variable ex_TASKDESCRIP = o_dr[1].ToString(); //get thirdt row data and assign it ex_name variable ex_CURRENTSTAGE = o_dr[2].ToString(); ex_ITEM = o_dr[6].ToString(); //get first row data and assign it ex_location variable ex_ACTIONPOINT = o_dr[3].ToString(); // DateTime.ParseExact((string)o_dr[3], "dd/MM/yyyy", null); //ex_EXPECTEDCLOSURE = Convert.ToDateTime(o_dr[3]); ex_RESPONSIBILITY = o_dr[4].ToString(); ex_TARGET = (DateTime)o_dr[5]; // ex_TARGET =DateTime.ParseExact(o_dr[5].ToString(),"dd/MM/yyyy",null); //Text = (string)o_dr[6]; //ex_REVIEWDATE = DateTime.ParseExact(Text, "dd/MM/yyyy", null); ex_EMAIL = o_dr[6].ToString(); var context = new MOMEntities(); MOMDETAILS rec = new MOMDETAILS(); rec.TASKDESCRIPTION = ex_TASKDESCRIP; rec.TARGET = ex_TARGET; rec.RESPONSIBILITY = ex_RESPONSIBILITY; //rec.RESPONSIBILITY = ex_RESPONSIBILITY; rec.CURRENTSTAGE = ex_CURRENTSTAGE; rec.ACTIONPOINT = ex_ACTIONPOINT; rec.EMAIL = ex_EMAIL; rec.ITSPOC = ex_ITSPOC; ////var context = new MOMEntities(); int id = Convert.ToInt32(ID); rec.MOMDETAILS1 = id; context.MOMDETAILS.Add(rec); context.SaveChanges(); } else { o_dr.Close(); break; } } //{ Response.Write("DATA INSERTED SUCCESSFULLY"); Response.Redirect("Details.aspx?identifier=" + ID); } catch (Exception ex) { Response.Write(ex.Message); } }