Exemplo n.º 1
0
        public IList<Core.Business.VoteRole> GetAllVoteRole()
        {
            IList<Core.Business.VoteRole> voteRolelist = new List<Core.Business.VoteRole>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllVoteRole);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.VoteRole voteRole = new Core.Business.VoteRole();

                    if (!reader.IsDBNull(0)) voteRole.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) voteRole.DepartmentID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) voteRole.VoteID = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) voteRole.RoleID = reader.GetInt32(3);

                    voteRole.MarkOld();
                    voteRolelist.Add(voteRole);
                }
                reader.Close();
            }
            return voteRolelist;
        }
Exemplo n.º 2
0
        public IList<Core.Business.Vote> GetVotesByUserRole(int departmentId,int userRoleId)
        {
            IList<Core.Business.VoteRole> voteRolelist = new List<Core.Business.VoteRole>();
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@DepartmentID", SqlDbType.Int, departmentId);
            sql.AddParameter("@RoleID", SqlDbType.Int, userRoleId);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVotesByUserRole);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.VoteRole voteRole = new Core.Business.VoteRole();

                    if (!reader.IsDBNull(0)) voteRole.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) voteRole.DepartmentID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) voteRole.VoteID = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) voteRole.RoleID = reader.GetInt32(3);

                    voteRole.MarkOld();
                    voteRolelist.Add(voteRole);
                }
                reader.Close();
            }

            IList<Core.Business.Vote> voteList = new List<Core.Business.Vote>();
            for (int i = 0; i < voteRolelist.Count; i++)
            {
                Core.Business.Vote vote = Core.Business.Vote.Load(voteRolelist[i].VoteID);
                voteList.Add(vote);
            }

            return voteList;
        }
Exemplo n.º 3
0
        public IList<VoteRole> GetVoteRoleList(int voteId)
        {
            if (voteId <= 0)
                return null;

            IList<Core.Business.VoteRole> voteRolelist = new List<Core.Business.VoteRole>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@VoteID", SqlDbType.Int, voteId);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVoteRoleByVoteId);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.VoteRole voteRole = new Core.Business.VoteRole();

                    if (!reader.IsDBNull(0)) voteRole.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) voteRole.DepartmentID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) voteRole.VoteID = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) voteRole.RoleID = reader.GetInt32(3);

                    voteRole.MarkOld();
                    voteRolelist.Add(voteRole);
                }
                reader.Close();
            }
            return voteRolelist;
        }