示例#1
0
 public void SubmitForm(SysTempletItemsEntity moduleEntity, string keyValue)
 {
     if (moduleEntity.FullName.ToLower() != ConfigHelp.configHelp.WEBSITESEARCHPATH.ToLower())
     {
         if (!service.IsExist(keyValue, "FullName", moduleEntity.FullName, true))
         {
             if (!string.IsNullOrEmpty(keyValue))
             {
                 moduleEntity.Modify(keyValue);
                 service.Update(moduleEntity);
                 //添加日志
                 LogHelp.logHelp.WriteDbLog(true, "修改模板信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "模板管理");
             }
             else
             {
                 moduleEntity.Create();
                 service.Insert(moduleEntity);
                 //添加日志
                 LogHelp.logHelp.WriteDbLog(true, "添加模板信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "模板管理");
             }
         }
         else
         {
             throw new Exception("名称已存在,请重新输入!");
         }
     }
     else
     {
         throw new Exception("名称不能为系统保留名称,请重新输入!");
     }
 }
 //[ValidateAntiForgeryToken]
 public ActionResult SubmitForm(SysTempletItemsEntity sysTempletItemsEntity, string keyValue)
 {
     sysTempletsApp.SubmitItemForm(sysTempletItemsEntity, keyValue);
     return(Success("操作成功。"));
 }
示例#3
0
        public void SubmitItemForm(SysTempletItemsEntity moduleEntity, string keyValue)
        {
            SysTempletItemsApp sysTempletItemsApp = new SysTempletItemsApp();

            sysTempletItemsApp.SubmitForm(moduleEntity, keyValue);
        }
示例#4
0
        /// <summary>
        /// 添加站点栏目
        /// </summary>
        /// <param name="moduleEntity"></param>
        /// <param name="db"></param>
        private void AddColumns(WebSiteEntity moduleEntity, IRepositoryBase db, List <TempletEntity> TempletModels)
        {
            List <ColumnsEntity> cmodels = new List <ColumnsEntity>();

            if (!string.IsNullOrEmpty(moduleEntity.Id))
            {
                List <SysColumnsEntity> models = iSysTempletsRepository.GetListBySysTempletId(moduleEntity.SysTempletId);

                List <TempletEntity> tempModels = GetListByWebSiteId(moduleEntity.Id);
                if (TempletModels != null && TempletModels.Count > 0)
                {
                    tempModels.AddRange(TempletModels);
                }
                List <SysTempletItemsEntity> systempsModels = iSysTempletsRepository.GetItemList(moduleEntity.SysTempletId);

                if (models != null && models.Count > 0)
                {
                    foreach (SysColumnsEntity model in models)
                    {
                        string strNewIds = Guid.NewGuid().ToString();
                        models.ForEach(delegate(SysColumnsEntity m)
                        {
                            if (m.ParentId == model.Id)
                            {
                                m.ParentId = strNewIds;
                            }
                            if (systempsModels != null && systempsModels.Count > 0 &&
                                tempModels != null && tempModels.Count > 0)
                            {
                                SysTempletItemsEntity systempsModelT   = systempsModels.Find(t => t.Id == m.TempletId);
                                SysTempletItemsEntity systempsModelCT  = systempsModels.Find(t => t.Id == m.CTempletId);
                                SysTempletItemsEntity systempsModelMT  = systempsModels.Find(t => t.Id == m.MTempletId);
                                SysTempletItemsEntity systempsModelMCT = systempsModels.Find(t => t.Id == m.MCTempletId);
                                if (systempsModelT != null && !string.IsNullOrEmpty(systempsModelT.Id))
                                {
                                    TempletEntity tempModelT = tempModels.Find(t => t.FullName == systempsModelT.FullName);
                                    if (tempModelT != null && !string.IsNullOrEmpty(tempModelT.Id))
                                    {
                                        m.TempletId = tempModelT.Id;
                                    }
                                }
                                if (systempsModelCT != null && !string.IsNullOrEmpty(systempsModelCT.Id))
                                {
                                    TempletEntity tempModelCT = tempModels.Find(t => t.FullName == systempsModelCT.FullName);
                                    if (tempModelCT != null && !string.IsNullOrEmpty(tempModelCT.Id))
                                    {
                                        m.CTempletId = tempModelCT.Id;
                                    }
                                }
                                if (systempsModelMT != null && !string.IsNullOrEmpty(systempsModelMT.Id))
                                {
                                    TempletEntity tempModelMT = tempModels.Find(t => t.FullName == systempsModelMT.FullName);
                                    if (tempModelMT != null && !string.IsNullOrEmpty(tempModelMT.Id))
                                    {
                                        m.MTempletId = tempModelMT.Id;
                                    }
                                }
                                if (systempsModelMCT != null && !string.IsNullOrEmpty(systempsModelMCT.Id))
                                {
                                    TempletEntity tempModelMCT = tempModels.Find(t => t.FullName == systempsModelMCT.FullName);
                                    if (tempModelMCT != null && !string.IsNullOrEmpty(tempModelMCT.Id))
                                    {
                                        m.MCTempletId = tempModelMCT.Id;
                                    }
                                }
                            }
                        });
                        model.Id = strNewIds;
                    }
                    cmodels = InitColumnsEntity(moduleEntity.Id, cmodels, models);
                    if (cmodels != null && cmodels.Count > 0)
                    {
                        foreach (var cmodelT in cmodels)
                        {
                            cmodelT.Create();
                            db.Insert(cmodelT);
                        }
                    }
                }
            }
        }