コード例 #1
0
        public string getStationery(int page, int amount, string categoryId)
        {
            page pageObject = new page(page, amount);

            JArray           jsonArray     = new JArray();
            JObject          finalJson     = new JObject();
            List <Inventory> inventoryList = new List <Inventory>();

            if (categoryId.Equals("0"))
            {
                inventoryList = inventoryDAO.getAllInventory(pageObject);
                foreach (Inventory i in inventoryList)
                {
                    jsonArray.Add(i.toJson());
                }
            }
            else
            {
                inventoryList = inventoryDAO.getInventoryByCategory(categoryId, pageObject);
                foreach (Inventory i in inventoryList)
                {
                    jsonArray.Add(i.toJson());
                }
            }
            finalJson.Add("itemList", jsonArray);
            finalJson.Add("count", pageObject.getTotalNumber());
            return(finalJson.ToString());
        }
コード例 #2
0
        public static async Task <page> getAuthPubsAuthenticus(string authID)
        {
            HttpClient client = new HttpClient();

            // authID needs to be validated at some point
            client.BaseAddress = new Uri("https://www.authenticus.pt/api/v2.0/researchers/" + authID + "/");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "gnrqOxEs7Aa5o6K47P6xmEQEs5URIC6avQ0N");

            HttpResponseMessage queryResult = client.GetAsync("publications").Result;

            if (!queryResult.IsSuccessStatusCode)
            {
                Console.WriteLine(queryResult.StatusCode);
                return(null);
            }
            else
            {
                string resultXml = await queryResult.Content.ReadAsStringAsync();

                page resultObject = DeserializeXML <page>(resultXml);

                return(resultObject);
            }
        }
コード例 #3
0
        public void changePage(page page)
        {
            try
            {
                if (!Dispatcher.CheckAccess())
                {
                    Dispatcher.Invoke(new Action <page>(changePage), new object[] { page });
                    return;
                }
                pgDataGrid.Focus();
                switch (page)
                {
                case page.logOn:
                    pgDataGrid.txtPassword.Focus();
                    break;

                case page.AddFiles:
                    //frame.Navigate(addfile); frameState = page.AddFiles;
                    break;

                case page.Main:
                    pgDataGrid.dataGrid.Focus();
                    break;

                default: break;
                }

                frameState = page;
                disableMenuItems();
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #4
0
        public ActionResult FacebookCallback3(fbuser user)
        {
            var pg = new page();

            pg = fuserG.pagelist[0];
            return(View(fuserG.pagelist));
        }
コード例 #5
0
        private void loadPaper(int pageNum)
        {
            this.panelInnerScreen.Controls.Clear();
            page p = currentNews.LPages[pageNum];

            for (int i = 0; i < p.LObjects.Count; i++)
            {
                switch (p.LObjects[i].Type)
                {
                case "Image":
                    addImage(p.LObjects[i].Xlocation, p.LObjects[i].Ylocation,
                             p.LObjects[i].Width, p.LObjects[i].Height, p.LObjects[i].LUris, 1);
                    break;

                case "SequenceImages":
                    addImage(p.LObjects[i].Xlocation, p.LObjects[i].Ylocation,
                             p.LObjects[i].Width, p.LObjects[i].Height, p.LObjects[i].LUris, 0);
                    break;

                case "Video":
                    addImage(p.LObjects[i].Xlocation, p.LObjects[i].Ylocation,
                             p.LObjects[i].Width, p.LObjects[i].Height, p.LObjects[i].LUris, 2);
                    break;
                }
            }
        }
コード例 #6
0
        public async Task <T> dialog <T>(page <T> page)
        {
            dialog_page = page;
            set(page);
            TaskCompletionSource <T> rt = new TaskCompletionSource <T>();

            page.reply = rt.SetResult;
            main_page.z_ui.IsEnabled = false;
            Border border = new Border()
            {
                Background = color, CornerRadius = new CornerRadius(2), DataContext = page
            };

            api_ui.stage.Children.Add(border);
            border.Child = page.z_ui;
            page.start(this);
            page.focus();
            var dv = await rt.Task;

            dialog_page = null;
            api_ui.stage.Children.Remove(border);
            main_page.z_ui.IsEnabled = true;
            z_focus();
            return(dv);
        }
コード例 #7
0
ファイル: ItemRenderer.cs プロジェクト: KerwinMa/Umbraco
        /// <summary>
        /// Renders the field contents.
        /// Checks via the NodeId attribute whether to fetch data from another page than the current one.
        /// </summary>
        /// <returns>A string of field contents (macros not parsed)</returns>
        protected virtual string GetFieldContents(Item item)
        {
            var tempElementContent = string.Empty;

            // if a nodeId is specified we should get the data from another page than the current one
            if (string.IsNullOrEmpty(item.NodeId) == false)
            {
                var tempNodeId = item.GetParsedNodeId();
                if (tempNodeId != null && tempNodeId.Value != 0)
                {
                    //moved the following from the catch block up as this will allow fallback options alt text etc to work
                    var cache = Umbraco.Web.UmbracoContext.Current.ContentCache.InnerCache as PublishedContentCache;
                    if (cache == null)
                    {
                        throw new InvalidOperationException("Unsupported IPublishedContentCache, only the Xml one is supported.");
                    }
                    var xml      = cache.GetXml(Umbraco.Web.UmbracoContext.Current, Umbraco.Web.UmbracoContext.Current.InPreviewMode);
                    var itemPage = new page(xml.GetElementById(tempNodeId.ToString()));
                    tempElementContent =
                        new item(item.ContentItem, itemPage.Elements, item.LegacyAttributes).FieldContent;
                }
            }
            else
            {
                // gets the field content from the current page (via the PageElements collection)
                tempElementContent =
                    new item(item.ContentItem, item.PageElements, item.LegacyAttributes).FieldContent;
            }

            return(tempElementContent);
        }
コード例 #8
0
        public ActionResult Create(PageCreateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var pageExists = db.pages.Where(x => x.PageName == viewModel.Page.Trim());
                if (pageExists.Count() > 0)
                {
                    ModelState.AddModelError("", "Page already exists.");
                }
                else
                {
                    var model = new page();
                    model.PageName    = viewModel.Page.Trim();
                    model.PageUrl     = viewModel.Page.Trim().ToLower().Replace(' ', '-');
                    model.IsPublished = viewModel.IsPublished == "A";
                    model.CreatedBy   = User.Identity.Name;
                    model.CreatedDate = DateTime.Now;

                    db.pages.Add(model);
                    db.SaveChanges();

                    return(RedirectToAction("index"));
                }
            }

            return(View(viewModel));
        }
コード例 #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int  macroID     = cms.businesslogic.macro.Macro.GetByAlias(helper.Request("umb_macroAlias")).Id;
            int  pageID      = int.Parse(helper.Request("umbPageId"));
            Guid pageVersion = new Guid(helper.Request("umbVersionId"));

            System.Web.HttpContext.Current.Items["macrosAdded"] = 0;
            System.Web.HttpContext.Current.Items["pageID"]      = pageID.ToString();

            // Collect attributes
            Hashtable attributes = new Hashtable();

            foreach (string key in Request.QueryString.AllKeys)
            {
                if (key.IndexOf("umb_") > -1)
                {
                    attributes.Add(key.Substring(4, key.Length - 4), Request.QueryString[key]);
                }
            }


            page  p = new page(pageID, pageVersion);
            macro m = new macro(macroID);

            Control c = m.renderMacro(attributes, p.Elements, p.PageID);

            PlaceHolder1.Controls.Add(c);
        }
