Exemple #1
0
    private void BindFromCatalogueDLL()
    {
        using (BLL_PURC_Purchase objBLLPurc = new BLL_PURC_Purchase())
        {
            DataSet ds = objBLLPurc.LibraryCatalogueSearch(null, txtFromMachinery.Text.Trim(), "SP", DDLFromDept.SelectedValue, Int32.Parse(DDLFromVessel.SelectedValue), "", 1, null, null, 1, 500, 1);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DDLFromSystem.Items.Clear();
                DDLFromSystem.DataSource     = ds.Tables[0];
                DDLFromSystem.DataTextField  = "System_Description";
                DDLFromSystem.DataValueField = "System_Code";
                DDLFromSystem.DataBind();
                ListItem li = new ListItem("--SELECT ALL--", "0");
                DDLFromSystem.Items.Insert(0, li);
            }
        }
    }
    //private void BindToDepartmentDLL()
    //{
    //    try
    //    {
    //        using (BLL_PURC_Purchase objBLLPURC = new BLL_PURC_Purchase())
    //        {
    //            DataTable dtDepartment = new DataTable();
    //            dtDepartment = objBLLPURC.SelectDepartment();
    //            dtDepartment.DefaultView.RowFilter = "Form_Type='SP'";

    //            DDLTofunc.Items.Clear();
    //            DDLTofunc.DataSource = dtDepartment;
    //            DDLTofunc.AppendDataBoundItems = true;
    //            DDLTofunc.DataTextField = "Name_Dept";
    //            DDLTofunc.DataValueField = "Code";
    //            DDLTofunc.DataBind();
    //            DDLTofunc.Items.Insert(0, new ListItem("--SELECT ALL--", "0"));

    //        }

    //    }
    //    catch (Exception ex)
    //    {

    //    }

    //}

    /// <summary>
    ///  Bind Catalogue (FROM)
    /// </summary>
    private void BindFromCatalogueDDL(DataTable dt)
    {
        try
        {
            if (dt.Rows.Count > 0)
            {
                DDLFromSystem.Items.Clear();
                DDLFromSystem.DataSource     = dt;
                DDLFromSystem.DataTextField  = "System_Description";
                DDLFromSystem.DataValueField = "System_Code";
                DDLFromSystem.DataBind();
            }
            else
            {
                DDLFromSystem.Items.Clear();
            }
            ListItem li = new ListItem("--SELECT ALL--", "0");
            DDLFromSystem.Items.Insert(0, li);
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }