コード例 #1
0
        public void Initialize(string connectionString, LogUtility logger)
        {
            _logger = logger;

            _db = new MySqlRepositoryBase();
            this._db.Initialize(connectionString, connectionString);
        }
コード例 #2
0
ファイル: LoggerDatabase.cs プロジェクト: Epstone/remindii
        public LoggerRepository Initialize(string connectionString)
        {
            _db = new MySqlRepositoryBase();
              this._db.Initialize( connectionString, connectionString );

              return this;
        }
コード例 #3
0
        public LoggerRepository Initialize(string connectionString)
        {
            _db = new MySqlRepositoryBase();
            this._db.Initialize(connectionString, connectionString);

            return(this);
        }
コード例 #4
0
 public void DeleteForm(string keyValue)
 {
     using (var db = new MySqlRepositoryBase().BeginTrans())
     {
         db.Delete <UserEntity>(t => t.Id == keyValue);
         db.Delete <UserLogOnEntity>(t => t.UserId == keyValue);
         db.Commit();
     }
 }
コード例 #5
0
ファイル: RoleRepository.cs プロジェクト: gongthub/CMS
 public void DeleteForm(string keyValue)
 {
     using (var db = new MySqlRepositoryBase().BeginTrans())
     {
         db.Delete <RoleEntity>(t => t.Id == keyValue);
         db.Delete <RoleAuthorizeEntity>(t => t.ObjectId == keyValue);
         db.Commit();
     }
 }
コード例 #6
0
 public void SubmitCloneButton(List <ModuleButtonEntity> entitys)
 {
     using (var db = new MySqlRepositoryBase().BeginTrans())
     {
         foreach (var item in entitys)
         {
             db.Insert(item);
         }
         db.Commit();
     }
 }
コード例 #7
0
ファイル: DbBackupRepository.cs プロジェクト: gongthub/CMS
 public void DeleteForm(string keyValue)
 {
     using (var db = new MySqlRepositoryBase().BeginTrans())
     {
         var dbBackupEntity = db.FindEntity <DbBackupEntity>(keyValue);
         if (dbBackupEntity != null)
         {
             FileHelper.DeleteFile(dbBackupEntity.FilePath);
         }
         db.Delete <DbBackupEntity>(dbBackupEntity);
         db.Commit();
     }
 }
コード例 #8
0
        public void SubmitForm(ContentEntity moduleEntity, string keyValue)
        {
            string strKeyWords = string.Empty;

            if (!iKeyWordsRespository.IsHasKeyWords(moduleEntity.WebSiteId, moduleEntity.Content, out strKeyWords))
            {
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        ContentEntity moduleEntityT = FindEntity(keyValue);
                        if (moduleEntityT != null)
                        {
                            //验证用户站点权限
                            iUserRepository.VerifyUserWebsiteRole(moduleEntityT.WebSiteId);
                            moduleEntity.WebSiteId = moduleEntityT.WebSiteId;
                        }
                        moduleEntity.Modify(keyValue);
                        db.Update(moduleEntity);
                        //添加日志
                        iLogRepository.WriteDbLog(true, "修改内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "内容管理");
                    }
                    else
                    {
                        string        mIds    = moduleEntity.ColumnId;
                        ColumnsEntity cmModel = iColumnsRepository.GetFormNoDel(mIds);
                        if (cmModel.Type == (int)Code.Enums.ModuleType.Content || cmModel.Type == (int)Code.Enums.ModuleType.List || cmModel.Type == (int)Code.Enums.ModuleType.AdvancedList)
                        {
                            if (JudgmentHelp.judgmentHelp.IsNullEntity <ColumnsEntity>(cmModel) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(cmModel.Id))
                            {
                                string urlAddress = @"\" + cmModel.ActionName + @"\" + moduleEntity.Id;
                                moduleEntity.UrlAddress = urlAddress;
                                //SubmitForm(moduleEntity, moduleEntity.Id);
                            }
                        }
                        moduleEntity.Create();
                        db.Insert(moduleEntity);


                        //添加日志
                        iLogRepository.WriteDbLog(true, "添加内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "内容管理");
                    }
                    db.Commit();
                }
            }
            else
            {
                throw new Exception("存在非法关键词,请检查!关键字:" + strKeyWords);
            }
        }
