Exemple #1
0
        private void gvwView_DoubleClick(object sender, EventArgs e)
        {
            BandedGridView view = (BandedGridView)sender;

            if (view != null)
            {
                Point             pt   = view.GridControl.PointToClient(Control.MousePosition);
                BandedGridHitInfo info = view.CalcHitInfo(pt);
                DevExpress.XtraGrid.Views.BandedGrid.BandedGridView sndr = sender as DevExpress.XtraGrid.Views.BandedGrid.BandedGridView;
                DevExpress.Utils.DXMouseEventArgs dxMouseEventArgs       = e as DevExpress.Utils.DXMouseEventArgs;
                DevExpress.XtraGrid.Views.BandedGrid.ViewInfo.BandedGridHitInfo hitInfo = sndr.CalcHitInfo(dxMouseEventArgs.Location);
                if (hitInfo.RowHandle < 0)
                {
                    if (hitInfo.Band.Caption.Equals("Chart"))
                    {
                        this.Close();
                        Form fc = Application.OpenForms["FRM_SMT_OS_TOPO_WEEKLY_CHART"];
                        if (fc != null)
                        {
                            fc.Show();
                        }
                        else
                        {
                            FRM_SMT_OS_TOPO_WEEKLY_CHART f = new FRM_SMT_OS_TOPO_WEEKLY_CHART();
                            f.Show();
                        }
                    }
                }
            }
        }
        private void channelGridView_MouseDown(object sender, MouseEventArgs e)
        {
            BandedGridView    view = sender as BandedGridView;
            BandedGridHitInfo hit  = channelGridView.CalcHitInfo(e.Location);

            if (hit == null)
            {
                return;
            }

            switch (hit.HitTest)
            {
            case BandedGridHitTest.Band:
                if (hit.Band.Index > 1)
                {
                    if (channelGridView.Columns[(hit.Band.Index - 2) * 2 + 5].OptionsColumn.AllowEdit == true)
                    {
                        Index = hit.Band.Index - 2;
                    }
                }
                break;

            case BandedGridHitTest.Column:
                if (hit.Column.FieldName == "Checked")
                {
                    CheckAll = !CheckAll;
                    SetCheckColumn(view);
                    OnRefreshView(sender, null);
                }
                break;
            }
        }
 private void AddSummaries(BandedGridView view)
 {
     view.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Count, FieldName = "Data", ShowInGroupColumnFooter = view.Columns["Data"], DisplayFormat = "Count data = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Max, FieldName = "Date", ShowInGroupColumnFooter = view.Columns["Date"], DisplayFormat = "Max date = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Min, FieldName = "Date", ShowInGroupColumnFooter = view.Columns["Date"], DisplayFormat = "Min date = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Count, FieldName = "Date", ShowInGroupColumnFooter = view.Columns["Date"], DisplayFormat = "Count date = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Average, FieldName = "Int", ShowInGroupColumnFooter = view.Columns["Int"], DisplayFormat = "Avg int = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Sum, FieldName = "Int", ShowInGroupColumnFooter = view.Columns["Int"], DisplayFormat = "Sum int = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Count, FieldName = "Int", ShowInGroupColumnFooter = view.Columns["Int"], DisplayFormat = "Count int = {0}"
                                                        },
                                                        new GridGroupSummaryItem()
                                                        {
                                                            SummaryType = SummaryItemType.Count, FieldName = "String", ShowInGroupColumnFooter = view.Columns["String"], DisplayFormat = "Count string = {0}"
                                                        } });
 }
Exemple #4
0
 private void SetExistingView(BandedGridView existingView)
 {
     foreach (var parameter in _columnManagers)
     {
         parameter.Value.Parameters.ExistingGridView = existingView;
     }
 }
Exemple #5
0
        private void bandedGridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e)
        {
            BandedGridView   view = sender as BandedGridView;
            GridGroupRowInfo info = e.Info as GridGroupRowInfo;

            if (info.Column == colANA_GRUP)
            {
                var text = view.GetGroupSummaryText(e.RowHandle);
                text            = Convert.ToDecimal(text.Substring(0, text.IndexOf(",")).Replace(" ", "")).ToString("N2");
                info.GroupText  = "<color=Maroon>" + info.GroupValueText + "</color> " + " : ";
                info.GroupText += "<color=blue>" + text + "</color> ";
            }
            if (info.Column == colGRUP)
            {
                var text       = view.GetGroupSummaryText(e.RowHandle);
                var firstIndex = text.IndexOf(",");
                var lastIndex  = text.LastIndexOf(",");
                text            = text.Substring(0, text.LastIndexOf(","));
                text            = Convert.ToDecimal(text.Substring(text.IndexOf(",") + 1).Replace(" ", "")).ToString("N2");
                info.GroupText  = "<color=Maroon>" + info.GroupValueText + "</color> " + " : ";
                info.GroupText += "<color=green>" + text + "</color> ";
            }
            if (info.Column == colCARI_KODLAR)
            {
                var text = view.GetGroupSummaryText(e.RowHandle);
                var lst  = text.LastIndexOf(",");
                text            = Convert.ToDecimal(text.Substring(text.LastIndexOf(",") + 1).Replace(" ", "")).ToString("N2");
                info.GroupText  = "<color=Maroon>" + info.GroupValueText + "</color> " + " : ";
                info.GroupText += "<color=black>" + text + "</color> ";
            }
        }
