public string MoveFrame(string pageId, string frameId, string pageType, int height, string ctrl) { string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey")); if (ctrl != crlHash) return string.Empty; db_config_frame dcf = null; try { int fid = Convert.ToInt32(frameId); int pid = Convert.ToInt32(pageId); dcf = new db_config_frame(pid); dcf.Open(); int y = dcf.Get(fid).Y; List<Frame> frames = (from f in dcf.AllFrames where f.Y >= y select f).ToList(); foreach (Frame f in frames) { f.Y = f.Y + height; } dcf.Commit(); return "Frame moved"; } catch (Exception ex) { return ex.Message; } finally { if (dcf != null) dcf.Close(); } }
public string GetFrame(string frameId, string ctrl) { JavaScriptSerializer js = new JavaScriptSerializer(); string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey")); if (ctrl != crlHash) return string.Empty; db_config_frame dcf = null; try { int id = Convert.ToInt32(frameId); dcf = new db_config_frame(id, false); dcf.Open(); Frame f = dcf.Get(id); return js.Serialize(new Dictionary<string, object> { {"ID", f.ID}, {"PageId", f.IDPage}, {"Title", f.Title}, {"X", f.X}, {"Y", f.Y}, {"Width", f.Width}, {"Height", f.Height}, {"FrameType", f.FrameType}, {"Scroll", f.Scroll}, {"Options", f.Options}, {"IsActive", f.IsActive}, {"ScheduleInterval", f.ScheduleInterval}, }); } catch (Exception ex) { loging.Error("BackOffice Frames Webservice", "Get Frame", ex.Message, _logRecord); } finally { if (dcf != null) dcf.Close(); } return js.Serialize(""); }
/// <summary> /// Delete frame by id /// </summary> private static void DeleteFrame(int id) { db_config_frame dcf = null; try { dcf = new db_config_frame(id, false); dcf.Open(); dcf.Delete(id); } catch (Exception ex) { throw new Exception("error: Delete Frame: " + ex.Message); } finally { if (dcf != null) dcf.Close(); } }