Exemplo n.º 1
0
        public DataTable SelectALL(Boolean StateIsTrue = true)
        {
            String state = StateIsTrue ? " AND AStatus=1" : "";
            String sql   = "SELECT * FROM ActionInfo WHERE 1=1 " + state;

            return(DataBaseOpen.Query(sql));
        }
Exemplo n.º 2
0
        public DataTable SelectByStat(Boolean Stat)
        {
            String sql = "SELECT * FROM ActionInfo WHERE AStatus=@Stat";

            return(DataBaseOpen.Query(sql, new SqlParameter[] {
                new SqlParameter("@Stat", Stat)
            }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询RoteUser额外一个票数统计的 RoteInfoCount
        /// </summary>
        /// <param name="AID">ActionID</param>
        /// <returns></returns>
        public DataTable SelectRoteUsersAndAllRoteInfoCountOrderByDesc(int AID)
        {
            String sql = "SELECT RU.*,COUNT(RI.RID) AS 'RoteInfoCount' FROM RoteUser AS RU  INNER JOIN RoteInfo AS RI ON RU.RUID=RI.RUID WHERE RU.AID=@AID GROUP BY RU.RUName,RU.RUID,RU.AID,RU.RUSex,RU.RUAge,RU.RUDetail,RU.RUImGUrl ORDER BY COUNT(RI.RID) DESC";

            return(DataBaseOpen.Query(sql, new SqlParameter[] {
                new SqlParameter("@AID", AID),
            }));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 用于判断一个IP是否参加过这次活动
        /// </summary>
        /// <param name="IP"></param>
        /// <returns></returns>
        public int GetRoteInfoCountByIP(int AID, String IP)
        {
            String sql = "SELECT COUNT(RU.RUID) FROM RoteUser AS RU INNER JOIN RoteInfo AS RI ON RI.RUID=RU.RUID AND RI.RIP=@RIP AND AID=@AID";

            return(Convert.ToInt32(DataBaseOpen.QueryOne(sql, new SqlParameter[] {
                new SqlParameter("@RIP", IP),
                new SqlParameter("@AID", AID)
            })));
        }
Exemplo n.º 5
0
        public DataTable LoginByUserCodePasswordReturnModel(String UserCode, String Password)
        {
            String sql = "SELECT * FROM Users WHERE UCode=@UserCode AND uPwd=@Password";

            return(DataBaseOpen.Query(sql, new SqlParameter[] {
                new SqlParameter("@UserCode", UserCode),
                new SqlParameter("@Password", Password),
            }));
        }
Exemplo n.º 6
0
        public int UpdatePasswordByID(UsersModel Model)
        {
            String sql = "UPDATE Users SET uPwd=@uPwd WHERE UID=@UID";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@uPwd", Model.uPwd),
                new SqlParameter("@UID", Model.UID),
            }));
        }
Exemplo n.º 7
0
        public DataTable SelectByBeginTimeAndEndTime(String BeginTime, String EndTime)
        {
            String sql = "SELECT * FROM ActionInfo WHERE ABeginTime<=@ABeginTime AND AEndTime>=@AEndTime ";

            return(DataBaseOpen.Query(sql, new SqlParameter[] {
                new SqlParameter("@ABeginTime", BeginTime),
                new SqlParameter("@AEndTime", EndTime),
            }));
        }
Exemplo n.º 8
0
        public int UpdateByModel(UsersModel Model)
        {
            String sql = "UPDATE Users SET uPwd=@uPwd,UName=@UName WHERE UID=@UID";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@UID", Model.UID),
                new SqlParameter("@uPwd", Model.uPwd),
                new SqlParameter("@UName", Model.UName),
            }));
        }
Exemplo n.º 9
0
        public int UpdateByModel(RootMenuModel Model)
        {
            String sql = "UPDATE RootMenu SET Title=@Title,ParentID=@ParentID,Link=@Link WHERE ID=@ID";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@Title", Model.Title),
                new SqlParameter("@ParentID", Model.ParentID),
                new SqlParameter("@Link", Model.Link),
            }));
        }
