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 Providers : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Btn_Insert_Click(object sender, EventArgs e)
    {
        UDF_SaveProvider();
    }

    private void UDF_SaveProvider()
    {
        try
        {
            Class_tblProviders tblProv = new Class_tblProviders(Txt_ProviderName.Text.Trim(), Txt_ProviderSName.Text.Trim(), Txt_ProviderEmail.Text.Trim()
                                                                , Txt_ProviderPhones.Text.Trim(), Txt_ProviderFax.Text.Trim(), Txt_ProviderMobiles.Text.Trim()
                                                                , Txt_ProviderPostalAddress.Text.Trim());
            tblProv.UDF_SaveProvider();
            Grd_Providers.DataBind();
            Lbl_Error.Text = "رکورد جدید درج شد.";
            UDF_TxtClear();
        }
        catch
        {
            Lbl_Error.Text = "اشکالی در درج رکورد پیش آمده است";
        }
    }

    private void UDF_TxtClear()
    {
        Txt_ProviderEmail.Text = String.Empty;
        Txt_ProviderFax.Text = String.Empty;
        Txt_ProviderMobiles.Text = String.Empty;
        Txt_ProviderName.Text = String.Empty;
        Txt_ProviderPhones.Text = String.Empty;
        Txt_ProviderPostalAddress.Text = String.Empty;
        Txt_ProviderSName.Text = String.Empty;
    }
}