Пример #1
0
        /// <summary>
        /// 获取全部讲座信息
        /// </summary>
        /// <param name="ArchitectureId"></param>
        /// <returns></returns>
        public List <Model.T_Base_Apply> GetAllLecture(string ParamLecture, int PageSize, int PageNumber, string State)
        {
            SqlConfig  config = new SqlConfig();
            SqlCommand cmd    = config.getSqlCommand();

            cmd.CommandText = "select top " + PageSize + " * from V_User_Lecture_Place" +
                              " where Id not in (select top " + (PageSize * (PageNumber - 1)) +
                              " Id from V_User_Lecture_Place where (V_User_Lecture_Place.Subject" +
                              " like '%" + ParamLecture + "%' or V_User_Lecture_Place.Name like '%" +
                              ParamLecture + "%') and V_User_Lecture_Place.State " + State + ") and (V_User_Lecture_Place.Subject" +
                              " like '%" + ParamLecture + "%' or V_User_Lecture_Place.Name like '%" +
                              ParamLecture + "%') and State " + State;
            SqlDataReader             reader = cmd.ExecuteReader();
            List <Model.T_Base_Apply> list   = new List <Model.T_Base_Apply>();

            while (reader.Read())
            {
                Model.T_Base_Apply apply = new Model.T_Base_Apply();

                apply.Id        = Convert.ToInt32(reader["Id"]);
                apply.Num       = Convert.ToString(reader["Num"]);
                apply.LectureId = Convert.ToInt32(reader["LectureId"]);
                apply.PlaceId   = Convert.ToInt32(reader["PlaceId"]);
                apply.ApplyTime = Convert.ToDateTime(reader["ApplyTime"]);

                Model.T_Base_User user = new Model.T_Base_User();
                user.Id           = Convert.ToInt32(reader["UserId"]);
                user.Num          = Convert.ToString(reader["Num"]);
                user.Name         = Convert.ToString(reader["Name"]);
                user.Sex          = Convert.ToInt32(reader["Sex"]);
                user.MajorClassId = Convert.ToInt32(reader["MajorClassId"]);
                Model.T_Base_MajorClass majorClass = new Model.T_Base_MajorClass();
                majorClass.Id             = Convert.ToInt32(reader["MajorClassId"]);
                majorClass.MajorClassName = Convert.ToString(reader["MajorClassName"]);
                user.MajorClass           = majorClass;
                user.PhoneNum             = Convert.ToString(reader["PhoneNum"]);
                apply.User = user;

                Model.T_Base_Lecture lecture = new Model.T_Base_Lecture();
                lecture.Id      = Convert.ToInt32(reader["LectureId"]);
                lecture.Subject = Convert.ToString(reader["Subject"]);
                lecture.Summary = Convert.ToString(reader["Summary"]);
                lecture.State   = Convert.ToInt32(reader["State"]);
                lecture.QRCode  = Convert.ToString(reader["QRCode"]);

                lecture.DeathLine    = Convert.ToDateTime(reader["DeathLine"]);
                lecture.LectureTime  = Convert.ToDateTime(reader["LectureTime"]);
                lecture.Span         = Convert.ToDouble(reader["Span"]);
                lecture.ExpectPeople = Convert.ToInt32(reader["ExpectPeople"]);
                lecture.RealPeople   = Convert.ToInt32(reader["RealPeople"]);
                lecture.Score        = Convert.ToDouble(reader["Score"]);
                apply.Lecture        = lecture;

                Model.T_Base_Place place = new Model.T_Base_Place();
                place.Id             = Convert.ToInt32(reader["PlaceId"]);
                place.PlaceName      = Convert.ToString(reader["PlaceName"]);
                place.PeopleNum      = Convert.ToInt32(reader["PeopleNum"]);
                place.ArchitectureId = Convert.ToInt32(reader["ArchitectureId"]);
                Model.T_Base_Architecture architecture = new Model.T_Base_Architecture();
                architecture.Id = Convert.ToInt32(reader["ArchitectureId"]);
                architecture.ArchitectureName = Convert.ToString(reader["ArchitectureName"]);
                place.Architecture            = architecture;
                apply.Place = place;

                list.Add(apply);
            }
            reader.Close();
            config.Close();
            return(list);
        }
