Example #1
0
        public void BindGrid()
        {
            try
            {
                //List<GetFacilityVendorAccount> list = new List<GetFacilityVendorAccount>();

                List <SearchFacilityVendorAcct> list = new List <SearchFacilityVendorAcct>();

                foreach (ListItem lst in drpVendorSearch.Items)
                {
                    if (lst.Selected && drpVendorSearch.SelectedValue != "All")
                    {
                        SB.Append(lst.Value + ',');
                    }
                }

                if (SB.ToString() != "")
                {
                    listFacilityVendorAcc.ListVendorID = SB.ToString().Substring(0, (SB.Length - 1));
                }
                //var DrpVendorSearch = Array.ConvertAll<string, Int64>(FinalOut.Split(','), Convert.ToInt64);
                SB.Clear();

                foreach (ListItem lst in drpFacilitySearch.Items)
                {
                    if (lst.Selected && drpVendorSearch.SelectedValue != "All")
                    {
                        SB.Append(lst.Value + ',');
                    }
                }

                if (SB.ToString() != "")
                {
                    listFacilityVendorAcc.ListFacilityID = SB.ToString().Substring(0, (SB.Length - 1));
                }
                //var DrpItemCategorySearch = Array.ConvertAll<string, Int64>(FinalOut.Split(','), Convert.ToInt64);
                SB.Clear();

                listFacilityVendorAcc.IsStrActive = rdbstatus.SelectedValue;
                listFacilityVendorAcc.LoggedIN    = defaultPage.UserId;
                listFacilityVendorAcc.Filter      = "";
                list = lclsservice.GetFacilityVendorAcct(listFacilityVendorAcc).ToList();
                //lblrowcount.Text = "No of records : " + list.Count.ToString();
                gridFacilityVendorAcc.DataSource = list;
                gridFacilityVendorAcc.DataBind();
                //if (drpVendorSearch.SelectedIndex == 0 && drpFacilitySearch.SelectedIndex == 0)
                //{
                //    list = service.GetFacilityVendorAccount(SearchItem).ToList();
                //    gridFacilityVendorAcc.DataSource = list;
                //    gridFacilityVendorAcc.DataBind();
                //}
                //else if (drpVendorSearch.SelectedIndex == 0 || drpFacilitySearch.SelectedIndex == 0)
                //{
                //    list = service.GetFacilityVendorAccount(SearchItem).Where(a => a.FacilityDescription == drpFacilitySearch.SelectedItem.Text || a.VendorID == Convert.ToInt64(drpVendorSearch.SelectedValue)).ToList();
                //    gridFacilityVendorAcc.DataSource = list;
                //    gridFacilityVendorAcc.DataBind();
                //}
                //else
                //{
                //    list = service.GetFacilityVendorAccount(SearchItem).Where(a => a.FacilityDescription == drpFacilitySearch.SelectedItem.Text && a.VendorID == Convert.ToInt64(drpVendorSearch.SelectedValue)).ToList();
                //    gridFacilityVendorAcc.DataSource = list;
                //    gridFacilityVendorAcc.DataBind();
                //}
            }
            catch (Exception ex)
            {
                EventLogger log = new EventLogger(config);
                log.LogException(ex);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountErrorMessage.Replace("<<FacilityDescription>>", ex.Message), true);
            }
        }