Beispiel #1
0
        private DataTable ValuesTable(string sXml)
        {
            DataTable dt = null;

            try
            {
                if (!Sql.IsEmptyString(sXml))
                {
                    XmlDocument xml = new XmlDocument();
                    xml.LoadXml(sXml);
                    dt = XmlUtil.CreateDataTable(xml.DocumentElement, "list", new string[] { "text", "value" });
                }
            }
            catch
            {
            }
            return(dt);
        }
Beispiel #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                DataTable dt = Cache.Get("PublicSugarCRMLanguagePacks.xml") as DataTable;
                if (dt == null)
                {
                    XmlDocument xml = new XmlDocument();
                    if (!IsPostBack)
                    {
                        try
                        {
#if DEBUG
                            xml.Load(Server.MapPath("PublicSugarCRMLanguagePacks.xml"));
#else
                            xml.Load("http://demo.splendidcrm.com/Administration/Terminology/Import/PublicSugarCRMLanguagePacks.xml");
#endif
                        }
                        catch
                        {
                            xml.Load(Server.MapPath("PublicSugarCRMLanguagePacks.xml"));
                        }
                    }
                    dt = XmlUtil.CreateDataTable(xml.DocumentElement, "LanguagePack", new string[] { "Name", "Date", "Description", "URL" });
                    Cache.Insert("PublicSugarCRMLanguagePacks.xml", dt, null, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration);
                }

                vwMain             = new DataView(dt);
                vwMain.RowFilter   = "URL > ''";
                vwMain.Sort        = "Name";
                grdMain.DataSource = vwMain;
                if (!IsPostBack)
                {
                    grdMain.DataBind();
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }