/// <summary>
 /// 修改资源文件
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 private bool UpdateResourcesFile(AcademicResources_File Data)
 {
     try
     {
         StringBuilder sql = new StringBuilder();
         sql.AppendLine(@"update de2_aresource_file set title=@title,createTime=@createTime,targetFileUrl=@targetFileUrl,sourceTypeID=@sourceTypeID ,lastModifyTime=@lastModifyTime,lastModifyUsrID=@lastModifyUsrID where parentID=@parentID");
         //执行sql语句
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql.ToString()
                                 , new MySqlParameter("@title", Data.title)
                                 , new MySqlParameter("@createTime", Data.createTime)
                                 , new MySqlParameter("@targetFileUrl", Data.targetFileUrl)
                                 , new MySqlParameter("@sourceTypeID", Data.sourceTypeID)
                                 , new MySqlParameter("@parentID", Data.parentID)
                                 , new MySqlParameter("@parentID", Data.parentID)
                                 , new MySqlParameter("@lastModifyTime", Data.lastModifyTime)
                                 , new MySqlParameter("@lastModifyUsrID", Data.lastModifyUsrID));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "新建资源文件", "AddResourcesFile", ex);
     }
     return(false);
 }
 /// <summary>
 /// 根据父级id删除学术资源
 /// </summary>
 /// <param name="parentID"></param>
 /// <returns></returns>
 public bool DelAcademicResourcesByParentID(int parentID)
 {
     try
     {
         //获取子级学术资源
         string sql = "select * from de2_aresource where parentID=@parentID";
         //执行sql
         MySqlClient _Client = new MySqlClient();
         var         result  = _Client.ExecuteQuery <AcademicResources>(sql, new MySqlParameter("@parentID", parentID));
         if (result.Count > 0)
         {
             foreach (AcademicResources item in result)
             {
                 if (!DelAcademicResources(item))
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "根据父级id删除学术资源", "DelAcademicResourcesByParentID", ex);
     }
     return(false);
 }
Exemple #3
0
 /// <summary>
 /// 添加收藏
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public bool AddColletion(Collection Data)
 {
     try
     {
         //获取当前用户
         AccountProvider _AccountProvider = new AccountProvider();
         var             user             = _AccountProvider.GetCurrentUser();
         if (user == null || user.id == 0)
         {
             return(false);
         }
         //判断是否已经收藏
         if (IsCollection(Data.aid, user.id))
         {
             return(true);
         }
         Data.createID   = user.id;
         Data.createTime = DateTime.Now;
         string      sql          = "insert into de2_collection(aid,createTime,createID) values(@aid,@createTime,@createID)";
         MySqlClient _MySqlClient = new MySqlClient();
         _MySqlClient.ExecuteNonQuery(sql, new MySqlParameter("@aid", Data.aid),
                                      new MySqlParameter("@createTime", Data.createTime),
                                      new MySqlParameter("@createID", Data.createID));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "添加收藏", "AddColletion", ex);
         return(false);
     }
 }
        /// <summary>
        /// 获取目录
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public BaseResopne <List <AcademicResources_Menu> > GetAcademicResourcesMenu(GetAcademicResourcesMenuParam Param)
        {
            BaseResopne <List <AcademicResources_Menu> > result = new BaseResopne <List <AcademicResources_Menu> >();

            try
            {
                StringBuilder sql      = new StringBuilder();
                StringBuilder sqlCount = new StringBuilder();
                sql.AppendLine(@"select dam.id,dam.title,dam.parentID,dam.createTime,dam.createUserID
                ,u.userName as createUserName,dam.sourceTypeID,dat.typeName as sourceTypeName,dam.author,lastModifyTime,lastModifyUsrID
                from de2_aresource_menu dam
                LEFT JOIN de2_user u on  u.id=dam.createUserID
                LEFT JOIN de2_aresource_type dat on dat.id=dam.sourceTypeID");
                sqlCount.AppendLine(@"select count(id)  from de2_aresource_menu ");
                //排序
                sql.AppendLine(" order by dam.createTime @orderByType");
                sql.AppendLine(" limit @start,@pageSize ");
                //执行
                MySqlClient _Client = new MySqlClient();
                result.Total = Convert.ToInt32(_Client.ExecuteScalar(sqlCount.ToString()));
                result.Data  = _Client.ExecuteQuery <AcademicResources_Menu>(sqlCount.ToString()
                                                                             , new MySqlParameter("@orderByType", Param.orderType)
                                                                             , new MySqlParameter("@start", Param.StartRow)
                                                                             , new MySqlParameter("@pageSize", Param.PageSize));
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取目录", "GetAcademicResourcesMenu", ex);
                result.IsSuccess = false;
            }
            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 获取关注作者列表
        /// </summary>
        /// <param name="Start"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        public List <Concerns> GetConcernsList(int StartRow, int PageSize)
        {
            List <Concerns> result = new List <Concerns>();

            try
            {
                //获取当前用户
                AccountProvider _AccountProvider = new AccountProvider();
                var             user             = _AccountProvider.GetCurrentUser();
                if (user == null || user.id == 0)
                {
                    return(result);
                }
                string      sql     = "select * from de2_concerns where createID=@userID order by createTime DESC";
                MySqlClient _client = new MySqlClient();
                result = _client.ExecuteQuery <Concerns>(sql.ToString(),
                                                         new MySqlParameter("@userID", user.id));
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取关注作者列表", "GetCollectionList", ex);
            }
            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 验证用户是否存在
        /// </summary>
        /// <param name="LoginName"></param>
        /// <param name="UserKey">新建时为空</param>
        /// <returns></returns>
        public bool LoginNameIsRepeat(string LoginName, Guid UserKey)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("select count(id) from de2_user where loginName=@loginName ");
                if (UserKey != Guid.Empty)
                {
                    sql.AppendLine(" && userKey=@userKey");
                }
                MySqlClient _MySqlClient = new MySqlClient();
                int         UserCount    = 0;
                if (UserKey != Guid.Empty)
                {
                    UserCount = Convert.ToInt32(_MySqlClient.ExecuteScalar(sql.ToString(), new MySqlParameter("loginName", LoginName), new MySqlParameter("userKey", UserKey)));
                }
                else
                {
                    UserCount = Convert.ToInt32(_MySqlClient.ExecuteScalar(sql.ToString(), new MySqlParameter("loginName", LoginName)));
                }
                if (UserCount > 0)
                {
                    return(true);
                }

                return(false);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "验证用户是否存在", "LoginNameIsRepeat", ex);
                return(true);
            }
        }
 /// <summary>
 /// 根据父级ID删除目录
 /// </summary>
 /// <param name="parentID"></param>
 /// <returns></returns>
 private bool DelMenuByParent(int parentID)
 {
     try
     {
         //获取目录列表
         string      sql     = "select * from  de2_aresource_menu where parentID=@parentID";
         MySqlClient _Client = new MySqlClient();
         var         list    = _Client.ExecuteQuery <AcademicResources_Menu>(sql, new MySqlParameter("@parentID", parentID));
         if (list.Count > 0)
         {
             foreach (var item in list)
             {
                 if (!DelResourceMenu(item.id).IsSuccess)
                 {
                     return(false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "根据父级ID删除目录", "DelMenuByParent", ex);
         return(false);
     }
     return(true);
 }
Exemple #8
0
 /// <summary>
 /// 修改用户信息
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public bool UpdateMember(Member Data)
 {
     try
     {
         string      sql          = @"update de2_user set address=@address,email=@email,sex=@sex,addressProvinceID=@addressProvinceID,addressProvince=@addressProvince,addressCityID=@addressCityID,addressCity=@addressCity ,age=@age,mobileNO=@mobileNO,pid=@professionID,oid=@occupationID where id=@id;
           update de2_user_member set areaID=@areaID,branchID=@branchID where userid=@id";
         MySqlClient _MySqlClient = new MySqlClient();
         _MySqlClient.ExecuteNonQuery(sql,
                                      new MySqlParameter("branchID", Data.branchID),
                                      new MySqlParameter("areaID", Data.areaID),
                                      new MySqlParameter("address", Data.address),
                                      new MySqlParameter("email", Data.email),
                                      new MySqlParameter("sex", Data.sex),
                                      new MySqlParameter("addressProvinceID", Data.addressProvinceID),
                                      new MySqlParameter("addressProvince", Data.addressProvince),
                                      new MySqlParameter("addressCityID", Data.addressCityID),
                                      new MySqlParameter("addressCity", Data.addressCity),
                                      new MySqlParameter("age", Data.age),
                                      new MySqlParameter("mobileNO", Data.mobileNO),
                                      new MySqlParameter("occupationID", Data.occupationID),
                                      new MySqlParameter("professionID", Data.professionID),
                                      new MySqlParameter("id", Data.id)
                                      );
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "修改用户信息", "UpdateMember", ex);
         return(false);
     }
 }
        /// <summary>
        /// 删除目录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BaseResopne <string> DelResourceMenu(int id)
        {
            BaseResopne <string> result = new BaseResopne <string>();

            try
            {
                //删除文件
                if (DelResourcesFileByParent(id))
                {
                    result.IsSuccess = false;
                    result.Error     = "资源文件删除失败";
                    return(result);
                }
                //删除目录
                string sql = "delete from de2_aresource_menu where id=@id";
                //
                MySqlClient _Client = new MySqlClient();
                _Client.ExecuteNonQuery(sql, new MySqlParameter("@id", id));
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "删除目录", "DelResourceMenu", ex);
                result.IsSuccess = false;
            }
            return(result);
        }
Exemple #10
0
        /// <summary>
        /// 获取广告列表
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public BaseResopne <List <Advertisement> > GetAdvertisementes(GetAdvertisementesParam Param)
        {
            BaseResopne <List <Advertisement> > result = new BaseResopne <List <Advertisement> >();

            try
            {
                StringBuilder sql      = new StringBuilder();
                StringBuilder countSql = new StringBuilder();
                sql.AppendLine("select * from de2_advertisement");
                countSql.AppendLine("select count(id) from de2_advertisement");

                sql.AppendLine("order by `index` desc limit @start,@count");
                // string sql = string.Format("select * from de2_advertisement  order by index desc limit @limit");
                MySqlClient _client = new MySqlClient();

                result.Total = Convert.ToInt32(_client.ExecuteScalar(countSql.ToString()));
                result.Data  = _client.ExecuteQuery <Advertisement>(sql.ToString(), new MySqlParameter("@start", Param.StartRow), new MySqlParameter("@count", Param.PageSize));
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取广告列表", "GetAdvertisementList", ex);
                result.IsSuccess = false;
                result.Error     = ex.Message;
            }
            return(result);
        }
Exemple #11
0
        /// <summary>
        /// 获取收藏列表
        /// </summary>
        /// <param name="StartRow">开始行</param>
        /// <param name="PageSize">页面数据大小</param>
        /// <param name="userID">用户ID</param>
        /// <returns></returns>
        public List <Archives> GetCollectionList(int StartRow, int PageSize, int userID)
        {
            List <Archives> Result = new List <Archives>();

            try
            {
                //生成检索语句
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("select ar.* from de2_archives as ar join  de2_collection as co on ar.id=co.aid  where co.createID=@userID");

                sql.AppendLine(" order by sortrank desc");
                sql.AppendLine(" limit @start,@count ");
                MySqlClient _client = new MySqlClient();

                Result = _client.ExecuteQuery <Archives>(sql.ToString(),
                                                         new MySqlParameter("@start", StartRow),
                                                         new MySqlParameter("@count", PageSize),
                                                         new MySqlParameter("@userID", userID));
                Result = FromateLitpic(Result);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取收藏列表", "GetCollectionList", ex);
            }
            return(Result);
        }
Exemple #12
0
        /// <summary>
        /// 获取年度计划详情
        /// </summary>
        /// <param name="wid"></param>
        /// <returns></returns>
        public WorkPlan GetWorkPlanDetial(int wid)
        {
            WorkPlan _result = new WorkPlan();

            try
            {
                //获取年度计划详情
                string      sql     = @"  select p.id,`year`,startTime,endTime,p.`name`,content,scale,address,addressCity,addressCityID,
                                addressProvince,addressProvinceID,workPlanTypeID ,t.`Name` workPlanTypeName
                                from de2_workplan as p
                                left join de2_workplantype as t on p.workPlanTypeID=t.id where p.id=@id";
                MySqlClient _Client = new MySqlClient();
                _result = _Client.ExecuteQuery <WorkPlan>(sql, new MySqlParameter("@id", wid)).FirstOrDefault();
                //获取联系人
                if (_result == null)
                {
                    return(_result);
                }
                _result.Contacts = GetWorkPlanContacts(wid);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取年度计划详情", "GetWorkPlanDetial", ex);
            }
            return(_result);
        }
Exemple #13
0
        /// <summary>
        /// 获取头条新闻
        /// </summary>
        /// <param name="Count"></param>
        /// <returns></returns>
        public List <Archives> GetHeadline(int Count)
        {
            List <Archives> Result = new List <Archives>();

            try
            {
                log.SaveLog("开始获取数据!");
                AccountProvider _AccountProvider = new AccountProvider();
                //获取访问权限
                int VewBrowsePermissions = _AccountProvider.GetBrowsePermissions();
                //生成检索语句
                string sql = string.Format("select * from de2_archives where  flag like '%h%' and arcrank!=-1 and( arcrank=0 or arcrank={0} )order by sortrank desc limit @limit", VewBrowsePermissions);

                MySqlClient _client = new MySqlClient();
                log.SaveLog("开始执行SQL!");
                Result = _client.ExecuteQuery <Archives>(sql, new MySqlParameter("@limit", Count));
                log.SaveLog("完成SQL!");
                Result = FromateLitpic(Result);
            }
            catch (Exception ex)
            {
                log.SaveLog("执行错误!" + ex.Message);
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取头条新闻", "GetHeadline", ex);
            }
            return(Result);
        }
        /// <summary>
        /// 获取目录详细信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public AcademicResources_Menu GetAcademicResourcesMenuDetail(int id)
        {
            AcademicResources_Menu result = null;

            try
            {
                StringBuilder sql = new StringBuilder();

                sql.AppendLine(@"select dam.id,dam.title,dam.parentID,dam.createTime,dam.createUserID
                ,u.userName as createUserName,dam.sourceTypeID,dat.typeName as sourceTypeName,dam.author,lastModifyTime,lastModifyUsrID
                from de2_aresource_menu dam
                LEFT JOIN de2_user u on  u.id=dam.createUserID
                LEFT JOIN de2_aresource_type dat on dat.id=dam.sourceTypeID where dam.id=@id");

                MySqlClient _Client = new MySqlClient();
                result = _Client.ExecuteQuery <AcademicResources_Menu>(sql.ToString(), new MySqlParameter("@id", id)).FirstOrDefault();

                return(result);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "删除目录", "DelResourceMenu", ex);
                return(null);
            }
        }
Exemple #15
0
 /// <summary>
 /// 新建广告信息
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public bool InsterAdvertisement(Advertisement Data)
 {
     try
     {
         string sql = @" INSERT into de2_advertisement(title, targetUrl, imageUrl, imageBase64, `index`, isVail,count,lastModifyTime,regTime) VALUES
                               (@title, @targetUrl, @imageUrl, @imageBase64,@`index`, @isVail,@count,@lastModifyTime,@regTime)";
         Data.imageBase64 = GetImageBase64(Data.imageUrl);
         MySqlClient _MySqlClient = new MySqlClient();
         _MySqlClient.ExecuteNonQuery(sql, new MySqlParameter("@title", Data.title),
                                      new MySqlParameter("@targetUrl", Data.targetUrl),
                                      new MySqlParameter("@imageUrl", Data.imageUrl),
                                      new MySqlParameter("@imageBase64", Data.imageBase64),
                                      new MySqlParameter("@`index`", Convert.ToInt32(Data.index)),
                                      new MySqlParameter("@isVail", true),
                                      new MySqlParameter("@count", Convert.ToInt32(0)),
                                      new MySqlParameter("@lastModifyTime", DateTime.Now),
                                      new MySqlParameter("@regTime", DateTime.Now)
                                      );
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "新建广告信息", "InsterAdvertisement", ex);
         return(false);
     }
 }
        /// <summary>
        /// 修改目录
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public BaseResopne <string> UpdateResourceMenu(AcademicResources_Menu Param)
        {
            BaseResopne <string> result = new BaseResopne <string>();

            try
            {
                //获取当前登录人
                AccountProvider _AccountProvider = new AccountProvider();
                var             user             = _AccountProvider.GetCurrentUser();
                if (user == null)
                {
                    result.IsSuccess = false;
                    result.Error     = "获取当前用户信息失败";
                    return(result);
                }
                Param.lastModifyTime  = DateTime.Now;
                Param.lastModifyUsrID = user.id;
                string sql = @"update  de2_aresource_menu set title=@title,parentID=@parentID,sourceTypeID=@sourceTypeID,author=@author,lastModifyUsrID=@lastModifyUsrID,lastModifyTime=@lastModifyTime";
                //执行sql
                MySqlClient _Client    = new MySqlClient();
                var         ResourceID = _Client.Inster(sql
                                                        , new MySqlParameter("@title", Param.title)
                                                        , new MySqlParameter("@parentID", Param.parentID)
                                                        , new MySqlParameter("@sourceTypeID", Param.sourceTypeID)
                                                        , new MySqlParameter("@author", Param.author)
                                                        , new MySqlParameter("@lastModifyUsrID", Param.lastModifyUsrID)
                                                        , new MySqlParameter("@lastModifyTime", Param.lastModifyTime));
                //判断文件路径是否为空
                if (!string.IsNullOrEmpty(Param.resourceFile))
                {
                    AcademicResources_File _AcademicResources_File = new AcademicResources_File();
                    _AcademicResources_File.lastModifyTime  = DateTime.Now;
                    _AcademicResources_File.lastModifyUsrID = user.id;
                    _AcademicResources_File.parentID        = Param.id;
                    _AcademicResources_File.sourceTypeID    = Param.sourceTypeID;
                    _AcademicResources_File.targetFileUrl   = Param.resourceFile;
                    _AcademicResources_File.title           = Param.title;
                    UpdateResourcesFile(_AcademicResources_File);
                }
                else
                {
                    result.IsSuccess = false;
                    result.Error     = "资源文件路径为空";
                    return(result);
                }
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "修改目录", "UpdateResourceMenu", ex);
                result.IsSuccess = false;
            }
            return(result);
        }