Exemple #6
0
        /// <summary>
        /// 类初始化
        /// </summary>
        private void ClassIni(LookUpEdit p_DrpSizeNum, Label[] p_LblSizeNmA, ComboBoxEdit[] p_DrpSizeNmA, BandedGridView p_View, string[] p_FieldNameA,
                              string p_TableName, string p_FieldName, GridBand[] p_Banded, bool p_ShowBlank)
        {
            m_DrpSizeNum = p_DrpSizeNum;
            m_LblSizeNmA = p_LblSizeNmA;
            m_DrpSizeNmA = p_DrpSizeNmA;
            m_FieldNameA = p_FieldNameA;
            m_View       = p_View;
            m_Banded     = p_Banded;
            p_DrpSizeNum.EditValueChanged += new System.EventHandler(drpEditValueChanged);


            Common.BindSizeNum(m_DrpSizeNum, "SOType", true);
            for (int i = 0; i < 12; i++)
            {
                m_DrpSizeNmA[i].Properties.Appearance.TextOptions.Trimming = DevExpress.Utils.Trimming.None;

                m_DrpSizeNmA[i].EditValueChanged += new System.EventHandler(drpSizeName_EditValueChanged);
                Common.BindCLS(m_DrpSizeNmA[i], p_TableName, p_FieldName, p_ShowBlank);


                m_Banded[i].Caption = "";
            }

            drpEditValueChanged(null, null);
        }
Exemple #7
0
        protected void BandedView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            BandedGridView bandedView = (BandedGridView)MainView;

            //Hiển thị lương theo nhóm ca
            int focusedRowHandle = e.RowHandle;

            if (focusedRowHandle >= 0)
            {
                HREmployeePayRollsInfo objEmployeePayRollsInfo = bandedView.GetRow(focusedRowHandle) as HREmployeePayRollsInfo;
                if (objEmployeePayRollsInfo != null)
                {
                    foreach (var item in WorkingShiftGroupsList)
                    {
                        if (item.ADWorkingShiftGroupID > 0)
                        {
                            if (e.Column.FieldName == item.ADWorkingShiftGroupID.ToString())
                            {
                                decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                                Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADWorkingShiftGroupID.ToString() &&
                                                      !o.IsOT).
                                                Sum(o => o.HREmployeePayrollHours);

                                e.DisplayText = total.ToString("n4");
                            }
                            else if (e.Column.FieldName == "L" + item.ADWorkingShiftGroupID.ToString())
                            {
                                decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                                Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADWorkingShiftGroupID.ToString() &&
                                                      !o.IsOT).
                                                Sum(o => o.HREmployeePayrollSalaryFactor);

                                e.DisplayText = total.ToString("n0");
                            }
                        }
                    }

                    foreach (var item in OTFactorlist)
                    {
                        if (e.Column.FieldName == string.Format("TC{0}", item.ADOTFactorID.ToString()))
                        {
                            decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                            Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADOTFactorID.ToString() &&
                                                  o.IsOT).
                                            Sum(o => o.HREmployeePayrollHourFactor);
                            e.DisplayText = total.ToString("n5");
                        }
                        else if (e.Column.FieldName == string.Format("LTC{0}", item.ADOTFactorID.ToString()))
                        {
                            decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                            Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADOTFactorID.ToString() &&
                                                  o.IsOT).
                                            Sum(o => o.HREmployeePayrollSalaryFactor);

                            e.DisplayText = total.ToString("n0");
                        }
                    }
                }
            }
        }
Exemple #8
0
        public InventoryView(BandedGridView view)
        {
            base.SetGridView(view);

            MemoryTable.Instance.LoadClothes();
            listClothes = MemoryTable.Instance.ListClothes;
        }
Exemple #9
0
        /// <summary>
        /// BandGridView删除一个CheckBox列
        /// </summary>
        /// <param name="view"></param>
        protected virtual void Detach()
        {
            if (_view == null)
            {
                return;
            }

            if (column != null)
            {
                column.Dispose();
            }

            if (edit != null)
            {
                _view.GridControl.RepositoryItems.Remove(edit);
                edit.Dispose();
            }

            _view.Click -= new EventHandler(View_Click);
            _view.CustomDrawColumnHeader  -= new ColumnHeaderCustomDrawEventHandler(View_CustomDrawColumnHeader);
            _view.CustomDrawGroupRow      -= new RowObjectCustomDrawEventHandler(View_CustomDrawGroupRow);
            _view.CustomUnboundColumnData -= new CustomColumnDataEventHandler(view_CustomUnboundColumnData);
            _view.KeyDown  -= new KeyEventHandler(view_KeyDown);
            _view.RowStyle -= new RowStyleEventHandler(view_RowStyle);

            _view = null;
        }
