示例#1
0
 public List<Article> GetAll(Paginate arPage)
 {
     arDal = new ArticleDAL();
     arDal.GetAll(arPage);
     arDal.ReturnUnitToPool();
     return arDal.list_ArticleInfo;
 }
示例#2
0
 public ResponseStatus GetFamilys(HttpRequestBase req, Paginate paginate, Container_List_Family conta_Family)
 {
     return service.GetMuti(req,
         ()=>new FamilyDAL(),
         conta_Family.List_Family,
         paginate);
 }
 public ResponseStatus GetImportantEvents(HttpRequestBase req, Paginate paginate, Container_List_ImportantEvent conta_ImportantEvent)
 {
     return service.GetMuti(req,
         () => new ImportantEventDAL(),
         conta_ImportantEvent.List_ImportantEvent,
         paginate);
 }
示例#4
0
 public ResponseStatus GetApplys(Paginate paginate)
 {
     dalBase.sql = string.Format(
         "SELECT db_visitapply.id,stuNum,stuName,phone,content FROM db_visitapply,db_activity WHERE db_visitapply.activityId=db_activity.id AND db_activity.isactive=1 AND publishTime <= CURDATE() AND overEnd >=CURDATE() ORDER BY applytime DESC LIMIT {0},{1}",
         paginate.StartRow, paginate.EndRow);
     return base.JudgeDBResult(
             dalBase.Run(Behavious.SELECT_WITHOUT_PARAM,false),
             ()=>{
                 list_Visit = new List<Visit>();
                 while (dalBase.DataRead.Read())
                 {
                     list_Visit.Add(
                         new Visit(){
                             Id = Convert.ToInt32(dalBase.DataRead["id"]),
                             UserID = dalBase.DataRead["stuNum"].ToString(),
                             UserName = dalBase.DataRead["stuName"].ToString(),
                             Phone = dalBase.DataRead["phone"].ToString(),
                             ActivityName = dalBase.DataRead["content"].ToString()
                         }
                     );
                 }
             },
             null
         );
 }
示例#5
0
        //public static ArticleDAL Instance()
        //{
        //    if (arDal == null)
        //    {
        //        arDal = new ArticleDAL();
        //    }
        //    return arDal;
        //}
        public void GetAll(Paginate arPage)
        {
            dalBase.sql = "SELECT COUNT(*) FROM db_article  WHERE ispass=1 AND publishTime <= CURDATE()";
            dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
            dalBase.DataRead.Read();
            arPage.TotalRecords = int.Parse(dalBase.DataRead[0].ToString());

            int start = arPage.StartRow;
            int perPageSize = arPage.PageSize;

            dalBase.sql = string.Format("SELECT * FROM db_article   WHERE ispass=1 AND publishTime <= CURDATE() ORDER BY id DESC  LIMIT {0},{1}", start, perPageSize);
            dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
            list_ArticleInfo.Clear();
            while (dalBase.DataRead.Read())
            {
                articleInfo = new Article()
                {
                    ID = Convert.ToInt32(dalBase.DataRead["id"]),
                    Title = dalBase.DataRead["title"].ToString(),
                    Summary = dalBase.DataRead["summary"].ToString(),
                    //Body = dalBase.MySqldr["body"].ToString(),
                    PublishTime = Convert.ToDateTime(dalBase.DataRead["publishTime"].ToString()),
                    Author = dalBase.DataRead["author"].ToString(),
                    //ReprintName = mySqldr["reprintName"].ToString(),
                    //ReprintAdress = mySqldr["reprintAdress"].ToString()
                };
                list_ArticleInfo.Add(articleInfo);
            }
            dalBase.CloseConnect();
        }
 public ArticleController()
 {
     conta_List_Atc = new Container_List_Article();
     conta_Atc_Dta = new Container_Article_Detail();
     arPage = new Paginate()
     {
         PageSize = GLB.articlePerPageCount
     };
 }