Exemple #17
0
 /// <summary>
 /// 修改点击次数
 /// </summary>
 /// <param name="aid"></param>
 public void UpdataClickCount(int aid)
 {
     try
     {
         string      sql     = "update de2_archives set click=click+1 where id=@id";
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql.ToString(), new MySqlParameter("@id", aid));
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "修改点击次数", "UpdataClickCount", ex);
     }
 }
Exemple #18
0
 /// <summary>
 /// 缓存角色信息
 /// </summary>
 /// <returns></returns>
 private bool CacheRole(DataCacheProvider Provider)
 {
     try
     {
         string      sql     = "select * from de2_user_roletype";
         MySqlClient _Client = new MySqlClient();
         var         result  = _Client.ExecuteQuery <RoleType>(sql);
         return(Provider.SetCache("roetype", result));
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "缓存角色信息", "CacheRole", ex);
         return(false);
     }
 }
Exemple #19
0
 /// <summary>
 /// 删除收藏
 /// </summary>
 /// <param name="cid">主键</param>
 /// <returns></returns>
 public bool DelColletion(int cid)
 {
     try
     {
         string      sql          = "delete from de2_collection where id=@id";
         MySqlClient _MySqlClient = new MySqlClient();
         _MySqlClient.ExecuteNonQuery(sql, new MySqlParameter("@id", cid));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "删除收藏", "DelColletion", ex);
         return(false);
     }
 }
