Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < dataGridView1.Rows.Count; i++)
- {
- for (int k = 0; k < 2; k++)
- {
- if (dataGridView1[k, i].Value != null)
- {
- DateTime dateTime = DateTime.UtcNow.Date;
- var tomorrow = dateTime.AddDays(1);
- var tom1 = dateTime.AddDays(2);
- var tom2 = dateTime.AddDays(3);
- string data = dataGridView1.Rows[i].Cells[6].Value.ToString();
- string dateVal = Convert.ToDateTime(dataGridView1[k, i].Value).ToString("MM/dd/yyyy");
- PdfPCell cellc = new PdfPCell(new Phrase(dateVal, fontTable));
- if (dateVal == dateTime.ToString("MM/dd/yyyy") && data != "FIN - ENIG ")
- {
- cellc.BackgroundColor = new iTextSharp.text.Color(0, 240, 240);
- pdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
- }
- else if (data != "FIN - ENIG " && dateVal == tomorrow.ToString("MM/dd/yyyy"))
- {
- cellc.BackgroundColor = new iTextSharp.text.Color(0, 240, 240);
- pdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
- }
- else if (data != "FIN - ENIG " && dateVal == tom1.ToString("MM/dd/yyyy"))
- {
- cellc.BackgroundColor = new iTextSharp.text.Color(0, 240, 240);
- pdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
- }
- else if (data != "FIN - ENIG " && dateVal == tom2.ToString("MM/dd/yyyy"))
- {
- cellc.BackgroundColor = new iTextSharp.text.Color(0, 240, 240);
- pdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
- }
- else
- {
- // pdfTable.DefaultCell.BackgroundColor = BaseColor.WHITE;
- }
- pdfTable.AddCell(cellc);
- }
- }
Add Comment
Please, Sign In to add comment