コード例 #10
0
        public DreamMessage GetPageHandler(DreamContext context, DreamMessage message)
        {
            page cur = null;//deki.GetCur(true); Max: commented out to allow compilation

            if (cur == null)
            {
                return(DreamMessage.BadRequest("can't load page"));
            }
            string mode = context.Uri.GetParam("mode", "raw").ToLowerInvariant();

            switch (mode)
            {
            case "raw":
                return(DreamMessage.Ok(MimeType.HTML, cur.Text));

            case "xml":
                string xml    = string.Format(DekiWikiService.XHTML_LOOSE, cur.Text);
                XDoc   result = XDoc.FromXml(xml);
                return(DreamMessage.Ok(MimeType.XHTML, result.ToXHtml()));

            case "export":
            case "edit":
            case "print":
            case "view":
                return(DreamMessage.Ok(MimeType.HTML, /*deki.Render(cur.Text, mode) Max:Removed to allow compilation*/ ""));
            }
            return(DreamMessage.NotImplemented(string.Format("'mode={0}' is not supported")));
        }
コード例 #11
0
ファイル: HomeController.cs プロジェクト: cchanal/documentify
        public ActionResult CreateProject([Bind(Include = "id_projet,nom,description")] projet projet)
        {
            HomePageViewModel model = new HomePageViewModel();

            if (ModelState.IsValid)
            {
                page homePage = new page
                {
                    titre  = "HomePage",
                    numero = 0
                };

                projet.pages.Add(homePage);
                db.projets.Add(projet);

                db.SaveChanges();

                model                   = createDefaultHomeViewModel();
                model.validation        = true;
                model.validationMessage = "Projet crée avec succès";

                return(View("Index", model));
            }

            model          = createDefaultHomeViewModel();
            model.projet   = projet;
            model.creation = true;

            return(View("Index", model));
        }
コード例 #12
0
        private QueryResult QueryProducts(Query query, int publicationId)
        {
            query.setThemesDisabled(true);
            query.setListViewSize(this.maxItems);
            page     fhPage        = this.fhClient.getAll(query.toString());
            universe universe      = this.GetUniverse(fhPage);
            var      modelMappings = this.GetPublicationConfiguration(publicationId).ModelMappings;

            var result = new QueryResult();

            result.Products = new List <Product>();
            var itemsSection = universe.itemssection;

            if (universe.itemssection != null)
            {
                result.Total         = universe.itemssection.results.total_items;
                result.NumberOfPages = universe.itemssection.results.total_items / universe.itemssection.results.view_size;
                if (universe.itemssection.results.total_items % universe.itemssection.results.view_size != 0)
                {
                    result.NumberOfPages++;
                }
                foreach (var item in universe.itemssection.items)
                {
                    result.Products.Add(new FredhopperProduct(item, modelMappings));
                }
            }
            return(result);
        }
コード例 #13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {

            int macroID = cms.businesslogic.macro.Macro.GetByAlias(helper.Request("umb_macroAlias")).Id;
            int pageID = int.Parse(helper.Request("umbPageId"));
            Guid pageVersion = new Guid(helper.Request("umbVersionId"));

            System.Web.HttpContext.Current.Items["macrosAdded"] = 0;
            System.Web.HttpContext.Current.Items["pageID"] = pageID.ToString();

            // Collect attributes
            Hashtable attributes = new Hashtable();
            foreach (string key in Request.QueryString.AllKeys)
            {
                if (key.IndexOf("umb_") > -1)
                {
                    attributes.Add(key.Substring(4, key.Length - 4), Request.QueryString[key]);
                }
            }


            page p = new page(pageID, pageVersion);
            macro m = macro.GetMacro(macroID);

            Control c = m.renderMacro(attributes, p.Elements, p.PageID);
            PlaceHolder1.Controls.Add(c);
        }
コード例 #14
0
        protected void renderMacro_Click(object sender, EventArgs e)
        {
            int    pageID          = int.Parse(UmbracoContext.Current.Request["umbPageId"]);
            string macroAttributes = "macroAlias=\"" + m.Alias + "\"";

            Guid pageVersion = new Guid(UmbracoContext.Current.Request["umbVersionId"]);

            Hashtable attributes = new Hashtable();

            attributes.Add("macroAlias", m.Alias);

            macro mRender = new macro(m.Id);

            foreach (Control c in _dataFields)
            {
                try
                {
                    IMacroGuiRendering ic = (IMacroGuiRendering)c;
                    attributes.Add(c.ID, ic.Value);
                    macroAttributes += " " + c.ID + "=\"" +
                                       ic.Value.Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "\\r") + "\"";
                }
                catch
                {
                }
            }

            // document this, for gods sake!
            HttpContext.Current.Items["macrosAdded"] = 0;
            HttpContext.Current.Items["pageID"]      = pageID.ToString();


            page p = new page(pageID, pageVersion);

            string div = macro.renderMacroStartTag(attributes, pageID, pageVersion).Replace("\\", "\\\\").Replace("'", "\\'");

            string macroContent =
                macro.MacroContentByHttp(pageID, pageVersion, attributes).Replace("\\", "\\\\").Replace("'", "\\'").
                Replace("/", "\\/").Replace("\n", "\\n");

            if (macroContent.Length > 0 && macroContent.ToLower().IndexOf("<script") > -1)
            {
                macroContent =
                    "<b>Macro rendering contains script code</b><br/>This macro won\\'t be rendered in the editor because it contains script code. It will render correct during runtime.";
            }
            div += macroContent;
            div += macro.renderMacroEndTag();

            _scriptOnLoad += "\t\tumbracoEditMacroDo('" + macroAttributes.Replace("'", "\\'") +
                             "', '" + m.Name.Replace("'", "\\'") + "', '" + div + "');\n";

/*
 *          ClientScript.RegisterStartupScript(GetType(), "postbackScript",
 *                                             "<script>\n umbracoEditMacroDo('" + macroAttributes.Replace("'", "\\'") +
 *                                             "', '" + m.Name.Replace("'", "\\'") + "', '" + div + "');\n</script>");
 *          ClientScript.RegisterStartupScript(GetType(), "postbackScriptWindowClose",
 *                                             "<script>\n //setTimeout('window.close()',300);\n</script>");
 */         //theForm.Visible = false;
        }