Exemple #10
0
        public void BandGrid넘기기(ref DataSet dv2, ref BandedGridView GridView2)
        {
            BandView1 = GridView2;

            dv          = dv2;
            useGridView = false;
        }
Exemple #11
0
        private void bandedGridView1_MouseDown(object sender, MouseEventArgs e)
        {
            if (Control.ModifierKeys != (Keys.Shift | Keys.Control))
            {
                return;
            }
            BandedGridView    view  = (BandedGridView)sender;
            BandedGridHitInfo hInfo = view.CalcHitInfo(e.Location);

            if (hInfo.InColumn)
            {
                view.ClearSelection();
                SelectCells(hInfo.Column);
            }
            else if (hInfo.InBandPanel && hInfo.Band != null)
            {
                view.ClearSelection();
                SelectCells(hInfo.Band);
            }
            else
            {
                return;
            }
            ((DXMouseEventArgs)e).Handled = true;
        }
Exemple #12
0
        public Form1()
        {
            string workPath = GetWorkPath();
            strPath3 = workPath + "\\附件3-反应性控制需求表.docx";
            strPath4 = workPath + "\\附件4-CoreEasy输出参数表.docx";
            strPath5 = workPath + "\\附件5-反应性控制分析计算.docx";
            InitializeComponent();
            LoadView();

            _view = this.bandedGridView1;

            //AddMergedCell(7, this.bandedGridView1.Columns["Value1"], bandedGridView1.Columns["Error1"]);
            //AddMergedCell(7, this.bandedGridView1.Columns["Value2"], bandedGridView1.Columns["Error2"]);
            //AddMergedCell(7, this.bandedGridView1.Columns["Value3"], bandedGridView1.Columns["Error3"]);
            //AddMergedCell(9, this.bandedGridView1.Columns["Value1"], bandedGridView1.Columns["Error1"]);
            //AddMergedCell(9, this.bandedGridView1.Columns["Value2"], bandedGridView1.Columns["Error2"]);
            //AddMergedCell(9, this.bandedGridView1.Columns["Value3"], bandedGridView1.Columns["Error3"]);
            //AddMergedCell(10, this.bandedGridView1.Columns["Value1"], bandedGridView1.Columns["Error1"]);
            //AddMergedCell(10, this.bandedGridView1.Columns["Value2"], bandedGridView1.Columns["Error2"]);
            //AddMergedCell(10, this.bandedGridView1.Columns["Value3"], bandedGridView1.Columns["Error3"]);
            //AddMergedCell(11, this.bandedGridView1.Columns["Value1"], bandedGridView1.Columns["Error1"]);
            //AddMergedCell(11, this.bandedGridView1.Columns["Value2"], bandedGridView1.Columns["Error2"]);
            //AddMergedCell(11, this.bandedGridView1.Columns["Value3"], bandedGridView1.Columns["Error3"]);

            //AddMergedCell(7, this.bandedGridView1.Columns["Error2"], bandedGridView1.Columns["Value2"]);
            //AddMergedCell(7, this.bandedGridView1.Columns["Error3"], bandedGridView1.Columns["Value1"]);

            //object va = 12345678;
            //AddMergedCell(7, 1, 2, va);
            painter = new MyGridPainter(this.bandedGridView1);
            Jisuan();
        }
Exemple #13
0
        /// <summary>
        /// Return true if one or more complete rows are selected
        /// </summary>
        /// <param name="topRow"></param>
        /// <param name="bottomRow"></param>
        /// <returns></returns>

        private bool RowsSelected(
            out int topRow,
            out int bottomRow)
        {
            topRow = bottomRow = -1;

            BandedGridView bgv = RulesGrid.MainView as BandedGridView;

            GridCell[] cells = bgv.GetSelectedCells();
            if (cells.Length <= 1)
            {
                return(false);
            }

            foreach (GridCell cell in cells)
            {
                if (topRow < 0 || cell.RowHandle < topRow)
                {
                    topRow = cell.RowHandle;
                }
                if (cell.RowHandle > bottomRow)
                {
                    bottomRow = cell.RowHandle;
                }
            }

            return(true);
        }
        public static void ClearSelection(BaseView baseView)
        {
            switch (baseView.GetType().Name)
            {
            case "BandedGridView":

                BandedGridView bView = baseView as BandedGridView;
                bView.OptionsView.NewItemRowPosition = NewItemRowPosition.Top;
                bView.FocusedRowHandle = GridControl.NewItemRowHandle;
                bView.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
                //bView.OptionsSelection.EnableAppearanceFocusedRow = false;
                bView.ClearSelection();

                break;

            case "GridView":
                GridView gView = baseView as GridView;
                gView.OptionsView.NewItemRowPosition = NewItemRowPosition.Top;
                gView.FocusedRowHandle = GridControl.NewItemRowHandle;
                gView.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
                //gView.OptionsSelection.EnableAppearanceFocusedRow = false;
                gView.ClearSelection();
                break;

            default:
                break;
            }
        }
