Beispiel #1
0
        public LayoutEntry Item(string key)
        {
            //Return an existing entry object from the layout view
            LayoutEntry entry = null;

            try {
                //Merge from collection (dataset)
                if (key.Length > 0)
                {
                    DataRow[] rows = this.mLayout.LayoutTable.Select("Key='" + key + "'");
                    if (rows.Length == 0)
                    {
                        throw new ApplicationException("Entry " + key + " does not exist in this view!\n");
                    }
                    LayoutDS.LayoutTableRow row = (LayoutDS.LayoutTableRow)rows[0];
                    entry = new LayoutEntry(row, this.mMediator);
                    //entry.DataFile = App.LAYOUT_FILE;
                    entry.EntryChanged += new EventHandler(OnEntryChanged);
                }
                else
                {
                    entry = (LayoutEntry)Item();
                }
            }
            catch (Exception ex) { throw ex; }
            return(entry);
        }
Beispiel #2
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 #3
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 #4
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 #5
0
 public LayoutEntry(LayoutDS.LayoutTableRow layout, Mediator mediator)
 {
     //Constructor
     try {
         this.mMediator = mediator;
         if (layout != null)
         {
             this._viewname        = layout.ViewName;
             this._schedulename    = layout.ScheduleName;
             this._key             = layout.Key;
             this._visibleposition = layout.VisiblePosition;
             this._visible         = (!layout.IsVisibleNull()) ? layout.Visible : true;
             this._caption         = (!layout.IsCaptionNull()) ? layout.Caption : layout.Key;
             this._width           = (!layout.IsWidthNull()) ? layout.Width : 96;
             this._alignment       = (!layout.IsAlignmentNull()) ? layout.Alignment : "L";
             this._format          = (!layout.IsFormatNull()) ? layout.Format : "";
             this._nulltext        = (!layout.IsNullTextNull()) ? layout.NullText : "";
             this._sort            = (!layout.IsSortNull()) ? layout.Sort : "A";
             this._sortorder       = (!layout.IsSortOrderNull()) ? layout.SortOrder : -1;
             this._groupby         = (!layout.IsGroupByNull()) ? layout.GroupBy : false;
         }
     }
     catch (Exception ex) { throw ex; }
 }