コード例 #15
0
ファイル: pagesController.cs プロジェクト: outsourcevn/ttmn
        public ActionResult DeleteConfirmed(int id)
        {
            page page = db.pages.Find(id);

            db.pages.Remove(page);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #16
0
 public void LostPage(page who)
 {
     if (!mFound)
     {
         mPageLost = who;
         mFound    = true;
     }
 }
コード例 #17
0
ファイル: Page.cs プロジェクト: seanlinmt/tradelr
 public Page(page page)
 {
     title   = page.name;
     handle  = page.permalink;
     url     = "/pages/" + handle.ToLower();
     content = page.content;
     author  = page.user.ToFullName();
 }
コード例 #18
0
ファイル: ImageUrl.cs プロジェクト: KerwinMa/Umbraco
        public static bool TryGetImageUrl(string specifiedSrc, string field, string provider, string parameters, int?nodeId, out string url)
        {
            var imageUrlProvider = GetProvider(provider);

            var parsedParameters = string.IsNullOrEmpty(parameters) ? new NameValueCollection() : HttpUtility.ParseQueryString(parameters);

            var queryValues = parsedParameters.Keys.Cast <string>().ToDictionary(key => key, key => parsedParameters[key]);

            if (string.IsNullOrEmpty(field))
            {
                url = imageUrlProvider.GetImageUrlFromFileName(specifiedSrc, queryValues);
                return(true);
            }
            else
            {
                var fieldValue = string.Empty;
                if (nodeId.HasValue)
                {
                    var contentFromCache = GetContentFromCache(nodeId.GetValueOrDefault(), field);
                    if (contentFromCache != null)
                    {
                        fieldValue = contentFromCache.ToString();
                    }
                    else
                    {
                        var itemPage = new page(content.Instance.XmlContent.GetElementById(nodeId.GetValueOrDefault().ToString(CultureInfo.InvariantCulture)));
                        var value    = itemPage.Elements[field];
                        fieldValue = value != null?value.ToString() : string.Empty;
                    }
                }
                else
                {
                    var context = HttpContext.Current;
                    if (context != null)
                    {
                        var elements = context.Items["pageElements"] as Hashtable;
                        if (elements != null)
                        {
                            var value = elements[field];
                            fieldValue = value != null?value.ToString() : string.Empty;
                        }
                    }
                }

                if (!string.IsNullOrWhiteSpace(fieldValue))
                {
                    int mediaId;
                    url = int.TryParse(fieldValue, out mediaId)
                              ? imageUrlProvider.GetImageUrlFromMedia(mediaId, queryValues)
                              : imageUrlProvider.GetImageUrlFromFileName(fieldValue, queryValues);
                    return(true);
                }
            }

            url = string.Empty;
            return(false);
        }
コード例 #19
0
        private string parseMacrosToHtml(string input)
        {
            int    nodeId    = _nodeId;
            Guid   versionId = _versionId;
            string content   = input;


            string          pattern = @"(<\?UMBRACO_MACRO\W*[^>]*/>)";
            MatchCollection tags    =
                Regex.Matches(content, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

            // Page for macro rendering
            page p = new page(nodeId, versionId);

            HttpContext.Current.Items["macrosAdded"] = 0;
            HttpContext.Current.Items["pageID"]      = nodeId.ToString();

            foreach (Match tag in tags)
            {
                // Create div
                Hashtable attributes = helper.ReturnAttributes(tag.Groups[1].Value);
                string    div        = macro.renderMacroStartTag(attributes, nodeId, versionId).Replace("&quot;", "&amp;quot;");

                // Insert macro contents here...
                macro m;
                if (helper.FindAttribute(attributes, "macroID") != "")
                {
                    m = new macro(int.Parse(helper.FindAttribute(attributes, "macroID")));
                }
                else
                {
                    m = new macro(Macro.GetByAlias(helper.FindAttribute(attributes, "macroAlias")).Id);
                }

                if (helper.FindAttribute(attributes, "macroAlias") == "")
                {
                    attributes.Add("macroAlias", m.Alias);
                }


                try
                {
                    div += macro.MacroContentByHttp(nodeId, versionId, attributes);
                }
                catch
                {
                    div += "<span style=\"color: green\">No macro content available for WYSIWYG editing</span>";
                }


                div += macro.renderMacroEndTag();

                content = content.Replace(tag.Groups[1].Value, div);
            }
            return(content);
        }
コード例 #20
0
 internal api(page page, c_run c_run)
 {
     this.c_run        = c_run;
     api_ui.heder.text = page.title;
     set(page);
     stack.Children.Add(api_ui);
     main_page = page;
     api_ui.stage.Children.Add(page.z_ui);
     page.start(this);
 }
コード例 #21
0
ファイル: PageController.cs プロジェクト: peisheng/taoke
        /// <summary>
        /// 取得产口详细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Get(int id)
        {
            if (id <= 0)
            {
                return(ErrorResult);
            }
            page page
                = Uof.IpageService.GetById(id);

            return(Json(page, JsonRequestBehavior.AllowGet));
        }
コード例 #22
0
ファイル: pagesController.cs プロジェクト: outsourcevn/ttmn
 public ActionResult Edit([Bind(Include = "id,domain,name,page_id,cat_id,status")] page page)
 {
     if (ModelState.IsValid)
     {
         page.status          = 0;
         db.Entry(page).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(page));
 }
コード例 #23
0
        public page GetPage(string title)
        {
            PageData pd = new PageData()
            {
                title = title
            };
            PageManager pm = new PageManager();
            page        p  = pm.GetPage(pd);

            return(p);
        }
コード例 #24
0
 private universe GetUniverse(page fhPage)
 {
     foreach (var universe in fhPage.universes)
     {
         if (universe.type == universeType.selected)
         {
             return(universe);
         }
     }
     return(null);
 }
コード例 #25
0
        public ActionResult DeleteConfirmed(int id)
        {
            page page = db.pages.Find(id);

            page.sections.ToList().ForEach(x => x.sous_section.ToList().ForEach(y => db.sous_section.Remove(y)));
            page.sections.ToList().ForEach(x => db.sections.Remove(x));
            db.pages.Remove(page);

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #26
0
 public ActionResult Edit([Bind(Include = "id_page,titre,description,numero,id_projet")] page page)
 {
     if (ModelState.IsValid)
     {
         db.Entry(page).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_projet = new SelectList(db.projets, "id_projet", "nom", page.id_projet);
     return(View(page));
 }
コード例 #27
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            // check if a macro (tag) is specified
            if (!string.IsNullOrEmpty(this.Options.MacroTag))
            {
                // get the node for the current page
                var node = uQuery.GetCurrentNode();

                // if the node is null (either document is unpublished, or rendering from outside the content section)
                if (node == null)
                {
                    // then get the first child node from the XML content root
                    var nodes = uQuery.GetNodesByXPath(string.Concat("descendant::*[@parentID = ", uQuery.RootNodeId, "]")).ToList();
                    if (nodes != null && nodes.Count > 0)
                    {
                        node = nodes[0];
                    }
                }

                if (node != null)
                {
                    // load the page reference
                    var umbPage = new page(node.Id, node.Version);
                    HttpContext.Current.Items["pageID"]       = node.Id;
                    HttpContext.Current.Items["pageElements"] = umbPage.Elements;

                    var attr = XmlHelper.GetAttributesFromElement(this.Options.MacroTag);

                    if (attr.ContainsKey("macroalias"))
                    {
                        var macro = new Macro()
                        {
                            Alias = attr["macroalias"].ToString()
                        };

                        foreach (var item in attr)
                        {
                            macro.Attributes.Add(item.Key.ToString(), item.Value.ToString());
                        }

                        this.Controls.Add(macro);
                    }
                }
                else
                {
                    this.Controls.Add(new Literal()
                    {
                        Text = "<em>There are no published content nodes (yet), therefore the macro can not be rendered.</em>"
                    });
                }
            }

            base.OnInit(e);
        }
コード例 #28
0
ファイル: WebForm1.aspx.cs プロジェクト: NingMoe/cqpixie2017
        protected void Button5_Click(object sender, EventArgs e)
        {
            PageManager p    = new PageManager();
            PageData    data = new PageData();

            data.id = Convert.ToInt32(TextBox4.Text);

            page list = p.GetPage(data);

            Response.Write(list.title);
        }
コード例 #29
0
ファイル: pagesController.cs プロジェクト: outsourcevn/ttmn
        public ActionResult Create([Bind(Include = "id,domain,name,page_id,cat_id,status")] page page)
        {
            if (ModelState.IsValid)
            {
                page.status = 0;
                db.pages.Add(page);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(page));
        }
コード例 #30
0
        public static List <publication> allResearchersPubsAuthenticus(string authID)
        {
            // authID needs to be validated at some point
            page authPubs = getAuthPubsAuthenticus(authID).Result;
            List <publication> allPubs = new List <publication>();

            foreach (filteredResource item in authPubs.items)
            {
                allPubs.Add(getPubDataAuthenticus(item.id).Result);
            }

            return(allPubs);
        }
コード例 #31
0
        public Result GetTop(page pageData)
        {
            var data   = _userBll.GetPageEntities(pageData.pageSize, pageData.pageIndex, out int totol, u => u.Id > 0, u => u.integral, false).ToList();
            var myData = (from u in data
                          select new
            {
                u.Id,
                u.user_name,
                u.integral
            }).ToList();

            return(Result.Success().SetData(myData));
        }
コード例 #32
0
ファイル: UmbracoPage.cs プロジェクト: elrute/Triphulcas
        protected override void OnPreInit(EventArgs e)
        {
            if (UmbracoContext.Current == null)
            {
                // Set umbraco context
                UmbracoContext.Current = new UmbracoContext(HttpContext.Current);
            }

            HttpContext.Current.Items["pageID"] = PageId;

            // setup page properties
            page pageObject = new page(((System.Xml.IHasXmlNode) library.GetXmlNodeCurrent().Current).GetNode());
            System.Web.HttpContext.Current.Items.Add("pageElements", pageObject.Elements);

            base.OnPreInit(e);
        }
コード例 #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PageElementEditor"/> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public PageElementEditor(Item item)
        {
            m_Item = item;
            EnsureChildControls();

            // does the field belong to the current page? (no node ID)
            if (String.IsNullOrEmpty(item.NodeId))
            {
                // get the current page's element
                Value = item.PageElements[item.Field];
            }
            else
            {
                // get the elements of the chosen page
                page itemPage = new page(content.Instance.XmlContent.GetElementById(item.NodeId.ToString()));
                Value = itemPage.Elements[item.Field];
            }
        }
コード例 #34
0
ファイル: PageClass.cs プロジェクト: hharrysidhu/timmins
 public bool commitInsert(int _subject_id, string _menu_name, string _title, string _content)
 {
     pagesDataContext objPageDC = new pagesDataContext();
     //to ensure all data will be disposed when finished
     using (objPageDC)
     {
         //create an instance of the table
         page objNewPage = new page();
         //set table column to new values being passed from *.aspx page
         objNewPage.subject_id = _subject_id;
         objNewPage.menu_name = _menu_name;
         objNewPage.title = _title;
         objNewPage.page_content = _content;
         //insert command
         objPageDC.pages.InsertOnSubmit(objNewPage);
         //commit insert against db
         objPageDC.SubmitChanges();
         return true;
     }
 }
コード例 #35
0
    //ADD NEW PAGE
    public bool commitNewPage(string _title, string _author, string _parent, string _entry, DateTime _dateAdded, DateTime _dateEdited, int _saved, int _published, string _publicUrl)
    {
        page objNewPage = new page();

        using(objPagesDC)
        {
            objNewPage.title = _title;
            objNewPage.author = _author;
            objNewPage.parent = _parent;
            objNewPage.entry = _entry;
            objNewPage.date_added = _dateAdded;
            objNewPage.date_edited = _dateEdited;
            objNewPage.saved = _saved;
            objNewPage.published = _published;
            objNewPage.public_url = _publicUrl;

            objPagesDC.pages.InsertOnSubmit(objNewPage);
            objPagesDC.SubmitChanges();
        }

        return true;
    }
コード例 #36
0
ファイル: pages.designer.cs プロジェクト: hharrysidhu/timmins
 partial void Deletepage(page instance);
コード例 #37
0
ファイル: pages.designer.cs プロジェクト: hharrysidhu/timmins
 partial void Updatepage(page instance);
コード例 #38
0
ファイル: pages.designer.cs プロジェクト: hharrysidhu/timmins
 partial void Insertpage(page instance);
コード例 #39
0
        public string SaveXslt(string fileName, string oldName, string fileContents, bool ignoreDebugging)
        {
            if (AuthorizeRequest(DefaultApps.developer.ToString()))
            {

                // validate file
                IOHelper.ValidateEditPath(IOHelper.MapPath(SystemDirectories.Xslt + "/" + fileName),
                                          SystemDirectories.Xslt);
                // validate extension
                IOHelper.ValidateFileExtension(IOHelper.MapPath(SystemDirectories.Xslt + "/" + fileName),
                                               new List<string>() { "xsl", "xslt" });


                StreamWriter SW;
                string tempFileName = IOHelper.MapPath(SystemDirectories.Xslt + "/" + DateTime.Now.Ticks + "_temp.xslt");
                SW = File.CreateText(tempFileName);
                SW.Write(fileContents);
                SW.Close();

                // Test the xslt
                string errorMessage = "";

                if (!ignoreDebugging)
                {
                    try
                    {
                        // Check if there's any documents yet
                        string xpath = UmbracoSettings.UseLegacyXmlSchema ? "/root/node" : "/root/*";
                        if (content.Instance.XmlContent.SelectNodes(xpath).Count > 0)
                        {
                            var macroXML = new XmlDocument();
                            macroXML.LoadXml("<macro/>");

                            var macroXSLT = new XslCompiledTransform();
                            var umbPage = new page(content.Instance.XmlContent.SelectSingleNode("//* [@parentID = -1]"));

                            var xslArgs = macro.AddMacroXsltExtensions();
                            var lib = new library(umbPage);
                            xslArgs.AddExtensionObject("urn:umbraco.library", lib);
                            HttpContext.Current.Trace.Write("umbracoMacro", "After adding extensions");

                            // Add the current node
                            xslArgs.AddParam("currentPage", "", library.GetXmlNodeById(umbPage.PageID.ToString()));

                            HttpContext.Current.Trace.Write("umbracoMacro", "Before performing transformation");

                            // Create reader and load XSL file
                            // We need to allow custom DTD's, useful for defining an ENTITY
                            var readerSettings = new XmlReaderSettings();
                            readerSettings.ProhibitDtd = false;
                            using (var xmlReader = XmlReader.Create(tempFileName, readerSettings))
                            {
                                var xslResolver = new XmlUrlResolver();
                                xslResolver.Credentials = CredentialCache.DefaultCredentials;
                                macroXSLT.Load(xmlReader, XsltSettings.TrustedXslt, xslResolver);
                                xmlReader.Close();
                                // Try to execute the transformation
                                var macroResult = new HtmlTextWriter(new StringWriter());
                                macroXSLT.Transform(macroXML, xslArgs, macroResult);
                                macroResult.Close();

                                File.Delete(tempFileName);
                            }
                        }
                        else
                        {
                            //errorMessage = ui.Text("developer", "xsltErrorNoNodesPublished");
                            File.Delete(tempFileName);
                            //base.speechBubble(speechBubbleIcon.info, ui.Text("errors", "xsltErrorHeader", base.getUser()), "Unable to validate xslt as no published content nodes exist.");
                        }
                    }
                    catch (Exception errorXslt)
                    {
                        File.Delete(tempFileName);

                        errorMessage = (errorXslt.InnerException ?? errorXslt).ToString();

                        // Full error message
                        errorMessage = errorMessage.Replace("\n", "<br/>\n");
                        //closeErrorMessage.Visible = true;

                        // Find error
                        var m = Regex.Matches(errorMessage, @"\d*[^,],\d[^\)]", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
                        foreach (Match mm in m)
                        {
                            string[] errorLine = mm.Value.Split(',');

                            if (errorLine.Length > 0)
                            {
                                var theErrorLine = int.Parse(errorLine[0]);
                                var theErrorChar = int.Parse(errorLine[1]);

                                errorMessage = "Error in XSLT at line " + errorLine[0] + ", char " + errorLine[1] +
                                               "<br/>";
                                errorMessage += "<span style=\"font-family: courier; font-size: 11px;\">";

                                var xsltText = fileContents.Split("\n".ToCharArray());
                                for (var i = 0; i < xsltText.Length; i++)
                                {
                                    if (i >= theErrorLine - 3 && i <= theErrorLine + 1)
                                        if (i + 1 == theErrorLine)
                                        {
                                            errorMessage += "<b>" + (i + 1) + ": &gt;&gt;&gt;&nbsp;&nbsp;" +
                                                            Server.HtmlEncode(xsltText[i].Substring(0, theErrorChar));
                                            errorMessage +=
                                                "<span style=\"text-decoration: underline; border-bottom: 1px solid red\">" +
                                                Server.HtmlEncode(
                                                    xsltText[i].Substring(theErrorChar,
                                                                          xsltText[i].Length - theErrorChar)).
                                                    Trim() + "</span>";
                                            errorMessage += " &lt;&lt;&lt;</b><br/>";
                                        }
                                        else
                                            errorMessage += (i + 1) + ": &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
                                                            Server.HtmlEncode(xsltText[i]) + "<br/>";
                                }
                                errorMessage += "</span>";
                            }
                        }
                    }
                }

                if (errorMessage == "" && fileName.ToLower().EndsWith(".xslt"))
                {
                    //Hardcoded security-check... only allow saving files in xslt directory... 
                    var savePath = IOHelper.MapPath(SystemDirectories.Xslt + "/" + fileName);

                    if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Xslt + "/")))
                    {
                        //deletes the old xslt file
                        if (fileName != oldName)
                        {

                            var p = IOHelper.MapPath(SystemDirectories.Xslt + "/" + oldName);
                            if (File.Exists(p))
                                File.Delete(p);
                        }

                        SW = File.CreateText(savePath);
                        SW.Write(fileContents);
                        SW.Close();
                        errorMessage = "true";

                       
                    }
                    else
                    {
                        errorMessage = "Illegal path";
                    }
                }

                File.Delete(tempFileName);

                return errorMessage;
            }
            return "false";
        }
コード例 #40
0
 void AddCur(DekiContext deki, page cur, XDoc doc, ICollection<string> columns, string filter, int level) {
     AddCur(deki, cur, doc, columns, filter, level, false, true);
 }
コード例 #41
0
		public void Populate(page Page) {
			if (Page != null) 
			{
				_pageID = Page.PageID;
				_templateID = Page.Template;

				_createDate = Page.CreateDate;
				_updateDate = Page.UpdateDate;
				
				_writerName = Page.WriterName;
				_pageName = Page.PageName;
				_elements = Page.Elements;

				_pageContent.Append(Page.PageContent);
				this.Controls.Add(Page.PageContentControl);
			}
		}
コード例 #42
0
ファイル: loginuser.cs プロジェクト: rxaa/washmange
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "select UID,id,password,team,logdate,loginIP from wa_login where 1=1";

            string sql2 = "select count(*) from wa_login where 1=1";

            if (textBox1.Text != "")
            {
                sql += " and id='" + textBox1.Text + "'";
                sql2 += " and id='" + textBox1.Text + "'";
            }

            if (comboBox1.Text == "管理员")
            {
                sql += " and team=0";
                sql2 += " and team=0";
            }
            else if(comboBox1.Text == "录入员")
            {
                sql += " and team=1";
                sql2 += " and team=1";
            }

            sql += " order by UID";

            ds.Clear();

            page1 = new page(sql2, sql, ds, "wa_wash");
            if (page1.conerror)
            {
                MessageBox.Show("数据库访问失败:" + page1.error);
                return;
            }
            toolStripLabel2.Text = "共" + page1.total + "条记录";

            dataGridView1.DataSource = ds.Tables["wa_wash"];

            bindingNavigatorMovePreviousItem.Enabled = false;
            if (page1.pnum > 1) bindingNavigatorMoveNextItem.Enabled = true;
            else bindingNavigatorMoveNextItem.Enabled = false;

            bindingNavigatorCountItem.Enabled = true;
            bindingNavigatorCountItem.Text = "/" + page1.pnum;
            bindingNavigatorPositionItem.Enabled = true;
            bindingNavigatorPositionItem.Text = "1";

            bindingNavigatorMoveFirstItem.Enabled = true;
            bindingNavigatorMoveLastItem.Enabled = true;
        }