Пример #2
0
        /// <summary>
        /// 获取个人所申请的全部讲座信息
        /// </summary>
        /// <param name="Num"></param>
        /// <returns></returns>
        public List <Model.T_Base_Apply> GetPersonalAllLecture(string Num, int Role)
        {
            SqlConfig  config = new SqlConfig();
            SqlCommand cmd    = config.getSqlCommand();

            if (Role == 1 || Role == 2)
            {
                cmd.CommandText = "select * from V_User_Lecture_Place order by Id desc";
            }
            else if (Role == 3)
            {
                cmd.CommandText = "select * from V_User_Lecture_Place where Num = '" + Num + "' order by Id desc";
            }
            SqlDataReader             reader = cmd.ExecuteReader();
            List <Model.T_Base_Apply> list   = new List <Model.T_Base_Apply>();

            while (reader.Read())
            {
                Model.T_Base_Apply apply = new Model.T_Base_Apply();

                apply.Id        = Convert.ToInt32(reader["Id"]);
                apply.Num       = Convert.ToString(reader["Num"]);
                apply.LectureId = Convert.ToInt32(reader["LectureId"]);
                apply.PlaceId   = Convert.ToInt32(reader["PlaceId"]);
                apply.ApplyTime = Convert.ToDateTime(reader["ApplyTime"]);

                Model.T_Base_User user = new Model.T_Base_User();
                user.Id           = Convert.ToInt32(reader["Id"]);
                user.Num          = Convert.ToString(reader["Num"]);
                user.Name         = Convert.ToString(reader["Name"]);
                user.Sex          = Convert.ToInt32(reader["Sex"]);
                user.MajorClassId = Convert.ToInt32(reader["MajorClassId"]);
                Model.T_Base_MajorClass majorClass = new Model.T_Base_MajorClass();
                majorClass.Id             = Convert.ToInt32(reader["MajorClassId"]);
                majorClass.MajorClassName = Convert.ToString(reader["MajorClassName"]);
                user.MajorClass           = majorClass;
                user.PhoneNum             = Convert.ToString(reader["PhoneNum"]);
                apply.User = user;

                Model.T_Base_Lecture lecture = new Model.T_Base_Lecture();
                lecture.Id           = Convert.ToInt32(reader["LectureId"]);
                lecture.Subject      = Convert.ToString(reader["Subject"]);
                lecture.Summary      = Convert.ToString(reader["Summary"]);
                lecture.State        = Convert.ToInt32(reader["State"]);
                lecture.QRCode       = Convert.ToString(reader["QRCode"]);
                lecture.DeathLine    = Convert.ToDateTime(reader["DeathLine"]);
                lecture.LectureTime  = Convert.ToDateTime(reader["LectureTime"]);
                lecture.Span         = Convert.ToDouble(reader["Span"]);
                lecture.ExpectPeople = Convert.ToInt32(reader["ExpectPeople"]);
                lecture.RealPeople   = Convert.ToInt32(reader["RealPeople"]);
                lecture.Score        = Convert.ToDouble(reader["Score"]);
                apply.Lecture        = lecture;

                Model.T_Base_Place place = new Model.T_Base_Place();
                place.Id             = Convert.ToInt32(reader["PlaceId"]);
                place.PlaceName      = Convert.ToString(reader["PlaceName"]);
                place.PeopleNum      = Convert.ToInt32(reader["PeopleNum"]);
                place.ArchitectureId = Convert.ToInt32(reader["ArchitectureId"]);
                Model.T_Base_Architecture architecture = new Model.T_Base_Architecture();
                architecture.Id = Convert.ToInt32(reader["ArchitectureId"]);
                architecture.ArchitectureName = Convert.ToString(reader["ArchitectureName"]);
                place.Architecture            = architecture;
                apply.Place = place;

                list.Add(apply);
            }
            reader.Close();
            config.Close();
            return(list);
        }
