Exemplo n.º 1
0
    public void bindEmployeeDetailsToRepeater()
    {
        Usercs user = new Usercs();

        Repeaterregister.DataSource = user.showallRecentRegestroment();
        Repeaterregister.DataBind();
    }
Exemplo n.º 2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        //SqlCommand _command = new SqlCommand();
        if (IsValid)
        {
            Usercs user;
            /*verifier datatable*/
            //label1.Text = new Usercs().getUserByMail(txt_mail.Text).Rows.Count.ToString();
            if (new Usercs().getUserByMail(txt_mail.Text).Rows.Count == 0)
            {
                if (FileUpload1.HasFile)
                {
                    if (FileUpload1.PostedFile.ContentType.ToLower() == "image/jpeg" || FileUpload1.PostedFile.ContentType == "image/png")
                    {
                        string image = "ImageUser/" + Session.SessionID + getstring() + "." + Path.GetExtension(FileUpload1.PostedFile.FileName);


                        FileUpload1.SaveAs(Server.MapPath(image));
                        user = new Usercs(TextBoxusername.Text, txt_phonenumber.Text, txt_job.Text, txt_mail.Text, TextBox_password.Text, image);
                        string confirmail = " Hello: " + TextBoxusername.Text + " Thanks for signing up to Golf Academy! To set up your account" + txt_mail.Text;
                        if (user.insertUser() > 0)
                        {
                            sendMail(txt_mail.Text, confirmail);
                        }
                    }
                    else
                    {
                        labelerreur.Visible = true;
                        labelerreur.Text    = "extension for image invalid  ";
                    }
                }
            }
            else
            {
                labelerreur.Visible = true;
                labelerreur.Text    = "the email is existing ";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["admin"] != null)
            {
                Admin admin = (Admin)Session["admin"];
            }
            else
            {
                if (Request.Cookies["login"] != null && Request.Cookies["passeword"] != null)
                {
                    Admin admin = Admin.Authentification(Request.Cookies["login"].Value, Request.Cookies["passeword"].Value);
                    if (admin != null)
                    {
                        Response.Redirect("AdminHome.aspx");
                    }
                    else
                    {
                        Response.Redirect("LoginAdmin.aspx");
                    }
                }
                Response.Redirect("LoginAdmin.aspx");
            }


            Usercs _user = new Usercs();

            Repeater_register.DataSource = _user.showRecentRegestroment();
            Repeater_register.DataBind();

            Contact _contact = new Contact();
            Repeater_message.DataSource = _contact.Afficher4Message();
            Repeater_message.DataBind();
        }
    }