示例#7
0
        public override ResponseStatus GetMuti(object list_obj, Paginate paginate)
        {
            if (!(list_obj is List<Family>)) return ResponseStatus.FAILED;

            List<Family> list_Family = (List<Family>)list_obj;
            dalBase.sql = string.Format("SELECT COUNT(*) FROM db_family ");
            bool isSuccess1 = dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
            ResponseStatus resp1, resp2;
            resp1 = this.JudgeDBResult(isSuccess1,
                ()=>
                {
                    dalBase.DataRead.Read();
                    paginate.TotalRecords = Convert.ToInt32(dalBase.DataRead[0]);

                    dalBase.sql = string.Format(
                        "SELECT id,userId,userName,sex,db_grade.grdId,grdname,db_collage.collageid,db_collage.collagename,db_department.depId,db_department.depname,wish  " +
                        "FROM db_family LEFT JOIN db_grade ON db_family.grdId=db_grade.grdid " +
                        "LEFT JOIN db_department ON db_family.depId=db_department.depid " +
                        "LEFT JOIN db_collage ON db_family.clgId=db_collage.collageid " +
                        "ORDER BY userId LIMIT {0},{1}",
                        paginate.StartRow, paginate.PageSize);

                    //list_Family = new List<Family>();
                    bool isSuccess2 = dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
                    resp2 =  this.JudgeDBResult(isSuccess2,
                        () =>
                        {
                            while (dalBase.DataRead.Read())
                            {
                                list_Family.Add(new Family()
                                {
                                    ID = Convert.ToInt32(dalBase.DataRead["id"]),
                                    UserID = dalBase.DataRead["userId"].ToString(),
                                    UserName = dalBase.DataRead["userName"].ToString(),
                                    Sex = Convert.ToByte(dalBase.DataRead["sex"]),
                                    Grd = dalBase.DataRead["grdId"] != DBNull.Value?
                                    new Grade() { ID = Convert.ToInt32(dalBase.DataRead["grdId"]), Name = dalBase.DataRead["grdname"].ToString() }:
                                    new Grade(),
                                    Clg = dalBase.DataRead["collageid"] != DBNull.Value ?
                                    new Collage() { ID = Convert.ToInt32(dalBase.DataRead["collageid"]), Name = dalBase.DataRead["collagename"].ToString() }:
                                    new Collage(),
                                    Dep = dalBase.DataRead["depId"] != DBNull.Value ?
                                    new Department() { ID = Convert.ToInt32(dalBase.DataRead["depId"]), Name = dalBase.DataRead["depname"].ToString() }:
                                    new Department(),
                                    Wish = dalBase.DataRead["wish"].ToString(),
                                });
                            }
                        }, null);
                    resp1 = resp2;
                },
                ()=>
                {
                     dalBase.CloseConnect();
                });
            return resp1;
        }
        public override ResponseStatus GetMuti(object list_obj, Paginate paginate)
        {
            if (!(list_obj is List<ImportantEvent>)) return ResponseStatus.FAILED;

            List<ImportantEvent> list_ImportantEvent = (List<ImportantEvent>)list_obj;
            dalBase.sql = string.Format("SELECT COUNT(*) FROM db_importantEvent WHERE publishTime <= CURDATE()");
            bool isSuccess1 = dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
            ResponseStatus resp1, resp2;
            resp1 = this.JudgeDBResult(isSuccess1,
                ()=>
                {
                    dalBase.DataRead.Read();
                    paginate.TotalRecords = Convert.ToInt32(dalBase.DataRead[0]);

                    dalBase.sql = string.Format(
                        "SELECT * FROM db_importantEvent WHERE publishTime <= CURDATE() ORDER BY publishTime DESC LIMIT {0},{1}",
                        paginate.StartRow, paginate.PageSize);

                    //list_ImportantEvent = new List<ImportantEvent>();
                    bool isSuccess2 = dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
                    resp2 =  this.JudgeDBResult(isSuccess2,
                        () =>
                        {
                            while (dalBase.DataRead.Read())
                            {
                                list_ImportantEvent.Add(new ImportantEvent()
                                {
                                    Id = Convert.ToInt32(dalBase.DataRead["id"]),
                                    Content = dalBase.DataRead["content"].ToString(),
                                    PublisTime = Convert.ToDateTime(dalBase.DataRead["publishTime"])
                                });
                            }
                        }, null);
                    resp1 = resp2;
                },
                ()=>
                {
                     dalBase.CloseConnect();
                });
            return resp1;
        }