Exemple #20
0
 /// <summary>
 /// 删除联系人
 /// </summary>
 /// <param name="cid">联系人ID</param>
 /// <returns></returns>
 public bool DelWorkPlanContacts(int cid)
 {
     try
     {
         string      sql     = "delete from de2_workplancontacts where id=@id";
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql, new MySqlParameter("@id", cid));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "删除联系人", "DelWorkPlanContacts", ex);
         return(false);
     }
 }
Exemple #21
0
        /// <summary>
        /// 获取广告详细信息
        /// </summary>
        /// <param name="key">主键</param>
        /// <returns></returns>
        public Advertisement GetAdvertisement(int key)
        {
            Advertisement result = null;

            try
            {
                string      sql     = string.Format("select * from de2_advertisement where  id=@key");
                MySqlClient _client = new MySqlClient();
                result = _client.ExecuteQuery <Advertisement>(sql, new MySqlParameter("@key", key)).FirstOrDefault();
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取广告详细信息", "GetAdvertisementList", ex);
            }
            return(result);
        }
Exemple #22
0
        /// <summary>
        /// 提交用户注册数据
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        private bool RegUserCommit(User Data)
        {
            string      sql          = @" INSERT into de2_user(userKey, loginName, password, userName, memberCode, sex,regTime,lastModifyTime,state) VALUES
                                      (@userKey, @loginName, @password, @userName,@memberCode, @sex,@regTime,@lastModifyTime,1)";
            MySqlClient _MySqlClient = new MySqlClient();

            _MySqlClient.ExecuteNonQuery(sql, new MySqlParameter("userKey", Data.userKey),
                                         new MySqlParameter("loginName", Data.loginName),
                                         new MySqlParameter("password", Data.password),
                                         new MySqlParameter("userName", Data.userName),
                                         new MySqlParameter("memberCode", Data.memberCode),
                                         new MySqlParameter("sex", Data.sex),
                                         new MySqlParameter("regTime", Data.regTime),
                                         new MySqlParameter("lastModifyTime", Data.lastModifyTime)
                                         );
            return(true);
        }
