public bool Update() { //Update this object bool bRet = false; try { LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); LayoutDS.LayoutTableRow row = (LayoutDS.LayoutTableRow)ds.LayoutTable.Select("ViewName='" + this._viewname + "' AND ScheduleName='" + this._schedulename + "' AND Key='" + this._key + "'")[0]; //row.ViewName = this._viewname; //row.ScheduleName = this._schedulename; //row.Key = this._key; row.VisiblePosition = this._visibleposition; row.Visible = this._visible; row.Caption = this._caption; row.Width = this._width; row.Alignment = this._alignment; row.Format = this._format; row.NullText = this._nulltext; row.Sort = this._sort; row.SortOrder = this._sortorder; row.GroupBy = this._groupby; ds.LayoutTable.AcceptChanges(); bRet = this.mMediator.ExecuteNonQuery(App.LAYOUT_FILE, new object[] { ds }); if (this.EntryChanged != null) { this.EntryChanged(this, new EventArgs()); } } catch (Exception ex) { throw ex; } return(bRet); }
public void Read() { //Read this layout view try { //Read from data store this.mLayout.Clear(); try { LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); if (this.mViewName.Length > 0) { //Existing view this.mLayout.Merge(ds.LayoutTable.Select("ViewName='" + this.mViewName + "' AND ScheduleName='" + this.mScheduleName + "'")); } else { //New view this.mLayout.Merge(ds.LayoutTable.Select("ViewName='Default' AND ScheduleName='" + this.mScheduleName + "'")); for (int i = 0; i < this.mLayout.LayoutTable.Rows.Count; i++) { this.mLayout.LayoutTable[i].ViewName = ""; } } if (this.ViewChanged != null) { this.ViewChanged(this, new EventArgs()); } } catch (Exception) { } } catch (Exception ex) { throw ex; } }
public void SetActiveView(string viewName) { // try { //Capture this.mActiveView = new LayoutView(viewName, this.mScheduleName, this.mMediator); //Read data store LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUTVIEWS_FILE, "", null)); //Remove current active layout, and set new active layout LayoutDS.ViewTableRow[] rows; rows = (LayoutDS.ViewTableRow[])ds.ViewTable.Select("ScheduleName='" + this.mScheduleName + "' AND Active=true"); if (rows.Length > 0) { rows[0].Active = false; } rows = (LayoutDS.ViewTableRow[])ds.ViewTable.Select("ScheduleName='" + this.mScheduleName + "' AND ViewName='" + viewName + "'"); if (rows.Length > 0) { rows[0].Active = true; } //Update data store ds.ViewTable.AcceptChanges(); this.mMediator.ExecuteNonQuery(App.LAYOUTVIEWS_FILE, new object[] { ds }); Read(); } catch (Exception ex) { throw ex; } }
public void Create() { //Create a new layout view try { //Create new layout in data store LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); //Create views entry in the view store ds.ViewTable.AddViewTableRow(this.mViewName, this.mScheduleName, false); //Create layout entries in the data store ds.Merge(this.mLayout); ds.LayoutTable.AcceptChanges(); this.mMediator.ExecuteNonQuery(App.LAYOUT_FILE, new object[] { ds }); Read(); } catch (Exception ex) { throw ex; } }
public void Update(LayoutDS layout) { //Update this entire layout view try { //Delete existing layout in data store LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); LayoutDS.LayoutTableRow[] rows = (LayoutDS.LayoutTableRow[])ds.LayoutTable.Select("ViewName='" + this.mViewName + "' AND ScheduleName='" + this.mScheduleName + "'"); for (int i = 0; i < rows.Length; i++) { rows[i].Delete(); } //Add updated layout to data store ds.Merge(layout); ds.LayoutTable.AcceptChanges(); this.mMediator.ExecuteNonQuery(App.LAYOUT_FILE, new object[] { ds }); Read(); } catch (Exception ex) { throw ex; } }
public bool Create() { //Save this object bool bRet = false; try { LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); ds.LayoutTable.AddLayoutTableRow(this._viewname, this._schedulename, this._key, this._visibleposition, this._visible, this._caption, this._width, this._alignment, this._format, this._nulltext, this._sort, this._sortorder, this._groupby); ds.LayoutTable.AcceptChanges(); bRet = this.mMediator.ExecuteNonQuery(App.LAYOUT_FILE, new object[] { ds }); if (this.EntryChanged != null) { this.EntryChanged(this, new EventArgs()); } } catch (Exception ex) { throw ex; } return(bRet); }
public void Read() { //Read all layout views for this schedule try { //Read from data store this.mLayoutViews.Clear(); try { LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUTVIEWS_FILE, "", null)); this.mLayoutViews.Merge(ds.ViewTable.Select("ScheduleName='" + this.mScheduleName + "'")); if (this.ViewsChanged != null) { this.ViewsChanged(this, new EventArgs()); } } catch (Exception) { } } catch (Exception ex) { throw ex; } }
public bool Delete() { //Delete this object bool bRet = false; try { LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); LayoutDS.LayoutTableRow row = (LayoutDS.LayoutTableRow)ds.LayoutTable.Select("ViewName='" + this._viewname + "' AND ScheduleName='" + this._schedulename + "' AND Key='" + this._key + "'")[0]; row.Delete(); ds.LayoutTable.AcceptChanges(); bRet = this.mMediator.ExecuteNonQuery(App.LAYOUT_FILE, new object[] { ds }); if (this.EntryChanged != null) { this.EntryChanged(this, new EventArgs()); } } catch (Exception ex) { throw ex; } return(bRet); }
public void Delete() { //Delete this entire layout view try { //Read the data store LayoutDS ds = new LayoutDS(); ds.Merge(this.mMediator.FillDataset(App.LAYOUT_FILE, "", null)); //Delete views entry from the view store LayoutDS.ViewTableRow row = (LayoutDS.ViewTableRow)ds.ViewTable.Select("ViewName='" + this.mViewName + "' AND ScheduleName='" + this.mScheduleName + "'")[0]; row.Delete(); //Delete all layout entries from the view store LayoutDS.LayoutTableRow[] rows = (LayoutDS.LayoutTableRow[])ds.LayoutTable.Select("ViewName='" + this.mViewName + "' AND ScheduleName='" + this.mScheduleName + "'"); for (int i = 0; i < rows.Length; i++) { rows[i].Delete(); } ds.LayoutTable.AcceptChanges(); this.mMediator.ExecuteNonQuery(App.LAYOUT_FILE, new object[] { ds }); Read(); } catch (Exception ex) { throw ex; } }