示例#9
0
 public override ResponseStatus GetMuti(object list_obj, Paginate paginate)
 {
     if (!(list_obj is List<Department>)) return ResponseStatus.FAILED;
     List<Department> list_Dep = (List<Department>)list_obj;
      	        dalBase.sql = "SELECT * FROM db_department";
     bool isSuccess = dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
     return this.JudgeDBResult(isSuccess,
         ()=>
         {
             while (dalBase.DataRead.Read())
             {
                 depInfo = new Department()
                 {
                     ID = Convert.ToInt32(dalBase.DataRead["depid"]),
                     Name = dalBase.DataRead["depname"].ToString(),
                     Introduce = dalBase.DataRead["depintroduction"].ToString(),
                     WeiboId = dalBase.DataRead["weiboId"] != DBNull.Value?
                         dalBase.DataRead["weiboId"].ToString():"0"
                 };
                 list_Dep.Add(depInfo);
             }
         },null);
 }
示例#10
0
 public VisitController()
 {
     visitPaginate = new Paginate() { PageSize = GLB.VisitCount };
     visitService = ServiceBuilder.BuildVisitService();
 }
示例#11
0
        public ResponseStatus PermissionNewUser(HttpRequestBase req, Paginate userPaginate, 
            Container_list_UserWaitForPass conTa_list_u_Sta)
        {
            UserDAL userDAL = new UserDAL();
            if (req.Form.Count > 0)
            {
                List<string> list_userID = new List<string>();
                for (int i = 0; i < req.Form.Count; ++i)
                {
                    list_userID.Add(req.Form.AllKeys[i]);
                }
                userDAL.SetWaitForPass(list_userID);
            }

            conTa_list_u_Sta.list_UserStatus = userDAL.GetWaitForPass(req.Cookies[GLB.userId].Value, userPaginate);
            conTa_list_u_Sta.paginate = userPaginate;
            userDAL.ReturnUnitToPool();
            if (conTa_list_u_Sta.list_UserStatus != null && conTa_list_u_Sta.list_UserStatus.Count > 0)
            {
                return ResponseStatus.SUCCESS;
            }
            else
            {
                return ResponseStatus.NOT_PERMIS_NEWUSER;
            }
        }
示例#12
0
 public NoticeController()
 {
     noticeService = ServiceBuilder.BuildNoticeService();
     paginate = new Paginate() { PageSize = GLB.noticePerPageCount };
     conta_List_Notice = new Container_List_Notice();
 }
