public override void Refresh()
 {
     base.Refresh();
     //
     setLangThis();
     //
     initRoom();
     initReserved();
     //
     if (selectRoomID != 0)
     {
         DevExpress.XtraGrid.Views.Base.ColumnView c = gridControlRoomLeave.MainView as DevExpress.XtraGrid.Views.Base.ColumnView;
         //
         gvControlRoomLeave.FocusedRowHandle = c.LocateByValue("room_id", selectRoomID);
         //
         selectRoomID = 0;
     }
     if (selectReserveID != 0)
     {
         DevExpress.XtraGrid.Views.Base.ColumnView c = gridControlReserved.MainView as DevExpress.XtraGrid.Views.Base.ColumnView;
         //
         gvControlReserved.FocusedRowHandle = c.LocateByValue("reserve_room_id", selectReserveID);
         //
         selectReserveID = 0;
     }
     //
     changeRow();
 }
Example #2
0
        private void CheckSequrityDetail(DevExpress.XtraGrid.Views.Base.ColumnView view)
        {
            view.Columns["ShipsMD5"].Visible         = false;
            view.Columns["ShipsMD5DetailID"].Visible = false;
            view.Columns["ShipsMD5ID"].Visible       = false;
            view.Columns["AddTime"].Visible          = false;

            view.Columns["ShipNumber"].Caption = "№ отгрузки";
            view.Columns["Customer"].Caption   = "Клиент";
            view.Columns["LegalName"].Caption  = "Юр. лицо";
            view.Columns["ShipDate"].Caption   = "Дата отгр";
            view.Columns["FilePath"].Visible   = false;


            view.Columns["AdvancePayment"].Caption = "Предв расчет";
            view.Columns["Completed"].Caption      = "Комплектация";
            view.Columns["FinalPayment"].Caption   = "Окон. расчет";
            view.Columns["Invoiced"].Caption       = "Выст. счет-фактура";
            view.Columns["Paid"].Caption           = "Оплачено";
            view.Columns["Shiped"].Caption         = "Отгружено";

            foreach (var a in Security.ValuesAndDescriptions.Where(a => a.Value[1] != "DontShowField"))
            {
                view.Columns[a.Value[0]].OptionsColumn.AllowEdit = ((Security.ShipControl & a.Key) == a.Key);
                if ((Security.ShipControl & a.Key) != a.Key)
                {
                    //view.Columns.Remove(view.Columns[a.Value]);
                }
            }
            ApplySecurityDetails(view);
        }
 /// <summary>
 /// 取消冻结。
 /// </summary>
 /// <param name="xtraGrid"></param>
 public void UnSixedColumn(DevExpress.XtraGrid.GridControl xtraGrid) {
     DevExpress.XtraGrid.Views.Base.ColumnView girdView = xtraGrid.MainView as DevExpress.XtraGrid.Views.Base.ColumnView;
     if (girdView.FocusedColumn == null)
         return;
     for (int i = girdView.Columns.Count - 1; i > -1; i--) {
         girdView.Columns[i].Fixed = DevExpress.XtraGrid.Columns.FixedStyle.None;
     }
 }
Example #4
0
 private void StudenQuery()
 {
     gridControl1.DataSource    = StudentInfo.SimpleQuery(1, int.MaxValue, _key, out _pageTotal);
     gridView1.FocusedRowHandle = _selectionRow;
     DevExpress.XtraGrid.Views.Base.ColumnView columnView = gridControl1.FocusedView as DevExpress.XtraGrid.Views.Base.ColumnView;
     columnView.MoveBy(0);
     gridControl1.RefreshDataSource();
 }
Example #5
0
 private void AddGridColumn(DevExpress.XtraGrid.Views.Base.ColumnView view, string fieldName, string caption, DevExpress.XtraEditors.Repository.RepositoryItem item, string format, DevExpress.Utils.FormatType type)
 {
     DevExpress.XtraGrid.Columns.GridColumn column = view.Columns.AddField(fieldName);
     column.Caption    = caption;
     column.ColumnEdit = item;
     column.DisplayFormat.FormatType   = type;
     column.DisplayFormat.FormatString = format;
     column.VisibleIndex = view.VisibleColumns.Count;
 }