コード例 #43
0
ファイル: search.cs プロジェクト: rxaa/washmange
        private void button1_Click(object sender, EventArgs e)
        {
            sql = "select WID,Wnumber,cardid,Wname,Wphone,Wjifen,XiangMu,YangShi,color,XiaCi,JiaGe,number,FuKuan,fromdate,todate,fromID,toID,discount,GuaDian,mark,shopID from wa_wash where 1=1";

            sql2="select count(*) from wa_wash where 1=1";

            if (radioButton1.Checked && textBox1.Text != "")
            {
                sql += " and Wname like '%" + textBox1.Text + "%'";
                sql2 += " and Wname like '%" + textBox1.Text + "%'";
            }
            else if (radioButton2.Checked && textBox1.Text != "")
            {
                sql += " and Wphone='" + textBox1.Text + "'";
                sql2 += " and Wphone='" + textBox1.Text + "'";
            }
            else if (radioButton3.Checked && textBox1.Text != "")
            {
                sql += " and cardid='" + textBox1.Text + "'";
                sql2 += " and cardid='" + textBox1.Text + "'";
            }

            if (comboBox1.Text != "全部")
            {
                sql += " and shopID=" + sid[comboBox1.SelectedIndex];
                sql2 += " and shopID=" + sid[comboBox1.SelectedIndex];
            }

            if (radioButton4.Checked)
            {
                sql += " and DATE(fromdate)<='" + dateTimePicker2.Value.Date.ToString() + "' and DATE(fromdate)>='" + dateTimePicker1.Value.Date.ToString() + "'";
                sql2 += " and DATE(fromdate)<='" + dateTimePicker2.Value.Date.ToString() + "' and DATE(fromdate)>='" + dateTimePicker1.Value.Date.ToString() + "'";
            }

            sql += " order by WID";

            ds.Clear();

            page1 = new page(sql2, sql, ds, "wa_wash");
            if (page1.conerror)
            {
                MessageBox.Show("数据库访问失败:" + page1.error);
                return;
            }
            toolStripLabel2.Text = "共" + page1.total + "条记录";

            dataGridView1.DataSource = ds.Tables["wa_wash"];

            bindingNavigatorMovePreviousItem.Enabled = false;
            if(page1.pnum>1)bindingNavigatorMoveNextItem.Enabled = true;
            else bindingNavigatorMoveNextItem.Enabled = false;

            bindingNavigatorCountItem.Enabled = true;
            bindingNavigatorCountItem.Text = "/"+page1.pnum;
            bindingNavigatorPositionItem.Enabled = true;
            bindingNavigatorPositionItem.Text = "1";

            bindingNavigatorMoveFirstItem.Enabled = true;
            bindingNavigatorMoveLastItem.Enabled = true;

              //  bindingNavigatorMovePreviousItem.Enabled = true;
        }
