public override int Save() { //初始化 if (this.Id <= 0) { int sortNum = this._archiveRep.GetMaxSortNumber(this.Category.Site.Id); if (this.SortNumber == 0) { this.SortNumber = sortNum + 1; } } this.Id = this._archiveRep.SaveArchive(this); this._extendRep.UpdateArchiveRelationExtendValues(this); //保存文档绑定的模板 if (this._templateBind != null) { if (this._templateBind.BindRefrenceId == this.Id) { this._templateRep.SaveTemplateBind(this._templateBind, this.Id); if (this._templateBind.TplPath == null) { this._templateBind = null; } } } //保存其他 base.Save(); return(this.Id); }
public void UpdateTemplateBind(string templatePath) { bool templateIsNull = String.IsNullOrEmpty(templatePath); if (this.Template != null) { //处理自身的模板 if (this.Template.BindRefrenceId == this.Id) { if (templateIsNull) { this.Template.TplPath = null; } else { this.Template.TplPath = templatePath; } return; } } //为文档新建模板绑定 if (!templateIsNull) { this.Template = this._templateRep.CreateTemplateBind( -1, TemplateBindType.ArchiveTemplate, templatePath); this.Template.BindRefrenceId = this.Id; } }
public IEnumerable <ITemplateBind> GetTemplateBindsForCategory(ICategory category) { //ITemplateBind bind; //bind = this.GetBind(TemplateBindType.CategoryTemplate, category.ID); //如果栏目不存在绑定,则查找模块的绑定 //if (false || bind == null) //{ // int moduleID = cbll.Get(a => a.ID == categoryID).ModuleID; // bind = GetBind(TemplateBindType.ModuleCategoryTemplate, moduleID.ToString()); //} ITemplateBind bind = this.GetBind(TemplateBindType.CategoryTemplate, category.Id); if (bind != null) { yield return(bind); } bind = this.GetBind(TemplateBindType.CategoryArchiveTemplate, category.Id); if (bind != null) { yield return(bind); } /* * * IDictionary<TemplateBindType, ITemplateBind> templates = new Dictionary<TemplateBindType, ITemplateBind>(); * if (bind != null) * { * templates.Add(TemplateBindType.CategoryTemplate, bind); * } * * if (bindArchive != null) * { * templates.Add(TemplateBindType.CategoryArchiveTemplate, bindArchive); * } * return templates; */ }
public override int Save() { this.Id = this._archiveRep.SaveArchive(this); this._extendRep.UpdateArchiveRelationExtendValues(this); //保存文档绑定的模板 if (this._templateBind != null) { if (this._templateBind.BindRefrenceId == this.Id) { this._templateRep.SaveTemplateBind(this._templateBind, this.Id); if (this._templateBind.TplPath == null) { this._templateBind = null; } } } //保存其他 base.Save(); return(this.Id); }
public int SaveCategory(int siteId, int parentLft, CategoryDto category) { ISite site = this._resp.GetSiteById(siteId); ICategory ic = site.GetCategoryByLft(category.Lft); if (ic == null) { ic = _categoryRep.CreateCategory(-1, site); } //ic.CloneData(category); ic.Id = category.Id; ic.Keywords = category.Keywords; ic.Description = category.Description; ic.Tag = category.Tag; ic.Icon = category.Icon; ic.Name = category.Name; ic.PageTitle = category.PageTitle; ic.OrderIndex = category.OrderIndex; ic.ModuleId = category.ModuleId; ic.Location = category.Location; bool isExistCategoryBind = false; bool isExistArchiveBind = false; #region 模板绑定 foreach (ITemplateBind tempBind in ic.Templates) { if (tempBind.BindType == TemplateBindType.CategoryTemplate) { isExistCategoryBind = true; tempBind.TplPath = category.CategoryTemplate; } else if (tempBind.BindType == TemplateBindType.CategoryArchiveTemplate) { isExistArchiveBind = true; tempBind.TplPath = category.CategoryArchiveTemplate; } } //栏目模板 if (!isExistCategoryBind && !String.IsNullOrEmpty(category.CategoryTemplate)) { ITemplateBind bind = this._tempRep.CreateTemplateBind(-1, TemplateBindType.CategoryTemplate, category.CategoryTemplate); bind.BindRefrenceId = ic.Id; ic.Templates.Add(bind); } //栏目文档模板 if (!isExistArchiveBind && !String.IsNullOrEmpty(category.CategoryArchiveTemplate)) { ITemplateBind bind = this._tempRep.CreateTemplateBind(-1, TemplateBindType.CategoryArchiveTemplate, category.CategoryArchiveTemplate); bind.BindRefrenceId = ic.Id; ic.Templates.Add(bind); } #endregion #region 扩展属性 if (category.ExtendFields != null) { ic.ExtendFields = category.ExtendFields; } #endregion if (parentLft >= 0) { ic.Parent = site.GetCategoryByLft(parentLft); } return(ic.Save()); }
public override int Save() { //初始化 if (this.Id<=0) { int sortNum = this._archiveRep.GetMaxSortNumber(this.Category.Site.Id); if (this.SortNumber == 0) { this.SortNumber = sortNum + 1; } } this.Id = this._archiveRep.SaveArchive(this); this._extendRep.UpdateArchiveRelationExtendValues(this); //保存文档绑定的模板 if (this._templateBind != null) { if (this._templateBind.BindRefrenceId == this.Id) { this._templateRep.SaveTemplateBind(this._templateBind, this.Id); if (this._templateBind.TplPath == null) { this._templateBind = null; } } } //保存其他 base.Save(); return this.Id; }
public void UpdateTemplateBind(string templatePath) { bool templateIsNull = String.IsNullOrEmpty(templatePath); if (this.Template != null) { //处理自身的模板 if (this.Template.BindRefrenceId == this.Id) { if (templateIsNull) { this.Template.TplPath = null; } else { this.Template.TplPath = templatePath; } return; } } //为文档新建模板绑定 if (!templateIsNull) { this.Template = this._templateRep.CreateTemplateBind( -1, TemplateBindType.ArchiveTemplate, templatePath); this.Template.BindRefrenceId = this.Id; } }
public int SaveTemplateBind(ITemplateBind templateBind,int bindRefrenceId) { tpldal.SetBind(templateBind.BindType, bindRefrenceId, templateBind.TplPath); RepositoryDataCache.ClearTemplateBinds(); return templateBind.Id; }
public int SaveTemplateBind(ITemplateBind templateBind, int bindRefrenceId) { tpldal.SetBind(templateBind.BindType, bindRefrenceId, templateBind.TplPath); RepositoryDataCache.ClearTemplateBinds(); return(templateBind.Id); }
public void Show(PItem2[] rReward, bool canGoto = true, bool skipAnim = false) { if (rReward == null || rReward.Length == 0) { return; } if (showQueue == null) { showQueue = new Queue <PItem2>(); } else { showQueue.Clear(); } gameObject.SetActive(true); Content.SafeSetActive(false); enabled = true; if (binder == null) { binder = new NormalTemplateBind(); } Util.ClearChildren(Content); for (var i = 0; i < rReward.Length; i++) { var item = rReward[i]; var t = Content.AddNewChild(Template); t.name = i.ToString(); t.SafeSetActive(true); showQueue.Enqueue(item); binder?.Bind(t, item); itemTweenQueue.Enqueue(t.GetComponent <TweenFillAmount>("card")); t.GetComponent <Transform>("card").SafeSetActive(true); items.Add(t?.gameObject); t?.GetComponent <Button>()?.onClick.AddListener(() => { if (!enabled) { Module_Global.instance.UpdateGlobalTip(item, false); } }); foreach (var tupe in handler) { var b = tupe.Item1(item); t.GetComponent <Transform>("eff_putong").SafeSetActive(!b); t.GetComponent <Transform>("eff_jipin").SafeSetActive(b); if (b) { break; } } } EffectNode.SafeSetActive(!skipAnim); SkipEffectAnimationButton.SafeSetActive(!skipAnim); if (!skipAnim) { timer = EffAnimLength; } }
public void SetBinder(ITemplateBind rBinder) { binder = rBinder; }
public override int Save() { this.ID = this._archiveRep.SaveArchive(this); this._extendRep.UpdateArchiveRelationExtendValues(this); //保存文档绑定的模板 if (this._templateBind != null) { if (this._templateBind.BindRefrenceId == this.ID) { this._templateRep.SaveTemplateBind(this._templateBind, this.ID); if (this._templateBind.TplPath == null) { this._templateBind = null; } } } //保存其他 base.Save(); return this.ID; }