Beispiel #1
0
    public void FillVendorDataList(int SocietyID, String UserType)
    {
        try
        {
            VendorController vendorController = new VendorController();
            DataSet          DatasetVendors   = vendorController.GetVendors(muser.currentResident.SocietyID, muser.currentResident.UserType, 0);

            //String TotalvendorsQuery = "Select Count(ID) from dbo.vendors;";
            int Totalvendors = 0; //dacess.GetSingleValue(TotalvendorsQuery);

            if (DatasetVendors == null || DatasetVendors.Tables == null || DatasetVendors.Tables.Count == 0 ||
                DatasetVendors.Tables[0].Rows.Count == 0)
            {
                drpvendorfilter.Visible = false;
                //lblVendrCatText.Visible = false;
                lblVendrEmptyText.Text = "At this  time  there are  no  Vendors registered in this society";
            }

            else
            {
                drpVendorcategory.Visible = true;
                //lblVendrCatText.Visible = true;
                DataTable dt = DatasetVendors.Tables[0];
                Datavendors.DataSource = dt;

                Datavendors.DataBind();
                Totalvendors = dt.Rows.Count;
                //if (dt.Rows.Count > 0)
                //{
                //    if (dt.Rows.Count == 2)
                //    {
                //        Datavendors.Width = new Unit("100%");
                //    }

                //    if (dt.Rows.Count == 1)
                //    {
                //        Datavendors.Width = new Unit("100%");
                //    }
                //    Datavendors.DataSource = dt;
                //    Datavendors.DataBind();
                //    Totalvendors = dt.Rows.Count;
                //}
                lblTotalVendors.Text = Totalvendors.ToString();
            }
        }

        catch (Exception ex)
        {
        }
    }
Beispiel #2
0
    public void Filterdata(int SocietyID)
    {
        try
        {
            muser = (User)Session["User"];
            DataAccess dacess = new DataAccess();

            if (drpvendorfilter.SelectedItem.Text == "All")
            {
                FillVendorDataList(muser.currentResident.SocietyID, muser.currentResident.UserType);
            }

            else
            {
                String DatalistQuery = "Select * from dbo.Vendors where ShopCategory = '" + drpvendorfilter.SelectedItem.Text + "' and SocietyID ='" + SocietyID + "'";

                DataSet ds           = dacess.ReadData(DatalistQuery);
                int     Totalvendors = 0;
                if (ds != null && ds.Tables != null && ds.Tables.Count > 0)
                {
                    DataTable data = ds.Tables[0];

                    if (data.Rows.Count == 2)
                    {
                        Datavendors.Width = new Unit("100%");
                    }
                    if (data.Rows.Count == 1)
                    {
                        Datavendors.Width = new Unit("100%");
                    }

                    //String TotalvendorsQuery = "Select Count(ID) from dbo.vendors where ShopCategory = '" + drpvendorfilter.SelectedItem.Text + "'";
                    Totalvendors = ds.Tables[0].Rows.Count; //dacess.GetSingleValue(TotalvendorsQuery);
                }
                else
                {
                    ds = new DataSet();
                }
                Datavendors.DataSource = ds;
                Datavendors.DataBind();
                lblTotalVendors.Text = Totalvendors.ToString();
            }
        }

        catch (Exception ex)
        {
        }
    }