コード例 #44
0
        private string SaveXslt(string fileName, string fileContents, bool ignoreDebugging)
        {	        
			var tempFileName = IOHelper.MapPath(SystemDirectories.Xslt + "/" + System.DateTime.Now.Ticks + "_temp.xslt");
            using (var sw = File.CreateText(tempFileName))
            {
				sw.Write(fileContents);
				sw.Close();    
            }
            
            // Test the xslt
            string errorMessage = "";
            if (!ignoreDebugging)
            {
                try
                {

                    // Check if there's any documents yet
                    if (content.Instance.XmlContent.SelectNodes("/root/node").Count > 0)
                    {
                        XmlDocument macroXML = new XmlDocument();
                        macroXML.LoadXml("<macro/>");

                        XslCompiledTransform macroXSLT = new XslCompiledTransform();
                        page umbPage = new page(content.Instance.XmlContent.SelectSingleNode("//node [@parentID = -1]"));

                        XsltArgumentList xslArgs;
                        xslArgs = macro.AddMacroXsltExtensions();
                        library lib = new library(umbPage);
                        xslArgs.AddExtensionObject("urn:umbraco.library", lib);
                        HttpContext.Current.Trace.Write("umbracoMacro", "After adding extensions");

                        // Add the current node
                        xslArgs.AddParam("currentPage", "", library.GetXmlNodeById(umbPage.PageID.ToString()));
                        HttpContext.Current.Trace.Write("umbracoMacro", "Before performing transformation");

                        // Create reader and load XSL file
                        // We need to allow custom DTD's, useful for defining an ENTITY
                        XmlReaderSettings readerSettings = new XmlReaderSettings();
                        readerSettings.ProhibitDtd = false;
                        using (XmlReader xmlReader = XmlReader.Create(tempFileName, readerSettings))
                        {
                            XmlUrlResolver xslResolver = new XmlUrlResolver();
                            xslResolver.Credentials = CredentialCache.DefaultCredentials;
                            macroXSLT.Load(xmlReader, XsltSettings.TrustedXslt, xslResolver);
                            xmlReader.Close();
                            // Try to execute the transformation
                            HtmlTextWriter macroResult = new HtmlTextWriter(new StringWriter());
                            macroXSLT.Transform(macroXML, xslArgs, macroResult);
                            macroResult.Close();
                        }
                    }
                    else
                    {
                        errorMessage = "stub";
                        //base.speechBubble(speechBubbleIcon.info, ui.Text("errors", "xsltErrorHeader", base.getUser()), "Unable to validate xslt as no published content nodes exist.");
                    }

                }
                catch (Exception errorXslt)
                {
                    //base.speechBubble(speechBubbleIcon.error, ui.Text("errors", "xsltErrorHeader", base.getUser()), ui.Text("errors", "xsltErrorText", base.getUser()));

                    //errorHolder.Visible = true;
                    //closeErrorMessage.Visible = true;
                    //errorHolder.Attributes.Add("style", "height: 250px; overflow: auto; border: 1px solid CCC; padding: 5px;");

                    errorMessage = (errorXslt.InnerException ?? errorXslt).ToString();

                    // Full error message
                    errorMessage = errorMessage.Replace("\n", "<br/>\n");
                    //closeErrorMessage.Visible = true;

                    string[] errorLine;
                    // Find error
                    MatchCollection m = Regex.Matches(errorMessage, @"\d*[^,],\d[^\)]", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
                    foreach (Match mm in m)
                    {
                        errorLine = mm.Value.Split(',');

                        if (errorLine.Length > 0)
                        {
                            int theErrorLine = int.Parse(errorLine[0]);
                            int theErrorChar = int.Parse(errorLine[1]);

                            errorMessage = "Error in XSLT at line " + errorLine[0] + ", char " + errorLine[1] + "<br/>";
                            errorMessage += "<span style=\"font-family: courier; font-size: 11px;\">";

                            string[] xsltText = fileContents.Split("\n".ToCharArray());
                            for (int i = 0; i < xsltText.Length; i++)
                            {
                                if (i >= theErrorLine - 3 && i <= theErrorLine + 1)
                                    if (i + 1 == theErrorLine)
                                    {
                                        errorMessage += "<b>" + (i + 1) + ": &gt;&gt;&gt;&nbsp;&nbsp;" + Server.HtmlEncode(xsltText[i].Substring(0, theErrorChar));
                                        errorMessage += "<span style=\"text-decoration: underline; border-bottom: 1px solid red\">" + Server.HtmlEncode(xsltText[i].Substring(theErrorChar, xsltText[i].Length - theErrorChar)).Trim() + "</span>";
                                        errorMessage += " &lt;&lt;&lt;</b><br/>";
                                    }
                                    else
                                        errorMessage += (i + 1) + ": &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + Server.HtmlEncode(xsltText[i]) + "<br/>";
                            }
                            errorMessage += "</span>";

                        }
                    }
                }

            }


            if (errorMessage == "" && fileName.ToLower().EndsWith(".xslt"))
            {
                //Hardcoded security-check... only allow saving files in xslt directory... 
                var savePath = IOHelper.MapPath(SystemDirectories.Xslt + "/" + fileName);

                if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Xslt)))
                {
					using (var sw = File.CreateText(savePath))
	                {
						sw.Write(fileContents);
						sw.Close();
	                }
                    errorMessage = "true";
                }
                else
                {
                    errorMessage = "Illegal path";
                }
            }

            File.Delete(tempFileName);


            return errorMessage;
        }
