示例#1
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);
        }
 /// <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);
 }
示例#4
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);
     }
 }
示例#5
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);
     }
 }
示例#6
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);
     }
 }
示例#7
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);
     }
 }
示例#8
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);
     }
 }
示例#9
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);
        }
示例#10
0
 /// <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);
 }
示例#11
0
 /// <summary>
 /// 新建工作计划联系人
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 private bool AddWorkPlanContacts(WorkPlanContacts Data, int wid)
 {
     try
     {
         string      sql     = "insert into de2_workplancontacts(contactsID,contactsName,phone,wid) values (@contactsID,@contactsName,@phone,@wid)";
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql,
                                 new MySqlParameter("@contactsID", Data.contactsID)
                                 , new MySqlParameter("@contactsName", Data.contactsName)
                                 , new MySqlParameter("@phone", Data.phone)
                                 , new MySqlParameter("@wid", wid));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "新建工作计划联系人", "AddWorkPlanContacts", ex);
         return(false);
     }
 }
示例#12
0
 /// <summary>
 /// 修改工作计划联系人
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 private bool UpdateWorkPlanContacts(WorkPlanContacts Data)
 {
     try
     {
         string      sql     = "update de2_workplancontacts set contactsID=@contactsID,contactsName=@contactsName,phone=@phone where id=@id";
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql,
                                 new MySqlParameter("@contactsID", Data.contactsID)
                                 , new MySqlParameter("@contactsName", Data.contactsName)
                                 , new MySqlParameter("@phone", Data.phone)
                                 , new MySqlParameter("@id", Data.id));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "修改工作计划联系人", "UpdateWorkPlanContacts", ex);
         return(false);
     }
 }
示例#13
0
        /// <summary>
        /// 修改登录密码
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public UpdatePasswordResult UpdatePassword(UpdatePasswordParam Param)
        {
            UpdatePasswordResult _Result = new UpdatePasswordResult();

            try
            {
                string oldPassword = EncryptPassword(Param.Param1);
                string newPassword = EncryptPassword(Param.Param2);
                User   _User       = GetCurrentUser();
                //验证旧密码是否正确
                string      sql          = @"select count(id) from de2_user where id=@id and password=@password";
                MySqlClient _MySqlClient = new MySqlClient();
                int         count        = Convert.ToInt32(_MySqlClient.ExecuteScalar(sql, new MySqlParameter("id", _User.id), new MySqlParameter("password", oldPassword)));
                if (count == 0)
                {
                    _Result.isSuccess  = false;
                    _Result.errMessage = "原密码不正确";
                    return(_Result);
                }
                //验证新密码
                RegUserResult CheckResult = CheckPassword(Param.Param2);
                if (!CheckResult.isSuccess)
                {
                    _Result.isSuccess  = false;
                    _Result.errMessage = CheckResult.errMessage;
                    return(_Result);
                }
                //修改密码
                sql = @"update de2_user set password=@password  where id=@id  ";
                _MySqlClient.ExecuteNonQuery(sql, new MySqlParameter("id", _User.id), new MySqlParameter("@password", newPassword));
                _Result.isSuccess = true;
                return(_Result);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "修改登录密码", "UpdatePassword", ex);
            }
            return(_Result);
        }
示例#14
0
 /// <summary>
 /// 取消关注
 /// </summary>
 /// <param name="author">作者</param>
 /// <returns></returns>
 public bool CancelConcerns(string author)
 {
     try
     {
         //获取当前登录人
         AccountProvider _AccountProvider = new AccountProvider();
         var             user             = _AccountProvider.GetCurrentUser();
         if (user == null)
         {
             return(false);
         }
         string      sql     = "delete from de2_concerns where authorName=@authorName  and createID=@createID";
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql, new MySqlParameter("@authorName", author), new MySqlParameter("@createID", user.id));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "取消关注", "CancelConcerns", ex);
         return(false);
     }
 }
示例#15
0
 /// <summary>
 /// 取消收藏
 /// </summary>
 /// <param name="aid">文章编号</param>
 /// <returns></returns>
 public bool CancelColletion(int aid)
 {
     try
     {
         //获取当前登录人
         AccountProvider _AccountProvider = new AccountProvider();
         var             user             = _AccountProvider.GetCurrentUser();
         if (user == null)
         {
             return(false);
         }
         string      sql     = "delete from de2_collection where aid=@aid  and createID=@createID";
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql, new MySqlParameter("@aid", aid), new MySqlParameter("@createID", user.id));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "删除收藏", "DelColletion", ex);
         return(false);
     }
 }
