Beispiel #1
0
 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; }
 }
Beispiel #2
0
        public DataSet ToDataSet()
        {
            //Return a dataset containing values for this object
            LayoutDS ds = null;

            try {
                ds = new LayoutDS();
                LayoutDS.LayoutTableRow layout = ds.LayoutTable.NewLayoutTableRow();
                layout.ViewName        = this._viewname;
                layout.ScheduleName    = this._schedulename;
                layout.Key             = this._key;
                layout.VisiblePosition = this._visibleposition;
                layout.Visible         = this._visible;
                layout.Caption         = this._caption;
                layout.Width           = this._width;
                layout.Alignment       = this._alignment;
                layout.Format          = this._format;
                layout.NullText        = this._nulltext;
                layout.Sort            = this._sort;
                layout.SortOrder       = this._sortorder;
                layout.GroupBy         = this._groupby;
                ds.LayoutTable.AddLayoutTableRow(layout);
            }
            catch (Exception) { }
            return(ds);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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; }
        }
Beispiel #5
0
 //Interface
 public dlgViews(LayoutViews views)
 {
     //Required for Windows Form Designer support
     try {
         InitializeComponent();
         this.mViews = views;
         this.mViews.ViewsChanged += new EventHandler(OnViewsChanged);
         this.mLayoutDS            = new LayoutDS();
     }
     catch (Exception ex) { throw ex; }
 }
Beispiel #6
0
 //Interface
 public LayoutView(string viewName, string scheduleName, Mediator mediator)
 {
     //Constructor
     try {
         //Set custom attributes
         this.mViewName     = viewName;
         this.mScheduleName = scheduleName;
         this.mMediator     = mediator;
         this.mLayout       = new LayoutDS();
         Read();
     }
     catch (Exception ex) { throw ex; }
 }
Beispiel #7
0
        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; }
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
 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; }
 }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        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; }
        }
Beispiel #12
0
 //Interface
 public LayoutViews(string scheduleName, Mediator mediator)
 {
     //Constructor
     try {
         this.mScheduleName = scheduleName;
         this.mMediator     = mediator;
         this.mLayoutViews  = new LayoutDS();
         Read();
         LayoutDS.ViewTableRow[] rows = (LayoutDS.ViewTableRow[]) this.mLayoutViews.ViewTable.Select("ScheduleName='" + this.mScheduleName + "' AND Active=true");
         if (rows.Length > 0)
         {
             this.mActiveView = new LayoutView(rows[0].ViewName, this.mScheduleName, this.mMediator);
         }
         else
         {
             this.mActiveView = new LayoutView("Default", this.mScheduleName, this.mMediator);
         }
         this.mActiveView.ViewChanged += new EventHandler(OnViewChanged);
     }
     catch (Exception ex) { throw ex; }
 }
Beispiel #13
0
        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; }
        }