コード例 #45
0
        protected void renderMacro_Click(object sender, EventArgs e)
        {
            int pageID = int.Parse(UmbracoContext.Current.Request["umbPageId"]);
            string macroAttributes = "macroAlias=\"" + m.Alias + "\"";

            Guid pageVersion = new Guid(UmbracoContext.Current.Request["umbVersionId"]);

            Hashtable attributes = new Hashtable();
            attributes.Add("macroAlias", m.Alias);

            macro mRender = new macro(m.Id);
            foreach (Control c in _dataFields)
            {
                try
                {
                    IMacroGuiRendering ic = (IMacroGuiRendering)c;
                    attributes.Add(c.ID, ic.Value);
                    macroAttributes += " " + c.ID + "=\"" +
                                       ic.Value.Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "\\r") + "\"";
                }
                catch
                {
                }
            }

            // document this, for gods sake!
            HttpContext.Current.Items["macrosAdded"] = 0;
            HttpContext.Current.Items["pageID"] = pageID.ToString();

            page p = new page(pageID, pageVersion);

            string div = macro.renderMacroStartTag(attributes, pageID, pageVersion).Replace("\\", "\\\\").Replace("'", "\\'");

            string macroContent =
                macro.MacroContentByHttp(pageID, pageVersion, attributes).Replace("\\", "\\\\").Replace("'", "\\'").
                    Replace("/", "\\/").Replace("\n", "\\n");

            if (macroContent.Length > 0 && macroContent.ToLower().IndexOf("<script") > -1)
                macroContent =
                    "<b>Macro rendering contains script code</b><br/>This macro won\\'t be rendered in the editor because it contains script code. It will render correct during runtime.";
            div += macroContent;
            div += macro.renderMacroEndTag();

            _scriptOnLoad += "\t\tumbracoEditMacroDo('" + macroAttributes.Replace("'", "\\'") +
                                               "', '" + m.Name.Replace("'", "\\'") + "', '" + div + "');\n";
            /*
            ClientScript.RegisterStartupScript(GetType(), "postbackScript",
                                               "<script>\n umbracoEditMacroDo('" + macroAttributes.Replace("'", "\\'") +
                                               "', '" + m.Name.Replace("'", "\\'") + "', '" + div + "');\n</script>");
            ClientScript.RegisterStartupScript(GetType(), "postbackScriptWindowClose",
                                               "<script>\n //setTimeout('window.close()',300);\n</script>");
            */            //theForm.Visible = false;
        }
コード例 #46
0
		/// <summary>
		/// Renders the field contents.
		/// Checks via the NodeId attribute whether to fetch data from another page than the current one.
		/// </summary>
		/// <returns>A string of field contents (macros not parsed)</returns>
		protected virtual string GetFieldContents(Item item)
		{
			var tempElementContent = string.Empty;

			// if a nodeId is specified we should get the data from another page than the current one
			if (string.IsNullOrEmpty(item.NodeId) == false)
			{
				var tempNodeId = item.GetParsedNodeId();
				if (tempNodeId != null && tempNodeId.Value != 0)
				{
                    //moved the following from the catch block up as this will allow fallback options alt text etc to work
                    var itemPage = new page(Umbraco.Web.UmbracoContext.Current.GetXml().GetElementById(tempNodeId.ToString()));
                    tempElementContent = new item(itemPage.Elements, item.LegacyAttributes).FieldContent;
				}
			}
			else
			{
				// gets the field content from the current page (via the PageElements collection)
				tempElementContent = new item(item.PageElements, item.LegacyAttributes).FieldContent;
			}

			return tempElementContent;
		}