Exemple #15
0
        private void TableList_List_SelectedIndexChanged(object sender, EventArgs e)
        {         // item selected from list, select corresponding band in grid
            GridBandColumnCollection cols;

            string txt = (string)TableList.List.SelectedItem;

            TableList.Close();

            if (!BandCaptionDict.ContainsKey(txt))
            {
                return;
            }
            int leftCol = BandCaptionDict[txt];

            BandedGridView v = MoleculeGridPanel.BandedViewGrid.V as BandedGridView;

            if (v == null)
            {
                return;
            }

            cols = v.Bands[v.Bands.Count - 1].Columns;             // go to end first
            v.MakeColumnVisible(cols[cols.Count - 1]);
            cols = v.Bands[BandCaptionDict[txt]].Columns;          // then back to beginning
            v.MakeColumnVisible(cols[0]);

            return;
        }
 public static void SetGridFocused(BandedGridView view, DrawFocusRectStyle focustyle, bool isGridFocused)
 {
     view.FocusRectStyle = isGridFocused ? focustyle : DrawFocusRectStyle.None;
     view.OptionsSelection.EnableAppearanceFocusedCell   = isGridFocused;
     view.OptionsSelection.EnableAppearanceFocusedRow    = isGridFocused;
     view.OptionsSelection.EnableAppearanceHideSelection = isGridFocused;
 }
Exemple #17
0
        //初始化
        public virtual void Initialize(BandedGridView view)
        {
            gridView = view;
            if (gridView == null)
            {
                return;
            }
            view.BeginUpdate();     //开始视图的编辑,防止触发其他事件
            view.BeginDataUpdate(); //开始数据的编辑

            InitGridView();

            CreateGridBand();

            CreateGridColumns();

            view.Columns.AddRange(this.Columns);

            //绑定列
            BindingBandColumn();

            dataTable = GetDataSource();

            view.EndDataUpdate();
            view.EndUpdate();
        }
 public void CreateSizeGrid(DevExpress.XtraGrid.GridControl gridControl, BandedGridView gridView, DataTable dt)
 {
     //gridControl.Hide();
     gridView.BeginDataUpdate();
     try
     {
         bool flag = false;
         gridView.OptionsView.ShowGroupPanel = false;
         gridView.OptionsView.AllowCellMerge = true;
         gridView.Columns.Clear();
         gridView.Bands.Clear();
         gridView.OptionsView.ShowColumnHeaders = false;
         gridView.OptionsView.ColumnAutoWidth   = false;
         DevExpress.XtraGrid.Views.BandedGrid.GridBand[] band_parent = new DevExpress.XtraGrid.Views.BandedGrid.GridBand[dt.Columns.Count];
         DevExpress.XtraGrid.Views.BandedGrid.GridBand[] band_child  = new DevExpress.XtraGrid.Views.BandedGrid.GridBand[dt.Columns.Count - 2];
         int i_arr = 0;
         for (int i = 0; i < dt.Columns.Count; i++)
         {
             //if (i<=1)
             //{
             band_parent[i] = new GridBand()
             {
                 Caption = dt.Columns[i].ColumnName.ToString()
             };
             gridView.Bands.Add(band_parent[i]);
             band_parent[i].Columns.Add(new BandedGridColumn()
             {
                 FieldName = dt.Columns[i].ColumnName.ToString(), Visible = true, Caption = band_parent[i].Caption
             });
             //}
             // else
             ////{
             //    if (!flag)
             //    {
             //        band_parent[i] = new GridBand() { Caption = "COMPONENT INCOMING" };
             //        gridView.Bands.Add(band_parent[i]);
             //        band_parent[i].Children.Add(new GridBand() { Caption = dt.Columns[i].ColumnName.ToString() });
             //        band_parent[i].Children[i_arr].Columns.Add(new BandedGridColumn() { FieldName = dt.Columns[i].ColumnName.ToString(), Visible = true, Caption = dt.Columns[i].ColumnName.ToString() });
             //        i_arr++;
             //        band_parent[i].Children[0].RowCount = 2;
             //        flag = true;
             //    }
             //    else
             //    {
             //        band_parent[band_parent.Count() - 1].Children.Add(new GridBand() { Caption = dt.Columns[i].ColumnName.ToString() });
             //        band_parent[band_parent.Count() - 1].Children[i_arr].Columns.Add(new BandedGridColumn() { FieldName = dt.Columns[i].ColumnName.ToString(), Visible = true, Caption = dt.Columns[i].ColumnName.ToString() });
             //        i_arr++;
             //    }
             ////}
         }
         band_parent[0].RowCount = 2;
         gridView.OptionsView.ColumnAutoWidth = false;
     }
     catch (Exception EX)
     {
         //throw EX;
     }
     gridView.EndDataUpdate();
     gridView.ExpandAllGroups();
 }