コード例 #9
0
        public void SubmitForm(SysTempletsEntity moduleEntity, string keyValue, UpFileDTO upFileentity)
        {
            if (!IsExist(keyValue, "FullName", moduleEntity.FullName, true))
            {
                if (!IsExist(keyValue, "ShortName", moduleEntity.ShortName, true))
                {
                    using (var db = new MySqlRepositoryBase().BeginTrans())
                    {
                        if (!string.IsNullOrEmpty(keyValue))
                        {
                            moduleEntity.Modify(keyValue);
                            db.Update(moduleEntity);
                            //添加日志
                            iLogRepository.WriteDbLog(true, "修改系统模板信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "系统模板管理");
                        }
                        else
                        {
                            moduleEntity.Create();
                            db.Insert(moduleEntity);
                            //添加日志
                            iLogRepository.WriteDbLog(true, "添加系统模板信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "系统模板管理");
                        }
                        //更新上传文件表
                        UpFileEntity upFileModel = new UpFileEntity();
                        upFileentity.Sys_WebSiteId  = moduleEntity.Id;
                        upFileentity.Sys_ParentId   = keyValue;
                        upFileentity.Sys_ModuleName = EnumHelp.enumHelp.GetDescription(Enums.UpFileModule.WebSites);
                        upFileModel = iUpFileRepository.InitUpFileEntity(upFileentity);

                        upFileModel.Create();
                        db.Insert(upFileModel);
                        db.Commit();
                    }
                }
                else
                {
                    throw new Exception("简称已存在,请重新输入!");
                }
            }
            else
            {
                throw new Exception("名称已存在,请重新输入!");
            }
        }
コード例 #10
0
        public void Down(string keyValue)
        {
            ContentEntity contentEntity = FindEntity(keyValue);

            if (contentEntity != null && !string.IsNullOrEmpty(contentEntity.Id))
            {
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        contentEntity.EnabledMark = false;
                        db.Update(contentEntity);
                        //添加日志
                        iLogRepository.WriteDbLog(true, "移除内容信息=>" + contentEntity.FullName, Enums.DbLogType.Update, "内容管理");
                    }
                    db.Commit();
                }
            }
        }
コード例 #11
0
        public void DeleteForm(string keyValue)
        {
            SysTempletsEntity sysTempletsEntity = FindEntity(keyValue);

            if (sysTempletsEntity != null && !string.IsNullOrEmpty(sysTempletsEntity.Id))
            {
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    db.DeleteById <SysTempletsEntity>(t => t.Id == keyValue);
                    db.DeleteById <SysTempletItemsEntity>(t => t.ParentId == keyValue);
                    db.DeleteById <SysColumnsEntity>(t => t.ParentId == keyValue);
                    MoveResourceForDelDir(sysTempletsEntity.ShortName, sysTempletsEntity.Id);
                    //添加日志
                    iLogRepository.WriteDbLog(true, "删除系统模板信息=>" + keyValue, Enums.DbLogType.Delete, "系统模板管理");

                    db.Commit();
                }
            }
        }
コード例 #12
0
 public void SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
 {
     using (var db = new MySqlRepositoryBase().BeginTrans())
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             db.Update(userEntity);
         }
         else
         {
             userLogOnEntity.Id            = userEntity.Id;
             userLogOnEntity.UserId        = userEntity.Id;
             userLogOnEntity.UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
             userLogOnEntity.UserPassword  = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.UserPassword, 32).ToLower(), userLogOnEntity.UserSecretkey).ToLower(), 32).ToLower();
             db.Insert(userEntity);
             db.Insert(userLogOnEntity);
         }
         db.Commit();
     }
 }
コード例 #13
0
ファイル: WebSiteRepository.cs プロジェクト: gongthub/CMS
        public void DeleteForm(string keyValue)
        {
            WebSiteEntity webSiteEntity = FindEntity(keyValue);

            if (webSiteEntity != null && !string.IsNullOrEmpty(webSiteEntity.Id))
            {
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    db.DeleteById <WebSiteEntity>(t => t.Id == keyValue);
                    db.DeleteById <WebSiteForUrlEntity>(t => t.WebSiteId == keyValue);
                    //移除文件
                    MoveFileForDel(webSiteEntity.ShortName, webSiteEntity.Id);

                    //添加日志
                    iLogRepository.WriteDbLog(true, "删除站点信息=>" + keyValue, Enums.DbLogType.Delete, "站点管理");

                    db.Commit();
                }
            }
        }