Пример #3
0
        /// <summary>
        /// 获取指定id的讲座
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public List <Model.T_Base_Apply> GetLecture(int LectureId, int State)
        {
            List <Model.T_Base_Apply> list = new List <Model.T_Base_Apply>();
            SqlConfig  config = new SqlConfig();
            SqlCommand cmd    = config.getSqlCommand();

            if (State == 1)
            {
                cmd.CommandText = "select * from V_User_Lecture_Place where LectureId = " + LectureId;
            }
            else if (State == 2)
            {
                cmd.CommandText = "select * from V_User_Lecture_Place_Audit where LectureId = " + LectureId;
            }

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Model.T_Base_Apply apply = new Model.T_Base_Apply();
                apply.Id        = Convert.ToInt32(reader["Id"]);
                apply.Num       = Convert.ToString(reader["Num"]);
                apply.LectureId = Convert.ToInt32(reader["LectureId"]);
                apply.PlaceId   = Convert.ToInt32(reader["PlaceId"]);
                apply.ApplyTime = Convert.ToDateTime(reader["ApplyTime"]);

                Model.T_Base_User user = new Model.T_Base_User();
                user.Id           = Convert.ToInt32(reader["Id"]);
                user.Num          = Convert.ToString(reader["Num"]);
                user.Name         = Convert.ToString(reader["Name"]);
                user.Sex          = Convert.ToInt32(reader["Sex"]);
                user.MajorClassId = Convert.ToInt32(reader["MajorClassId"]);
                Model.T_Base_MajorClass majorClass = new Model.T_Base_MajorClass();
                majorClass.Id             = Convert.ToInt32(reader["MajorClassId"]);
                majorClass.MajorClassName = Convert.ToString(reader["MajorClassName"]);
                user.MajorClass           = majorClass;
                user.PhoneNum             = Convert.ToString(reader["PhoneNum"]);
                apply.User = user;

                Model.T_Base_Lecture lecture = new Model.T_Base_Lecture();
                lecture.Id           = Convert.ToInt32(reader["LectureId"]);
                lecture.Subject      = Convert.ToString(reader["Subject"]);
                lecture.Summary      = Convert.ToString(reader["Summary"]);
                lecture.State        = Convert.ToInt32(reader["State"]);
                lecture.QRCode       = Convert.ToString(reader["QRCode"]);
                lecture.DeathLine    = Convert.ToDateTime(reader["DeathLine"]);
                lecture.LectureTime  = Convert.ToDateTime(reader["LectureTime"]);
                lecture.Span         = Convert.ToDouble(reader["Span"]);
                lecture.ExpectPeople = Convert.ToInt32(reader["ExpectPeople"]);
                lecture.RealPeople   = Convert.ToInt32(reader["RealPeople"]);
                lecture.Score        = Convert.ToDouble(reader["Score"]);
                if (State == 2)
                {
                    if (reader["Reason"].Equals(DBNull.Value))
                    {
                        lecture.Reason = "";
                    }
                    else
                    {
                        lecture.Reason = Convert.ToString(reader["Reason"]);
                    }
                }
                apply.Lecture = lecture;

                Model.T_Base_Place place = new Model.T_Base_Place();
                place.Id             = Convert.ToInt32(reader["PlaceId"]);
                place.PlaceName      = Convert.ToString(reader["PlaceName"]);
                place.PeopleNum      = Convert.ToInt32(reader["PeopleNum"]);
                place.ArchitectureId = Convert.ToInt32(reader["ArchitectureId"]);
                Model.T_Base_Architecture architecture = new Model.T_Base_Architecture();
                architecture.Id = Convert.ToInt32(reader["ArchitectureId"]);
                architecture.ArchitectureName = Convert.ToString(reader["ArchitectureName"]);
                place.Architecture            = architecture;
                apply.Place = place;

                list.Add(apply);
            }
            reader.Close();
            config.Close();
            return(list);
        }