Exemplo n.º 1
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            LinqtoSQLDataContext datac = new LinqtoSQLDataContext();
            var query = from p in datac.details
                        where p.Fnm == txtName.Text.ToString() && p.pass == Password.Text.ToString()
                        select p;

            if (query.Any())
            {
                Session["UserName"] = txtName.Text;
                Server.Transfer("Profile.aspx");
            }
            else
            {
                Errorlbl.Text = "Invalid Credentials!";
            }

            //HttpCookie cookie = new HttpCookie("LoginInfo");
            //cookie.Value = "Ketan";
            //Response.Cookies.Add(cookie);
            //Server.Transfer("Profile.aspx");
            ////Response.Redirect("Profile.aspx");
            //String en=TxtEn.Text;
            //Response.Redirect("Profile.aspx?Enroll="+en);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LinqtoSQLDataContext datac = new LinqtoSQLDataContext();

            if (Session["UserName"] != null)
            {
                namelbl.Text = Session["UserName"].ToString();
            }
            var x = from b in datac.details
                    where b.Fnm == namelbl.Text
                    select b.eno;

            j          = x.FirstOrDefault();
            Name1.Text = j;

            //HttpCookie cookie = new HttpCookie("LoginInfo");
            //cookie=Request.Cookies["LoginInfo"];
            //if (cookie != null)
            //{
            //    namelbl.Text = cookie.Value;
            //}
            //else
            //{
            //    namelbl.Text = "Mr.X";
            //}
            //String enr = Request.QueryString["Enroll"].ToString();
            //namelbl.Text = enr;
        }
Exemplo n.º 3
0
        protected void post_Click(object sender, EventArgs e)
        {
            LinqtoSQLDataContext datac = new LinqtoSQLDataContext();
            var c = from p in datac.details
                    where p.Fnm == namelbl.Text
                    select p.email;
            string s = c.FirstOrDefault();


            complaint cmp = new complaint
            {
                Comp = TextBox1.Text,
                Enr  = j,
            };

            datac.complaints.InsertOnSubmit(cmp);
            try
            {
                datac.SubmitChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                datac.SubmitChanges();
            }
            if (s != null)
            {
                SendEmail(s);
            }
            else
            {
                Response.Redirect("Errorpage.aspx");
            }
            TextBox1.Text = "";
            //Name.Text = "";
        }