示例#16
0
 /// <summary>
 /// 删除学术资源
 /// </summary>
 /// <param name="Resource"></param>
 /// <returns></returns>
 private bool DelAcademicResources(AcademicResources Resource)
 {
     try
     {
         //删除子文章
         if (Resource.isChild)
         {
             if (DelAcademicResourcesByParentID(Resource.id))
             {
                 return(false);
             }
         }
         //删除目录
         if (Resource.isMenu)
         {
             if (DelMenuByParent(Resource.id))
             {
                 return(false);
             }
         }
         //删除上传文件
         DelResourcesFileByParent(Resource.id);
         //生成sql
         StringBuilder sql = new StringBuilder();
         sql.AppendLine(@"delete from   de2_aresource where id=@id");
         //执行sql语句
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql.ToString(), new MySqlParameter("@id", Resource.id));
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "删除学术资源", "DelAcademicResources", ex);
         return(false);
     }
 }
示例#17
0
 /// <summary>
 /// 修改工作计划
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public bool UpdateWorkPlan(WorkPlan Data)
 {
     try
     {
         AccountProvider _AccountProvider = new AccountProvider();
         var             user             = _AccountProvider.GetCurrentUser();
         string          sql = "update de2_workplan set `year`=@`year`,startTime=@startTime,endTime=@endTime,name=@name,content=@content,scale=@scale,addressProvinceID=@addressProvinceID,addressProvince=@addressProvince,addressCityID=@addressCityID,addressCity=@addressCity,address=@address,lastModifyTime=@lastModifyTime,workPlanTypeID=@workPlanTypeID where id=@id"; Data.lastModifyTime = DateTime.Now;
         if (user == null)
         {
             Data.createUserID = user.id;
         }
         MySqlClient _Client = new MySqlClient();
         _Client.ExecuteNonQuery(sql,
                                 new MySqlParameter("@`year`", Data.year)
                                 , new MySqlParameter("@startTime", Data.startTime)
                                 , new MySqlParameter("@endTime", Data.endTime)
                                 , new MySqlParameter("@name", Data.name)
                                 , new MySqlParameter("@content", Data.content)
                                 , new MySqlParameter("@scale", Data.scale)
                                 , new MySqlParameter("@addressProvinceID", Data.addressProvinceID)
                                 , new MySqlParameter("@addressProvince", Data.addressProvince)
                                 , new MySqlParameter("@addressCityID", Data.addressCityID)
                                 , new MySqlParameter("@addressCity", Data.addressCity)
                                 , new MySqlParameter("@address", Data.address)
                                 , new MySqlParameter("@lastModifyTime", Data.lastModifyTime)
                                 , new MySqlParameter("@workPlanTypeID", Data.workPlanTypeID)
                                 , new MySqlParameter("@id", Data.id));
         SaveWorkPlanContacts(Data);
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "修改工作计划", "UpdateWorkPlan", ex);
         return(false);
     }
 }
示例#18
0
        /// <summary>
        /// 修改学术资源发布状态
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public BaseResopne <string> UpdatePublishStatue(AcademicResources Data)
        {
            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);
                }
                Data.lastModifyTime  = DateTime.Now;
                Data.lastModifyUsrID = user.id;

                StringBuilder sql = new StringBuilder();
                sql.AppendLine(@"update  de2_aresource set isPublish=@isPublish,lastModifyTime=@lastModifyTime,lastModifyUsrID=@lastModifyUsrID where id=@id");
                //执行sql语句
                MySqlClient _Client = new MySqlClient();
                _Client.ExecuteNonQuery(sql.ToString()
                                        , new MySqlParameter("@isPublish", Data.isPublish)
                                        , new MySqlParameter("@lastModifyTime", Data.lastModifyTime)
                                        , new MySqlParameter("@lastModifyUsrID", Data.lastModifyUsrID)
                                        , new MySqlParameter("@id", Data.id));
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "修改学术资源发布状态", "UpdatePublishStatue", ex);
                result.IsSuccess = false;
            }
            return(result);
        }
示例#19
0
 /// <summary>
 /// 修改广告信息
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public bool UpdateAdvertisement(Advertisement Data)
 {
     try
     {
         string sql = @" update  de2_advertisement set title=@title, targetUrl=@targetUrl, imageUrl=@imageUrl, imageBase64=@imageBase64, `index`=@`index`, lastModifyTime=@lastModifyTime where id=@id";
         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("@lastModifyTime", DateTime.Now),
                                      new MySqlParameter("@id", Data.id)
                                      );
         return(true);
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "修改广告信息", "InsterAdvertisement", ex);
         return(false);
     }
 }
