/// <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 #2
0
        /// <summary>
        /// 新建工作计划
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public bool AddWorkPlan(WorkPlan Data)
        {
            try
            {
                AccountProvider _AccountProvider = new AccountProvider();
                var             user             = _AccountProvider.GetCurrentUser();
                string          sql = @"insert into de2_workplan  (`year`,startTime,endTime,name,content,scale,addressProvinceID,addressProvince,addressCityID,addressCity,address,createTime,lastModifyTime,createUserID,workPlanTypeID) 
                              values (@`year`,@startTime,@endTime,@name,@content,@scale,@addressProvinceID,@addressProvince,@addressCityID,@addressCity,@address,@createTime,@lastModifyTime,@createUserID,@workPlanTypeID)";
                Data.createTime     = DateTime.Now;
                Data.lastModifyTime = DateTime.Now;
                if (user == null)
                {
                    Data.createUserID = user.id;
                }
                MySqlClient _Client = new MySqlClient();
                Data.id = (int)_Client.Inster(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("@createTime", Data.createTime)
                                              , new MySqlParameter("@lastModifyTime", Data.lastModifyTime)
                                              , new MySqlParameter("@createUserID", Data.createUserID)
                                              , new MySqlParameter("@workPlanTypeID", Data.workPlanTypeID));

                SaveWorkPlanContacts(Data);
                return(true);
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "新建工作计划", "AddWorkPlan", ex);
                return(false);
            }
        }
        /// <summary>
        /// 保存学术资源信息
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public BaseResopne <Int32> AddAcademicResources(AcademicResources Data)
        {
            BaseResopne <Int32> result = new BaseResopne <Int32>();

            try
            {
                //获取当前登录人
                AccountProvider _AccountProvider = new AccountProvider();
                var             user             = _AccountProvider.GetCurrentUser();
                if (user == null)
                {
                    result.IsSuccess = false;
                    result.Error     = "获取当前用户信息失败";
                    return(result);
                }
                Data.createUserID    = user.id;
                Data.createTime      = DateTime.Now;
                Data.lastModifyTime  = DateTime.Now;
                Data.lastModifyUsrID = user.id;
                //生成sql
                StringBuilder sql = new StringBuilder();
                sql.AppendLine(@"insert into de2_aresource (`name`,parentID,sourceTypeID,createTime,createUserID,isChild,author,isPublish,`year`,periodNumber,lastModifyTime,lastModifyUsrID,isMenu) values(@`name`,@parentID,@sourceTypeID,@createTime,@createUserID,@isChild,@author,@isPublish,@`year`,@periodNumber,@lastModifyTime,@lastModifyUsrID,@isMenu)");
                //执行sql语句
                MySqlClient _Client    = new MySqlClient();
                var         ResourceID = _Client.Inster(sql.ToString()
                                                        , new MySqlParameter("@`name`", Data.name)
                                                        , new MySqlParameter("@parentID", Data.parentID)
                                                        , new MySqlParameter("@sourceTypeID", Data.sourceTypeID)
                                                        , new MySqlParameter("@createTime", Data.createTime)
                                                        , new MySqlParameter("@createUserID", Data.createUserID)
                                                        , 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));
                result.Data = Convert.ToInt32(ResourceID);
                //判断文件路径是否为空
                if (!string.IsNullOrEmpty(Data.resourceFile))
                {
                    AcademicResources_File _AcademicResources_File = new AcademicResources_File();
                    _AcademicResources_File.lastModifyTime  = DateTime.Now;
                    _AcademicResources_File.lastModifyUsrID = user.id;
                    _AcademicResources_File.createTime      = DateTime.Now;
                    _AcademicResources_File.createUserID    = user.id;
                    _AcademicResources_File.parentID        = Convert.ToInt32(ResourceID);
                    _AcademicResources_File.sourceTypeID    = Data.sourceTypeID;
                    _AcademicResources_File.targetFileUrl   = Data.resourceFile;
                    _AcademicResources_File.title           = Data.name;
                    AddResourcesFile(_AcademicResources_File);
                }
                result.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogFactory _LogFactory = new LogFactory(this.GetType());
                _LogFactory.CreateLog(LogType.Error, "保存学术资源信息", "AddAcademicResources", ex);
                result.IsSuccess = false;
            }
            return(result);
        }