Example #6
0
 //handler used in order to validate a new row
 void gridViewListaComprasEspeciales_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     DevExpress.XtraGrid.Views.Base.ColumnView view         = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
     DevExpress.XtraGrid.Columns.GridColumn    costosColumn = view.Columns[1];
     if (view.GetRowCellValue(e.RowHandle, costosColumn).ToString() == null || view.GetRowCellValue(e.RowHandle, costosColumn).ToString().Trim().Length == 0)
     {
         e.Valid = false;
         view.SetColumnError(costosColumn, "Columna Costos no puede estar vacia", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
 }
Example #7
0
 private void Query()
 {
     gridControl1.DataSource    = PayRecordInfo.SimpleQuery(_pageIndex, _pageSize, _key, out _pageTotal);
     gridView1.FocusedRowHandle = _selectionRow;
     DevExpress.XtraGrid.Views.Base.ColumnView columnView =
         gridControl1.FocusedView as DevExpress.XtraGrid.Views.Base.ColumnView;
     columnView.MoveBy(0);
     gridControl1.RefreshDataSource();
     _page.SetPage(_pageIndex, _pageSize, _pageTotal);
 }
Example #8
0
 public static void SetFocusedRow <T>(this DevExpress.XtraGrid.Views.Base.ColumnView gView, T entity)
 {
     if (entity == null)
     {
         gView.FocusInvalidRow();
     }
     else
     {
         gView.FocusedRowHandle = gView.FindRow(entity);
     }
 }
Example #9
0
        private IGridColumnModelSynchronizer GetColumnInfo(GridColumn column, DevExpress.XtraGrid.Views.Base.ColumnView columnView)
        {
            IGridColumnModelSynchronizer result = null;
            var modelSynchronizersHolder        = columnView as IModelSynchronizersHolder;

            if (modelSynchronizersHolder != null)
            {
                result = modelSynchronizersHolder.GetSynchronizer(column) as IGridColumnModelSynchronizer;
            }
            return(result);
        }
Example #10
0
 private void _gdSUB_VIEW_RowStyle(object sender, RowStyleEventArgs e)
 {
     DevExpress.XtraGrid.Views.Base.ColumnView view = (DevExpress.XtraGrid.Views.Base.ColumnView)sender;
     if (view.IsValidRowHandle(e.RowHandle))
     {
         if (view.GetRowCellValue(e.RowHandle, "USE_YN") != null && view.GetRowCellValue(e.RowHandle, "USE_YN").ToString() == "N")
         {
             e.Appearance.BackColor = Color.Tomato;
         }
     }
 }
 void EnsureCurrentObject()
 {
     if ((View).CurrentObject == null)
     {
         DevExpress.XtraGrid.Views.Base.ColumnView gridView =
             ((IColumnViewEditor)((ListView)View).Editor).ColumnView;
         gridView.ActiveEditor.IsModified = true;
         ((IGridInplaceEdit)gridView.ActiveEditor).GridEditingObject = (View).CurrentObject;
         gridView.RefreshEditor(true);
     }
 }
Example #12
0
        private void gridViewMaster_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)
        {
            DevExpress.XtraGrid.Views.Base.ColumnView view = gridViewMaster.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
            GridView gridView = gridViewMaster.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;

            gridView.CustomDrawCell -= detailView_CustomDrawCell;
            gridView.CustomDrawCell += detailView_CustomDrawCell;


            //view.ViewCaption = "Text " + e.RowHandle.ToString();
            CheckSequrityDetail(view);
        }
        /// <summary>
        ///  冻结列
        /// </summary>
        /// <param name="girdView"></param>
        public void FixedFocusColumn(DevExpress.XtraGrid.GridControl xtraGrid) {
            DevExpress.XtraGrid.Views.Base.ColumnView girdView = xtraGrid.MainView as DevExpress.XtraGrid.Views.Base.ColumnView;
            if (girdView.FocusedColumn == null)
                return;

            int index = girdView.FocusedColumn.VisibleIndex;
            foreach (DevExpress.XtraGrid.Columns.GridColumn dc in girdView.Columns) {
                if (dc.VisibleIndex > index)
                    continue;
                dc.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
            }
        }