Exemple #23
0
        /// <summary>
        /// 获取广告列表
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public List <Advertisement> GetAdvertisementList(int count)
        {
            List <Advertisement> result = new List <Advertisement>();

            try
            {
                string      sql     = string.Format("select * from de2_advertisement where  isVail=true order by `index` desc limit @limit");
                MySqlClient _client = new MySqlClient();
                result = _client.ExecuteQuery <Advertisement>(sql, new MySqlParameter("@limit", count));
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取广告列表", "GetAdvertisementList", ex);
            }
            return(result);
        }
Exemple #24
0
        /// <summary>
        /// 记录广告点击次数
        /// </summary>
        /// <param name="key">主键</param>
        /// <returns></returns>
        public Advertisement AdvertisementClickCount(int key)
        {
            Advertisement result = null;

            try
            {
                string      sql     = string.Format("update   de2_advertisement set count=(count+1) where  id=@key");
                MySqlClient _client = new MySqlClient();
                result = _client.ExecuteQuery <Advertisement>(sql, new MySqlParameter("@key", key)).FirstOrDefault();
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "记录广告点击次数", "AdvertisementClickCount", ex);
            }
            return(result);
        }
Exemple #25
0
        /// <summary>
        /// 获取职业列表
        /// </summary>
        /// <returns></returns>
        public List <Occupation> GetOccupationList()
        {
            List <Occupation> result = new List <Occupation>();

            try
            {
                string      sql     = "select * from de2_user_occupation  order by oindex";
                MySqlClient _Client = new MySqlClient();
                result = _Client.ExecuteQuery <Occupation>(sql);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取职业列表", "GetOccupationList", ex);
            }
            return(result);
        }
