コード例 #1
0
        void DienThoaiGridView_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            try
            {
                if (DicCommand != null && e.CellValue != null && e.CellValue.ToString() != string.Empty)
                {
                    if (e.Column.FieldName.Contains("LenhDienThoai"))
                    {
                        var color = DicCommand.FirstOrDefault(p => p.Command.Equals(e.CellValue));
                        if (color != null && !string.IsNullOrEmpty(color.CommandColor) && !(color.IsColorRow == Utils.CommandBool.True))
                        {
                            e.Appearance.BackColor = Color.FromName(color.CommandColor);
                        }
                    }
                    else if (e.Column.FieldName.Contains("LenhTongDai"))
                    {
                        var color = DicCommand.FirstOrDefault(p => p.Command.Equals(e.CellValue));
                        if (color != null && !string.IsNullOrEmpty(color.CommandColor) && !(color.IsColorRow == Utils.CommandBool.True))
                        {
                            e.Appearance.BackColor = Color.FromName(color.CommandColor);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError("DienThoaiGridView_RowCellStyle", ex);
            }

            OnGridStyle(e.Appearance, e.Column.FieldName, e.RowHandle);
        }
コード例 #2
0
 private void RealTimeGridViewCommand_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (DicCommand != null)
         {
             var Command = DicCommand.FirstOrDefault(p => ((Keys)p.Shortcuts == e.KeyData || ((int)p.Shortcuts >= 48 && (int)p.Shortcuts <= 57 && (Keys)(p.Shortcuts + 48) == e.KeyData)));
             if (Command != null)
             {
                 var data = FocusedRow;
                 if (CheckCommand(data, Command))
                 {
                     DoCommand(data, Command);
                 }
             }
         }
     }
     catch (Exception ex) { ExceptionError("RealTimeGridViewCommand_KeyDown", ex); }
 }
コード例 #3
0
 private void RealTimeGridViewCommand_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (DicCommand != null)
         {
             var cmd = DicCommand.Join(RealTimeEnvironment.DicCommandModule, x => x.Id, y => y.CommandId, (x, y) => x);
             if (cmd == null || cmd.Count() == 0)
             {
                 return;
             }
             var Command = cmd.FirstOrDefault(p => ((Keys)p.Shortcuts == e.KeyData || ((int)p.Shortcuts >= 48 && (int)p.Shortcuts <= 57 && (Keys)(p.Shortcuts + 48) == e.KeyData)));
             if (Command != null)
             {
                 var data = FocusedRow;
                 if (CheckCommand(data, Command))
                 {
                     DoCommand(data, Command);
                 }
             }
         }
     }
     catch (Exception ex) { ExceptionError("RealTimeGridViewCommand_KeyDown", ex); }
 }
コード例 #4
0
        void DienThoaiGridView_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            try
            {
                if (e.RowHandle >= 0)
                {
                    if (DicCommand != null)
                    {
                        var LenhDienThoai = this.GetRowCellValue(e.RowHandle, "LenhDienThoai");
                        if (LenhDienThoai != null && LenhDienThoai.ToString() != string.Empty)
                        {
                            var color = DicCommand.FirstOrDefault(p => p.Command.Equals(LenhDienThoai));
                            if (color != null && !string.IsNullOrEmpty(color.CommandColor) && (color.IsColorRow == Utils.CommandBool.True))
                            {
                                e.Appearance.BackColor = Color.FromName(color.CommandColor);
                            }
                        }
                        var LenhTongDai = this.GetRowCellValue(e.RowHandle, "LenhTongDai");
                        if (LenhTongDai != null && LenhTongDai.ToString() != null)
                        {
                            var color2 = DicCommand.FirstOrDefault(p => p.Command.Equals(LenhTongDai));
                            if (color2 != null && color2.IsColorAll == Utils.CommandBool.True && !string.IsNullOrEmpty(color2.CommandColor) && (color2.IsColorRow == Utils.CommandBool.True))
                            {
                                e.Appearance.BackColor = Color.FromName(color2.CommandColor);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionError("DienThoaiGridView_RowStyle", ex);
            }

            OnGridStyle(e.Appearance, string.Empty, e.RowHandle, true);
        }