コード例 #47
0
ファイル: TinyMCE.cs プロジェクト: JianwenSun/mono-soc-2007
        private string parseMacrosToHtml(string input)
        {
            int nodeId = _nodeId;
            Guid versionId = _versionId;
            string content = input;


            string pattern = @"(<\?UMBRACO_MACRO\W*[^>]*/>)";
            MatchCollection tags =
                Regex.Matches(content, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

            // Page for macro rendering
            page p = new page(nodeId, versionId);
            HttpContext.Current.Items["macrosAdded"] = 0;
            HttpContext.Current.Items["pageID"] = nodeId.ToString();

            foreach (Match tag in tags)
            {
                // Create div
                Hashtable attributes = helper.ReturnAttributes(tag.Groups[1].Value);
                string div = macro.renderMacroStartTag(attributes, nodeId, versionId).Replace("&quot;", "&amp;quot;");

                // Insert macro contents here...
                macro m;
                if (helper.FindAttribute(attributes, "macroID") != "")
                    m = new macro(int.Parse(helper.FindAttribute(attributes, "macroID")));
                else
                    m = new macro(Macro.GetByAlias(helper.FindAttribute(attributes, "macroAlias")).Id);

                if (helper.FindAttribute(attributes, "macroAlias") == "")
                    attributes.Add("macroAlias", m.Alias);


                try
                {
                    div += macro.MacroContentByHttp(nodeId, versionId, attributes);
                }
                catch
                {
                    div += "<span style=\"color: green\">No macro content available for WYSIWYG editing</span>";
                }


                div += macro.renderMacroEndTag();

                content = content.Replace(tag.Groups[1].Value, div);
            }
            return content;
        }
コード例 #48
0
ファイル: ZCview.cs プロジェクト: rxaa/washmange
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "select ZID,JinE,Zname,FID,Zdate,Zmark,shopID from wa_zhichu where 1=1";

            string sql2 = "select count(*) from wa_zhichu where 1=1";

            if (textBox1.Text != "")
            {
                sql += " and Zname like '%" + textBox1.Text + "%'";
                sql2 += " and Zname like '%" + textBox1.Text + "%'";
            }

            if (comboBox1.Text != "全部")
            {
                sql += " and shopID=" + sid[comboBox1.SelectedIndex];
                sql2 += " and shopID=" + sid[comboBox1.SelectedIndex];
            }

            if (radioButton4.Checked)
            {
                sql += " and DATE(Zdate)<='" + dateTimePicker2.Value.Date.ToString() + "' and DATE(Zdate)>='" + dateTimePicker1.Value.Date.ToString() + "'";
                sql2 += " and DATE(Zdate)<='" + dateTimePicker2.Value.Date.ToString() + "' and DATE(Zdate)>='" + dateTimePicker1.Value.Date.ToString() + "'";
            }

            sql += " order by ZID";

            ds.Clear();

            page1 = new page(sql2, sql, ds, "wa_wash");
            if (page1.conerror)
            {
                MessageBox.Show("数据库访问失败:" + page1.error);
                return;
            }
            toolStripLabel2.Text = "共" + page1.total + "条记录";

            dataGridView1.DataSource = ds.Tables["wa_wash"];

            bindingNavigatorMovePreviousItem.Enabled = false;
            if (page1.pnum > 1) bindingNavigatorMoveNextItem.Enabled = true;
            else bindingNavigatorMoveNextItem.Enabled = false;

            bindingNavigatorCountItem.Enabled = true;
            bindingNavigatorCountItem.Text = "/" + page1.pnum;
            bindingNavigatorPositionItem.Enabled = true;
            bindingNavigatorPositionItem.Text = "1";

            bindingNavigatorMoveFirstItem.Enabled = true;
            bindingNavigatorMoveLastItem.Enabled = true;
        }
コード例 #49
0
ファイル: ItemRenderer.cs プロジェクト: elrute/Triphulcas
		/// <summary>
		/// Renders the field contents.
		/// Checks via the NodeId attribute whether to fetch data from another page than the current one.
		/// </summary>
		/// <returns>A string of field contents (macros not parsed)</returns>
		protected virtual string GetFieldContents(Item item)
		{
			string tempElementContent = String.Empty;

			// if a nodeId is specified we should get the data from another page than the current one
			if (!String.IsNullOrEmpty(item.NodeId))
			{
				int? tempNodeId = item.GetParsedNodeId();
				if (tempNodeId != null && tempNodeId.Value != 0)
				{

                    //moved the following from the catch block up as this will allow fallback options alt text etc to work

                    page itemPage = new page(content.Instance.XmlContent.GetElementById(tempNodeId.ToString()));
                    tempElementContent = new item(itemPage.Elements, item.LegacyAttributes).FieldContent;

                    /*removed as would fail as there is a incorrect cast in the method called.  
                      Also the following code does not respect any of Umbraco Items fallback and formatting options */

					//string currentField = helper.FindAttribute(item.LegacyAttributes, "field");
					// check for a cached instance of the content
					//object contents = GetContentFromCache(tempNodeId.Value, currentField);
                    //if (contents != null)
                    //    tempElementContent = (string)contents;
                    //else
                    //{
                    //    // as the field can be used for both documents, media and even members we'll use the 
                    //    // content class to lookup field items
                    //    try
                    //    {
                    //        tempElementContent = GetContentFromDatabase(item.LegacyAttributes, tempNodeId.Value, currentField);
                    //    }
                    //    catch
                    //    {
                    //        // content was not found in property fields,
                    //        // so the last place to look for is page fields
                    //        page itemPage = new page(content.Instance.XmlContent.GetElementById(tempNodeId.ToString()));
                    //        tempElementContent = new item(itemPage.Elements, item.LegacyAttributes).FieldContent;
                    //    }
                    //}
				}

			}
			else
			{
				// gets the field content from the current page (via the PageElements collection)
				tempElementContent = new item(item.PageElements, item.LegacyAttributes).FieldContent;
			}

			return tempElementContent;
		}
コード例 #50
0
ファイル: ItemRenderer.cs プロジェクト: saciervo/Umbraco-CMS
        /// <summary>
        /// Renders the field contents.
        /// Checks via the NodeId attribute whether to fetch data from another page than the current one.
        /// </summary>
        /// <returns>A string of field contents (macros not parsed)</returns>
        protected virtual string GetFieldContents(Item item)
        {
            var tempElementContent = string.Empty;

            // if a nodeId is specified we should get the data from another page than the current one
            if (string.IsNullOrEmpty(item.NodeId) == false)
            {
                var tempNodeId = item.GetParsedNodeId();
                if (tempNodeId != null && tempNodeId.Value != 0)
                {
                    //moved the following from the catch block up as this will allow fallback options alt text etc to work
                    var cache = Umbraco.Web.UmbracoContext.Current.ContentCache.InnerCache as PublishedContentCache;
                    if (cache == null) throw new InvalidOperationException("Unsupported IPublishedContentCache, only the Xml one is supported.");
                    var xml = cache.GetXml(Umbraco.Web.UmbracoContext.Current, Umbraco.Web.UmbracoContext.Current.InPreviewMode);
                    var itemPage = new page(xml.GetElementById(tempNodeId.ToString()));
                    tempElementContent = 
                        new item(item.ContentItem, itemPage.Elements, item.LegacyAttributes).FieldContent;
                }
            }
            else
            {
                // gets the field content from the current page (via the PageElements collection)
                tempElementContent =
                    new item(item.ContentItem, item.PageElements, item.LegacyAttributes).FieldContent;
            }

            return tempElementContent;
        }
