public ActionResult AddRow() { DashboardRow DBRow; try { DashboardWidget qw = new DashboardWidget(ConnectionString); GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"]; DBRow = qw.AddRow(DashBoardObject.id, false, -1); if (DashBoardObject.rows == null) DashBoardObject.rows = new List<DashboardRow>(); DashBoardObject.rows.Add(DBRow); Session["DashBoard"] = DashBoardObject; return CS.ReturnForJQuery(DBRow); } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult ActiveDashboard() { try { GetDashboardObject PostDataArrived = CS.GetPostData<GetDashboardObject>(this.Request); ConnectionStringSettings connectionStringSetting = ConfigurationManager.ConnectionStrings["ISTATWebClientConnection"]; if (connectionStringSetting == null || string.IsNullOrEmpty(connectionStringSetting.ConnectionString)) throw new Exception("ConnectionString not set"); DashboardWidget qw = new DashboardWidget(connectionStringSetting.ConnectionString); return CS.ReturnForJQuery(qw.Active(PostDataArrived.id, PostDataArrived.active)); } catch (Exception ex) { return CS.ReturnForJQuery(JSONConst.Error); } }
public ActionResult AddWidget() { WidgetObject woRet; try { DashboardWidget qw = new DashboardWidget(ConnectionString); GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"]; WidgetObject PostDataArrived = CS.GetPostData<WidgetObject>(this.Request); woRet = qw.AddWidget(PostDataArrived); DashboardRow dbRow = DashBoardObject.rows.Find(r => r.id == woRet.rowID); if(dbRow.widgets == null) dbRow.widgets = new List<WidgetObject>(); dbRow.widgets.Add(woRet); Session["DashBoard"] = DashBoardObject; return CS.ReturnForJQuery(woRet); } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult UpdateRow() { try { DashboardWidget qw = new DashboardWidget(ConnectionString); DashboardRow UpdatedDashBoardRow; DashboardRow PostDataArrived = CS.GetPostData<DashboardRow>(this.Request); GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"]; UpdatedDashBoardRow = qw.UpdateRow(PostDataArrived); var row_widget = DashBoardObject.rows.Find(c => c.id == PostDataArrived.id); UpdatedDashBoardRow.widgets = row_widget.widgets; DashBoardObject.rows.Remove(row_widget); DashBoardObject.rows.Add(UpdatedDashBoardRow); Session["DashBoard"] = DashBoardObject; return CS.ReturnForJQuery(UpdatedDashBoardRow); } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult GetDashboardsActive() { try { DashboardWidget qw = new DashboardWidget(ConnectionString); GetDashboardObject PostDataArrived = CS.GetPostData<GetDashboardObject>(this.Request); return CS.ReturnForJQuery(qw.Load(-1, true)); } catch (Exception ex) { return CS.ReturnForJQuery(JSONConst.Error); } }
public ActionResult PreviewDashboard() { try { GetDashboardObject PostDataArrived = CS.GetPostData<GetDashboardObject>(this.Request); List<GetDashboardObject> DashBoardObject; DashboardWidget qw = new DashboardWidget(ConnectionString); DashBoardObject = qw.Load(PostDataArrived.id); Session["DashBoard"] = DashBoardObject[0]; return CS.ReturnForJQuery(DashBoardObject); } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult GetDashboards() { try { DashboardWidget qw = new DashboardWidget(ConnectionString); if (ConnectionString.ToLower() != "file") return CS.ReturnForJQuery(qw.Load()); else return null; } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult DeleteWidget() { bool ret = true; try { DashboardWidget qw = new DashboardWidget(ConnectionString); GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"]; WidgetObject PostDataArrived = CS.GetPostData<WidgetObject>(this.Request); ret = qw.DeleteWidget(PostDataArrived.id); DashboardRow dRow = DashBoardObject.rows.Find(r => r.widgets.Find(w => w.id == PostDataArrived.id) != null); dRow.widgets.Remove(dRow.widgets.Find(w => w.id == PostDataArrived.id)); Session["DashBoard"] = DashBoardObject; return CS.ReturnForJQuery(ret); } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult DeleteRow() { DashboardRow DBRow = CS.GetPostData<DashboardRow>(this.Request); try { DashboardWidget qw = new DashboardWidget(ConnectionString); GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"]; qw.DeleteRow(DBRow.id); DashBoardObject.rows.Remove(DashBoardObject.rows.Find(c => c.id == DBRow.id)); Session["DashBoard"] = DashBoardObject; return CS.ReturnForJQuery(DBRow); } catch (Exception ex) { return CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult() { Msg = ex.Message })); } }
public ActionResult DeleteDashboard() { try { GetDashboardObject DashBoardObject = CS.GetPostData<GetDashboardObject>(this.Request); DashboardWidget dBWidget = new DashboardWidget(ConnectionString); //DashBoardObject.id = dBWidget.CreateDashBoard(DashBoardObject); if (DashBoardObject.id == -1) return CS.ReturnForJQuery(JSONConst.Error); ConnectionStringSettings connectionStringSetting = ConfigurationManager.ConnectionStrings["ISTATWebClientConnection"]; if (connectionStringSetting == null || string.IsNullOrEmpty(connectionStringSetting.ConnectionString)) throw new Exception("ConnectionString not set"); DashboardWidget qw = new DashboardWidget(connectionStringSetting.ConnectionString); return CS.ReturnForJQuery((qw.Delete(DashBoardObject.id)) ? JSONConst.Success : JSONConst.Error); } catch (Exception ex) { return CS.ReturnForJQuery(JSONConst.Error); } }
public ActionResult CreateDashboard() { try { GetDashboardObject DashBoardObject = CS.GetPostData<GetDashboardObject>(this.Request); DashboardWidget dBWidget = new DashboardWidget(ConnectionString); DashBoardObject.id = dBWidget.CreateDashBoard(DashBoardObject); if (DashBoardObject.id == -1) return CS.ReturnForJQuery(JSONConst.Error); Session["DashBoard"] = DashBoardObject; AddRow(); return CS.ReturnForJQuery(DashBoardObject); } catch (Exception ex) { return CS.ReturnForJQuery(JSONConst.Error); } }