Exemple #26
0
        /// <summary>
        /// 获取省列表
        /// </summary>
        /// <returns></returns>
        public List <NativePlace> GetProvinceList()
        {
            List <NativePlace> result = new List <NativePlace>();

            try
            {
                string      sql     = "select ename as Name,evalue as id from de2_sys_enum where egroup='nativeplace' and issign=0 order by disorder";
                MySqlClient _Client = new MySqlClient();
                result = _Client.ExecuteQuery <NativePlace>(sql);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取省列表", "GetProvinceList", ex);
            }
            return(result);
        }
 /// <summary>
 /// 删除资源文件
 /// </summary>
 /// <param name="parentd"></param>
 /// <returns></returns>
 public bool DelResourcesFileByParent(int parentID)
 {
     try
     {
         StringBuilder sql = new StringBuilder();
         sql.AppendLine("delete  from de2_aresource_file where parentID=@parentID");
         //执行sql
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql.ToString(), new MySqlParameter("@parentID", parentID));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "删除资源文件", "DelResourcesFileByParent", ex);
     }
     return(false);
 }
        /// <summary>
        /// 获取学术资源详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private AcademicResources GetAcademicResources(int id)
        {
            AcademicResources result = new AcademicResources();

            try
            {
                string sql = "select * from de2_aresource where id=@id ";
                //执行sql
                MySqlClient _Client = new MySqlClient();
                result = _Client.ExecuteQuery <AcademicResources>(sql, new MySqlParameter("@id", id)).FirstOrDefault();
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取学术资源详情", "GetAcademicResources", ex);
            }
            return(result);
        }
