當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlDataDocument.SelectSingleNode方法代碼示例

本文整理匯總了C#中System.Xml.XmlDataDocument.SelectSingleNode方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlDataDocument.SelectSingleNode方法的具體用法?C# XmlDataDocument.SelectSingleNode怎麽用?C# XmlDataDocument.SelectSingleNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlDataDocument的用法示例。


在下文中一共展示了XmlDataDocument.SelectSingleNode方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        string connStr = "Data Source=.\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=SSPI;";

        using (SqlConnection conn = new SqlConnection(connStr))
        {
            SqlCommand command = new SqlCommand("select * from customers", conn);
            conn.Open();
            DataSet ds = new DataSet();
            ds.DataSetName = "Customers";
            ds.Load(command.ExecuteReader(), LoadOption.OverwriteChanges, "Customer");
            //Response.ContentType = "text/xml";
            //ds.WriteXml(Response.OutputStream);

            //Added in Listing 13-15
            XmlDataDocument doc = new XmlDataDocument(ds);
            doc.DataSet.EnforceConstraints = false;
            XmlNode node = doc.SelectSingleNode(@"//Customer[CustomerID = 'ANATR']/ContactTitle");
            node.InnerText = "Boss";
            doc.DataSet.EnforceConstraints = true;

            DataRow dr = doc.GetRowFromElement((XmlElement)node.ParentNode);
            Response.Write(dr["ContactName"].ToString() + " is the ");
            Response.Write(dr["ContactTitle"].ToString());
        }
    }
開發者ID:kacecode,項目名稱:SchoolWork,代碼行數:26,代碼來源:Default.aspx.cs

示例2: AddLink

        public void AddLink(string title, string uri)
        {
            XmlDocument doc = new XmlDataDocument();
            doc.Load("RssLinks.xml");
            XmlNode rootNode = doc.SelectSingleNode("links");

            XmlNode linkNode = doc.CreateElement("link");

            XmlNode titleNode = doc.CreateElement("title");
            XmlText titleText = doc.CreateTextNode(title);
            titleNode.AppendChild(titleText);

            XmlNode uriNode = doc.CreateElement("uri");
            XmlText uriText = doc.CreateTextNode(uri);
            uriNode.AppendChild(uriText);

            XmlNode defaultshowNode = doc.CreateElement("defaultshow");
            XmlText defaultshowText = doc.CreateTextNode("false");
            defaultshowNode.AppendChild(defaultshowText);

            linkNode.AppendChild(titleNode);
            linkNode.AppendChild(uriNode);
            linkNode.AppendChild(defaultshowNode);

            rootNode.AppendChild(linkNode);

            doc.Save("RssLinks.xml");
        }
開發者ID:jun-quan-Lai,項目名稱:RSSReader,代碼行數:28,代碼來源:RssLinkXML.cs

示例3: loaddata

    public void loaddata()
    {
        XmlDataDocument xml = new XmlDataDocument();
        xml.Load(Server.MapPath("~/" + "ad.xml"));

        XmlNodeList nodes = xml.SelectSingleNode("ttt").ChildNodes;

        DataTable dt = new DataTable();

        dt.Columns.Add("index", typeof(string));
        dt.Columns.Add("src", typeof(string));
        dt.Columns.Add("href", typeof(string));
        dt.Columns.Add("target", typeof(string));

        foreach (XmlNode node in nodes)
        {
            DataRow row = dt.NewRow();

            row["href"] = node.Attributes["href"].Value;
            row["src"] = node.Attributes["src"].Value;
            dt.Rows.Add(row);
        }

        DataList4.DataSource = dt;
        DataList4.DataBind();
    }
開發者ID:kavilee2012,項目名稱:kvShop,代碼行數:26,代碼來源:index.aspx.cs

示例4: Main

        static void Main(string[] args)
        {
            string strConn = "Data Source=localhost;Initial Catalog=booksourcedb;Integrated Security=True";
              string strSql = "SELECT * FROM book";
              SqlDataAdapter dataAdapter = new SqlDataAdapter(strSql, strConn);

              DataSet dataSet = new DataSet("booklist");
              dataAdapter.Fill(dataSet, "book");

              XmlDataDocument xdd = new XmlDataDocument(dataSet);

              string xpath = "/booklist/book[bid='b2']";
              XmlElement eBook = (XmlElement)xdd.SelectSingleNode(xpath);

              Console.WriteLine("bid = " + eBook.ChildNodes[0].InnerText);
              Console.WriteLine("kind = " + eBook.ChildNodes[1].InnerText);
              Console.WriteLine("title = " + eBook.ChildNodes[2].InnerText);
              Console.WriteLine("publisher = " + eBook.ChildNodes[3].InnerText);
              Console.WriteLine("price = " + eBook.ChildNodes[4].InnerText);
        }
開發者ID:Choyoungju,項目名稱:XMLDTD,代碼行數:20,代碼來源:XmlDataDocumentSearch.cs

示例5: AddWebConfigNodes

 private void AddWebConfigNodes(string xPath, ref XmlDataDocument xmlDoc, ref WebConfigModifications webConfigMods, ref SPWebApplication webApp)
 {
     foreach (XmlNode node in xmlDoc.SelectSingleNode(xPath))
     {
         if (node.NodeType != XmlNodeType.Comment)
         {
             webConfigMods.AddWebConfigNode(webApp, xPath, node, node.Attributes);
         }
     }
 }
開發者ID:infinitimods,項目名稱:clif-sharepoint,代碼行數:10,代碼來源:WebConfigEntries.cs

示例6: NavigationSearchData

        public NavigationSearchData(string xmltag)
        {
            Id = "";
            FieldId = "";
            Action = "";
            SqlOperator = "";
            SearchFrom = "";
            SearchTo = "";
            SqlType = "";
            SearchField = "";
            SqlField = "";
            ControlType = "";
            Static = "";
            Dependency = "";
            if (xmltag.Trim().StartsWith("<tag"))
            {
                var xdoc = new XmlDataDocument();
                xdoc.LoadXml(xmltag);
                var nodtag = xdoc.SelectSingleNode("tag");
                if (nodtag != null)
                {
                    if (nodtag.Attributes["search"] != null)
                    {
                        SearchField = nodtag.Attributes["search"].Value;
                        var s = SearchField.Split('/');
                        FieldId = s[s.Count() - 1];
                        ControlType = s[s.Count() - 2];
                    }
                    if (nodtag.Attributes["id"] != null) Id = nodtag.Attributes["id"].Value;
                    if (nodtag.Attributes["action"] != null) Action = nodtag.Attributes["action"].Value;
                    if (nodtag.Attributes["sqloperator"] != null) SqlOperator = nodtag.Attributes["sqloperator"].Value;
                    if (nodtag.Attributes["searchfrom"] != null) SearchFrom = nodtag.Attributes["searchfrom"].Value;
                    if (nodtag.Attributes["searchto"] != null) SearchTo = nodtag.Attributes["searchto"].Value;
                    if (nodtag.Attributes["sqltype"] != null) SqlType = nodtag.Attributes["sqltype"].Value;
                    if (nodtag.Attributes["sqlfield"] != null) SqlField = nodtag.Attributes["sqlfield"].Value;
                    if (nodtag.Attributes["static"] != null) Static = nodtag.Attributes["static"].Value;
                    if (nodtag.Attributes["dependency"] != null) Dependency = nodtag.Attributes["dependency"].Value;

                }
            }
        }
開發者ID:DNNMonster,項目名稱:NBrightBuy,代碼行數:41,代碼來源:NavigationData.cs