コード例 #51
0
ファイル: vip.cs プロジェクト: rxaa/washmange
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "select VID,Card,vipid,Telphone,ShenFenHao,ChunKuan,XianJin,XaoFei,credate,discount,JiFen,mark,state,fromID,shopID from wa_vip where 1=1";

              string sql2 = "select count(*) from wa_vip where 1=1";

              if (radioButton3.Checked && textBox1.Text != "")
              {
              sql += " and Card='" + textBox1.Text + "'";
              sql2 += " and Card='" + textBox1.Text + "'";
              }
              else if (radioButton1.Checked && textBox1.Text != "")
              {
              sql += " and vipid like '%" + textBox1.Text + "%'";
              sql2 += " and vipid like '%" + textBox1.Text + "%'";
              }

              if (comboBox1.Text != "全部")
              {
              sql += " and shopID=" + sid[comboBox1.SelectedIndex];
              sql2 += " and shopID=" + sid[comboBox1.SelectedIndex];
              }

              if (radioButton4.Checked)
              {
              sql += " and DATE(credate)<='" + dateTimePicker2.Value.Date.ToString() + "' and DATE(credate)>='" + dateTimePicker1.Value.Date.ToString() + "'";
              sql2 += " and DATE(credate)<='" + dateTimePicker2.Value.Date.ToString() + "' and DATE(credate)>='" + dateTimePicker1.Value.Date.ToString() + "'";
              }

              sql += " order by VID";

              ds.Clear();

              page1 = new page(sql2, sql, ds, "wa_wash");
              if (page1.conerror)
              {
              MessageBox.Show("数据库访问失败:" + page1.error);
              return;
              }
              toolStripLabel2.Text = "共" + page1.total + "条记录";

              dataGridView1.DataSource = ds.Tables["wa_wash"];

              bindingNavigatorMovePreviousItem.Enabled = false;
              if (page1.pnum > 1) bindingNavigatorMoveNextItem.Enabled = true;
              else bindingNavigatorMoveNextItem.Enabled = false;

              bindingNavigatorCountItem.Enabled = true;
              bindingNavigatorCountItem.Text = "/" + page1.pnum;
              bindingNavigatorPositionItem.Enabled = true;
              bindingNavigatorPositionItem.Text = "1";

              bindingNavigatorMoveFirstItem.Enabled = true;
              bindingNavigatorMoveLastItem.Enabled = true;
        }
コード例 #52
0
ファイル: SgmlPage.cs プロジェクト: codefrom/HtmlUnit.NET
 * @param webResponse the web response that was used to create this page
 * @param webWindow the window that this page is being loaded into
コード例 #53
0
ファイル: SgmlPage.cs プロジェクト: codefrom/HtmlUnit.NET
 * @param webWindow the window that this page is being loaded into
コード例 #54
0
ファイル: TinyMCE.cs プロジェクト: jracabado/justEdit-
        private string parseMacrosToHtml(string input)
        {
            int nodeId = _nodeId;
            Guid versionId = _versionId;
            string content = input;

            string pattern = @"(<\?UMBRACO_MACRO\W*[^>]*/>)";
            MatchCollection tags =
                Regex.Matches(content, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

            // Page for macro rendering
            page p = new page(nodeId, versionId);
            HttpContext.Current.Items["macrosAdded"] = 0;
            HttpContext.Current.Items["pageID"] = nodeId.ToString();

            foreach (Match tag in tags) {
                try {
                    // Create div
                    Hashtable attributes = helper.ReturnAttributes(tag.Groups[1].Value);
                    string div = macro.renderMacroStartTag(attributes, nodeId, versionId).Replace("&quot;", "&amp;quot;");

                    // Insert macro contents here...
                    macro m;
                    if (helper.FindAttribute(attributes, "macroID") != "")
                        m = new macro(int.Parse(helper.FindAttribute(attributes, "macroID")));
                    else {
                        // legacy: Check if the macroAlias is typed in lowercasing
                        string macroAlias = helper.FindAttribute(attributes, "macroAlias");
                        if (macroAlias == "") {
                            macroAlias = helper.FindAttribute(attributes, "macroalias");
                            attributes.Remove("macroalias");
                            attributes.Add("macroAlias", macroAlias);
                        }

                        if (macroAlias != "")
                            m = new macro(Macro.GetByAlias(macroAlias).Id);
                        else
                            throw new ArgumentException("umbraco is unable to identify the macro. No id or macroalias was provided for the macro in the macro tag.", tag.Groups[1].Value);
                    }

                    if (helper.FindAttribute(attributes, "macroAlias") == "")
                        attributes.Add("macroAlias", m.Alias);

                    try {
                        div += macro.MacroContentByHttp(nodeId, versionId, attributes);
                    } catch {
                        div += "<span style=\"color: green\">No macro content available for WYSIWYG editing</span>";
                    }

                    div += macro.renderMacroEndTag();
                    content = content.Replace(tag.Groups[1].Value, div);
                } catch (Exception ee) {
                    Log.Add(LogTypes.Error, this._nodeId, "Macro Parsing Error: " + ee.ToString());
                    string div = "<div class=\"umbMacroHolder mceNonEditable\"><p style=\"color: red\"><strong>umbraco was unable to parse a macro tag, which means that parts of this content might be corrupt.</strong> <br /><br />Best solution is to rollback to a previous version by right clicking the node in the tree and then try to insert the macro again. <br/><br/>Please report this to your system administrator as well - this error has been logged.</p></div>";
                    content = content.Replace(tag.Groups[1].Value, div);
                }

            }
            return content;
        }
コード例 #55
0
 void AddCur(DekiContext deki, page cur, XDoc doc, ICollection<string> columns, string filter, int level, bool flat, bool addWrap) {
     if (level < 0)
         return;
     if (addWrap)
         doc.Start("page");
     doc.Attr("cur-id", cur.ID.ToString());
     if (columns.Count == 0 || columns.Contains("parent"))
         doc.Start("parent").Value(cur.ParentID).End();
     if (columns.Count == 0 || columns.Contains("name"))
         doc.Start("name").Value(cur.PrefixedName).End();
     if (columns.Count == 0 || columns.Contains("modified"))
         doc.Start("modified").Value(cur.TimeStamp).End();
     if (columns.Count == 0 || columns.Contains("comment"))
         doc.Start("comment").Value(cur.Comment).End();
     if (columns.Count == 0 || columns.Contains("preview"))
         doc.Start("preview").Value(cur.TIP).End();
     if (columns.Count == 0 || columns.Contains("table-of-contents"))
         doc.Start("table-of-contents").Value(cur.TOC).End();
     if (columns.Count == 0 || columns.Contains("is-redirect"))
         doc.Start("is-redirect").Value(cur.IsRedirect.ToString()).End();
     if (columns.Count == 0 || columns.Contains("from-links"))
         AddCurIDList(cur.GetLinkIDsFrom(), "from-links", doc);
     if (columns.Count == 0 || columns.Contains("to-links"))
         AddCurIDList(cur.GetLinkIDsTo(), "to-links", doc);
     if (columns.Count == 0 || columns.Contains("files")) {
         doc.Start("files");
         foreach (attachments attachment in cur.GetAttachments())
             AddFile(attachment, doc);
         doc.End();
     }
     if (level < 1) {
         if (addWrap)
             doc.End();
         return;
     }
     if (columns.Count == 0 || columns.Contains("children")) {
         if (flat)
             AddCurIDList(cur.GetChildIDs(filter), "children", doc);
         else {
             doc.Start("children");
             foreach (page child in cur.LoadChildren(filter))
                 AddCur(deki, child, doc, columns, filter, level - 1);
             doc.End();
         }
     }
     if (addWrap)
         doc.End();
 }