示例#1
0
        private void Frm_SearchAndEdit_Load(object sender, EventArgs e)
        {
            grid_SearchAndEdit.EmbeddedNavigator.TextStringFormat = "Bản ghi {0} / {1}";
            grid_SearchAndEdit.EmbeddedNavigator.Size             = new Size(1000, 10);
            //CheckConnectionDb();


            try
            {
                Dt_loc.FromDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 00, 00, 00);
                //  Dt_loc.ToDate =new DateTime( DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day,23,23,59);
                DatLaiTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59));
                dtfrom = Dt_loc.FromDate;
                dtto   = Dt_loc.ToDate;
                grid_SearchAndEdit.Refresh();
                LoadDb();
                if (grd_HistoryGs.RowCount == 0)
                {
                    KhoaButtonLoi(true);
                }

                if (grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaLoi") != null)
                {
                    if (grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaLoi").ToString().Equals("0"))
                    {
                        OldErr = "không lỗi";
                    }
                    else
                    {
                        OldErr = "lỗi loại " + grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaLoi").ToString();
                    }
                }
                if (CommonDictionary4Monitor.DataSource.error_type != null)
                {
                    repError.DataSource    = CommonDictionary4Monitor.DataSource.error_type;
                    repError.DisplayMember = CommonDictionary4Monitor.DataSource.error_type.ERR_TYPE_DESCColumn.ColumnName;
                    repError.ValueMember   = CommonDictionary4Monitor.DataSource.error_type.ERR_TYPE_IDColumn.ColumnName;
                }
                else
                {
                    CommonDictionary4Monitor.LoadAllDictionary();
                }
                GridView view = grd_HistoryGs;
                view.Appearance.FocusedRow.BackColor = Color.Transparent;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
示例#2
0
        /// <summary>
        /// Trả về mô tả loại xe khi đã biết loại xe
        /// </summary>
        /// <returns></returns>
        public string dictionaryVehType(int VehNum)
        {
            if (CommonDictionary4Monitor.DataSource.vehicle_type == null)
            {
                CommonDictionary4Monitor.LoadAllDictionary();
            }

            string result = "";

            if (CommonDictionary4Monitor.DataSource != null)
            {
                result = CommonDictionary4Monitor.DataSource.vehicle_type.FirstOrDefault(x => x.VEH_TYPE_ID == VehNum).VEH_TYPE_DESC.ToString();
            }
            else
            {
                result = VehNum.ToString();
            }
            return(result);
        }