Exemple #19
0
        /// <summary>
        /// Activate editor for cell
        /// </summary>
        /// <param name="r"></param>
        /// <param name="c"></param>

        private void EditCellValue(
            int r,
            int c)
        {
            BandedGridView bgv = RulesGrid.MainView as BandedGridView;

            bgv.ClearSelection();
            bgv.SelectCell(r, bgv.Columns[c]);
            bgv.FocusedRowHandle = r;
            bgv.FocusedColumn    = bgv.Columns[c];
            bgv.ShowEditor();             // doesn't seem to open dropdown
            //Application.DoEvents();

            //ColorDialog cd = new ColorDialog();
            //cd.Color = RulesGrid.GetCellBackColor(r, BackColorCol);
            //DialogResult dr = cd.ShowDialog(this);
            //if (dr != DialogResult.OK) return;

            //CellInfo ci = RulesGrid.GetCellInfo(r, c);
            //RulesGrid.DataTable.Rows[ci.DataRowIndex][ci.DataColIndex] = cd.Color;
            //bgv.RefreshRowCell(r, ci.GridColumn);

            //RulesGrid.AddNewRowAsNeeded();
            return;
        }
Exemple #20
0
 //绑定表字段到Band
 protected virtual void BindingBandColumn()
 {
     if (gridView == null)
     {
         return;
     }
     BandedGridView view = gridView;
 }
Exemple #21
0
 public CPivotGridBatch(GridControl gc, BandedGridView bgv)
 {
     gridcontrol = gc;
     gridview    = bgv;
     FormatColumns();
     FormatColumnConst();
     FormatRows();
 }
Exemple #22
0
        private static void SetFontStyle(BandedGridView bandedGridView)
        {
            bandedGridView.Appearance.BandPanel.Font            = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
            bandedGridView.Appearance.BandPanel.ForeColor       = System.Drawing.Color.FromArgb(134, 136, 142);
            bandedGridView.Appearance.BandPanel.Options.UseFont = true;

            SetFontStyle(gridView: bandedGridView);
        }
Exemple #23
0
        private void updateTableHead(double cafc, double tcafc, double zczbzl)
        {
            BandedGridView view = CafcbandedGridView as BandedGridView;

            view.Bands[1].Children[1].Caption = Math.Round(cafc, 2).ToString();
            view.Bands[2].Children[1].Caption = Math.Round(tcafc, 2).ToString();
            view.Bands[3].Children[1].Caption = Math.Round(zczbzl, 2).ToString();
        }
 public CPivotGridBatch(GridControl gc, BandedGridView bgv)
 {
     gridcontrol = gc;
     gridview = bgv;
     FormatColumns();
     FormatColumnConst();
     FormatRows();
 }
Exemple #25
0
        public void Setup(
            MoleculeList structureList,
            ListItemSelectedDelegate itemSelectedCallback)
        {
            DataTableMx dt;
            DataRowMx   dr;

            InSetup = true;

            StructureList            = structureList;
            ListItemSelectedCallback = itemSelectedCallback;

// Create DataTable if not done yet

            if (DataTable == null)
            {
                dt        = new DataTableMx();
                DataTable = dt;                 // save ref to table
                dt.Columns.Add("NameCol", typeof(string));
                dt.Columns.Add("StructureCol", typeof(MoleculeMx));
                dt.Columns.Add("DateCol", typeof(DateTime));
                dt.Columns.Add("StructureTypeCol", typeof(string));

                MoleculeGrid.SetupDefaultQueryManager(dt);                 // setup underlying QueryManager/QueryTable for current type
                MoleculeGrid.SetupUnboundColumns(dt);
            }

            dt = DataTable;

// Add rows to DataTable

            bool saveEnabled = dt.EnableDataChangedEventHandlers(false);             // turn off change events while filling

            if (structureList == null)
            {
                InSetup = false; return;
            }

            for (int ri = 0; ri < structureList.Count; ri++)             // fill in the grid
            {
                MoleculeListItem sli = structureList[ri];

                dr = dt.NewRow();

                dr["NameCol"]          = sli.Name;
                dr["StructureCol"]     = sli.Molecule;
                dr["DateCol"]          = sli.UpdateDate;
                dr["StructureTypeCol"] = sli.MoleculeType;

                dt.Rows.Add(dr);
            }

            MoleculeGrid.DataSource = dt;             // make the data visible
            BandedGridView.ClearSelection();
            dt.EnableDataChangedEventHandlers(saveEnabled);
            InSetup = false;
            return;
        }