Exemplo n.º 10
0
        public int InsertByModel(RootMenuModel Model)
        {
            String sql = "INSERT INTO RootMenu(Title,ParentID,Link) VALUES(@Title,@ParentID,@Link)";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@Title", Model.Title),
                new SqlParameter("@ParentID", Model.ParentID),
                new SqlParameter("@Link", Model.Link),
            }));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 查找指定页数的 产于用户信息 并且包含了被投票的数量
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="Page"></param>
        /// <param name="AID"></param>
        /// <returns></returns>
        public DataTable SelectRoteInfoByPageAndAID(int PageSize, int Page, int AID)
        {
            String sql = "SELECT * FROM SelectRoteInfoByPageAndAID(@PageSize,@Page,@AID)";

            return(DataBaseOpen.Query(sql, new SqlParameter[] {
                new SqlParameter("@PageSize", PageSize),
                new SqlParameter("@Page", Page),
                new SqlParameter("@AID", AID),
            }));
        }
Exemplo n.º 12
0
        public int InsertByModel(UsersModel Model)
        {
            String sql = "INSERT INTO Users(UCode,uPwd,UName) VALUES(@UCode,@uPwd,@UName)";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@UID", Model.UID),
                new SqlParameter("@UCode", Model.UCode),
                new SqlParameter("@uPwd", Model.uPwd),
                new SqlParameter("@UName", Model.UName),
            }));
        }
Exemplo n.º 13
0
        public int UpdateByModel(RoteInfoModel Model)
        {
            String sql = "UPDATE RoteInfo SET RID=@RIDRUID=@RUID,UID=@UID,RIP=@RIP,RCreateTime=@RCreateTime WHERE ID=@ID";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@RID", Model.RID),
                new SqlParameter("@RUID", Model.RUID),
                new SqlParameter("@UID", Model.UID),
                new SqlParameter("@RIP", Model.RIP),
                new SqlParameter("@RCreateTime", Model.RCreateTime),
            }));
        }
Exemplo n.º 14
0
        public int InsertByModel(RoteInfoModel Model)
        {
            String sql = "INSERT INTO RoteInfo(RUID,UID,RIP,RCreateTime) VALUES(@RUID,@UID,@RIP,@RCreateTime)";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@RID", Model.RID),
                new SqlParameter("@RUID", Model.RUID),
                new SqlParameter("@UID", Model.UID),
                new SqlParameter("@RIP", Model.RIP),
                new SqlParameter("@RCreateTime", Model.RCreateTime),
            }));
        }
Exemplo n.º 15
0
        public int UpdateByModel(ActionInfoModel Model)
        {
            String sql = "UPDATE ActionInfo SET AName=@AName,ADetail=@ADetail,ABeginTime=@ABeginTime,AEndTime=@AEndTime,AStatus=@AStatus WHERE AID=@AID";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@AID", Model.AID),
                new SqlParameter("@AName", Model.AName),
                new SqlParameter("@ADetail", Model.ADetail),
                new SqlParameter("@ABeginTime", Model.ABeginTime),
                new SqlParameter("@AEndTime", Model.AEndTime),
                new SqlParameter("@AStatus", Model.AStatus),
            }));
        }
Exemplo n.º 16
0
        public int InsertByModel(ActionInfoModel Model)
        {
            String sql = "INSERT INTO ActionInfo(AName,ADetail,ABeginTime,AEndTime,AStatus) VALUES(@AName,@ADetail,@ABeginTime,@AEndTime,@AStatus)";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@AID", Model.AID),
                new SqlParameter("@AName", Model.AName),
                new SqlParameter("@ADetail", Model.ADetail),
                new SqlParameter("@ABeginTime", Model.ABeginTime),
                new SqlParameter("@AEndTime", Model.AEndTime),
                new SqlParameter("@AStatus", Model.AStatus),
            }));
        }