コード例 #14
0
        public void SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue, string[] webSiteIds)
        {
            userEntity.Account = userEntity.Account.Trim();
            if (!IsExist(keyValue, "Account", userEntity.Account) && !IsSystemUserName(userEntity.Account))
            {
                iUserWebSiteRepository.DeleteById(m => m.UserId == keyValue);
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        userEntity.Modify(keyValue);
                        db.Update(userEntity);

                        //添加日志
                        iLogRepository.WriteDbLog(true, "修改用户信息=>" + userEntity.Account, Enums.DbLogType.Update, "用户管理");
                    }
                    else
                    {
                        userEntity.Create();
                        userLogOnEntity.Id            = userEntity.Id;
                        userLogOnEntity.UserId        = userEntity.Id;
                        userLogOnEntity.UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
                        userLogOnEntity.UserPassword  = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.UserPassword, 32).ToLower(), userLogOnEntity.UserSecretkey).ToLower(), 32).ToLower();
                        db.Insert(userEntity);
                        db.Insert(userLogOnEntity);

                        //添加日志
                        iLogRepository.WriteDbLog(true, "添加用户信息=>" + userEntity.Account, Enums.DbLogType.Create, "用户管理");
                    }

                    //添加用户站点信息
                    AddUserWebSites(userEntity, webSiteIds, db);
                    db.Commit();
                }
            }
            else
            {
                throw new Exception("用户名已存在,请重新输入!");
            }
        }
コード例 #15
0
ファイル: RoleRepository.cs プロジェクト: gongthub/CMS
 public void SubmitForm(RoleEntity roleEntity, List <RoleAuthorizeEntity> roleAuthorizeEntitys, string keyValue)
 {
     using (var db = new MySqlRepositoryBase().BeginTrans())
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             db.Update(roleEntity);
             //添加日志
             iLogRepository.WriteDbLog(true, "修改角色信息=>" + roleEntity.FullName, Enums.DbLogType.Update, "角色管理");
         }
         else
         {
             roleEntity.Category = 1;
             db.Insert(roleEntity);
             //添加日志
             iLogRepository.WriteDbLog(true, "添加角色信息=>" + roleEntity.FullName, Enums.DbLogType.Create, "角色管理");
         }
         db.Delete <RoleAuthorizeEntity>(t => t.ObjectId == roleEntity.Id);
         db.Insert(roleAuthorizeEntitys);
         db.Commit();
     }
 }
コード例 #16
0
ファイル: WebSiteRepository.cs プロジェクト: gongthub/CMS
        private void VerifyUrlAddres(string webSiteId, List <WebSiteForUrlEntity> webSiteForUrlEntitys, string urlAddress)
        {
            List <WebSiteForUrlEntity> webSiteForUrlEntities = new List <WebSiteForUrlEntity>();
            List <string> urlAddresslst = new List <string>();

            urlAddresslst.Add(urlAddress);
            if (webSiteForUrlEntitys != null && webSiteForUrlEntitys.Count > 0)
            {
                urlAddresslst.AddRange(webSiteForUrlEntitys.Select(m => m.UrlAddress).ToList());
            }
            using (var db = new MySqlRepositoryBase().BeginTrans())
            {
                if (!string.IsNullOrWhiteSpace(webSiteId))
                {
                    webSiteForUrlEntities = db.IQueryable <WebSiteForUrlEntity>(m => m.WebSiteId != webSiteId &&
                                                                                m.DeleteMark != true &&
                                                                                urlAddresslst.Contains(m.UrlAddress)).ToList();
                }
                else
                {
                    webSiteForUrlEntities = db.IQueryable <WebSiteForUrlEntity>(m => m.DeleteMark != true &&
                                                                                urlAddresslst.Contains(m.UrlAddress)).ToList();
                }
            }
            urlAddresslst = webSiteForUrlEntities?.Where(m => m.UrlAddress != "").Select(m => m.UrlAddress).Distinct().ToList();
            if (urlAddresslst != null && urlAddresslst.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("域名:");
                foreach (var item in urlAddresslst)
                {
                    stringBuilder.Append(item + ";");
                }
                stringBuilder.Append("已存在!");
                string strmsg = stringBuilder.ToString();
                throw new Exception(strmsg);
            }
        }
