using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

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

    }
    private void UDF_ClearTextBox()
    {
        Txt_Address.Text = String.Empty;
        Txt_Email.Text = String.Empty;
        Txt_Family.Text = String.Empty;
        Txt_Mobail.Text = String.Empty;
        Txt_Name.Text = String.Empty;
        Txt_Password.Text = String.Empty;
        Txt_RePass.Text = String.Empty;
        Txt_Tell.Text = String.Empty;
        Txt_UserName.Text = String.Empty;
    }
    protected void Btn_Save_Click(object sender, EventArgs e)
    {
        Class_tblDriver clsDriv = new Class_tblDriver(2, Txt_UserName.Text.Trim(), Txt_Password.Text.Trim(), Txt_Name.Text.Trim(), Txt_Family.Text.Trim(), Txt_Tell.Text.Trim(), Txt_Mobail.Text.Trim(), Txt_Email.Text.Trim(), Txt_Address.Text.Trim());
        if (clsDriv.UDF_ReternUserName() == true)
        {
            Lbl_Error.Visible = true;
            Lbl_Error.Text = "نام کاربری تکراری است";
        }
        else
        {
            clsDriv.UDF_Save();
            Lbl_Error.Visible = true;
            Lbl_Error.Text = "ثبت نام با موفقیت انجام شد";
            UDF_ClearTextBox();
        }
    }
    protected void Btn_Cansel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?ID=" + DateTime.Now.Ticks.ToString());
    }
}