Exemplo n.º 17
0
        public int InsertByModel(RoteUserModel Model)
        {
            String sql = "INSERT INTO RoteUser(AID,RUName,RUSex,RUAge,RUDetail,RUImGUrl) VALUES(@AID,@RUName,@RUSex,@RUAge,@RUDetail,@RUImGUrl)";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@RUID", Model.RUID),
                new SqlParameter("@AID", Model.AID),
                new SqlParameter("@RUName", Model.RUName),
                new SqlParameter("@RUSex", Model.RUSex),
                new SqlParameter("@RUAge", Model.RUAge),
                new SqlParameter("@RUDetail", Model.RUDetail),
                new SqlParameter("@RUImGUrl", Model.RUImGUrl),
            }));
        }
Exemplo n.º 18
0
        public int UpdateByModel(RoteUserModel Model)
        {
            String ImgSql = Model.RUImGUrl == ""?"":" ,RUImGUrl=@RUImGUrl ";
            String sql    = "UPDATE RoteUser SET AID=@AID,RUName=@RUName,RUSex=@RUSex,RUAge=@RUAge,RUDetail=@RUDetail " + ImgSql + " WHERE RUID=@RUID";

            return(DataBaseOpen.NoQuery(sql, new SqlParameter[] {
                new SqlParameter("@RUID", Model.RUID),
                new SqlParameter("@AID", Model.AID),
                new SqlParameter("@RUName", Model.RUName),
                new SqlParameter("@RUSex", Model.RUSex),
                new SqlParameter("@RUAge", Model.RUAge),
                new SqlParameter("@RUDetail", Model.RUDetail),
                new SqlParameter("@RUImGUrl", Model.RUImGUrl),
            }));
        }
Exemplo n.º 19
0
        public int DeleteByID(int ID)
        {
            String sql = "DELETE  ActionInfo WHERE AID=" + ID + " AND AStatus=1";

            return(DataBaseOpen.NoQuery(sql));
        }
Exemplo n.º 20
0
        public DataTable SelectByID(int ID)
        {
            String sql = "SELECT * FROM  Users WHERE UID=" + ID;

            return(DataBaseOpen.Query(sql));
        }
Exemplo n.º 21
0
        public int DeleteByID(int ID)
        {
            String sql = "DELETE  RoteUser WHERE RUID=" + ID;

            return(DataBaseOpen.NoQuery(sql));
        }
Exemplo n.º 22
0
        public int GetCount(int AID = 0)
        {
            String sql = "SELECT COUNT(RUID) FROM RoteUser" + (AID == 0 ? "" : " WHERE AID=" + AID);

            return(Convert.ToInt32(DataBaseOpen.QueryOne(sql)));
        }
Exemplo n.º 23
0
        public DataTable SelectByActionID(int ID)
        {
            String sql = "SELECT * FROM  RoteUser WHERE AID=" + ID;

            return(DataBaseOpen.Query(sql));
        }
Exemplo n.º 24
0
        public DataTable SelectALL()
        {
            String sql = "SELECT * FROM  RoteUser";

            return(DataBaseOpen.Query(sql));
        }
Exemplo n.º 25
0
        public int DeleteByID(int ID)
        {
            String sql = "DELETE  RootMenu WHERE ID=" + ID;

            return(DataBaseOpen.NoQuery(sql));
        }
Exemplo n.º 26
0
        /// <summary>
        /// 获取到的值分别是 RID  RUID	RUName	UID	UName	RIP
        /// </summary>
        /// <param name="AID"></param>
        /// <returns></returns>
        public DataTable SelectRoteInfoByAID(int AID)
        {
            String sql = "SELECT RI.RID,RI.RUID,RU.RUName,U.UID,U.UName,RI.RIP FROM RoteInfo AS RI INNER JOIN RoteUser AS RU ON RI.RUID=RU.RUID INNER JOIN Users AS U ON U.UID=RI.UID WHERE RU.AID=" + AID;

            return(DataBaseOpen.Query(sql));
        }
Exemplo n.º 27
0
        public DataTable SelectByID(int ID)
        {
            String sql = "SELECT * FROM  RoteInfo WHERE IRD=" + ID;

            return(DataBaseOpen.Query(sql));
        }