Example #14
0
 private void _gdSUB_VIEW_RowStyle(object sender, RowStyleEventArgs e)
 {
     DevExpress.XtraGrid.Views.Base.ColumnView view = (DevExpress.XtraGrid.Views.Base.ColumnView)sender;
     if (view.IsValidRowHandle(e.RowHandle))
     {
         if (view.GetRowCellValue(e.RowHandle, "USE_YN") != null && view.GetRowCellValue(e.RowHandle, "USE_YN").ToString() == "N")
         {
             e.Appearance.BackColor = Color.Tomato;
         }
     }
     //(Color)view.GetRowCellValue(e.RowHandle, "Color");
     //view.SetRowCellValue(e.RowHandle, view.Columns["PART_UNITCOST_START_DATE"], DateTime.Today);
 }
Example #15
0
        /// <summary>
        /// 获取Grid当前选择 某个字段值
        /// </summary>
        /// <param name="view">gridView对象</param>
        /// <param name="ColName">字段名</param>
        /// <returns></returns>
        public string GetGridViewColValue(DevExpress.XtraGrid.Views.Base.ColumnView view, string ColName)
        {
            string value = string.Empty;

            if (view.RowCount == 0)
            {
                return(value);
            }

            DevExpress.XtraGrid.Columns.GridColumn colvalue = view.Columns.ColumnByFieldName(ColName);
            value = view.GetRowCellValue(view.FocusedRowHandle, colvalue).ToString();

            return(value);
        }
 private void grd_view_purchase_return_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     DevExpress.XtraGrid.Views.Base.ColumnView view = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
     if (view.FocusedColumn.VisibleIndex == 3)
     {
         double stock_qty = bllUtility.Val(view.GetRowCellDisplayText(view.FocusedRowHandle, "Stock"));
         double pr_qty    = bllUtility.Val(e.Value.ToString());
         if (pr_qty > stock_qty)
         {
             e.Valid     = false;
             e.ErrorText = "You can not return more then stock qty !";
             view.SetColumnError(view.Columns["PRQty"], e.ErrorText);
             return;
         }
     }
 }
        private void gridViewMain_ShownEditor(object sender, EventArgs e)
        {
            DevExpress.XtraGrid.Views.Base.ColumnView view = (DevExpress.XtraGrid.Views.Base.ColumnView)sender;
            XPDataTableObject row = (XPDataTableObject)gridViewMain.GetRow(gridViewMain.FocusedRowHandle);

            if (row == null)
            {
                return;
            }
            if (row.GetMemberValue("jointocheck") == null || Convert.ToBoolean(row.GetMemberValue("jointocheck")) == false)
            {
                view.ActiveEditor.Properties.ReadOnly = true;
            }
            else
            {
                view.ActiveEditor.Properties.ReadOnly = false;
            }
        }
