private PageEdit GetPageEdit(string page) { PageEdit result = null; ExecQuery((query) => { query.Execute(@"Page\[get]", new SqlParameter[] { new SqlParameter() { ParameterName = "@Page", Value = page } } , onExecute: null , (values) => { result = new PageEdit() { Id = (int)values[0], Page = (string)values[1], ContentEn = string.Empty, ContentRu = string.Empty }; }); }); return(result); }
private IList <PageZone> CreateMaster(string oldTemplate, string template, string fileName) { template = ChangeHead(template); template = AddForm(template); IList <object> oldFragments = SplitPageTemplate(oldTemplate); IList <object> fragments = SplitPageTemplate(template); IList <PageZone> oldZoneList = new List <PageZone>(); for (int i = 0; i < oldFragments.Count; i++) { if (oldFragments[i] is PageZone) { PageZone oldZone = oldFragments[i] as PageZone; oldZoneList.Add(oldZone); } } IList <PageZone> zoneList = new List <PageZone>(); StringBuilder master = new StringBuilder(); master.Append(MASTERHEADER); for (int i = 0; i < fragments.Count; i++) { if (fragments[i] is PageZone) { PageZone zone = fragments[i] as PageZone; master.AppendFormat(PLACEHOLDER, zone.Name); zoneList.Add(zone); } else if (fragments[i] is PageEdit) { PageEdit edit = fragments[i] as PageEdit; master.AppendFormat(PAGEEDIT, edit.Name); } else if (fragments[i] is PageCatalog) { // do nothing } else { master.Append((string)fragments[i]); } } _isZoneChange = ZoneChanged(oldZoneList, zoneList); // MasterPages will be generated next to PageTemplates with appropriate extension and content type. // SaveMasterPage(string.Concat(fileName, MASTER), Repository.PageTemplatesFolderPath, master.ToString()); var parentPath = RepositoryPath.GetParentPath(this.PageTemplateNode.Path); SaveMasterPage(string.Concat(fileName, MASTER), parentPath, master.ToString()); return(zoneList); }
public async Task <HttpMessage <bool> > PageEditPost(PageEdit page) => await TryCatchResponseAsync(async() => { return(await Task.Run(() => { SetEditContent(@"Page\[get_content]", @"Page\[set_content]", @"Page\[del_content]", page); return CreateResponseOk(true); })); });
public async Task <HttpMessage <PageEdit> > EditPage(string page) => await TryCatchResponseAsync(async() => { return(await Task.Run(() => { PageEdit result = GetPageEdit(page); //if(result == null) result = GetEditContent(this, @"Page\[get_content]", result); return CreateResponseOk(result); })); });
private GameObject GenerateEdit(PageEdit data) { GameObject newEdit = (GameObject)Instantiate(editTemplate); newEdit.transform.parent = this.transform; //Randomish Position newEdit.transform.position = new Vector3(this.transform.position.x + Random.Range(0, 10), this.transform.position.y + Random.Range(0, 7), this.transform.position.z + Random.Range(0, 10)); newEdit.GetComponent <StoreEdit> ().data = data; return(newEdit); }
public async Task <HttpMessage <Page> > Page(string lang, string page) => await TryCatchResponseAsync(async() => { return(await Task.Run(() => { PageEdit pageEdit = GetPageEdit(page); pageEdit = GetEditContent(this, @"Page\[get_content]", pageEdit); Page result = new Page() { Content = lang == "ru" ? pageEdit.ContentRu : pageEdit.ContentEn }; return CreateResponseOk(result); })); });
public async Task <IPageEdit> CreateEditAsync(IPage page, string userId, CancellationToken cancellationToken = default) { var content = await pageRepository.GetContentAsync(page.Id); var editId = Guid.NewGuid(); var edit = new PageEdit { Id = editId, CreatedDate = DateTime.UtcNow, PageId = page.Id, UserId = userId, Content = content }; var uniqueId = GetId(page, userId); edits.Add(uniqueId, edit); ids.Add(editId, uniqueId); return(edit); }