コード例 #17
0
ファイル: WebSiteRepository.cs プロジェクト: gongthub/CMS
        public void SubmitForm(WebSiteEntity moduleEntity, List <WebSiteForUrlEntity> webSiteForUrlEntitys, string keyValue, UpFileDTO upFileentity)
        {
            VerifyUrlAddres(keyValue, webSiteForUrlEntitys, moduleEntity.UrlAddress);
            if (string.IsNullOrEmpty(moduleEntity.SysTempletId))
            {
                moduleEntity.SysTempletId = null;
            }
            moduleEntity.UrlAddress = moduleEntity.UrlAddress.Trim();
            moduleEntity.Id         = keyValue;
            if (!IsExist(keyValue, "ShortName", moduleEntity.ShortName, true))
            {
                InitSpareUrl(ref moduleEntity);
                WebSiteEntity moduleEntityOld = FindEntity(keyValue);
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        //验证用户站点权限
                        iUserRepository.VerifyUserWebsiteRole(keyValue);
                        if (moduleEntityOld != null && !string.IsNullOrEmpty(moduleEntityOld.Id))
                        {
                            moduleEntity.ShortName = moduleEntityOld.ShortName;
                        }
                        moduleEntity.Modify(keyValue);
                        db.Update(moduleEntity);
                        //添加日志
                        iLogRepository.WriteDbLog(true, "修改站点信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "站点管理");
                    }
                    else
                    {
                        int iWebSiteNum = 0;
                        if (IsOverNum(out iWebSiteNum))
                        {
                            moduleEntity.Create();
                            db.Insert(moduleEntity);
                            keyValue = moduleEntity.Id;

                            var LoginInfo = SysLoginObjHelp.sysLoginObjHelp.GetOperator();
                            if (LoginInfo != null)
                            {
                                if (!string.IsNullOrEmpty(moduleEntity.Id))
                                {
                                    UserWebSiteEntity entity = new UserWebSiteEntity();
                                    entity.Create();
                                    entity.UserId      = LoginInfo.UserId;
                                    entity.WebSiteId   = moduleEntity.Id;
                                    entity.EnabledMark = true;
                                    db.Insert(entity);
                                }
                            }
                            //添加配置表
                            AddWebSiteConfig(moduleEntity, db);
                            List <TempletEntity> TempletModels = new List <TempletEntity>();
                            //添加站点模板
                            CreateTemplet(moduleEntity, db, out TempletModels);
                            //添加站点搜索模板
                            AddSearchModel(moduleEntity, db);
                            //添加站点移动端搜索模板
                            AddMSearchModel(moduleEntity, db);
                            //添加站点栏目
                            AddColumns(moduleEntity, db, TempletModels);
                            //添加日志
                            iLogRepository.WriteDbLog(true, "添加站点信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "站点管理");
                        }
                        else
                        {
                            throw new Exception("当前用户最多可添加" + iWebSiteNum + "个站点,如需添加更多站点,请联系管理员!");
                        }
                    }
                    //更新上传文件表
                    AddUppFile(moduleEntity, keyValue, upFileentity, db);
                    //保存备用域名
                    SaveWebSiteForUrl(moduleEntity, webSiteForUrlEntitys, keyValue, db);

                    db.Commit();
                }
            }
            else
            {
                throw new Exception("简称已存在,请重新输入!");
            }
        }
コード例 #18
0
ファイル: AccountController.cs プロジェクト: Epstone/mypvlog
        private static MySqlAccountHelperRepository GetAccountHelperRepository()
        {
            var connStr = ConfigurationManager.ConnectionStrings["pv_data"].ConnectionString;
              MySqlRepositoryBase mySqlLayer = new MySqlRepositoryBase();
              mySqlLayer.Initialize(connStr, connStr);

              var repository = MySqlAccountHelperRepository.Create(mySqlLayer, 2);
              return repository;
        }