Exemple #26
0
        public override void InitializeControl()
        {
            base.InitializeControl();
            //Init banded view and make it the main view
            BandedGridView bandedView = InitializeBandedGridView(GridViewMain);

            MainView = bandedView;
            ViewCollection.AddRange(new BaseView[] { bandedView });
        }
Exemple #27
0
        public AuthorityForm()
        {
            InitializeComponent();
            BandedGridView view = bandedGridView1 as BandedGridView;

            view.OptionsView.ShowGroupPanel  = false;
            view.OptionsBehavior.Editable    = false;
            view.OptionsView.ColumnAutoWidth = false;
        }
Exemple #28
0
        private void UpdateRow(HRM_EMPLOYEE item)
        {
            BandedGridView bandedGridView   = this.gbList;
            int            focusedRowHandle = this.gbList.FocusedRowHandle;

            bandedGridView.SetRowCellValue(focusedRowHandle, "SubsidiaryCode", item.SubsidiaryCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BranchCode", item.BranchCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "DepartmentCode", item.DepartmentCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "GroupCode", item.GroupCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "EmployeeCode", item.EmployeeCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "FirstName", item.FirstName);
            bandedGridView.SetRowCellValue(focusedRowHandle, "LastName", item.LastName);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BirthdayDay", item.BirthdayDay);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BirthdayMonth", item.BirthdayMonth);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BirthdayYear", item.BirthdayYear);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BirthPlace", item.BirthPlace);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Sex", item.Sex);
            bandedGridView.SetRowCellValue(focusedRowHandle, "CellPhone", item.CellPhone);
            bandedGridView.SetRowCellValue(focusedRowHandle, "HomePhone", item.HomePhone);
            bandedGridView.SetRowCellValue(focusedRowHandle, "MainAddress", item.MainAddress);
            bandedGridView.SetRowCellValue(focusedRowHandle, "ContactAddress", item.ContactAddress);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Position", item.Position);
            bandedGridView.SetRowCellValue(focusedRowHandle, "IDCard", item.IDCard);
            bandedGridView.SetRowCellValue(focusedRowHandle, "IDCardPlace", item.IDCardPlace);
            bandedGridView.SetRowCellValue(focusedRowHandle, "IDCardDate", item.IDCardDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Status", item.Status);
            bandedGridView.SetRowCellValue(focusedRowHandle, "TestFromDate", item.TestFromDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "TestToDate", item.TestToDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BeginDate", item.BeginDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "EndDate", item.EndDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Photo", item.Photo);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Email", item.Email);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Nationality", item.Nationality);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Ethnic", item.Ethnic);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Religion", item.Religion);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Education", item.Education);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Language", item.Language);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Informatic", item.Informatic);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Professional", item.Professional);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Marriage", item.Marriage);
            bandedGridView.SetRowCellValue(focusedRowHandle, "InsuranceCode", item.InsuranceCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "InsuranceDate", item.InsuranceDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "BasicSalary", item.BasicSalary);
            bandedGridView.SetRowCellValue(focusedRowHandle, "InsuranceSalary", item.InsuranceSalary);
            bandedGridView.SetRowCellValue(focusedRowHandle, "DateSalary", item.DateSalary);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Health", item.Health);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Weight", item.Weight);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Height", item.Height);
            bandedGridView.SetRowCellValue(focusedRowHandle, "ContractCode", item.ContractCode);
            bandedGridView.SetRowCellValue(focusedRowHandle, "ContractType", item.ContractType);
            bandedGridView.SetRowCellValue(focusedRowHandle, "ContractSignDate", item.ContractSignDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "ContractFromDate", item.ContractFromDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "ContractToDate", item.ContractToDate);
            bandedGridView.SetRowCellValue(focusedRowHandle, "EnrollNumber", item.EnrollNumber);
            bandedGridView.SetRowCellValue(focusedRowHandle, "Description", item.Description);
            bandedGridView.UpdateCurrentRow();
        }
Exemple #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridBandPaintHelper"/> class.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="bands">The bands.</param>
 public GridBandPaintHelper(BandedGridView view, GridBand[] bands)
     : base(view)
 {
     _gridView  = view;
     _gridBands = bands;
     _gridView.GridControl.Paint      += GridControl_Paint;
     _gridView.CustomDrawColumnHeader += _gridView_CustomDrawColumnHeader;
     _gridView.CustomDrawBandHeader   += _gridView_CustomDrawBandHeader;
 }