示例#13
0
        public ResponseStatus GetNotices(bool isResume, Paginate paginate,NoticeType nType)
        {
            int topCount;
            dalBase.sql = "SELECT COUNT(*) FROM db_notice WHERE publishTime <= CURDATE() AND isTop=1";
            if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
            {
                dalBase.DataRead.Read();
                topCount = Convert.ToInt32(dalBase.DataRead[0]);
            }
            else
            {
                dalBase.CloseConnect();
                return ResponseStatus.FAILED;
            }

            if (!isResume)
            {
                if (nType == NoticeType.NONE)
                {
                    dalBase.sql = "SELECT COUNT(*) FROM db_notice WHERE publishTime <= CURDATE()";
                }
                else
                {
                    dalBase.sql = string.Format("SELECT COUNT(*) FROM db_notice WHERE publishTime <= CURDATE() AND ntype={0}", Convert.ToByte(nType));
                }
                if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
                {
                    dalBase.DataRead.Read();
                    paginate.TotalRecords = Convert.ToInt32(dalBase.DataRead[0]);
                }
                else
                {
                    dalBase.CloseConnect();
                    return ResponseStatus.FAILED;
                }
            }

            list_Notice = new List<Notice>();
            if (isResume)
            {
                #region Resume
                if (topCount > GLB.noticeResumeCount)
                {
                    dalBase.sql = string.Format(
                        "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE()  AND isTop=1 ORDER BY publishtime DESC LIMIT 0,{1}",
                        Convert.ToByte(nType), GLB.noticeResumeCount);
                }
                else
                {
                    dalBase.sql = string.Format(
                        "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND isTop=1 ORDER BY publishtime DESC LIMIT 0,{1}",
                        Convert.ToByte(nType), topCount);
                    if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
                    {
                        while (dalBase.DataRead.Read())
                        {
                            list_Notice.Add(new Notice()
                            {
                                ID = Convert.ToInt32(dalBase.DataRead["id"]),
                                PublishTime = Convert.ToDateTime(dalBase.DataRead["publishtime"]),
                                Content = dalBase.DataRead["content"].ToString(),
                                NType = (NoticeType)Convert.ToByte(dalBase.DataRead["ntype"]),
                                isTop = Convert.ToByte(dalBase.DataRead["isTop"])
                            });
                        };
                        dalBase.sql = string.Format(
                            "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND isTop=0 ORDER BY publishtime DESC LIMIT 0,{1}",
                            Convert.ToByte(nType), GLB.noticeResumeCount - topCount);
                    }
                    else
                    {
                        dalBase.CloseConnect();
                        return ResponseStatus.FAILED;
                    }
                }
                #endregion
            }
            else
            {
                if (nType == NoticeType.NONE)
                {
                    if (paginate.CurrentPage == 1)
                    {
                        dalBase.sql = "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND isTop=1 ORDER BY publishtime DESC";
                        if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
                        {
                            while (dalBase.DataRead.Read())
                            {
                                list_Notice.Add(new Notice()
                                {
                                    ID = Convert.ToInt32(dalBase.DataRead["id"]),
                                    PublishTime = Convert.ToDateTime(dalBase.DataRead["publishtime"]),
                                    Content = dalBase.DataRead["content"].ToString(),
                                    NType = (NoticeType)Convert.ToByte(dalBase.DataRead["ntype"]),
                                    isTop = Convert.ToByte(dalBase.DataRead["isTop"])
                                });
                            };
                        }
                        dalBase.sql = string.Format(
                            "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND isTop!=1 ORDER BY publishtime DESC LIMIT {0},{1}",
                            paginate.StartRow, paginate.PageSize - topCount);
                    }
                    else
                    {
                        dalBase.sql = string.Format(
                            "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND isTop!=1 ORDER BY publishtime DESC LIMIT {0},{1}",
                            paginate.StartRow - topCount, paginate.PageSize);
                    }
                }
                else
                {
                    int topCountOfNtype;
                    dalBase.sql = string.Format("SELECT COUNT(*) FROM db_notice WHERE publishTime <= CURDATE() AND isTop=1 AND ntype={0}", Convert.ToByte(nType));
                    if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
                    {
                        dalBase.DataRead.Read();
                        topCountOfNtype = Convert.ToInt32(dalBase.DataRead[0]);
                    }
                    else
                    {
                        dalBase.CloseConnect();
                        return ResponseStatus.FAILED;
                    }

                    if (paginate.CurrentPage == 1)
                    {
                        dalBase.sql = string.Format(
                            "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND ntype={0} AND isTop=1 ORDER BY publishtime DESC ",
                            Convert.ToByte(nType));
                        if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
                        {
                            while (dalBase.DataRead.Read())
                            {
                                list_Notice.Add(new Notice()
                                {
                                    ID = Convert.ToInt32(dalBase.DataRead["id"]),
                                    PublishTime = Convert.ToDateTime(dalBase.DataRead["publishtime"]),
                                    Content = dalBase.DataRead["content"].ToString(),
                                    NType = (NoticeType)Convert.ToByte(dalBase.DataRead["ntype"]),
                                    isTop = Convert.ToByte(dalBase.DataRead["isTop"])
                                });
                            };
                        }
                        dalBase.sql = string.Format(
                            "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND ntype={0} AND isTop!=1 ORDER BY publishtime DESC LIMIT {1},{2}",
                            Convert.ToByte(nType), paginate.StartRow, paginate.PageSize - topCountOfNtype);
                    }
                    else
                    {
                        dalBase.sql = string.Format(
                            "SELECT id,publishTime,content,ntype,isTop FROM db_notice WHERE publishTime <= CURDATE() AND ntype={0} AND isTop!=1 ORDER BY publishtime DESC LIMIT {1},{2}",
                            Convert.ToByte(nType), paginate.StartRow - topCountOfNtype, paginate.PageSize);
                    }
                }
            }

            bool isSuccess = dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
            return this.JudgeDBResult(isSuccess,
                ()=>
                {
                    while (dalBase.DataRead.Read())
                    {
                        list_Notice.Add(new Notice()
                        {
                            ID = Convert.ToInt32(dalBase.DataRead["id"]),
                            PublishTime = Convert.ToDateTime(dalBase.DataRead["publishtime"]),
                            Content = dalBase.DataRead["content"].ToString(),
                            NType=(NoticeType)Convert.ToByte(dalBase.DataRead["ntype"]),
                            isTop = Convert.ToByte(dalBase.DataRead["isTop"])
                        });
                    }
                }, null);
        }
 public ImportantEventController()
 {
     importantEventService = ServiceBuilder.BuildImportantEventService();
         paginate = new Paginate() { PageSize = GLB.importantEventPerPageCount };
 }