コード例 #19
0
ファイル: ColumnsRepository.cs プロジェクト: gongthub/CMS
        public void SubmitForm(ColumnsEntity moduleEntity, string keyValue)
        {
            if (!IsExist(keyValue, "ActionName", moduleEntity.ActionName, moduleEntity.WebSiteId, true))
            {
                if (!Common.IsSystemHaveName(moduleEntity.ActionName) && !Common.IsSearch(moduleEntity.ActionName))
                {
                    using (var db = new MySqlRepositoryBase().BeginTrans())
                    {
                        if (!string.IsNullOrEmpty(keyValue))
                        {
                            ColumnsEntity moduleEntityT = FindEntity(keyValue);
                            if (moduleEntityT != null)
                            {
                                //验证用户站点权限
                                iUserRepository.VerifyUserWebsiteRole(moduleEntityT.WebSiteId);
                                moduleEntity.WebSiteId = moduleEntityT.WebSiteId;
                            }

                            moduleEntity.Modify(keyValue);
                            if (moduleEntity.MainMark == true)
                            {
                                List <ColumnsEntity> models = IQueryable().Where(m => m.DeleteMark != true && m.Id != moduleEntity.Id && m.WebSiteId == moduleEntity.WebSiteId).ToList();
                                if (models != null && models.Count > 0)
                                {
                                    models.ForEach(delegate(ColumnsEntity model)
                                    {
                                        model.MainMark = false;
                                        db.Update(model);
                                    });
                                }
                            }

                            db.Update(moduleEntity);
                            //添加日志
                            iLogRepository.WriteDbLog(true, "修改栏目信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "栏目管理");
                        }
                        else
                        {
                            moduleEntity.Create();

                            if (moduleEntity.MainMark == true)
                            {
                                List <ColumnsEntity> models = IQueryable().Where(m => m.DeleteMark != true && m.Id != moduleEntity.Id && m.WebSiteId == moduleEntity.WebSiteId).ToList();
                                if (models != null && models.Count > 0)
                                {
                                    models.ForEach(delegate(ColumnsEntity model)
                                    {
                                        model.MainMark = false;
                                        db.Update(model);
                                    });
                                }
                            }
                            db.Insert(moduleEntity);
                            //添加日志
                            iLogRepository.WriteDbLog(true, "添加栏目信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "栏目管理");
                        }
                        db.Commit();
                    }
                }
                else
                {
                    throw new Exception("简称已存在,请重新输入!");
                }
            }
            else
            {
                throw new Exception("简称不能为系统保留名称,请重新输入!");
            }
        }
コード例 #20
0
        public void SubmitForm(ContentEntity moduleEntity, string keyValue, List <UpFileDTO> upFileentitys)
        {
            string strKeyWords = string.Empty;

            if (!iKeyWordsRespository.IsHasKeyWords(moduleEntity.WebSiteId, moduleEntity.Content, out strKeyWords))
            {
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        ContentEntity moduleEntityT = FindEntity(keyValue);
                        if (moduleEntityT != null)
                        {
                            //验证用户站点权限
                            iUserRepository.VerifyUserWebsiteRole(moduleEntityT.WebSiteId);
                            moduleEntity.WebSiteId = moduleEntityT.WebSiteId;
                        }
                        moduleEntity.Modify(keyValue);
                        db.Update(moduleEntity);
                        //添加日志
                        iLogRepository.WriteDbLog(true, "修改内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "内容管理");
                    }
                    else
                    {
                        string        mIds    = moduleEntity.ColumnId;
                        ColumnsEntity cmModel = iColumnsRepository.GetFormNoDel(mIds);
                        if (cmModel.Type == (int)Code.Enums.ModuleType.Content || cmModel.Type == (int)Code.Enums.ModuleType.List || cmModel.Type == (int)Code.Enums.ModuleType.AdvancedList)
                        {
                            if (JudgmentHelp.judgmentHelp.IsNullEntity <ColumnsEntity>(cmModel) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(cmModel.Id))
                            {
                                string urlAddress = @"\" + cmModel.ActionName + @"\" + moduleEntity.Id;
                                moduleEntity.UrlAddress = urlAddress;
                                //SubmitForm(moduleEntity, moduleEntity.Id);
                            }
                        }
                        moduleEntity.Create();
                        db.Insert(moduleEntity);

                        //添加日志
                        iLogRepository.WriteDbLog(true, "添加内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "内容管理");
                    }
                    if (upFileentitys != null && upFileentitys.Count > 0)
                    {
                        upFileentitys = upFileentitys.FindAll(m => m != null);
                        foreach (UpFileDTO upFileentity in upFileentitys)
                        {
                            if (upFileentity != null)
                            {
                                //更新上传文件表
                                upFileentity.Sys_WebSiteId  = moduleEntity.WebSiteId;
                                upFileentity.Sys_ParentId   = keyValue;
                                upFileentity.Sys_ModuleName = EnumHelp.enumHelp.GetDescription(Enums.UpFileModule.Contents);
                                UpFileEntity upFileEntity = iUpFileRepository.InitUpFileEntity(upFileentity);

                                upFileEntity.Create();
                                db.Insert(upFileEntity);
                            }
                        }
                    }
                    db.Commit();
                }
            }
            else
            {
                throw new Exception("存在非法关键词,请检查!关键字:" + strKeyWords);
            }
        }
コード例 #21
0
ファイル: WebSiteRepository.cs プロジェクト: gongthub/CMS
        public void SubmitForm(WebSiteEntity moduleEntity, string keyValue)
        {
            moduleEntity.UrlAddress = moduleEntity.UrlAddress.Trim();
            if (!iWebSiteForUrlRepository.IsExistUrl(moduleEntity, moduleEntity.UrlAddress))
            {
                InitSpareUrl(ref moduleEntity);
                using (var db = new MySqlRepositoryBase().BeginTrans())
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        //验证用户站点权限
                        iUserRepository.VerifyUserWebsiteRole(keyValue);
                        moduleEntity.Modify(keyValue);
                        db.Update(moduleEntity);
                        //添加日志
                        iLogRepository.WriteDbLog(true, "修改站点信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "站点管理");
                    }
                    else
                    {
                        int iWebSiteNum = 0;
                        if (IsOverNum(out iWebSiteNum))
                        {
                            moduleEntity.Create();
                            db.Insert(moduleEntity);

                            var LoginInfo = SysLoginObjHelp.sysLoginObjHelp.GetOperator();
                            if (LoginInfo != null)
                            {
                                if (!string.IsNullOrEmpty(moduleEntity.Id))
                                {
                                    UserWebSiteEntity entity = new UserWebSiteEntity();
                                    entity.Create();
                                    entity.UserId      = LoginInfo.UserId;
                                    entity.WebSiteId   = moduleEntity.Id;
                                    entity.EnabledMark = true;
                                    db.Insert(entity);
                                }
                            }
                            //添加配置表
                            AddWebSiteConfig(moduleEntity, db);
                            //添加站点模板
                            List <TempletEntity> TempletModels = new List <TempletEntity>();
                            CreateTemplet(moduleEntity, db, out TempletModels);
                            //添加站点搜索模板
                            AddSearchModel(moduleEntity, db);
                            //添加站点移动端搜索模板
                            AddMSearchModel(moduleEntity, db);
                            //添加站点栏目
                            AddColumns(moduleEntity, db, TempletModels);

                            //添加日志
                            iLogRepository.WriteDbLog(true, "添加站点信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "站点管理");
                        }
                        else
                        {
                            throw new Exception("当前用户最多可添加" + iWebSiteNum + "个站点,如需添加更多站点,请联系管理员!");
                        }
                    }
                    db.Commit();
                }
            }
            else
            {
                throw new Exception("域名已存在,请重新输入!");
            }
        }
コード例 #22
0
ファイル: ReminderDatabase.cs プロジェクト: Epstone/remindii
        public void Initialize(string connectionString, LogUtility logger)
        {
            _logger = logger;

              _db = new MySqlRepositoryBase();
              this._db.Initialize( connectionString, connectionString );
        }