Exemple #30
0
        public static void AddLookupEditColumn(
            this BandedGridView gridView,
            string fieldName,
            string caption,
            int width,
            object itemSource,
            string valueMember,
            string displayMember,
            bool isAllowEdit              = true,
            List <ColumnInfo> columns     = null,
            string nullText               = "",
            bool showHearder              = false,
            EventHandler editValueChanged = null)
        {
            RepositoryItemLookUpEdit itemCtrl = new RepositoryItemLookUpEdit
            {
                DataSource     = itemSource,
                DisplayMember  = displayMember,
                ValueMember    = valueMember,
                NullText       = nullText,
                ShowHeader     = showHearder,
                TextEditStyle  = TextEditStyles.Standard,
                AllowNullInput = DefaultBoolean.True
            };

            if (editValueChanged != null)
            {
                itemCtrl.EditValueChanged += editValueChanged;
            }

            if (columns != null)
            {
                foreach (var col in columns)
                {
                    var colInfo = new LookUpColumnInfo
                    {
                        FieldName = col.FieldName,
                        Caption   = col.Caption,
                        Visible   = true,
                    };

                    if (col.Width > 0)
                    {
                        colInfo.Width = col.Width;
                    }

                    itemCtrl.Columns.Add(colInfo);
                }
            }
            else
            {
                itemCtrl.Columns.Add(new LookUpColumnInfo(displayMember));
            }

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
Exemple #31
0
        private void bandedGridView2_MasterRowGetChildList(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs e)
        {
            BandedGridView      bandgv = sender as BandedGridView;
            CHITIETPHIEUMUONDTO ct     = bandgv.GetRow(e.RowHandle) as CHITIETPHIEUMUONDTO;

            if (ct != null)
            {
                e.ChildList = listpm.Where(p => (p.NgayMuon == ct.NgayMuon && p.MaDocGia == ct.MaDocGia) && (p.TinhTrangMuon == "Còn hạn" || p.TinhTrangMuon == "Quá hạn")).Select(p => p).ToList();
            }
        }
Exemple #32
0
        private void bandedGridView1_MasterRowGetChildList(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs e)
        {
            BandedGridView     bandgv = sender as BandedGridView;
            CHITIETPHIEUTRADTO ct     = bandgv.GetRow(e.RowHandle) as CHITIETPHIEUTRADTO;

            if (ct != null)
            {
                e.ChildList = listpt.Where(p => p.NgayTra == ct.NgayTra && p.MaDocGia == ct.MaDocGia).Select(p => p).ToList();
            }
        }
 public static void ExportExcel(BandedGridView ip_grv)
 {
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     saveFileDialog1.Filter = "xls files (*.xls)|*.xls|All files (*.*)|*.*";
     saveFileDialog1.RestoreDirectory = true;
     if(saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         ip_grv.ExportToXls(saveFileDialog1.FileName);
         DevExpress.XtraEditors.XtraMessageBox.Show("Trích xuất dữ liệu thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 public static String GetPLGridViewName(BandedGridView gridView)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(FrameworkParams.currentUser.username);
     if (gridView.GridControl != null)
     {
         builder.Append(gridView.GridControl.FindForm() == null ? "" : gridView.GridControl.FindForm().Name);
         builder.Append(gridView.GridControl.Name);
         builder.Append(gridView.Name);
         builder.Append(gridView.GridControl.Parent == null ? "" : gridView.GridControl.Parent.Name);
         try
         {
             builder.Append(gridView.GridControl.DataSource == null ? "" : ((DataTable)gridView.GridControl.DataSource).TableName);
         }
         catch { }
     }
     else PLMessageBoxDev.ShowMessage("GenName.NewName bằng rỗng. Báo ngay PHUOCNT");
     builder.Append("PLBandedGridView");
     return builder.ToString();
 }
Exemple #35
0
 /// <summary>Khởi tạo Grid trên phiếu 1 lưới
 /// </summary>
 public static BandedGridColumn InitGrid(GridControl gridControl, BandedGridView gridView, bool? IsAdd)
 {
     BandedGridColumn CotDong = HelpGridColumn.CotPLDong(gridControl, gridView);
     if (IsAdd == null)
     {
         CotDong.Visible = false;
         CotDong.OwnerBand.Visible = false;
         //((PLGridView)gridView)._SetDesignLayout();
         ((PLBandedGridView)gridView)._SetUserLayout("VIEW");
     }
     else
     {
         //((PLGridView)gridView)._SetUserLayout();
         ((PLBandedGridView)gridView)._SetUserLayout("UPDATE");
     }
     return CotDong;
 }
Exemple #36
0
        public static BandedGridColumn CotPLDong(GridControl GridCtrl, BandedGridView Grid, bool isConfirmDelete)
        {
            DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEditDEL = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit();
            repositoryItemButtonEditDEL.AutoHeight = false;
            repositoryItemButtonEditDEL.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
            repositoryItemButtonEditDEL.Buttons.Clear();
            repositoryItemButtonEditDEL.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "", 10, true, true, false, DevExpress.Utils.HorzAlignment.Center, null, new DevExpress.Utils.KeyShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)))});
            repositoryItemButtonEditDEL.Name = "repositoryItemButtonEditDEL";
            repositoryItemButtonEditDEL.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
            // repositoryItemButtonEditDEL.KeyUp += delegate(object sender, KeyEventArgs e)
            // {
            //    if (e.KeyData == Keys.Enter)
            //        Grid.DeleteRow(Grid.FocusedRowHandle);
            // };
            repositoryItemButtonEditDEL.Click += delegate(object sender, EventArgs e)
            {
                if (isConfirmDelete)
                {
                    if (PLMessageBox.ShowConfirmMessage("Bạn có muốn xóa dòng này không ?") == DialogResult.Yes)
                        Grid.DeleteRow(Grid.FocusedRowHandle);
                }
                else
                {
                    Grid.DeleteRow(Grid.FocusedRowHandle);

                }
            };
            GridCtrl.RepositoryItems.Add(repositoryItemButtonEditDEL);

            BandedGridColumn CotXoa = new BandedGridColumn();
            CotXoa.AppearanceHeader.Options.UseTextOptions = true;
            CotXoa.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            CotXoa.AppearanceCell.Options.UseTextOptions = true;
            CotXoa.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            CotXoa.Caption = "    ";
            CotXoa.ColumnEdit = repositoryItemButtonEditDEL;
            CotXoa.Name = "CotXoa";
            CotXoa.OptionsColumn.AllowSize = false;
            CotXoa.OptionsColumn.FixedWidth = true;
            CotXoa.Visible = true;
            CotXoa.VisibleIndex = 50;
            CotXoa.Width = 25;

            GridBand gridBand = new GridBand();
            gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            gridBand.Columns.Add(CotXoa);
            gridBand.MinWidth = 10;
            gridBand.Name = "gridBandCotXoa";
            gridBand.Caption = "    ";
            gridBand.OptionsBand.AllowSize = false;
            gridBand.Width = 10;

            Grid.Bands.Add(gridBand);
            Grid.Columns.Add(CotXoa);
            //Grid.Columns.Add(CotXoa);

            return CotXoa;
        }
