예제 #1
0
        protected void getUsersData()
        {
            List <users> lstUsers = new List <users>();
            usersBus     oUsers   = new usersBus();

            lstUsers = oUsers.usersGetAll();

            if (lstUsers.Count > 0)
            {
                ddlUsers.DataSource     = lstUsers;
                ddlUsers.DataValueField = "userId";
                ddlUsers.DataTextField  = "userName";
                ddlUsers.DataBind();
            }
        }
예제 #2
0
        protected void getUsersData()
        {
            DataTable dttUsers = new DataTable();

            dttUsers.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttUsers.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userLastName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userFirstName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userGroupId", System.Type.GetType("System.Int32")));
            dttUsers.Columns.Add(new DataColumn("userGroupDescription", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userActive", System.Type.GetType("System.Boolean")));

            List <users> lstUsers = new List <users>();
            usersBus     oUsers   = new usersBus();

            usergroup    auxGroup = new usergroup();
            usergroupBus oGroup   = new usergroupBus();

            lstUsers = oUsers.usersGetAll();

            if (lstUsers.Count > 0)
            {
                foreach (users row in lstUsers)
                {
                    auxGroup = oGroup.usergroupGetById(row.UserGroupId);

                    dttUsers.Rows.Add(row.UserId,
                                      row.UserName,
                                      row.UserLastName,
                                      row.UserFirstName,
                                      row.UserGroupId,
                                      auxGroup.UserGroupDescription,
                                      row.UserActive);
                }

                gvUsers.DataSource = dttUsers;
                gvUsers.DataBind();
            }
        }
예제 #3
0
        protected void generateBarChartUsers()
        {
            DataTable dttTaskByUser = new DataTable();

            dttTaskByUser.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttTaskByUser.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttTaskByUser.Columns.Add(new DataColumn("Quantity", System.Type.GetType("System.Int32")));

            List <users> lstUsers = new List <users>();
            usersBus     oUsers   = new usersBus();

            List <tasks> lstTasks = new List <tasks>();
            tasksBus     oTask    = new tasksBus();

            lstUsers = oUsers.usersGetAll();

            if (lstUsers.Count > 0)
            {
                foreach (users rowUser in lstUsers)
                {
                    int qtyTask = 0;
                    if (Convert.ToBoolean(rowUser.UserActive))
                    {
                        lstTasks = oTask.tasksGetAll();
                        foreach (tasks rowTask in lstTasks)
                        {
                            if (rowTask.UserId == rowUser.UserId)
                            {
                                if (rowTask.TaskStatudId != 2)     //Closed
                                {
                                    if (rowTask.TaskStatudId != 5) //Rejected
                                    {
                                        qtyTask++;
                                    }
                                }
                            }
                        }

                        dttTaskByUser.Rows.Add(rowUser.UserId, rowUser.UserName, qtyTask);
                    }
                }
            }

            //Task without User
            int qtyWithoutUser = 0;

            lstTasks = oTask.tasksGetAll();
            if (lstTasks.Count > 0)
            {
                foreach (tasks row in lstTasks)
                {
                    if (row.UserId < 1)
                    {
                        qtyWithoutUser++;
                    }
                }

                if (qtyWithoutUser > 0)
                {
                    dttTaskByUser.Rows.Add(0, "No asignado", qtyWithoutUser);
                }
            }

            barChartUsers.Series[0].XValueMember  = "userName";
            barChartUsers.Series[0].YValueMembers = "Quantity";
            barChartUsers.DataSource = dttTaskByUser;
            barChartUsers.DataBind();
        }