/* PUBLIC */ public List<Dictionary<string, string>> GetQueries() { List<Dictionary<string, string>> queries = new List<Dictionary<string, string>>(); // leaves if imput values are not all correct if (_scheduleInterval < 0 || _dbFilePath == string.Empty || _xmlFolderPath == string.Empty) return queries; db_config_page pages = new db_config_page(); // open the connection to the sqlite database pages.Open(_dbFilePath); foreach (Page page in pages.AllPages) { // get folder path string path = !page.XMLFolderPath.StartsWith("default") & page.XMLFolderPath != string.Empty ? page.XMLFolderPath.Trim() : _xmlFolderPath.Trim(); List<Frame> frames = (from f in pages.GetAllFrames(page.ID) where f.ScheduleInterval == _scheduleInterval && f.IsActive == 1 select f).ToList(); foreach (Frame frame in frames) { // add the options to the option smasher :) to get the individual strings OptionItems oi = new OptionItems(frame.Options); string frameTitle = frame.Title; string pageTitle = page.Title; string sql = oi.GetSingle("sql"); // first sql found string conn = oi.GetSingle("conn"); // first conn found string xmlFile = oi.GetSingle("xml_file"); // forst xml file found // if any of the above strins its empty, its because the user did someting very bad if (sql != string.Empty && conn != string.Empty && xmlFile != string.Empty) { // if the xml file contains ":\" its because its a c:\bla bla or d:\bla bla or someting like that. queries.Add(BuildQueryObject( sql, conn, path.EndsWith(@"\") ? path + xmlFile : path + @"\" + xmlFile, pageTitle, frameTitle )); } } } return queries; }
public string ListFrames(string pageId, string ctrl) { JavaScriptSerializer js = new JavaScriptSerializer(); string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey")); if (ctrl != crlHash) return string.Empty; db_config_page dcp = null; try { int id = Convert.ToInt32(pageId); dcp = new db_config_page(id, true); dcp.Open(); List<Frame> frames = dcp.GetAllFrames(id); List<Dictionary<string, object>> rows = frames.Select(f => new Dictionary<string, object> { {"ID", f.ID}, {"Title", f.Title}, {"FrameType", f.FrameType}, {"X", f.X}, {"Y", f.Y}, {"Width", f.Width}, {"Height", f.Height}, {"IsActive", f.IsActive}, {"Columnspan", new OptionItems(f.Options).GetSingle("columnspan")}, {"Rowspan", new OptionItems(f.Options).GetSingle("rowspan")}, }).ToList(); return js.Serialize(rows); } catch (Exception ex) { loging.Error("BackOffice Frames Webservice", "List Frames", ex.Message, _logRecord); } finally { if (dcp != null) dcp.Close(); } return js.Serialize(""); }