Exemple #37
0
 public static BandedGridColumn CotPLDong(GridControl GridCtrl, BandedGridView Grid)
 {
     return HelpGridColumn.CotPLDong(GridCtrl, Grid, true);
 }
Exemple #38
0
        /// <summary>
        /// Khởi tạo Grid trên phiếu 1 lưới không tạo cột xóa
        /// </summary>      
        public static void InitGrid(BandedGridView gridView, bool? IsAdd)
        {
            if (IsAdd == null)
            {

                //((PLGridView)gridView)._SetDesignLayout();
                ((PLBandedGridView)gridView)._SetUserLayout("VIEW");
            }
            else
            {
                //((PLGridView)gridView)._SetUserLayout();
                ((PLBandedGridView)gridView)._SetUserLayout("UPDATE");
            }
        }
Exemple #39
0
        public static void SetAutoHideEmptyBand(BandedGridView gridView)
        {
            gridView.ColumnPositionChanged += delegate(object sender, EventArgs e)
                                                  {

                                                      var sCol = (BandedGridColumn)sender;
                                                      GridBand band = sCol.OwnerBand;
                                                      if (band == null) return;
                                                      bool visible =
                                                          band.Columns.Cast<BandedGridColumn>().Any(col => col.Visible);

                                                      band.Visible = visible;
                                                      GridBand pband = band.ParentBand;
                                                      if (visible)
                                                      {
                                                          while (pband != null)
                                                          {
                                                              pband.Visible = visible;
                                                              pband = pband.ParentBand;
                                                          }
                                                      }
                                                      else
                                                      {
                                                          while (pband != null)
                                                          {
                                                              bool atLeastOneVisible =
                                                                  pband.Children.Cast<GridBand>().Any(
                                                                      gBan => gBan.Visible);
                                                              if (atLeastOneVisible == false)
                                                                  pband.Visible = visible;

                                                              pband = pband.ParentBand;

                                                          }
                                                      }

                                                  };
        }
Exemple #40
0
 public static void SetAutoHideEmptyBand(BandedGridView gridView)
 {
     gridView.ColumnPositionChanged += delegate(object sender, EventArgs e)
     {
         foreach (GridBand band in gridView.Bands)
         {
             bool visible = false;
             foreach (BandedGridColumn col in band.Columns)
             {
                 if (col.Visible)
                 {
                     visible = true;
                     break;
                 }
             }
             band.Visible = visible;
         }
     };
 }