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

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

    private void UDF_SaveWhAsset()
    {
        Class_tblWhAssets tblWhAs = new Class_tblWhAssets(Txt_ProviderName.Text.Trim(), int.Parse(Drp_AssetUnitID.SelectedValue.ToString())
                                                          , int.Parse(Drp_AssetCategory.SelectedValue.ToString()), int.Parse(Drp_AssetProvider.SelectedValue.ToString())
                                                          , int.Parse(Txt_OrderPoint.Text.Trim()));
        if (tblWhAs.UDF_CheckDuplicate() == 0)
        {
            tblWhAs.UDF_SaveWhAsset();
            Grd_WhAssets.DataBind();
            Lbl_Error.Text = "کالای جدید درج گردید";
            Txt_OrderPoint.Text = String.Empty;
            Txt_ProviderName.Text = String.Empty;
        }
        else
        {
            Lbl_Error.Text = "خطایی در هنگام درج کالا رخ داده است";
        }
    }
}