示例7: Build

        /// <summary>
        /// 
        /// </summary>
        /// <param name="soft"></param>
        public override void Build(CommuniSoft soft)
        {
            System.Collections.Hashtable idStationMap = new System.Collections.Hashtable();
            // build station
            //
            foreach (DataRow stationDR in _stationDataTable.Rows)
            {
                bool isStationDeleted = false;
                if (stationDR["Deleted"] != DBNull.Value)
                {
                    isStationDeleted = Convert.ToBoolean(stationDR["Deleted"]);
                }

                if (!isStationDeleted)
                {
                    string stationName = stationDR["Name"].ToString();
                    bool isExistStation = soft.HardwareManager.Stations.ExistName(stationName, null);
                    if (!isExistStation)
                    {
                        string xml = stationDR["CommuniTypeContent"].ToString().Trim();
                        if (xml.Length == 0)
                        {
                            // TODO: 2010-09-17
                            // log error info
                            //
                            continue;
                        }

                        int stationID = (int)stationDR["StationID"];

                        XmlDataDocument doc = new XmlDataDocument();
                        doc.LoadXml(xml);
                        XmlNode node = doc.SelectSingleNode("socketcommunitype");
                        CommuniType communiType = Xdgk.Communi.XmlBuilder.XmlSocketCommuniBuilder.Build(node);

                        Station station = new Station(stationName, communiType);
                        station.ID = stationID;
                        idStationMap.Add(stationID, station);
                        soft.HardwareManager.Stations.Add(station);
                    }
                }
            }

            // build device
            //
            foreach (DataRow deviceDR in _deviceDataTable.Rows)
            {
                bool isDeviceDeleted = false;
                if (deviceDR["deleted"] != DBNull.Value)
                {
                    isDeviceDeleted = Convert.ToBoolean(deviceDR["Deleted"]);
                }

                if (isDeviceDeleted)
                {
                    continue;
                }

                int stationID = (int)deviceDR["StationID"];
                int deviceID = (int)deviceDR["DeviceID"];
                string deviceType = deviceDR["DeviceType"].ToString();
                string addressString = deviceDR["Address"].ToString().Trim();

                if (addressString.Length == 0)
                    continue;

                int address = Convert.ToInt32(addressString);

                Station st = idStationMap[stationID] as Station;
                if (st == null)
                {
                    continue;
                }

                //DeviceDefine dd = soft.DeviceDefineCollection.FindDeviceDefine(deviceType);
                DeviceDefine dd = soft.DeviceDefineManager.DeviceDefineCollection.FindDeviceDefine(deviceType);
                if (dd == null)
                {
                    bool exist = soft.UnDefineDeviceType.Exist(deviceType);
                    if (!exist)
                    {
                        soft.UnDefineDeviceType.Add(deviceType);
                        string msg = string.Format(strings.UnDefineDeviceType, deviceType);
                        NUnit.UiKit.UserMessage.Display(msg);
                    }
                    continue;
                }

                //Xdgk.Communi.Device device = new Device(dd, "", address);
                Xdgk.Communi.Device device = DeviceFactory.Create(dd, "", address);

                //Xdgk.Communi.Device device = new Device(deviceType, address);
                //string t = soft.OperaFactory.DeviceDefineCollection.GetDeviceText(deviceType);
                //device.Text = t;
                device.ID = deviceID;

//.........這裏部分代碼省略.........
開發者ID:hkiaipc,項目名稱:lx,代碼行數:101,代碼來源:DBHardWareBuilder.cs

示例8: listUsers

        public System.Collections.ArrayList listUsers()
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();

            string cmd = "listUsers";
            ErrorCode = ERR_CODE_UNKNOWN_RESPONSE;
            ErrorMsg = ERR_MSG_UNKNOWN_RESPONSE;    //default error message

            try
            {
                StringBuilder sbReq = new StringBuilder();

                sbReq.Append(String.Format("{0}API?command={1}&session_id={2}", httpUri.AbsoluteUri, cmd, SessionId));

                string resp = sendHTTPRequest(sbReq.ToString());
                if (resp == null)
                    return null;

                XmlDataDocument doc = new XmlDataDocument();

                doc.LoadXml(resp);

                XmlElement element = doc.DocumentElement;
                if (element.Name == "CSL")
                {
                    XmlNode node = doc.SelectSingleNode("CSL/Command");
                    if (node != null)
                    {
                        if (node.InnerXml.Equals("listUsers", StringComparison.OrdinalIgnoreCase))
                        {
                            node = doc.SelectSingleNode("CSL/Account");
                            if (node != null)
                            {
                                while (node != null)
                                {
                                    USER_INFO info = new USER_INFO();

                                    XmlAttributeCollection atts = node.Attributes;
                                    info.username = atts.GetNamedItem("username").Value;
                                    //info.password = atts.GetNamedItem("password").Value;
                                    info.desc = atts.GetNamedItem("desc").Value;
                                    info.level = int.Parse(atts.GetNamedItem("level").Value);

                                    list.Add(info);
                                    node = node.NextSibling;
                                }
                                ErrorCode = ERR_CODE_NO_ERROR;
                                ErrorMsg = "";

                                return list;
                            }

                            node = doc.SelectSingleNode("CSL/Error");
                            if (node != null)
                            {
                                //<Error>
                                foreach (XmlAttribute att in node.Attributes)
                                {
                                    if (att.Name.Equals("msg", StringComparison.OrdinalIgnoreCase))
                                    {
                                        ErrorMsg = att.InnerXml.Substring(6).Trim();
                                    }
                                    else if (att.Name.Equals("code", StringComparison.OrdinalIgnoreCase))
                                    {
                                        Int32.TryParse(att.InnerXml, out ErrorCode);
                                    }
                                }
                                return null;
                            }
                        }
                    }
                }
            }
            catch (WebException wex)
            {
                ErrorMsg = wex.Message;
                return null;
            }
            ErrorMsg = ERR_MSG_UNKNOWN_RESPONSE;
            return null;
        }
開發者ID:riickky45,項目名稱:Triton,代碼行數:81,代碼來源:CS461_HL_API.cs

示例9: getTagDataAllBanks

        public System.Collections.ArrayList getTagDataAllBanks()
        {
            System.Collections.ArrayList tags = new System.Collections.ArrayList();
            try
            {
                StringBuilder sbReq = new StringBuilder();

                sbReq.Append(String.Format("{0}API?command=getCaptureTagsRaw&mode=getAllBanks&session_id={1}", httpUri.AbsoluteUri, SessionId));

                string resp = sendHTTPRequest(sbReq.ToString());
                if (resp == null)
                    return null;

                XmlDataDocument doc = new XmlDataDocument();

                doc.LoadXml(resp);

                XmlElement element = doc.DocumentElement;
                if (element.Name == "CSL")
                {
                    XmlNode node = doc.SelectSingleNode("CSL/Command");
                    if (node != null)
                    {
                        if (node.InnerXml.Equals("getcapturetagsraw", StringComparison.OrdinalIgnoreCase))
                        {
                            node = doc.SelectSingleNode("CSL/TagList/tagAllBanks");
                            if (node != null)
                            {
                                //<Ack>
                                TAG_MULTI_BANKS tag;
                                while (node != null)
                                {
                                    tag = new TAG_MULTI_BANKS();
                                    foreach (XmlAttribute att in node.Attributes)
                                    {
                                        if (att.Name.Equals("capturepoint_id", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.CapturePointId = att.InnerXml.Trim();
                                        }
                                        else if (att.Name.Equals("freq", StringComparison.OrdinalIgnoreCase))
                                        {
                                            if (att.InnerXml != null)
                                            {
                                                double d;
                                                if (double.TryParse(att.InnerXml, out d))
                                                {
                                                    tag.Frequency = d * 0.05 + 860.0;
                                                }
                                            }
                                        }
                                        else if (att.Name.Equals("index", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.Index = att.InnerXml.Trim();
                                        }
                                        else if (att.Name.Equals("rssi", StringComparison.OrdinalIgnoreCase))
                                        {
                                            if (att.InnerXml != null)
                                            {
                                                double d;
                                                double.TryParse(att.InnerXml, out d);
                                            }
                                        }
                                        else if (att.Name.Equals("bank1", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.EPC = att.InnerXml.Trim().Substring(8);
                                        }
                                        else if (att.Name.Equals("bank2", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.TID = att.InnerXml.Trim();
                                        }
                                        else if (att.Name.Equals("bank3", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.UserMemory = att.InnerXml.Trim();
                                        }
                                        else if (att.Name.Equals("time", StringComparison.OrdinalIgnoreCase))
                                        {
                                            int.TryParse(att.InnerXml, out tag.Time);
                                        }
                                    }
                                    tag.ApiTimeStampUTC = DateTime.UtcNow;
                                    tags.Add(tag);
                                    node = node.NextSibling;
                                }
                                ErrorCode = ERR_CODE_NO_ERROR;
                                ErrorMsg = "";
                                return tags;
                            }
                            node = doc.SelectSingleNode("CSL/Error");
                            if (node != null)
                            {
                                //<Error>
                                foreach (XmlAttribute att in node.Attributes)
                                {
                                    if (att.Name.Equals("msg", StringComparison.OrdinalIgnoreCase))
                                    {
                                        ErrorMsg = att.InnerXml.Substring(6).Trim();
                                    }
                                    else if (att.Name.Equals("code", StringComparison.OrdinalIgnoreCase))
                                    {
                                        Int32.TryParse(att.InnerXml, out ErrorCode);
//.........這裏部分代碼省略.........
開發者ID:riickky45,項目名稱:Triton,代碼行數:101,代碼來源:CS461_HL_API.cs

示例10: getCaptureTagsRaw

        public System.Collections.ArrayList getCaptureTagsRaw(string mode)
        {
            System.Collections.ArrayList tags = new System.Collections.ArrayList();
            try
            {
                StringBuilder sbReq = new StringBuilder();

                sbReq.Append(String.Format("{0}API?command=getCaptureTagsRaw&mode={1}&session_id={2}", httpUri.AbsoluteUri, mode, SessionId));

                string resp = sendHTTPRequest(sbReq.ToString());
                if (resp == null)
                    return null;

                XmlDataDocument doc = new XmlDataDocument();

                doc.LoadXml(resp);

                XmlElement element = doc.DocumentElement;
                if (element.Name == "CSL")
                {
                    XmlNode node = doc.SelectSingleNode("CSL/Command");
                    if (node != null)
                    {
                        if (node.InnerXml.Equals("getcapturetagsraw", StringComparison.OrdinalIgnoreCase))
                        {
                            node = doc.SelectSingleNode("CSL/TagList/tagEPC");
                            if (node != null)
                            {
                                //<Ack>
                                TAG tag;
                                while (node != null)
                                {
                                    tag = new TAG();
                                    foreach (XmlAttribute att in node.Attributes)
                                    {
                                        if (att.Name.Equals("capturepoint_id", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.Antenna = att.InnerXml;
                                        }
                                        else if (att.Name.Equals("capturepoint_name", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.CapturePointId = att.InnerXml;
                                        }
                                        else if (att.Name.Equals("freq", StringComparison.OrdinalIgnoreCase))
                                        {
                                            if (att.InnerXml != null)
                                            {
                                                double d;
                                                if (double.TryParse(att.InnerXml, out d))
                                                {
                                                    tag.Frequency = d * 0.05 + 860.0;
                                                }
                                            }
                                        }
                                        else if (att.Name.Equals("index", StringComparison.OrdinalIgnoreCase))
                                        {
                                            string s = att.InnerXml;
                                            if (s.Length > 1)
                                            {
                                                tag.Index = s.Substring(1);
                                                tag.session = s.Substring(0, 1);
                                            }

                                        }
                                        else if (att.Name.Equals("rssi", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.RSSI = double.Parse(att.InnerXml);
                                        }
                                        else if (att.Name.Equals("tag_id", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.TagOrigId = att.InnerXml;
                                        }
                                        else if (att.Name.Equals("time", StringComparison.OrdinalIgnoreCase))
                                        {
                                            int.TryParse(att.InnerXml, out tag.Time);
                                        }
                                        else if (att.Name.Equals("event_id", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.EventId = att.InnerXml;
                                        }
                                        else if (att.Name.Equals("reader_ip", StringComparison.OrdinalIgnoreCase))
                                        {
                                            tag.ServerIp = att.InnerXml;
                                        }
                                    }
                                    tag.ApiTimeStampUTC = DateTime.UtcNow;
                                    tag.ServerIp = httpUri.Host;
                                    tags.Add(tag);
                                    node = node.NextSibling;
                                }
                                ErrorCode = ERR_CODE_NO_ERROR;
                                ErrorMsg = "";
                                return tags;
                            }
                            node = doc.SelectSingleNode("CSL/Error");
                            if (node != null)
                            {
                                //<Error>
                                foreach (XmlAttribute att in node.Attributes)
                                {
//.........這裏部分代碼省略.........
開發者ID:riickky45,項目名稱:Triton,代碼行數:101,代碼來源:CS461_HL_API.cs

示例11: Populate_ViewCalendar


//.........這裏部分代碼省略.........
            dr[0] = dr[0] + "\"parentId\":" + contentdata.get_Item(i).FolderId + ",";
            dr[0] = dr[0] + "\"languageId\":" + contentdata.get_Item(i).Language + ",";
            dr[0] = dr[0] + "\"status\":\"" + contentStatus + "\",";
            dr[0] = dr[0] + "\"guid\":\"" + dmsMenuGuid + "\",";
            dr[0] = dr[0] + "\"communityDocumentsMenu\":\"\",";
            dr[0] = dr[0] + "\"contentType\":" + Convert.ToInt32(contentdata.get_Item(i).ContentType) + ",";
            dr[0] = dr[0] + "\"dmsSubtype\":\"\"}\'";
            dr[0] = dr[0] + " id=\"dmsContentInfo" + makeUnique + "\" />";
            dr[0] = dr[0] + "<img src=\"" + _ContentApi.ApplicationPath + "images/ui/icons/calendarViewDay.png\" onclick=\"event.cancelBubble=true;\" />";
            dr[0] = dr[0] + "<a";
            dr[0] = dr[0] + " id=\"dmsViewItemAnchor" + makeUnique + "\"";
            dr[0] = dr[0] + " class=\"dmsViewItemAnchor\"";
            dr[0] = dr[0] + " onclick=\"event.cancelBubble=true;\"";
            if (contentdata.get_Item(i).ContentStatus == "A")
            {
                ViewUrl = (string)("content.aspx?action=View&folder_id=" + _Id + "&id=" + contentdata.get_Item(i).Id + "&LangType=" + contentdata.get_Item(i).Language + "&callerpage=content.aspx&origurl=" + EkFunctions.UrlEncode(Request.ServerVariables["QUERY_STRING"]));
            }
            else
            {
                ViewUrl = (string)("content.aspx?action=ViewStaged&folder_id=" + _Id + "&id=" + contentdata.get_Item(i).Id + "&LangType=" + contentdata.get_Item(i).Language + "&callerpage=content.aspx&origurl=" + EkFunctions.UrlEncode(Request.ServerVariables["QUERY_STRING"]));
            }
            dr[0] = dr[0] + " href=\"" + ViewUrl + "\"";
            dr[0] = dr[0] + " title=\"View " + contentdata.get_Item(i).Title + "\"";
            dr[0] = dr[0] + ">";
            dr[0] = dr[0] + contentdata.get_Item(i).Title;
            dr[0] = dr[0] + "</a>";
            dr[0] = dr[0] + "</p>";
            dr[0] = dr[0] + "</div>";

            System.Xml.XmlDataDocument xd = new System.Xml.XmlDataDocument();
            try
            {
                xd.LoadXml(contentdata.get_Item(i).Html);
                System.Xml.XmlNode UTCstartDTXn = xd.SelectSingleNode("/root/StartTime");
                if (UTCstartDTXn != null)
                {
                    System.Xml.XmlNode alldayXn = xd.SelectSingleNode("/root/IsAllDay");
                    bool alldayBool = false;
                    DateTime UTCstartDT = new DateTime();
                    System.Globalization.CultureInfo ENci = new System.Globalization.CultureInfo(1033);
                    System.Globalization.CultureInfo userCi = EkFunctions.GetCultureInfo(_ContentApi.RequestInformationRef.UserCulture.ToString());
                    Ektron.Cms.Common.Calendar.TimeZoneInfo userTzi;

                    UTCstartDT = DateTime.ParseExact(UTCstartDTXn.InnerText, "s", ENci.DateTimeFormat);
                    userTzi = Ektron.Cms.Common.Calendar.TimeZoneInfo.GetTimeZoneInfo(_ContentApi.RequestInformationRef.UserTimeZone);
                    DateTime LocalstartDT = userTzi.ConvertUtcToTimeZone(UTCstartDT);
                    bool.TryParse(alldayXn.InnerText, out alldayBool);

                    if (!(LocalstartDT.Hour == 0 && LocalstartDT.Minute == 0) && !alldayBool)
                    {
                        if (userCi.DateTimeFormat.PMDesignator == string.Empty) //no ampm designator
                        {
                            dr[1] = LocalstartDT.ToString("ddd, MMM d yyyy hh:mm", userCi.DateTimeFormat) + " (" + userTzi.StandardName + ")"; //first occurence
                        }
                        else
                        {
                            dr[1] = LocalstartDT.ToString("ddd, MMM d yyyy h:mm tt", userCi.DateTimeFormat) + " (" + userTzi.StandardName + ")"; //first occurence
                        }
                    }
                    else if (alldayBool)
                    {
                        dr[1] = UTCstartDT.ToString("ddd, MMM d yyyy", userCi.DateTimeFormat); //first occurence
                    }
                    else
                    {
                        dr[1] = LocalstartDT.ToString("ddd, MMM d yyyy", userCi.DateTimeFormat) + " (" + userTzi.StandardName + ")"; //first occurence
開發者ID:jaytem,項目名稱:minGit,代碼行數:67,代碼來源:viewfolder.ascx.cs

示例12: Create

        /// <summary>
        /// 
        /// </summary>
        /// <param name="stationSource"></param>
        /// <returns></returns>
        public Xdgk.Communi.Station Create(object stationSource)
        {
            if (stationSource == null)
            {
                throw new ArgumentNullException("stationSource");
            }

            DataRow stationDR = stationSource as DataRow;
            if (stationDR == null)
            {
                string msg = string.Format("stationSource is not a data row");
                throw new ArgumentException(msg);
            }

            int stationID = (int)stationDR["StationID"];
            string stationName = stationDR["Name"].ToString();
            string xml = stationDR["CommuniTypeContent"].ToString().Trim();

            if (xml.Length == 0)
            {
                // TODO: 2010-09-17
                // log error info
                //
                //continue;
            }

            XmlDataDocument doc = new XmlDataDocument();
            doc.LoadXml(xml);
            XmlNode node = doc.SelectSingleNode("socketcommunitype");
            CommuniType communiType = Xdgk.Communi.XmlBuilder.XmlSocketCommuniBuilder.Build(node);

            Station station = new Station(stationName, communiType);
            station.ID = stationID;

            return station;
        }
開發者ID:hkiaipc,項目名稱:c2,代碼行數:41,代碼來源:Class1.cs


注:本文中的System.Xml.XmlDataDocument.SelectSingleNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。