Exemple #29
0
        /// <summary>
        /// 获取文章内容信息
        /// </summary>
        /// <param name="aid"></param>
        /// <returns></returns>
        public Addonarticle GetAddonarticle(int aid)
        {
            Addonarticle result = null;

            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("select * from de2_addonarticle where aid=@id");
                MySqlClient _Client = new MySqlClient();
                result = _Client.ExecuteQuery <Addonarticle>(sql.ToString(), new MySqlParameter("@id", aid)).FirstOrDefault();
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取文件内容信息", "GetAddonarticle", ex);
            }
            return(result);
        }
Exemple #30
0
        /// <summary>
        /// 获取联系人
        /// </summary>
        /// <param name="wpid"></param>
        /// <returns></returns>
        public List <WorkPlanContacts> GetWorkPlanContacts(int wpid)
        {
            List <WorkPlanContacts> result = new List <WorkPlanContacts>();

            try
            {
                //
                string      sql     = "select id ,phone,contactsName ,wid,'edit' as statue from de2_workplancontacts where wid=@wid";
                MySqlClient _Client = new MySqlClient();
                result = _Client.ExecuteQuery <WorkPlanContacts>(sql, new MySqlParameter("@wid", wpid));
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "获取联系人", "GetWorkPlanContacts", ex);
            }
            return(result);
        }