Example #18
0
        private void gridView1_CustomDrawEmptyForeground(object sender,
                                                         DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
        {
            string s = string.Empty;

            DevExpress.XtraGrid.Views.Base.ColumnView view = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
            BindingSource dataSource = view.DataSource as BindingSource;

            if (dataSource == null)
            {
                s = "没有数据 QAQ";
            }
            else if (dataSource.Count == 0)
            {
                s = "没有找到符合条件的数据 QAQ";
            }
            Font      font = new Font("微软雅黑", 10, FontStyle.Bold);
            Rectangle r    = new Rectangle(e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 5, e.Bounds.Height - 5);

            e.Graphics.DrawString(s, font, Brushes.Black, r);
        }
Example #19
0
 private void ApplySecurityDetails(DevExpress.XtraGrid.Views.Base.ColumnView view)
 {
     foreach (var a in Security.ValuesAndDescriptionsDetail.Where(a => a.Value[1] == "DontShowField"))
     {
         var column = view.Columns.ColumnByFieldName(a.Key.ToString());
         if (column != null)
         {
             column.Visible = false;
         }
         //XtraGrid.Columns[a.Value[0]].Visible = false;
     }
     foreach (var a in Security.ValuesAndDescriptionsDetail.Where(a => ((a.Value[0] != "Editable") || (Security.ReadOnlyForShips))))
     {
         var column = view.Columns.ColumnByFieldName(a.Key.ToString());
         if (column != null)
         {
             column.OptionsColumn.AllowEdit = false;
         }
         //XtraGrid.Columns[a.Key.ToString()].OptionsColumn.AllowEdit = false;
     }
 }
Example #20
0
        DevExpress.XtraGrid.Views.Base.ColumnView GetLevelDefaultViewCore(IModelListView masterModelListView, ExpressApp.MasterDetail.Win.IMasterDetailColumnView masterGridView, int rowHandle, int relationIndex, List <MasterDetailRuleInfo> masterDetailRules)
        {
            var  modelDetailRelationCalculator = new ModelDetailRelationCalculator(masterModelListView, masterGridView, masterDetailRules);
            bool isRelationSet = modelDetailRelationCalculator.IsRelationSet(rowHandle, relationIndex);

            if (isRelationSet)
            {
                IModelListView childModelListView = modelDetailRelationCalculator.GetChildModelListView(rowHandle, relationIndex);
                ListView       listView           = GetListView(modelDetailRelationCalculator, rowHandle, relationIndex, childModelListView);
                DevExpress.XtraGrid.Views.Base.ColumnView defaultXpandXafGridView = null;
                EventHandler[] listViewOnControlsCreated = { null };
                ListView       view = listView;
                listViewOnControlsCreated[0] = (sender, args) => {
                    defaultXpandXafGridView = ((IColumnViewEditor)((ListView)sender).Editor).GridView;
                    view.ControlsCreated   -= listViewOnControlsCreated[0];
                };
                listView.ControlsCreated += listViewOnControlsCreated[0];
                listView.CreateControls();
                return(defaultXpandXafGridView);
            }
            return(null);
        }
Example #21
0
        private void ucBankaListesi_Load(object sender, EventArgs e)
        {
            taksitlistesi();

            if (this.Tag != null)
            {
                if (this.Tag.ToString() != "")
                {
                    DevExpress.XtraGrid.Views.Base.ColumnView view = gridView1;
                    view.ActiveFilter.Add(view.Columns["Firmaadi"],
                                          new DevExpress.XtraGrid.Columns.ColumnFilterInfo("[Firmaadi] Like '" + this.Tag.ToString() + "'", ""));
                }
            }

            Yazdirma_islemleri yi = new Yazdirma_islemleri();

            yi.GridTasarimYukle(gridView1, "SenetlerGrid");

            gridView1.ExpandAllGroups();
            gridView1.ExpandGroupRow(0);
            //gridView1.ActiveFilterString = this.Tag.ToString();
        }
Example #22
0
 //handler used in order to validate a new row
 void gridViewCompras_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     DevExpress.XtraGrid.Views.Base.ColumnView view              = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
     DevExpress.XtraGrid.Columns.GridColumn    column1           = view.Columns[3];
     DevExpress.XtraGrid.Columns.GridColumn    columnCostoUnidad = view.Columns[4];
     DevExpress.XtraGrid.Columns.GridColumn    columnInsumo      = view.Columns[2];
     if (view.GetRowCellValue(e.RowHandle, column1).ToString() == null || view.GetRowCellValue(e.RowHandle, column1).ToString().Trim().Length == 0)
     {
         e.Valid = false;
         view.SetColumnError(column1, "Cantidad no puede ser vacio", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
     else if (view.GetRowCellValue(e.RowHandle, columnCostoUnidad).ToString() == null || view.GetRowCellValue(e.RowHandle, columnCostoUnidad).ToString().Trim().Length == 0)
     {
         e.Valid = false;
         view.SetColumnError(columnCostoUnidad, "Costo Unidad no puede ser vacio", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
     else if (view.GetRowCellValue(e.RowHandle, columnInsumo).ToString() == null || view.GetRowCellValue(e.RowHandle, columnInsumo).ToString().Trim().Length == 0)
     {
         e.Valid = false;
         view.SetColumnError(columnInsumo, "Debe seleccionar insumo", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
 }
Example #23
0
        private void gridViewComprarlista_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Base.ColumnView view = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
            // TODO: columnCantidad is declared but is never used. Use this local or remove it please.
            // TODO: columnCostoUnidad is declared but is never used. Use this local or remove it please.
            DevExpress.XtraGrid.Columns.GridColumn columnCantidad    = view.Columns[3];
            DevExpress.XtraGrid.Columns.GridColumn columnCostoUnidad = view.Columns[4];

            DataRow row;

            row = gridViewComprarlista.GetDataRow(e.RowHandle);

            if (row == null)  //|| row[0].ToString() == string.Empty)
            {
                // TODO: lote is declared but is never used. Use this local or remove it please.
                string lote = "select Cantidad from Insumo where InsumoId=" + e.Value.ToString( );
                //     lote = CommonUtils.ConexionBD.EjecutarConsultaEspecial(lote);
                //     gridViewComprarlista.SetRowCellValue(gridViewComprarlista.FocusedRowHandle, gridViewComprarlista.Columns["Cantidad"], lote);

                return;
            }
            else if (row[0].ToString( ) == string.Empty)
            {
                //
                return;
            }

            if ((e.Value.ToString( ).Trim( ) == string.Empty) && gridViewComprarlista.FocusedColumn.FieldName != "Descripcion")
            {
                ribbonControl.Enabled = false;
                return;
            }
            else
            {
                ribbonControl.Enabled = true;
            }

            object[] array = new object[5];
            array[0] = row[0].ToString( );                        //id
            array[1] = row[7].ToString( );                        //insumo id
            array[2] = int.Parse(row[2].ToString( )).ToString( ); //cantidad
            array[3] = row[3].ToString( );                        //costo unidad
            array[4] = row[5].ToString( );                        //descripcion

            if (gridViewComprarlista.FocusedColumn.FieldName == "Cantidad")
            {
                if (e.Value.ToString( ) != string.Empty)
                {
                    string a = e.Value.ToString( ).Replace(".", "");
                    array[2] = int.Parse(a);
                }
            }
            else if (gridViewComprarlista.FocusedColumn.FieldName == "CostoUnidad")
            {
                array[3] = e.Value.ToString( );
            }
            else if (gridViewComprarlista.FocusedColumn.FieldName == "InsumoId")
            {
                array[1] = e.Value.ToString( );
            }
            else if (gridViewComprarlista.FocusedColumn.FieldName == "Descripcion")
            {
                array[4] = e.Value.ToString( );
            }

            if (dictionaryOfRows.ContainsKey(row[0].ToString( )))
            {
                dictionaryOfRows.Remove(row[0].ToString( ));
            }
            dictionaryOfRows.Add
                (row[0].ToString( ), array);
        }
Example #24
0
 private void AddGridColumn(DevExpress.XtraGrid.Views.Base.ColumnView view, string fieldName, string caption)
 {
     AddGridColumn(view, fieldName, caption, null);
 }
Example #25
0
 private void AddGridColumn(DevExpress.XtraGrid.Views.Base.ColumnView view, string fieldName, string caption, DevExpress.XtraEditors.Repository.RepositoryItem item)
 {
     AddGridColumn(view, fieldName, caption, item, "", DevExpress.Utils.FormatType.None);
 }
Example #26
0
 public GridColumnCollection(DevExpress.XtraGrid.Views.Base.ColumnView view) : base(view)
 {
 }
Example #27
0
        private void gridView5_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Base.ColumnView columna = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
            string           nomcliente           = "";
            Int64            IdCliente            = 0;
            clsCuenta        cuenta               = new clsCuenta();
            clsClienteMaster clienteselecccionado = new clsClienteMaster(false);


            if (e.Column.FieldName == "Cliente.NombreFantasia")
            {
                nomcliente = columna.EditingValue.ToString();

                //Console.WriteLine("nomCliente--->"+nomcliente);
                if (nomcliente.Trim() != "")
                {
                    ddlP1Cliente.SelectedIndex = 0;
                    for (int i = 0; i < ddlP1Cliente.Properties.Items.Count; i++)
                    {
                        if (ddlP1Cliente.Properties.Items[i].ToString().Trim() == nomcliente.Trim())
                        {
                            ddlP1Cliente.SelectedIndex = i;
                            break;
                        }
                    }
                    //Console.WriteLine("index seleccionado--->" + ddlP1Cliente.SelectedIndex);

                    if (ddlP1Cliente.SelectedIndex == 0)
                    {
                        clienteselecccionado = new clsClienteMaster(true)
                        {
                            NombreFantasia = columna.EditingValue.ToString(),
                            NombreCompañia = columna.EditingValue.ToString(),
                            Tipo           = Enums.TipoPersona.CuentaPaperless,
                            EstadoCuenta   = Enums.Estado.Habilitado
                        };
                        PaperlessAsignacionActual.DataUsuario1.Paso1HousesBL[e.RowHandle].TipoCliente = null;
                    }
                    else
                    {
                        clienteselecccionado = (clsClienteMaster)this.ddlP1Cliente.SelectedItem;
                        if (clienteselecccionado.Id != 0)
                        {
                            PaperlessTipoCliente ptc = new PaperlessTipoCliente();

                            var transaccion = LogicaNegocios.Clientes.clsCuentas.BuscarCuentaPorId(clienteselecccionado.Id);
                            if (transaccion != null)
                            {
                                cuenta = (clsCuenta)transaccion.ObjetoTransaccion;
                                if (cuenta != null && cuenta.ClienteMaster.ClienteMasterTipoCliente != null)
                                {
                                    if (cuenta.ClienteMaster.ClienteMasterTipoCliente.Count.Equals(0) ||
                                        cuenta.ClienteMaster.ClienteMasterTipoCliente.Count > 1)
                                    {
                                        PaperlessAsignacionActual.DataUsuario1.Paso1HousesBL[e.RowHandle].TipoCliente = null;
                                    }
                                    else
                                    {
                                        ptc.Nombre = cuenta.ClienteMaster.ClienteMasterTipoCliente[0].Nombre;
                                        ptc.Id     = cuenta.ClienteMaster.ClienteMasterTipoCliente[0].Id;
                                        PaperlessAsignacionActual.DataUsuario1.Paso1HousesBL[e.RowHandle].TipoCliente = ptc;
                                    }
                                }
                                else
                                {
                                    PaperlessAsignacionActual.DataUsuario1.Paso1HousesBL[e.RowHandle].TipoCliente = null;
                                }
                            }
                        }
                        if (clienteselecccionado.NombreFantasia.Length.Equals(0))
                        {
                            clienteselecccionado.NombreFantasia = clienteselecccionado.NombreCompañia;
                        }
                    }
                }

                PaperlessAsignacionActual.DataUsuario1.Paso1HousesBL[e.RowHandle].Cliente = clienteselecccionado;
            }

            if (e.Column.FieldName == "TipoCliente.Nombre")
            {
                PaperlessAsignacionActual.DataUsuario1.Paso1HousesBL[e.RowHandle].TipoCliente =
                    (PaperlessTipoCliente)columna.EditingValue;
            }
        }
Example #28
0
        private void dgv_KQ_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (DanhSachCum.RowCount > 0)
            {
                //SplashScreenManager.ShowForm(typeof(WaitForm2));
                Double DTB_Max_Detail = 0;
                Double DTB_Min_Detail = 10;
                DevExpress.XtraGrid.Views.Base.ColumnView bw = (DevExpress.XtraGrid.Views.Base.ColumnView)dgv_DanhSachCum.FocusedView;
                DataRow dr1    = bw.GetDataRow(0);
                double  center = Convert.ToDouble(DanhSachCum.GetRowCellValue(DanhSachCum.FocusedRowHandle, "Cen").ToString());

                dgv_ChiTietCum.DataSource     = null;
                dgv_TongHopTheoLop.DataSource = null;

                String[] Class     = new String[frm_Main.path_src.dt.Rows.Count];
                int      COU_Class = 0;
                int      NUM_Class = 0;


                KMEDOIDS_Result.dt_View_Clustering_Detail = new DataTable();
                KMEDOIDS_Result.dt_View_Clustering_Detail.Columns.Add(new DataColumn("f_masv"));
                KMEDOIDS_Result.dt_View_Clustering_Detail.Columns.Add(new DataColumn("f_lop"));
                KMEDOIDS_Result.dt_View_Clustering_Detail.Columns.Add(new DataColumn("f_ho"));
                KMEDOIDS_Result.dt_View_Clustering_Detail.Columns.Add(new DataColumn("f_ten"));
                KMEDOIDS_Result.dt_View_Clustering_Detail.Columns.Add(new DataColumn("f_dtb"));

                for (int i = 0; i < Subjects.COU_Subjects; i++)
                {
                    KMEDOIDS_Result.dt_View_Clustering_Detail.Columns.Add(new DataColumn(Subjects.ARR_Subjects[i]));
                }

                //DataRow dr;

                for (int i = 0; i < frm_Main.path_src.dt.Rows.Count; i++)
                {
                    if (Convert.ToDouble(Students.EXCEL[i, 5]) == center)
                    {
                        KMEDOIDS_Result.dr_View_Clustering_Detail           = KMEDOIDS_Result.dt_View_Clustering_Detail.NewRow();
                        KMEDOIDS_Result.dr_View_Clustering_Detail["f_masv"] = Students.EXCEL[i, 0];
                        KMEDOIDS_Result.dr_View_Clustering_Detail["f_lop"]  = Students.EXCEL[i, 3];
                        KMEDOIDS_Result.dr_View_Clustering_Detail["f_ho"]   = Students.EXCEL[i, 1];
                        KMEDOIDS_Result.dr_View_Clustering_Detail["f_ten"]  = Students.EXCEL[i, 2];
                        KMEDOIDS_Result.dr_View_Clustering_Detail["f_dtb"]  = Math.Round(Convert.ToDouble(Students.EXCEL[i, 4]), 2);

                        for (int j = 0; j < Subjects.COU_Subjects; j++)
                        {
                            KMEDOIDS_Result.dr_View_Clustering_Detail[Subjects.ARR_Subjects[j]] = Students.EXCEL[i, 6 + j];
                        }

                        KMEDOIDS_Result.dt_View_Clustering_Detail.Rows.Add(KMEDOIDS_Result.dr_View_Clustering_Detail);

                        Class[NUM_Class] = Students.EXCEL[i, 3];
                        NUM_Class++;

                        if (Math.Round(Convert.ToDouble(Students.EXCEL[i, 4]), 2) > DTB_Max_Detail)
                        {
                            DTB_Max_Detail = Math.Round(Convert.ToDouble(Students.EXCEL[i, 4]), 2);
                        }
                        if (Math.Round(Convert.ToDouble(Students.EXCEL[i, 4]), 2) < DTB_Min_Detail)
                        {
                            DTB_Min_Detail = Math.Round(Convert.ToDouble(Students.EXCEL[i, 4]), 2);
                        }
                    }
                }
                dgv_ChiTietCum.DataSource = KMEDOIDS_Result.dt_View_Clustering_Detail;

                String[,] Class_Detail = new String[NUM_Class, 3];
                Class_Detail[0, 0]     = Class[0];
                Class_Detail[0, 1]     = "1";
                Class_Detail[0, 2]     = "1%";
                COU_Class++;

                for (int i = 1; i < NUM_Class; i++)
                {
                    int similar_class = 0;

                    for (int j = 0; j < COU_Class; j++)
                    {
                        if (Class[i] == Class_Detail[j, 0])
                        {
                            Class_Detail[j, 1] = (Convert.ToInt32(Class_Detail[j, 1]) + 1).ToString();
                            similar_class++;
                        }
                    }

                    if (similar_class == 0)
                    {
                        Class_Detail[COU_Class, 0] = Class[i];
                        Class_Detail[COU_Class, 1] = "1";
                        COU_Class++;
                    }
                }

                for (int i = 0; i < NUM_Class; i++)
                {
                    Class_Detail[i, 2] = (Math.Round(Convert.ToDouble(Class_Detail[i, 1]) / Convert.ToDouble(DanhSachCum.GetRowCellValue(DanhSachCum.FocusedRowHandle, "SoPT").ToString()), 4) * 100).ToString() + " %";
                }

                DataTable dt_th = new DataTable();
                dt_th.Columns.Add(new DataColumn("TenLop"));
                dt_th.Columns.Add(new DataColumn("SoLuong"));
                dt_th.Columns.Add(new DataColumn("TyLe_Lop"));

                DataRow dr_th;

                for (int i = 0; i < COU_Class; i++)
                {
                    dr_th             = dt_th.NewRow();
                    dr_th["TenLop"]   = Class_Detail[i, 0];
                    dr_th["SoLuong"]  = Class_Detail[i, 1];
                    dr_th["TyLe_Lop"] = Class_Detail[i, 2];
                    dt_th.Rows.Add(dr_th);
                }
                dgv_TongHopTheoLop.DataSource = dt_th;

                txt_DiemTB_Max.Text = DTB_Max_Detail.ToString();
                txt_DiemTB_Min.Text = DTB_Min_Detail.ToString();
            }
        }
        private void gridViewComprasInsumos_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Base.ColumnView view = sender as DevExpress.XtraGrid.Views.Base.ColumnView;


            DataRow row;

            row = gridViewComprasInsumos.GetDataRow(e.RowHandle);

            if (row == null)//|| row[0].ToString() == string.Empty)
            {
                return;
            }
            else if (row[0].ToString() == string.Empty)
            {
                //
                return;
            }

            if ((e.Value.ToString().Trim() == string.Empty) && gridViewComprasInsumos.FocusedColumn.FieldName != "Descripcion")
            {
                ribbonControl.Enabled = false;
                return;
            }
            else
            {
                ribbonControl.Enabled = true;
            }
            dataHasChanged = true;

            object[] array = new object[5];
            array[0] = row[0].ToString();                       //id
            array[1] = row[7].ToString();                       //insumo id
            array[2] = int.Parse(row[2].ToString()).ToString(); //cantidad
            array[3] = row[3].ToString();                       //costo unidad
            array[4] = row[5].ToString();                       //descripcion

            if (gridViewComprasInsumos.FocusedColumn.FieldName == "Cantidad")
            {
                if (e.Value.ToString() != string.Empty)
                {
                    string a = e.Value.ToString().Replace(".", "");

                    array[2] = int.Parse(a);
                    if (row[3].ToString() != string.Empty)
                    {
                        string costoTotal = (float.Parse(a) * float.Parse(row[3].ToString())).ToString();
                        gridViewComprasInsumos.SetRowCellValue(gridViewComprasInsumos.FocusedRowHandle, gridViewComprasInsumos.Columns[4], costoTotal);
                    }
                }
            }
            else if (gridViewComprasInsumos.FocusedColumn.FieldName == "CostoUnidad")
            {
                array[3] = e.Value.ToString();
                if (row[2].ToString() != string.Empty && e.Value.ToString() != string.Empty)
                {
                    string costoTotal = (float.Parse(e.Value.ToString()) * float.Parse(row[2].ToString())).ToString();
                    gridViewComprasInsumos.SetRowCellValue(gridViewComprasInsumos.FocusedRowHandle, gridViewComprasInsumos.Columns[4], costoTotal);
                }
            }
            else if (gridViewComprasInsumos.FocusedColumn.FieldName == "InsumoId")
            {
                array[1] = e.Value.ToString();
                gridViewComprasInsumos.SetRowCellValue(gridViewComprasInsumos.FocusedRowHandle, gridViewComprasInsumos.Columns[7], CommonUtils.ConexionBD.EjecutarConsultaEspecial("select Cantidad from Insumo where InsumoId='" + e.Value.ToString() + "' "));
                gridViewComprasInsumos.SetRowCellValue(gridViewComprasInsumos.FocusedRowHandle, gridViewComprasInsumos.Columns[8], CommonUtils.ConexionBD.EjecutarConsultaEspecial("select Unidad from Insumo where InsumoId='" + e.Value.ToString() + "' "));
            }
            else if (gridViewComprasInsumos.FocusedColumn.FieldName == "Descripcion")
            {
                array[4] = e.Value.ToString();
            }

            if (dictionaryOfRows.ContainsKey(row[0].ToString()))
            {
                dictionaryOfRows.Remove(row[0].ToString());
            }
            dictionaryOfRows.Add
                (row[0].ToString(), array);
        }