Exemplo n.º 1
0
 public TrialPLDanhMucExt()
     : base()
 {
     popupContainerControl = new PopupContainerControl();
     plDanhMuc = new TrialPLDanhMucExtCtrl();
     this.Properties.PopupControl = popupContainerControl;
     popupContainerControl.Controls.Add(plDanhMuc);
     popupContainerControl.Size = plDanhMuc.Size;
     this.Properties.PopupSizeable = false;
     this.Properties.ShowPopupCloseButton = false;
 }
 private void init()
 {
     plDanhMuc = new TrialPLDanhMucExtCtrl();
     popupControl = new PopupContainerControl();
     this.PopupControl = popupControl;
     popupControl.Controls.Add(plDanhMuc);
     popupControl.Size = plDanhMuc.Size;
     this.PopupSizeable = false;
     this.ShowPopupCloseButton = false;
 }
        /// <summary>
        /// Sử dụng danh mục Extend
        /// </summary>
        /// <param name="frmDanhMuc"></param>
        /// <param name="btnCaption"></param>
        /// <param name="function"></param>
        /// <param name="columnField"></param>
        /// <param name="tableName"></param>
        /// <param name="ValueField"></param>
        /// <param name="visibleField"></param>
        /// <param name="caption"></param>
        /// <param name="getField"></param>
        /// <param name="treeList"></param>
        public RepositoryItemDanhMucExt(XtraForm frmDanhMuc,string btnCaption, TrialPLDanhMucExtCtrl.GetValue function, string columnField, string tableName, string ValueField, string[] visibleField, string[] caption, string getField, TreeList treeList)
        {
            init();
            plDanhMuc.TreeList = treeList;
            plDanhMuc._init(frmDanhMuc,btnCaption,function, columnField, tableName, ValueField, visibleField, caption, getField);

            treeList.GotFocus += delegate(object sender, EventArgs e)
            {
                if (treeList.DataSource != null &&
                        !((DataTable)treeList.DataSource).Columns.Contains(columnField + getField))
                {
                    ((DataTable)treeList.DataSource).Columns.Add(new DataColumn(columnField + getField));
                }
            };
            treeList.CellValueChanged += delegate(object sender, CellValueChangedEventArgs e)
            {
                if (e.Column.FieldName.Equals(columnField + getField))
                {
                    DataRowView rowView = (DataRowView)treeList.GetDataRecordByNode(e.Node);
                    DataRow row = rowView.Row;
                    row[columnField] = _getId(e.Value);
                }
            };
            this.Popup += new EventHandler(RepositoryHuyDanhMuc_Popup);
            this.Leave += new EventHandler(RepositoryDanhMucAdv_Leave);
        }
        /// <summary>
        /// Sử dụng danh mục extend
        /// </summary>
        /// <param name="frmDanhMuc"></param>
        /// <param name="btnCaption"></param>
        /// <param name="function"></param>
        /// <param name="columnField"></param>
        /// <param name="tableName"></param>
        /// <param name="ValueField"></param>
        /// <param name="visibleField"></param>
        /// <param name="caption"></param>
        /// <param name="getField"></param>
        /// <param name="gridView"></param>
        public RepositoryItemDanhMucExt(XtraForm frmDanhMuc, string btnCaption , TrialPLDanhMucExtCtrl.GetValue function, string columnField, string tableName, string ValueField, string[] visibleField, string[] caption, string getField, GridView gridView)
        {
            init();
            plDanhMuc.GridView = gridView;
            plDanhMuc._init(frmDanhMuc, btnCaption, function, columnField, tableName, ValueField, visibleField, caption, getField);

            gridView.GotFocus += delegate(object sender, EventArgs e)
            {
                if (gridView.DataSource != null &&
                    !((DataView)gridView.DataSource).Table.Columns.Contains(columnField + getField))
                {
                    ((DataView)gridView.DataSource).Table.Columns.Add(new DataColumn(columnField + getField));
                }
            };
            int idValue;
            gridView.CellValueChanged += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
            {

                if (e.Column.FieldName.Equals(columnField + getField))
                {
                    idValue = _getId(e.Value);
                    if (e.RowHandle < 0)
                    {
                        gridView.EditingValue = idValue;
                        gridView.SetFocusedRowCellValue(gridView.Columns.ColumnByFieldName(columnField), idValue);
                    }
                    else
                    {
                        DataRow row = gridView.GetDataRow(e.RowHandle);
                        row[columnField] = idValue;
                    }
                }

            };

            gridView.InitNewRow += delegate(object sender, InitNewRowEventArgs e)
            {
                gridView.SetRowCellValue(e.RowHandle, columnField + getField, plDanhMuc.GridViewEditor.FocusedValue);
            };
            this.Popup += new EventHandler(RepositoryHuyDanhMuc_Popup);
            this.Leave += new EventHandler(RepositoryDanhMucAdv_Leave);
        }
Exemplo n.º 5
0
 public void _init(XtraForm frmDanhMuc,string btnCaption, TrialPLDanhMucExtCtrl.GetValue function, string tableName, string fieldId, string[] visibleField, string[] caption, string getfield)
 {
     plDanhMuc.PopupContainerEdit = this;
     plDanhMuc._init(frmDanhMuc,btnCaption,function, tableName, fieldId, visibleField, caption, getfield);
 }
Exemplo n.º 6
0
 public static RepositoryItemDanhMucExt CotDanhMucGridExt(GridView gridView, GridColumn column, XtraForm frmDanhMuc, string btnCaption, TrialPLDanhMucExtCtrl.GetValue function, string ColumnField, string tableName, string ValueField, string[] visibleField, string[] caption, string getField)
 {
     column.FieldName = ColumnField + getField;
     RepositoryItemDanhMucExt dmExt = new RepositoryItemDanhMucExt(frmDanhMuc, btnCaption, function, ColumnField, tableName, ValueField, visibleField, caption, getField, gridView);
     column.ColumnEdit = dmExt;
     return dmExt;
 }