/// <summary> /// Inits the routing paths /// Directly connected to the Routing Config file and will reset once the file is changed. /// For routing to work global.asax must be included on the root of the website /// and must inherit lw.Base.Global, /// You can create your own Global File and call Initrouting yourself in Application_BeginRequest /// </summary> public static void InitRouting() { if (RouteTable.Routes.Count > 0) { return; } RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}"); RouteTable.Routes.Ignore("{resource}.lwjs"); RouteTable.Routes.Ignore("{resource}.Less"); ///Inline CMS Paths RouteTable.Routes.MapPageRoute( "Inline CMS", lw.CTE.cms.InlineCMSVirutalPath, lw.CTE.cms.InlineCMSRealPath ); RouteTable.Routes.MapPageRoute( "Inline CMS Logout", lw.CTE.cms.InlineCMSVirualLogoutPath, lw.CTE.cms.InlineCMSrealLogoutPath ); DataSet urlRoutingDS = XmlManager.GetDataSet(CTE.Content.UrlRouting, ResetRouting); if (urlRoutingDS != null) { DataTable urlRouting = urlRoutingDS.Tables["UrlRouting"]; if (urlRouting != null) { foreach (DataRow routing in urlRouting.Rows) { RouteTable.Routes.MapPageRoute( routing["Description"].ToString().Trim(), routing["Route"].ToString().Trim(), routing["Redirection"].ToString().Trim() ); } } } }
public void _initThreads() { //ThreadsCollection.Add("Minutly", new Minutly()); //ThreadsCollection.Add("Hourly", new Hourly()); //ThreadsCollection.Add("Daily", new Daily()); //ThreadsCollection.Add("Weekly", new Weekly()); //ThreadsCollection.Add("Monthly", new Monthly()); //ThreadsCollection.Add("Yearly", new Yearly()); DataSet threadingDs = XmlManager.GetDataSet(CTE.Content.Threadings); if (threadingDs != null) { DataTable threadTable = threadingDs.Tables["Threadings"]; if (threadTable != null) { foreach (DataRow dr in threadTable.Rows) { string key = dr["Description"].ToString(); if (ThreadsCollection.Keys.Contains(key)) { continue; } var thread = (ThreadingBase)ObjectTools.InstanceOfStringClass((string)dr["AssemblyName"], (string)dr["ClassName"]); thread.Repeat = (RepeatPattern)Enum.Parse(typeof(RepeatPattern), dr["Pattern"].ToString()); thread.StartDate = (DateTime)dr["StartDate"]; thread.Key = key; thread.AddToGlobalThreads(); ThreadsCollection.Add(key, thread); } } } }
public PrivacySettingsManager() { ds = XmlManager.GetDataSet(MembersSettings.PrivacyFile); }
/// <summary> /// Creates the data /// </summary> void getData() { if (DataSrc == null) { if (!Visible) { DataSrc = new EmptyDataSrc(); } else { // Connects to the database if (data == null) { if (!String.IsNullOrWhiteSpace(SelectCommand)) { if (enablePaging) { dataSrc = new PagingDataSource(selectCommand, _Page, OrderBy, DataLibrary); ((PagingDataSource)dataSrc).PageSize = PageSize; } else { dataSrc = new DataSource(selectCommand, OrderBy, DataLibrary); } try { data = dataSrc.GetData(); } catch (Exception ex) { ErrorContext.Add("CustomDataSource", ex); ErrorContext.Add("CustomDataSource-Select", SelectCommand); } checkEmptyValue((DataTable)data); } } // Use Config files if (data == null) { if (!String.IsNullOrWhiteSpace(configFile)) { DataSet ds = XmlManager.GetDataSet(configFile); if (ds != null && ds.Tables.Count > 0) { if (!String.IsNullOrWhiteSpace(configTable)) { data = ds.Tables[configTable]; } else { data = ds.Tables[0]; } if (!String.IsNullOrEmpty(OrderBy)) { data = new DataView((DataTable)data, "", OrderBy, DataViewRowState.CurrentRows); checkEmptyValue((DataView)data); } else { checkEmptyValue((DataTable)data); } } } } // Use an enum type if (data == null) { if (!String.IsNullOrWhiteSpace(enumType)) { string[] temp = enumType.Split(','); Assembly assem = Assembly.Load(temp[1]); Type typ = assem.GetType(temp[0]); FieldInfo[] fields = typ.GetFields(); DataTable table = new DataTable(); table.Columns.Add("Value"); table.Columns.Add("Name"); table.Columns.Add("NameAttribute"); table.Columns.Add("DescriptionAttribute"); table.Columns.Add("PermissionGroupAttribute"); checkEmptyValue(table); foreach (var field in fields) { if (field.Name.Equals("value__")) { continue; } DataRow row = table.NewRow(); row["Value"] = field.GetRawConstantValue(); row["Name"] = field.Name; row["NameAttribute"] = EnumHelper.GetName((Enum)Enum.Parse(typ, field.Name)); row["DescriptionAttribute"] = EnumHelper.GetDescription((Enum)Enum.Parse(typ, field.Name)); row["PermissionGroupAttribute"] = EnumHelper.GetPermissionGroup((Enum)Enum.Parse(typ, field.Name)); table.Rows.Add(row); } data = table; } } // Use Direct string input 1,2,3 if (data == null) { if (!String.IsNullOrWhiteSpace(dataString)) { string[] temp = dataString.Split(new Char[] { ',', ';', '|', '`' }); DataTable table = new DataTable(); table.Columns.Add("Value"); table.Columns.Add("Name"); checkEmptyValue(table); if (!String.IsNullOrWhiteSpace(DataStringValues)) { string[] valuesTemp = DataStringValues.Split(new char[] { ',', ';', '-', '`' }); try { if (valuesTemp.Length != temp.Length) { throw new Exception("DataString and DataStringValues must have equal amount of values"); } else { for (int i = 0; i < temp.Length; i++) { DataRow row = table.NewRow(); row["Value"] = valuesTemp[i]; row["Name"] = temp[i]; table.Rows.Add(row); data = table; } } } catch (Exception ex) { ErrorContext.Add("CustomDataSource", ex.Message); } } else { foreach (string str in temp) { DataRow row = table.NewRow(); row["Value"] = str; row["Name"] = str; table.Rows.Add(row); data = table; } } } } if (dataSrc == null && data != null) { EmptyDataSrc tempSrc = new EmptyDataSrc(); tempSrc.Data = data; if (data != null) { if (data as DataView != null) { tempSrc.RowsCount = ((DataView)data).Table.Rows.Count; } else { tempSrc.RowsCount = ((DataTable)data).Rows.Count; } tempSrc.HasData = tempSrc.RowsCount > 0; } dataSrc = tempSrc; } } } else { data = DataSrc.Data; } }