protected void btnReset_Click(object sender, EventArgs e)
 {
     using (PhotoProcessingDataContext dataDB = new PhotoProcessingDataContext())
     {
         var counter = from a in dataDB.Photo_CustomerRegistrationDetails where a.Email == login_id select a;
         var update = counter.FirstOrDefault();
         Photo_Change_Password_logBL obj = new Photo_Change_Password_logBL(txtNewpassword.Text, update.Password, DateTime.Now, update.Customer_id);
         obj.Insert();
         update.Password = txtNewpassword.Text;
         dataDB.SubmitChanges();
         lbResponse.Text = "Reset Successfully!";
     }
 }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
         string Path = "";
         using (PhotoProcessingDataContext dataDB = new PhotoProcessingDataContext())
         {
             var UpdateRegDetail = (from a in dataDB.Photo_CustomerRegistrationDetails where a.Email == Session["email"] select a).FirstOrDefault();
             if (fuProfileImage.HasFile)
            {
                 if (Request.ContentLength < 2097152)
                 {
                     string filename = fuProfileImage.FileName;


                     string[] a = filename.Split('.');
                     if (a[1] == "gif" || a[1] == "png" || a[1] == "jpg")
                     {
                         Path = "~/Images/Profile/" + UpdateRegDetail.Customer_id + fuProfileImage.FileName;
                         fuProfileImage.SaveAs(Server.MapPath(Path));
                         UpdateRegDetail.Profile_Image = Path;
                     }
                     else
                     {
                         lbResponse.Text = "Invalid Format!";
                     }

                 }
                 else
                 {
                     lbResponse.Text = "File size should be less then 2mb!";

                 }
            }
             UpdateRegDetail.Mobile = Convert.ToInt64(txtMobile.Text);
             UpdateRegDetail.DOB = Convert.ToDateTime(txtDOB.Text);
             UpdateRegDetail.Country = 1;
             UpdateRegDetail.Email_Subs = 0;

             if (cbEmailPrefer.Checked)
             {
                 UpdateRegDetail.Email_Subs = 1;
             }
             dataDB.SubmitChanges();
         }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        
        using (PhotoProcessingDataContext dataDB = new PhotoProcessingDataContext())
        {
            var counter = from a in dataDB.Photo_CustomerRegistrationDetails where a.Email == txtEmail.Text && a.Password == txtPassword.Text select a;
            if (counter.Count() == 1)
            {
                var checkAcivation = counter.FirstOrDefault();
                if (checkAcivation.ActivationStatus_Mail==1)
                {
                    //ContentPlaceHolder ph = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");
                    
                    //FormView fv = (FormView)ph.FindControl("form1");
                    //UpdatePanel up = (UpdatePanel)fv.FindControl("UpdatePanel1");
                    //LinkButton lbtnLoginfind = (LinkButton)up.FindControl("lbtnLogin");
                    //LinkButton lbtnLogoutfind = (LinkButton)up.FindControl("lbtnLogout");
                    //lbtnLogoutfind.Visible = true;
                    //lbtnLoginfind.Visible = false;
                   

                    Session["username"] = checkAcivation.Full_Name;
                    Session["email"]=checkAcivation.Email;
                    var lastlogin = (from a in dataDB.Photo_CustomerRegistrationDetails where a.Customer_id == checkAcivation.Customer_id select a).FirstOrDefault();
                    lastlogin.Last_Login = DateTime.Now;
                    dataDB.SubmitChanges();
                    Response.Redirect("Home.aspx");
                   

                }
                else
                {
                    lbResponse.ForeColor = System.Drawing.ColorTranslator.FromHtml("#006600");
                    lbResponse.Text = "We had sent mail to your Email Id Verify it..!";
                }
            }
            else
            {
                lbResponse.Text = "Invalid Login!";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string login_id = string.Empty;
                EncryptedQueryString args = new EncryptedQueryString(Request.QueryString["args"]);
                foreach (var arg in args)
                {
                    Label label = new Label();
                    label.Text = String.Format("{0}={1}", arg.Key, HttpUtility.HtmlEncode(arg.Value));
                    login_id = label.Text;
                }
                if (login_id == "")
                {
                    throw new Exception("Invalid User!");
                }
                string[] b = login_id.Split('=');
                login_id = b[1];
                using (PhotoProcessingDataContext dataDB = new PhotoProcessingDataContext())
                {
                    var account = (from a in dataDB.Photo_CustomerRegistrationDetails where a.Email == login_id select a).FirstOrDefault();
                    account.ActivationStatus_Mail = 1;
                    dataDB.SubmitChanges();
                    lbResponse.Text = "Your Account activated successfully!";
                }
            }
            catch (Exception ex)
            {
                lbResponse.ForeColor = System.Drawing.ColorTranslator.FromHtml("#CC0000");
                lbResponse.Text = ex.Message;

            }

        }
    }