Esempio n. 1
0
        private void BindGridViewDepartment(string search)
        {
            FiltersModel          fm        = Session["FiltersModel"] as FiltersModel;
            List <ViewDepartment> _View     = new List <ViewDepartment>();
            List <ViewDepartment> _TempView = new List <ViewDepartment>();
            User         LoggedInUser       = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder qb    = new QueryBuilder();
            string       query = qb.QueryForCompanyView(LoggedInUser);
            DataTable    dt    = qb.GetValuesfromDB("select * from ViewDepartment " + query + " ORDER BY DeptName ASC");

            _View = dt.ToList <ViewDepartment>();
            if (fm.CompanyFilter.Count > 0)
            {
                foreach (var comp in fm.CompanyFilter)
                {
                    short _compID = Convert.ToInt16(comp.ID);
                    _TempView.AddRange(_View.Where(aa => aa.CompID == _compID).ToList());
                }
                _View = _TempView.ToList();
            }
            if (fm.DivisionFilter.Count > 0)
            {
                _TempView.Clear();
                foreach (var div in fm.DivisionFilter)
                {
                    short _divID = Convert.ToInt16(div.ID);
                    _TempView.AddRange(_View.Where(aa => aa.DivID == _divID).ToList());
                }
                _View = _TempView.ToList();
            }
            GridViewDepartment.DataSource = _View.Where(aa => aa.DeptName.ToUpper().Contains(search.ToUpper())).ToList();
            GridViewDepartment.DataBind();
        }
    protected void Rebind()
    {
        DataSet DepartmentName_dataset = DepartmentInfoEx.SelectAllDepartName();

        GridViewDepartment.DataSource = DepartmentName_dataset;
        GridViewDepartment.DataBind();
    }
Esempio n. 3
0
        private void BindGridViewDepartment(string search)
        {
            FiltersModel         fm           = Session["FiltersModel"] as FiltersModel;
            List <HR_Department> _View        = new List <HR_Department>();
            List <HR_Department> _TempView    = new List <HR_Department>();
            ViewUserEmp          LoggedInUser = HttpContext.Current.Session["LoggedUser"] as ViewUserEmp;
            QueryBuilder         qb           = new QueryBuilder();
            string    query = qb.QueryForReportsDepartment(LoggedInUser);
            DataTable dt    = new DataTable();

            if (query != "where")
            {
                dt = qb.GetValuesfromDB("select * from HR_Department where Status=1 order by DepartmentName asc");
            }
            _View = dt.ToList <HR_Department>();
            GridViewDepartment.DataSource = _View.Where(aa => aa.DepartmentName.ToUpper().Contains(search.ToUpper())).OrderBy(aa => aa.DepartmentName).ToList();
            GridViewDepartment.DataBind();
        }
        public void display()
        {
            DataTable dt = new DataTable();
            String    con;

            con = "User Id = sandeep; Password=admin; Data source = XE";
            cn.ConnectionString = con;
            cn.Open();

            //to display data from department table

            OracleCommand     cmd = new OracleCommand("Select *  from Department_Detais", cn);
            OracleDataAdapter adp = new OracleDataAdapter(cmd);

            adp.Fill(dt);
            cn.Close();
            GridViewDepartment.DataSource = dt;
            GridViewDepartment.DataBind();
        }