Ejemplo n.º 1
0
        public DataSet GetEmployeesDs(int PageNumber)
        {// send employees for manage employees forms...
            string Querry1 = "select COUNT(*)as TotalEmp  from Employee;";

            Pagination.Pagination p1 = new Pagination.Pagination();
            int RowsPerPage          = 6;

            p1.CalculateRanges(Convert.ToInt32(database.ExecuteScalar(Querry1)), PageNumber, RowsPerPage);
            if (PageNumber > p1.TotalPages)
            {
                return(null);
            }
            else
            {
                string  Querry = string.Format(@"select Employee.EmployeeID,Employee.EmployeeName,Departments.Department,Designations.Designation,IsActive from Employee inner join Designations on Designations.DesignationID=Employee.DesignationID inner join Departments on Employee.DepartmentID=Departments.DepartmentID order by EmployeeName Asc offset {0} rows fetch next {1} rows only;
", p1.OffsetRows, RowsPerPage);
                DataSet ds     = database.Read(Querry);

                DataTable dt = new DataTable();
                dt.Columns.Add("Count");
                dt.Rows.Add(p1.TotalPages);
                ds.Tables.Add(dt);
                return(ds);
            }
        }
Ejemplo n.º 2
0
        public List <Designation> GetDesignation(Pagination.Pagination p1, int PageNo)
        {
            String Querry = "select count(*) from Designations";

            int RowPerPage = 5;

            p1.CalculateRanges(Convert.ToInt32(database.ExecuteScalar(Querry)), PageNo, RowPerPage);
            List <Designation> Designations = new List <Designation>();
            string             command      = string.Format("select * from Designations order by DesignationID offset {0} rows fetch next {1} rows only", p1.OffsetRows, RowPerPage);

            DataSet ds = database.Read(command);

            if (PageNo > p1.TotalPages)
            {
                return(null);
            }
            else
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Designation d1 = new Designation();
                    d1.DesignationID = int.Parse(ds.Tables[0].Rows[i][0].ToString());
                    d1.designation   = ds.Tables[0].Rows[i][1].ToString();
                    Designations.Add(d1);
                }

                return(Designations);
            }
        }