示例#15
0
 public FamilyController()
 {
     familyService = ServiceBuilder.BuildFamilyService();
     paginate = new Paginate() { PageSize = GLB.familyPerPageCount };
 }
示例#16
0
 public virtual ResponseStatus GetMuti(object list_obj, Paginate paginate)
 {
     return ResponseStatus.NONE;
 }
示例#17
0
        public List<UserStatus> GetWaitForPass(string userID,Paginate paginate)
        {
            int depID = this.GetUserDepID(userID);
            string depID_Str = "";
            if (depID > GLB.adminDepId)
            {
                depID_Str = "AND db_users.depid=" + depID;
            }
            dalBase.sql = "SELECT COUNT(*) FROM db_users WHERE db_users.isWaitForPass = 0 " + depID_Str;
            dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
            dalBase.DataRead.Read();
            paginate.TotalRecords = Convert.ToInt32(dalBase.DataRead[0]);

            List<UserStatus> list_u_Sta = new List<UserStatus>();
            if (paginate.TotalRecords > 0)
            {
                int start = paginate.StartRow;
                int perPageSize = paginate.PageSize;
                dalBase.sql = string.Format("SELECT stuNum,stuName,sex,grdname,collagename,depname,rolename,phone,short_phone " +
                                                        "FROM db_users,db_grade,db_department,db_collage,db_role " +
                                                        "WHERE db_users.depid=db_department.depid AND db_users.collageid = db_collage.collageid " +
                                                        "AND db_users.grdid = db_grade.grdid AND db_users.roleid = db_role.id " +
                                                        "AND db_users.isWaitForPass = 0 " + depID_Str + " " +
                                                        "LIMIT " + start + "," + perPageSize);
                dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false);
                while (dalBase.DataRead.Read())
                {
                    list_u_Sta.Add(new UserStatus()
                    {
                        UserID = dalBase.DataRead["stuNum"].ToString(),
                        UserName = dalBase.DataRead["stuName"].ToString(),
                        Sex = Convert.ToByte(dalBase.DataRead["sex"]),
                        Grd = new Grade()
                        {
                            Name = dalBase.DataRead["grdname"].ToString()
                        },
                        Clg = new Collage()
                        {
                            Name = dalBase.DataRead["collagename"].ToString()
                        },
                        Dep = new Department()
                        {
                            Name = dalBase.DataRead["depname"].ToString()
                        },
                        Ro = new Role()
                        {
                            Name = dalBase.DataRead["rolename"].ToString()
                        },
                        Phone = dalBase.DataRead["phone"].ToString(),
                        Phone_short = dalBase.DataRead["short_phone"].ToString()
                    });
                }
            }

            dalBase.CloseConnect();
            if (list_u_Sta.Count == 0)
            {
                list_u_Sta = null;
            }
            return list_u_Sta;
        }
示例#18
0
 public ResponseStatus GetNotices(HttpRequestBase req, NoticeType ntype, Paginate paginate, Container_List_Notice conta_Notice)
 {
     ResponseStatus resp = ResponseStatus.NONE;
     noticeDal = new NoticeDAL();
     bool isResume = false;
     resp = noticeDal.GetNotices(isResume, paginate, ntype);
     conta_Notice.list_Notice = noticeDal.ListNotice;
     conta_Notice.paginate = paginate;
     noticeDal.ReturnUnitToPool();
     return resp;
 }