示例#20
0
        /// <summary>
        /// 修改学术资源信息
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public BaseResopne <string> UpdateAcademicResources(AcademicResources Data)
        {
            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);
                }
                Data.lastModifyTime  = DateTime.Now;
                Data.lastModifyUsrID = user.id;
                //生成sql
                StringBuilder sql = new StringBuilder();
                sql.AppendLine(@"update  de2_aresource set `name`=@`name`,parentID=@parentID,sourceTypeID=@sourceTypeID,isChild=@,author=@,isPublish=@isPublish,`year`=@`year`,periodNumber=@periodNumber,lastModifyTime=@lastModifyTime,lastModifyUsrID=@lastModifyUsrID,isMenu=@isMenu where id=@id");
                //执行sql语句
                MySqlClient _Client = new MySqlClient();
                _Client.ExecuteNonQuery(sql.ToString()
                                        , new MySqlParameter("@`name`", Data.name)
                                        , new MySqlParameter("@parentID", Data.parentID)
                                        , new MySqlParameter("@sourceTypeID", Data.sourceTypeID)
                                        , new MySqlParameter("@isChild", Data.isChild)
                                        , new MySqlParameter("@author", Data.author)
                                        , new MySqlParameter("@isPublish", Data.isPublish)
                                        , new MySqlParameter("@`year`", Data.year)
                                        , new MySqlParameter("@periodNumber", Data.periodNumber)
                                        , new MySqlParameter("@lastModifyTime", Data.lastModifyTime)
                                        , new MySqlParameter("@lastModifyUsrID", Data.lastModifyUsrID)
                                        , new MySqlParameter("@isMenu", Data.isMenu)
                                        , new MySqlParameter("@id", Data.id));
                //判断文件路径是否为空
                if (string.IsNullOrEmpty(Data.resourceFile))
                {
                    AcademicResources_File _AcademicResources_File = new AcademicResources_File();
                    _AcademicResources_File.lastModifyTime  = DateTime.Now;
                    _AcademicResources_File.lastModifyUsrID = user.id;
                    _AcademicResources_File.parentID        = Data.id;
                    _AcademicResources_File.sourceTypeID    = Data.sourceTypeID;
                    _AcademicResources_File.targetFileUrl   = Data.resourceFile;
                    _AcademicResources_File.title           = Data.name;
                    UpdateResourcesFile(_AcademicResources_File);
                }
                else
                {
                    DelResourcesFileByParent(Data.id);
                }
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "修改学术资源信息", "UpdateAcademicResources", ex);
                result.IsSuccess = false;
            }
            return(result);
        }
示例#21
0
        /// <summary>
        /// 注册用户绑定
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public BindMemberResult BindMember(BindMemberParam Param)
        {
            BindMemberResult _result = new BindMemberResult();

            try
            {
                //查询会员账号是否已被绑定

                //查询会员是否存在
                string      sql          = "select * from de2_user_member where memberID=@memberID and memberName=@memberName";
                MySqlClient _MySqlClient = new MySqlClient();
                Member      _Member      = _MySqlClient.ExecuteQuery <Member>(sql, new MySqlParameter("memberID", Param.MemberCode), new MySqlParameter("memberName", Param.UserName)).FirstOrDefault();
                if (_Member == null)
                {
                    _result.isSuccess  = false;
                    _result.errMessage = "会员证号验证失败";
                    return(_result);
                }
                if (_Member.userID != 0)
                {
                    _result.isSuccess  = false;
                    _result.errMessage = "会员证号已被绑定请联系管理员";
                    return(_result);
                }
                //获取用户ID
                sql = "select * from de2_user where userKey=@userKey";
                User UserInfo = _MySqlClient.ExecuteQuery <User>(sql, new MySqlParameter("userKey", Param.UserKey)).FirstOrDefault();
                if (UserInfo == null)
                {
                    _result.isSuccess  = false;
                    _result.errMessage = "注册用户不存在";
                    return(_result);
                }
                //关联会员信息
                StringBuilder sqlb = new StringBuilder();
                sqlb.AppendLine(" update de2_user_member set userid=@userid where memberID=@memberID ;");
                sqlb.AppendLine(" update de2_user set memberCode= @memberID ,userName=@userName where id=@userid ;");
                _MySqlClient.ExecuteNonQuery(sqlb.ToString(), new MySqlParameter("userid", UserInfo.id)
                                             , new MySqlParameter("memberID", _Member.memberID), new MySqlParameter("userName", _Member.memberName));

                //设置session
                User SessionUserInfo = new User();
                SessionUserInfo.id         = UserInfo.id;
                SessionUserInfo.userKey    = UserInfo.userKey;
                SessionUserInfo.loginName  = UserInfo.loginName;
                SessionUserInfo.userName   = UserInfo.userName;
                SessionUserInfo.memberCode = _Member.memberID;
                SessionUserInfo.level      = _Member.level;
                SessionUserInfo.levelName  = _Member.levelName;
                SetSession(SessionUserInfo);

                //修改用户信息表
                _result.isSuccess = true;
                return(_result);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "注册用户绑定", "BindMember", ex);
                _result.isSuccess  = false;
                _result.errMessage = "用户绑定失败";
            }
            return(_result);
        }