using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            Class_tblUser user = new Class_tblUser(Txt_UserName.Text.Trim(), Txt_Password.Text.Trim(), int.Parse(Drp_TypeUser.SelectedValue.ToString()), Txt_Email.Text.Trim(), Txt_WebSite.Text.Trim(), Txt_Tell.Text.Trim(), Txt_Mobail.Text.Trim(), Txt_Note.Text.Trim(), Txt_Name.Text.Trim(), Txt_Family.Text.Trim(), int.Parse(Drp_CompanyName.SelectedValue.ToString()), Chb_UserIsActive.Checked);
            user.UDF_SaveUsers();

            Txt_UserName.Text = String.Empty;
            Txt_Password.Text = String.Empty;
            Txt_RePassword.Text = String.Empty;
            Txt_Tell.Text = String.Empty;
            Txt_BirthDate.Text = String.Empty;
            Txt_Email.Text = String.Empty;
            Txt_Family.Text = String.Empty;
            Txt_Mobail.Text = String.Empty;
            Txt_Name.Text = String.Empty;
            Txt_Note.Text = String.Empty;
            Txt_WebSite.Text = String.Empty;

            Lbl_Error.Visible = true;
            Lbl_Error.Text = "ثبت نام با موفقیت انجام شد";
            Grd_User.DataBind();

        }

        catch
        {
            Lbl_Error.Visible=true;
            Lbl_Error.Text="نام کاربری تکراری است";
        }
    }


    protected void Grd_Users_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
