protected void btn_Click(object sender, EventArgs e) { try { var FirstName = TextBox.Text; var LastName = TextBox1.Text; var Dep = DepList.SelectedValue; var Email = TextBox2.Text; var mobno = txtTinyMCE.Text; var phoneno = TextBox3.Text; var role = Rolelist.SelectedValue; var context = new MOMEntities(); DETAILSTABLE NEWMEMBER = new DETAILSTABLE(); NEWMEMBER.FIRSTNAME = FirstName; NEWMEMBER.LASTNAME = LastName; NEWMEMBER.DEPARTMENT = Convert.ToDecimal(Dep); NEWMEMBER.EMAIL = Email; if (mobno != "") { NEWMEMBER.MOBILE = mobno; } if (phoneno != "") { NEWMEMBER.TELEPHONE = phoneno; } NEWMEMBER.ROLE = Convert.ToDecimal(role); context.DETAILSTABLE.Add(NEWMEMBER); context.SaveChanges(); } catch (Exception ex) { Response.Write(ex); } }
protected void MOMList_RowUpdating(object sender, GridViewUpdateEventArgs e) { //string key = MOMList.SelectedRow.Cells[7].Text; GridViewRow row = (GridViewRow)MOMList.Rows[e.RowIndex]; var key = MOMList.DataKeys[e.RowIndex].Value; var Key = Convert.ToInt32(key); var context = new MOMEntities(); var obj = context.MOMDETAILS.Single(x => x.KEY == Key); var rem = e.NewValues["REMARKS"]; //TextBox txtBox = (TextBox); if (!string.IsNullOrEmpty(e.NewValues["REMARKS"].ToString())) { obj.REMARKS = rem.ToString();// e.NewValues["REMARKS"].ToString(); } else { obj.REMARKS = null; } string ATR = (MOMList.Rows[e.RowIndex].FindControl("DD2") as DropDownList).SelectedItem.Value; obj.ATR = ATR; context.SaveChanges(); Response.Redirect("Details.aspx?identifier=" + obj.MOMDETAILS1); }
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) { var context = new MOMEntities(); //this.BindGrid(); var context = new MOMEntities(); var list = context.DEPARTMENTTABLE.ToList(); var list1 = context.ROLETABLE.ToList(); Rolelist.DataSource = list1; Rolelist.DataTextField = "ROLE"; Rolelist.DataValueField = "ROLEID"; Rolelist.DataBind(); DepList.DataSource = list; DepList.DataTextField = "DEPARTMENT"; DepList.DataValueField = "KEY"; DepList.DataBind(); } else { Response.Redirect("Login.aspx"); } } }
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; }
private void BindGrid() { var context = new MOMEntities(); // var list = from u in MEETINGTABLE sel var list = context.MOMDETAILS.ToList(); Meet.DataSource = list; Meet.DataBind(); }
protected void btn_Click(object sender, EventArgs e) { try { var firstname = TextBox1.Text; var lastname = TextBox6.Text; var email = TextBox2.Text; var mob = TextBox3.Text; var tel = TextBox4.Text; var dep = Dep.SelectedValue; var password = TextBox5.Text; var context = new MOMEntities(); MEMBERTABLE user = new MEMBERTABLE(); var exa = context.MEMBERTABLE.SingleOrDefault(x => x.EMAIL == email); if (exa != null) { Response.Write("Email already exist"); } else { user.FIRSTNAME = firstname; user.LASTNAME = lastname; user.EMAIL = email; user.MOBILE = mob; user.TELEPHONE = tel; user.PASSWORD = password; user.ID = 0; var contextt = new ValidationContext(user); var results = new List <ValidationResult>(); var isValid = Validator.TryValidateObject(user, contextt, results, true); if (!isValid) { foreach (var validationResult in results) { //Response.Write(validationResult.ErrorMessage.ToString()); //Response.Redirect("SignUp.aspx"); } } else { user.DEPARTMENT = Convert.ToInt32(dep); context.MEMBERTABLE.Add(user); context.SaveChanges(); Response.Redirect("Login.aspx"); } } } catch (Exception ex) { Response.Write(ex.Message); } }
private void BindGrid() { var context = new MOMEntities(); var ID = Request.QueryString["identifier"]; var id = Convert.ToInt32(ID); // var list = from u in MEETINGTABLE sel List<MEETINGTABLE> list = new List<MEETINGTABLE>(); var list = (List <MOMDETAILS>)context.MOMDETAILS.Where(x => x.MOMDETAILS1 == id).ToList(); MOMList.DataSource = list; MOMList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var context = new MOMEntities(); var list = context.DEPARTMENTTABLE.ToList(); Dep.DataSource = list; Dep.DataTextField = "DEPARTMENT"; Dep.DataValueField = "KEY"; Dep.DataBind(); } }
protected void Button2_Click(object sender, EventArgs e) { try { var ID = Request.QueryString["identifier"]; int id = Convert.ToInt32(ID); var context = new MOMEntities(); List <MOMDETAILS> USER = new List <MOMDETAILS>(); USER = context.MOMDETAILS.Where(x => x.MOMDETAILS1 == id).ToList(); //var meeting = USER.MOMDETAILS1; List <INVITEESTABLE> INV = context.INVITEESTABLE.Where(x => x.MEETINGID == id).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"; foreach (var item2 in USER) { mm.Body = mm.Body + " " + item2.ACTIONPOINT + item2.TASKDESCRIPTION + item2.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); } } PopUp("Mail sent to all Invitees"); } catch (Exception ex) { PopUp("Some error occured"); //Response.Write(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!this.IsPostBack) { var token = Session["TOKEN"] as string; var user = TokenManager.Identifytoken(token); if (user != null) { var context = new MOMEntities(); var ID = context.ROLETABLE.SingleOrDefault(x => x.ROLE == "CP"); var origin = context.DETAILSTABLE.Where(s => s.ROLE == ID.ROLEID).ToList(); origin = origin.OrderBy(c => c.FIRSTNAME).ToList(); DataSet o = new DataSet(); ChairpersonList.DataSource = origin; ChairpersonList.DataTextField = "FullName"; ChairpersonList.DataValueField = "UNIQUEID"; ChairpersonList.DataBind(); var Invitees = context.DETAILSTABLE.ToList(); InviteeList.DataSource = Invitees; InviteeList.DataTextField = "FullName"; InviteeList.DataValueField = "UNIQUEID"; InviteeList.DataBind(); var Department = context.DEPARTMENTTABLE.ToList(); ListBox1.DataSource = Department; ListBox1.DataTextField = "DEPARTMENT"; ListBox1.DataValueField = "KEY"; ListBox1.DataBind(); //this.BindGrid(); } else { Response.Redirect("Login.aspx"); } } } }
protected void Button1_Click(object sender, EventArgs e) { var ID = Request.QueryString["identifier"]; int id = Convert.ToInt32(ID); var context = new MOMEntities(); List <MOMDETAILS> USER = new List <MOMDETAILS>(); USER = context.MOMDETAILS.Where(x => x.MOMDETAILS1 == id).ToList(); //var meeting = USER.MOMDETAILS1; //MEETINGTABLE Meeting = new MEETINGTABLE(); var Meeting = context.MEETINGTABLE.Single(x => x.MEETINGID == id); 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 = "Chairperson Meeting Update"; //var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, verifyUrl); //mm.Body = USER.ACTIONABLE+" "+ USER.ITEM+" "+ USER.STATUS+" "+ USER.EXPECTEDCLOSURE; foreach (var item in USER) { mm.Body = mm.Body + " " + item.ACTIONPOINT + item.TASKDESCRIPTION + item.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); } PopUp("Mail sent to Chairperson"); }
protected void btn_Click(object sender, EventArgs e) { try { var status = TextBox3.Text; var context = new MOMEntities(); var ID = Request.QueryString["Identifier"]; var id = Convert.ToInt32(ID); var obj = context.MOMDETAILS.Single(x => x.KEY == id); obj.CURRENTSTAGE = DateTime.Now.ToLongDateString() + ":" + status; context.SaveChanges(); Response.Write("Thank you!"); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btn_Click(object sender, EventArgs e) { //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MOMEntities"].ToString()); try { string uid = TextBox.Text; string pass = TextBox2.Text; var context = new MOMEntities(); MEMBERTABLE check = new MEMBERTABLE(); check.EMAIL = uid; check.PASSWORD = pass; //var contextt = new ValidationContext(uid); //var results = new List<ValidationResult>(); //var isValid = Validator.TryValidateObject(check, contextt, results, true); //if (!isValid) //{ //} //else //{ var user = context.MEMBERTABLE.SingleOrDefault(x => x.EMAIL == uid && x.PASSWORD == pass); if (user != null) { //Token_cs obj = new Token_cs(); var obj = TokenManager.GenerateToken(user.EMAIL); //var token=TokenManager.GenerateToken(user.EMAIL); Session["TOKEN"] = obj; Response.Redirect("Home.aspx?token=" + obj, false); } else { Label4.Text = "UserId & Password Is not correct Try again..!!"; } //} //con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } }
private void BindGrid() { var token = Session["TOKEN"] as string; var user = TokenManager.Identifytoken(token); var context = new MOMEntities(); // var list = from u in MEETINGTABLE sel List<MEETINGTABLE> list = new List<MEETINGTABLE>(); var dep = user.DEPARTMENT; var DepMeet = (List <MEETDEP>)context.MEETDEP.Where(x => x.DEPID == dep).ToList(); List <MEETINGTABLE> list = new List <MEETINGTABLE>(); foreach (var item in DepMeet) { MEETINGTABLE x = new MEETINGTABLE(); x = context.MEETINGTABLE.Single(p => p.MEETINGID == item.MEETID); list.Add(x); } Meetlist.DataSource = list; Meetlist.DataBind(); }
protected void btn_Click(object sender, EventArgs e) { try { var rem1 = TextBox1.Text; var rem2 = TextBox2.Text; var context = new MOMEntities(); MAILTIMER obj1 = new MAILTIMER(); obj1 = context.MAILTIMER.SingleOrDefault(x => x.KEYID == 1); //obj1.KEYID = 1; obj1.DAYS = Convert.ToDecimal(rem1); MAILTIMER obj2 = new MAILTIMER(); obj2 = context.MAILTIMER.SingleOrDefault(x => x.KEYID == 2); //obj1.KEYID = 1; obj2.DAYS = Convert.ToDecimal(rem2); context.SaveChanges(); Response.Redirect("Home.aspx"); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btn_Click(object sender, EventArgs e) { try { var agenda = txtTinyMCE.Text; var title = TextBox3.Text; var chairperson = ChairpersonList.SelectedValue; var date = Convert.ToDateTime(TextBox.Text); var time = TextBox1.Text; var NewMeeting = new MEETINGTABLE(); NewMeeting.CHAIRPERSON = Convert.ToDecimal(chairperson); NewMeeting.TIME = time; NewMeeting.TITLE = title; NewMeeting.MEETINGDATE = date; //NewMeeting.CHAIRPERSON = chairperson; var context = new MOMEntities(); context.MEETINGTABLE.Add(NewMeeting); context.SaveChanges(); var ID = NewMeeting.MEETINGID; var Meetagenda = new AGENDATABLE(); Meetagenda.MEETINGID = ID; Meetagenda.AGENDA = agenda; context.AGENDATABLE.Add(Meetagenda); context.SaveChanges(); foreach (ListItem listItem in InviteeList.Items) { if (listItem.Selected) { var val = listItem.Value; var txt = listItem.Text; INVITEESTABLE invite = new INVITEESTABLE(); invite.MEETINGID = ID; invite.INVITEEID = Convert.ToDecimal(val); context.INVITEESTABLE.Add(invite); context.SaveChanges(); } } foreach (ListItem LISTITEM in ListBox1.Items) { if (LISTITEM.Selected) { var val = LISTITEM.Value; MEETDEP obj = new MEETDEP(); obj.MEETID = ID; obj.DEPID = Convert.ToInt32(val); context.MEETDEP.Add(obj); context.SaveChanges(); } } Response.Redirect("/Home.aspx"); // var list = InviteeList.SelectedValue; // var ID= context.MEETINGTABLE. } catch (Exception ex) { Response.Write(ex.Message); } }
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); } }