Exemple #1
0
        void grdCtlMain_BeforeContextMenuClick(object sender, MB.XWinLib.XtraGrid.GridControlExMenuEventArg arg)
        {
            if (arg.MenuType == MB.XWinLib.XtraGrid.XtraContextMenuType.Copy)
            {
                arg.Handled = true;

                dataCopy();
            }
            else if (arg.MenuType == MB.XWinLib.XtraGrid.XtraContextMenuType.Past)
            {
                arg.Handled = true;

                IDataObject data = Clipboard.GetDataObject();

                object ss = data.GetData(typeof(string));
                dataPast(ss.ToString());
            }
            else if (arg.MenuType == XtraContextMenuType.DataImport)
            {
                arg.Handled = true;
                dataImport();
            }
            else if (arg.MenuType == XtraContextMenuType.QuickInput)
            {
                arg.Handled = true;

                if (arg.Column != null)
                {
                    DevExpress.XtraGrid.Views.Grid.GridView gridView = gridViewMain;
                    if (arg.Column.OptionsColumn.AllowEdit && gridView.FocusedRowHandle >= 0)
                    {
                        var dre = MB.WinBase.MessageBoxEx.Question("是否决定以当前选择列的值进行快速填充");
                        if (dre != DialogResult.Yes)
                        {
                            return;
                        }

                        DataRow entity = gridView.GetDataRow(gridView.FocusedRowHandle);
                        object  val    = entity[arg.Column.FieldName];
                        if (val != null)
                        {
                            int count = gridView.RowCount;
                            for (int i = 0; i < count; i++)
                            {
                                DataRow dr = gridView.GetDataRow(i);
                                GridRowCellEditEventArgs cellarg = new GridRowCellEditEventArgs(dr, arg.Column);
                                cellarg.AllowEdit = arg.Column.OptionsColumn.AllowEdit;
                                OnRowCellEditForEditing(cellarg);
                                if (cellarg.AllowEdit)
                                {
                                    gridView.SetRowCellValue(i, arg.Column.FieldName, val);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void gridViewInvDetAll_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView CurrentView = (sender as DevExpress.XtraGrid.Views.Grid.GridView);

            MDataSet.InvoiceMasterRow _row = (CurrentView.GetDataRow(e.RowHandle) as MDataSet.InvoiceDetailRow).InvoiceMasterRow;

            if (_row.NumCheck > 0)
            {
                e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Italic);

                //   if (e.RowHandle == CurrentView.FocusedRowHandle) return;

                e.Appearance.ForeColor = Color.Gray;
            }

            if (_row.DocumentTypeRef == 4)
            {
                e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Italic);

                //  if (e.RowHandle == CurrentView.FocusedRowHandle) return;

                e.Appearance.ForeColor = Color.Gray;

                // e.Appearance.BackColor = Color.LightPink;
            }
        }
Exemple #3
0
        private void CNT_DAHIL_Click(object sender, EventArgs e)
        {
            int index = xtraTabControl_MASTER_MNG_DETAY.SelectedTabPageIndex;
            var rtb   = xtraTabControl_MASTER_MNG_DETAY.TabPages[index].Controls[0];

            DevExpress.XtraGrid.GridControl         grd_ = (DevExpress.XtraGrid.GridControl)rtb;
            System.Data.DataView                    RW   = (System.Data.DataView)grd_.DataSource;
            DevExpress.XtraGrid.Views.Grid.GridView GR   = (DevExpress.XtraGrid.Views.Grid.GridView)grd_.MainView;



            int[] GETROW = GR.GetSelectedRows();
            if (GR.RowCount > 0)
            {
                for (int i = 0; i < GETROW.Length; i++)
                {
                    DataRow dr = GR.GetDataRow(Convert.ToInt32(GETROW[i]));
                    if (GR.Columns["DAHIL_HARIC"] != null)
                    {
                        dr["DAHIL_HARIC"] = "Dahil";
                    }
                }
            }

            //   GR.EndUpdate();
            //   GR.RefreshData();
        }
Exemple #4
0
        private void BorrarFilasSeleccionadas(DevExpress.XtraGrid.Views.Grid.GridView view)
        {
            if (view == null || view.SelectedRowsCount == 0)
            {
                return;
            }

            DataRow[] rows = new DataRow[view.SelectedRowsCount];

            for (int i = 0; i < view.SelectedRowsCount; i++)
            {
                rows[i] = view.GetDataRow(view.GetSelectedRows()[i]);
            }

            view.BeginSort();

            try
            {
                foreach (DataRow row in rows)
                {
                    row.Delete();
                }
            }
            finally
            {
                view.EndSort();
            }
        }
Exemple #5
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this._bindingSource.Current == null)
            {
                return;
            }
            _data.DrCurrentMaster = (this._bindingSource.Current as DataRowView).Row;
            List <DataRow> drDetails = new List <DataRow>();

            for (int i = 0; i < gvDetail.DataRowCount; i++)
            {
                drDetails.Add(gvDetail.GetDataRow(i));
            }

            this._data.LstDrCurrentDetails = drDetails;
            fShowHistoryMtdt fSHMt = new fShowHistoryMtdt(_data as DataMasterDetail);

            fSHMt.ShowDialog();
        }
Exemple #6
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            AutoIncrementValues _autoIncreValues;
            string sysTableID = _data.DrTable["SysTableID"].ToString();
            string soct       = textEdit3.Text;


            for (int i = 0; i < tb.Rows.Count; i++)
            {
                DataRow dr = gvMain.GetDataRow(i);
                if (dr != null)
                {
                    _autoIncreValues = new AutoIncrementValues(sysTableID, _data.DsStruct.Tables[0], dr);
                    string NewSoCT = _autoIncreValues.GetNewValueByOldvalue(soct, textEdit3.Text, DateTime.Parse(dr["NgayCT"].ToString()));
                    dr["SoCT"] = NewSoCT;
                    dr.EndEdit();
                    soct = NewSoCT;
                }
            }
        }
 private int FindRowHandleByDataRow(DevExpress.XtraGrid.Views.Grid.GridView view, DataRow row)
 {
     for (int i = 0; i < view.DataRowCount; i++)
     {
         if (view.GetDataRow(i) == row)
         {
             return(i);
         }
     }
     return(DevExpress.XtraGrid.GridControl.InvalidRowHandle);
 }
        //
        /// <summary>
        /// 根据商品ID 甚至对应行的焦点.
        /// </summary>
        /// <param name="gridView"></param>
        /// <param name="columnName"></param>
        /// <param name="columnValue"></param>
        public void SetGridViewFocusedRowHandle(DevExpress.XtraGrid.Views.Grid.GridView gridView, string columnName, string columnValue) {
            int count = gridView.RowCount;
            for (int index = 0; index < count; index++) {
                DataRow dr = gridView.GetDataRow(index);
                if (dr[columnName] == null || dr[columnName] == System.DBNull.Value)
                    continue;

                string val = dr[columnName].ToString();
                if (string.Compare(val, columnValue, true) == 0) {
                    gridView.FocusedRowHandle = index;
                    break;
                }
            }
        }
Exemple #9
0
        void _XtraGrid_BeforeContextMenuClick(object sender, MB.XWinLib.XtraGrid.GridControlExMenuEventArg arg)
        {
            if (arg.MenuType == XtraContextMenuType.QuickInput)
            {
                arg.Handled = true;

                if (arg.Column == null)
                {
                    return;
                }

                DevExpress.XtraGrid.Views.Grid.GridView gridView = _AdvBandGridView;
                if (!arg.Column.OptionsColumn.AllowEdit || gridView.FocusedRowHandle < 0)
                {
                    return;
                }

                if (gridView.SortedColumns.Contains(arg.Column))
                {
                    MB.WinBase.MessageBoxEx.Show("当前列正在排序状态,不能进行快速填充.请先取消排序");
                    return;
                }

                var dre = MB.WinBase.MessageBoxEx.Question("是否决定以当前选择列的值进行快速填充");
                if (dre != DialogResult.Yes)
                {
                    return;
                }

                DataRow entity = gridView.GetDataRow(gridView.FocusedRowHandle);
                object  val    = entity[arg.Column.FieldName];

                if (val == null)
                {
                    return;
                }

                int count = gridView.RowCount;
                for (int i = 0; i < count; i++)
                {
                    //判断当前列是否可以编辑
                    if (!checCanEdit(i, arg.Column.FieldName))
                    {
                        continue;
                    }

                    gridView.SetRowCellValue(i, arg.Column.FieldName, val);
                }
            }
        }
        /// <summary>
        /// 修改datatable里记录的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridViewCellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView focusView = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            string    gridViewName = focusView.Name.ToString();
            string    id           = focusView.GetDataRow(focusView.FocusedRowHandle)["ID"].ToString();
            string    tag          = basefun.valtag(Convert.ToString(this.treDept.FocusedNode.Tag.ToString()), "ID");
            DataTable dtTemp       = new DataTable();

            switch (gridViewName)
            {
            case "gridViewExchangeRelax":
                EditTabColValue(this.ds.Tables["部门员工假期"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["部门员工假期"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["部门员工假期"].Select("部门id='" + tag + "'"));
                this.grdExchangeRelax.DataSource = dtTemp;
                break;

            case "gridViewEvection":
                EditTabColValue(this.ds.Tables["员工出差"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工出差"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工出差"].Select("部门id='" + tag + "'"));
                this.grdEvection.DataSource = dtTemp;
                break;

            case "gridViewOvertime":
                EditTabColValue(this.ds.Tables["员工加班"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工加班"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工加班"].Select("部门id='" + tag + "'"));
                this.grdOvertime.DataSource = dtTemp;
                break;

            case "gridViewSignIn":
                EditTabColValue(this.ds.Tables["员工签到"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工签到"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工签到"].Select("部门id='" + tag + "'"));
                this.grdSignIn.DataSource = dtTemp;
                break;

            case "gridViewLeave":
                EditTabColValue(this.ds.Tables["员工请假"], e.Column.FieldName, e.Value.ToString(), id);
                dtTemp = this.ds.Tables["员工请假"].Clone();
                dtTemp = FunShare.GetTable(dtTemp, this.ds.Tables["员工请假"].Select("部门id='" + tag + "'"));
                this.grdLeave.DataSource = dtTemp;
                break;

            default:
                break;
            }
        }
Exemple #11
0
 void gridView1_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
     try
     {
         if (view == null)
         {
             return;
         }
         DataRow fila = view.GetDataRow(e.RowHandle);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #12
0
        /// <summary>
        /// GridViewRowStyle
        /// </summary>
        /// <param name="gridView"></param>
        /// <param name="e"></param>
        private void GridViewRowStyle(DevExpress.XtraGrid.Views.Grid.GridView gridView,
                                      DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            DevExpress.Utils.AppearanceDefault appNotPass1 = new DevExpress.Utils.AppearanceDefault(Color.Black, Color.Salmon, Color.Empty, Color.SeaShell, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
            DevExpress.Utils.AppearanceDefault appNotPass2 = new DevExpress.Utils.AppearanceDefault(Color.Black, Color.Yellow, Color.Empty, Color.SeaShell, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);

            System.Data.DataRow dr = gridView.GetDataRow(e.RowHandle);
            if (dr != null)
            {
                if (dr["sex"].ToString() == "女" && dr["birthday1"].ToString().Trim() == "55")
                {
                    DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, appNotPass2);
                }
                else if (dr["sex"].ToString() == "男" && dr["birthday1"].ToString().Trim() == "60")
                {
                    DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, appNotPass1);
                }
            }
        }
Exemple #13
0
        private void avbGridView_ShowingEditor(object sender, CancelEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            e.Cancel = !Program.MF.YetkiCheck(view.GetFocusedRowCellValue(colONYYTK).ToString());

            if (avbGridView.GetFocusedRowCellValue(colDRM).ToString() != "A" &&
                view.FocusedRowHandle != DevExpress.XtraGrid.GridControl.NewItemRowHandle &&
                view.GetDataRow(view.FocusedRowHandle).RowState != DataRowState.Added)
            {
                e.Cancel = true;
            }
            else if (view.FocusedColumn != colTUR && view.FocusedColumn != colACIKLAMA &&
                     view.GetFocusedRowCellValue(colREFID) != DBNull.Value &&
                     view.GetFocusedRowCellValue(colREFTO).ToString() != "E")    // OdemeEmri disindakiler
            {
                e.Cancel = true;
            }
        }
Exemple #14
0
 /// <summary>
 /// XtraGridView在行变化时,触发此事件,在事件中调用DoSave提交行数据的修改
 /// </summary>
 private void XtraGridView_BeforeLeaveRow(object sender, RowAllowEventArgs e)
 {
     try
     {
         if (masterBindingSource.Current != null)
         {
             DataRow dr = ((DataRowView)masterBindingSource.Current).Row;
             if (dr == browseXtraGridView.GetDataRow(e.RowHandle))
             {
                 if (dr.RowState != DataRowState.Unchanged)
                 {
                     //if (MessageHandler.ShowMessageBox_YesNo("确认是否保存当前行信息?") == DialogResult.Yes)
                     if (MessageHandler.ShowMessageBox_YesNo(f.tsmiQrsfbcdqhxx.Text) == DialogResult.Yes)
                     {
                         if (!btnSave_Click())
                         {
                             e.Allow = false;
                         }
                     }
                     else
                     {
                         dr.RejectChanges();
                         Set_Button_State(true);
                         Set_EditZone_ControlReadOnly(true);
                     }
                 }
                 else
                 {
                     Set_Button_State(true);
                     Set_EditZone_ControlReadOnly(true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         //ExceptionHandler.HandleException(this.Text + "--刷新按钮事件错误。", ex);
         ExceptionHandler.HandleException(this.Text + "--" + f.tsmiSxansjcw.Text, ex);
     }
 }
 private void view_MouseMove(object sender, MouseEventArgs e)
 {
     try
     {
         DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
         if (e.Button == MouseButtons.Left && _dragStartHitInfo != null)
         {
             Size      dragSize = SystemInformation.DragSize;
             Rectangle dragRect = new Rectangle(new Point(_dragStartHitInfo.HitPoint.X - dragSize.Width / 2, _dragStartHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize);
             if (!dragRect.Contains(new Point(e.X, e.Y)))
             {
                 _dragRowCursor = _imageHelper.GetDragCursor(_dragStartHitInfo.RowHandle, e.Location);
                 DataRow row = view.GetDataRow(_dragStartHitInfo.RowHandle);
                 view.GridControl.DoDragDrop(row, DragDropEffects.Move);
                 _dragStartHitInfo = null;
                 DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e).Handled = true;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemple #16
0
        private void repImg_Popup(object sender, EventArgs e)
        {
            if (!(sender is DevExpress.XtraEditors.ImageEdit))
            {
                return;
            }

            DevExpress.XtraEditors.ImageEdit        repImg = sender as DevExpress.XtraEditors.ImageEdit;
            DevExpress.XtraGrid.Views.Grid.GridView gv     = (repImg.Parent as DevExpress.XtraGrid.GridControl).MainView as DevExpress.XtraGrid.Views.Grid.GridView;

            DataRow _tpDr = gv.GetDataRow(gv.FocusedRowHandle);

            if (_tpDr["Icon"].Equals(System.DBNull.Value))
            {
                byte[] _tpBytes = ServerRefManager.PicFileRead(_tpDr["StylePic"].ToString(), _tpDr["Pic_Version"].ToString());
                gv.FocusedColumn = gv.Columns["Icon"];
                gv.ShowEditor();
                if (gv.ActiveEditor is DevExpress.XtraEditors.ImageEdit)
                {
                    if (repImg.Properties.ShowPopupShadow == false)
                    {
                        repImg.ShowPopup();
                    }
                }
                if (_tpBytes == null)
                {
                    _tpDr["Icon"] = new byte[1];
                }
                else
                {
                    _tpDr["Icon"] = _tpBytes;
                }
                gv.RefreshRow(gv.FocusedRowHandle);
                repImg.ShowPopup();
            }
        }
Exemple #17
0
        private void gridView1_Click(object sender, System.EventArgs e)
        {
            GridView    view = (GridView)sender;
            GridHitInfo hit  = view.CalcHitInfo(view.GridControl.PointToClient(MousePosition));

            if (hit.InRowCell && hit.Column.FieldName == "UnboundChecked")
            {
                DataRow row     = gridView1.GetDataRow(hit.RowHandle);
                object  key     = row["CategoryID"];
                DataRow prevRow = (DataRow)selectedItems[key];
                if (row == prevRow)
                {
                    return;
                }
                if (prevRow != null)
                {
                    prevRow["Selected"] = false;
                }
                view.RefreshRow(FindRowHandleByDataRow(view, prevRow));
                selectedItems[key] = view.GetDataRow(hit.RowHandle);
                view.GetDataRow(hit.RowHandle)["Selected"] = true;
                view.RefreshRow(hit.RowHandle);
            }
        }
Exemple #18
0
        private void gridMaster_DoubleClick(object sender, EventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi =
                gridMasterView.CalcHitInfo((sender as System.Windows.Forms.Control).PointToClient(System.Windows.Forms.Control.MousePosition));
            DataRow FocusRow;

            if (hi.RowHandle >= 0)
            {
                int nCategory = 99;
                FocusRow = gridMasterView.GetDataRow(hi.RowHandle);
                if (FocusRow.ItemArray[0].ToString() == "Fitness Package")
                {
                    nCategory = 1;
                }
                else if (FocusRow.ItemArray[0].ToString() == "Spa Package")
                {
                    nCategory = 2;
                }
                else if (FocusRow.ItemArray[0].ToString() == "Fitness Product")
                {
                    nCategory = 3;
                }
                else if (FocusRow.ItemArray[0].ToString() == "Spa Product")
                {
                    nCategory = 4;
                }
                else if (FocusRow.ItemArray[0].ToString() == "PT Package")
                {
                    nCategory = 5;
                }
                ACMS.ACMSManager.Human_Resource.Reports.RPAllIncomeDetail frm = new ACMS.ACMSManager.Human_Resource.Reports.RPAllIncomeDetail(FocusRow.ItemArray[0].ToString(), nCategory, dtDateDay.SelectionStart, oUser.NEmployeeID());
                frm.Show();
                //ACMS.ACMSStaff.WorkFlow.MyCustomEditForm frm = new ACMS.ACMSStaff.WorkFlow.MyCustomEditForm((int)FocusRow.ItemArray[0], nDepartment);
                //frm.Show();
            }
        }
        public void SetCurrentData()
        {
            DataRowView drv = (_bindingSource.Current as DataRowView);

            if (drv == null)
            {
                return;
            }
            this._data.DrCurrentMaster = drv.Row;
            DataRow[] drDetails;
            if (_data.DrCurrentMaster.RowState == DataRowState.Detached)
            {
                return;
            }
            if (_data.DrCurrentMaster[_data.PkMaster.FieldName] == DBNull.Value)
            {
                return;
            }
            string ConditionSelect = _data.PkMaster.FieldName + " = " + _data.quote + _data.DrCurrentMaster[_data.PkMaster.FieldName].ToString() + _data.quote;

            drDetails = _data.DsData.Tables[_data.DrTable["TableName"].ToString()].Select(ConditionSelect);
            //for (int i = 0; i < gvMain.DataRowCount; i++)
            //    drDetails.Add(gvMain.GetDataRow(i));
            this._data.LstDrCurrentDetails.Clear();
            this._data.LstDrCurrentDetails.AddRange(drDetails);
            this._data._formulaCaculator.LstDrCurrentDetails = this._data.LstDrCurrentDetails;
            //this._data._formulaCaculator.DataTable1_Rowdeleted(this._data.DsData.Tables[1], new DataRowChangeEventArgs(null, DataRowAction.Nothing));
            _data._lstCurRowDetail.Clear();
            for (int i = 0; i < _frmDesigner._gcDetail.Count; i++)
            {
                List <DataRow> drDetailstmp = new List <DataRow>();
                DevExpress.XtraGrid.Views.Grid.GridView gv = _frmDesigner._gcDetail[i].MainView as DevExpress.XtraGrid.Views.Grid.GridView;
                for (int j = 0; j < gv.DataRowCount; j++)
                {
                    CurrentRowDt crdt = new CurrentRowDt();
                    crdt.TableName = _frmDesigner._gcDetail[i].DataMember;
                    crdt.RowDetail = gv.GetDataRow(j);
                    _data._lstCurRowDetail.Add(crdt);
                }
            }
            DataView dvtmp = drv.Row.Table.DefaultView;

            //Lấy dữ liệu file
            this._data.Get_fileData4Record();
            foreach (CDTData.FileData fData in this._data._fileData)
            {
                foreach (fileContener fC in this._frmDesigner._lFileContener)
                {
                    if (fC.drField["sysFieldID"].ToString() == fData.drField["sysFieldID"].ToString())
                    {
                        fC.data = fData.fData;
                    }
                }
            }
            //Set Allow edit
            bool admin = bool.Parse(Config.GetValue("Admin").ToString());

            if (!admin)
            {
                foreach (DataRow dr in _data.DsStruct.Tables[0].Rows)
                {
                    if (this._frmDesigner.formAction == FormAction.View)
                    {
                        setEdit("1=0", dr["FieldName"].ToString());
                        continue;
                    }
                    if (dr["Editable1"] != DBNull.Value)
                    {
                        continue;
                    }
                    if (dr["Editable"] == DBNull.Value)
                    {
                        setEdit("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Editable"].ToString() == "0")
                    {
                        setEdit("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Editable"].ToString() == "1")
                    {
                        setEdit("1=1", dr["FieldName"].ToString());
                    }
                    else
                    {
                        try
                        {
                            setEdit(dr["Editable"].ToString(), dr["FieldName"].ToString());
                        }
                        catch {
                        }
                    }
                    //Set Visible
                    // if (dr["Visible1"] != DBNull.Value) continue;
                    if (dr["Visible"] == DBNull.Value)
                    {
                        setVisible("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Visible"].ToString() == "0")
                    {
                        setVisible("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Visible"].ToString() == "1")
                    {
                        setVisible("1=1", dr["FieldName"].ToString());
                    }
                    else
                    {
                        try
                        {
                            setVisible(dr["Visible"].ToString(), dr["FieldName"].ToString());
                        }
                        catch
                        {
                        }
                    }
                }
                foreach (DataRow dr in _data.DsStruct.Tables[1].Rows)
                {
                    if (this._frmDesigner.formAction == FormAction.View)
                    {
                        setEditCol("1=0", dr["FieldName"].ToString());
                        continue;
                    }
                    if (dr["Editable1"] != DBNull.Value)
                    {
                        continue;
                    }
                    if (dr["Editable"] == DBNull.Value)
                    {
                        setEditCol("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Editable"].ToString() == "0")
                    {
                        setEditCol("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Editable"].ToString() == "1")
                    {
                        setEditCol("1=1", dr["FieldName"].ToString());
                    }
                    else
                    {
                        try
                        {
                            setEditCol(dr["Editable"].ToString(), dr["FieldName"].ToString());
                        }
                        catch
                        {
                        }
                    }
                    //Set Visible

                    if (dr["Visible"] == DBNull.Value)
                    {
                        //setVisibleCol("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Visible"].ToString() == "0")
                    {
                        // setVisibleCol("1=0", dr["FieldName"].ToString());
                    }
                    else if (dr["Visible"].ToString() == "1")
                    {
                        //setVisibleCol("1=1", dr["FieldName"].ToString());
                    }
                    else
                    {
                        try
                        {
                            // setVisibleCol(dr["Visible"].ToString(), dr["FieldName"].ToString());
                        }
                        catch
                        {
                        }
                    }
                }
            }
            //Hiển thị các Action
            //foreach (DataRow dr in this._data.tbAction.Rows)
            //{
            foreach (ToolStripItem it in this.bindingNavigator1.Items)
            {
                //if (it.Name == dr["CommandName"].ToString())
                //{
                //it.Visible = true;
                if (this._frmDesigner.formAction == FormAction.View)
                {
                    it.Visible = false;
                    continue;
                }
                else
                {
                    it.Visible = true;
                }
                DataRow drAction = it.Tag as DataRow;
                if (it.Tag == null)
                {
                    continue;
                }
                if (drAction["BTID"].ToString() != _data.DrCurrentMaster["TaskID"].ToString())
                {
                    it.Visible = false;
                    continue;
                }
                string condition = drAction["ShowCond"].ToString();

                string con;
                if (condition != string.Empty)
                {
                    con = "(" + condition + ") and (" + this._data.PkMaster.FieldName + "=" + _data.quote + this._data.DrCurrentMaster[_data.PkMaster.FieldName].ToString() + _data.quote + ")";
                }
                else
                {
                    con = "(" + this._data.PkMaster.FieldName + "=" + _data.quote + this._data.DrCurrentMaster[_data.PkMaster.FieldName].ToString() + _data.quote + ")";
                }
                if (this._data.DrCurrentMaster.RowState == DataRowState.Detached || this._data.DrCurrentMaster.RowState == DataRowState.Added)
                {
                    it.Visible = false;
                }
                else
                {
                    //MessageBox.Show(con);
                    DataRow[] lstDr = _data.DrCurrentMaster.Table.Select(con);
                    if (lstDr.Length == 0)
                    {
                        it.Visible = false;
                    }
                    else
                    {
                        it.Visible = true;
                    }
                }
                //}
            }
            // }
        }