private void dgvInfo_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { if (e.RowIndex % 2 != 0) { dgvInfo.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.WhiteSmoke; } if (e.RowIndex >= dgvInfo.Rows.Count) { return; } try { DataGridViewRow dgrSingle = dgvInfo.Rows[e.RowIndex]; var test1 = dgrSingle.Cells["TestItemStatus"].Value.ToString().ExtendToInt(); if (test1 > -1 && test1 < 4) { dgrSingle.DefaultCellStyle.ForeColor = statusColor[test1]; } } catch (Exception ex) { AppFramework.WriteLog(ex); } }
private static void GetCustomerLogo() { if (!string.IsNullOrEmpty(SystemData.Setting.Profile.CustomerLogo)) { var logofi = new FileInfo(SystemData.Setting.Profile.CustomerLogo); if (logofi.Exists) { try { using (var fs = logofi.OpenRead()) { byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); MemoryStream ms = new MemoryStream(data); CustomerLogo = Image.FromStream(ms); } } catch (Exception ex) { AppFramework.WriteLog(ex); } } } }
private void dgvTestItems_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { var dgvTestInfo = sender as DataGridView; if (dgvTestInfo == null || e.RowIndex >= dgvTestInfo.Rows.Count) { return; } try { DataGridViewRow dgrSingle = dgvTestInfo.Rows[e.RowIndex]; var test1 = dgrSingle.Cells["ItemResult"].Value.ToString().ExtendToInt(); if (test1 > 0) { dgrSingle.DefaultCellStyle.ForeColor = Color.LimeGreen; } else { dgrSingle.DefaultCellStyle.ForeColor = Color.Red; } } catch (Exception ex) { AppFramework.WriteLog(ex); } }
public static bool Initialization(DbClientType type, string providerName, string connectionString) { var dbID = type.ToString(); try { DbRegistry.RegisterDatabase(dbID, providerName, connectionString); } catch (Exception ex) { AppFramework.WriteLog(ex); return(false); } return(true); }