private void ShowMonthAndPeruPoluthu(bool isCallFromMonthChange) { objTodayTamilDate = objtnDateTime. getTamilDate(DateTime.Now, Eras.ChithiraiBased); lblCurrentTime.Text = objTodayTamilDate.ToString(); if (isCallFromMonthChange == false) { cboMonthName.SelectedValue = objTodayTamilDate.tamilMonth.MonthNo; } txtPeruPoluthu.Text = objTodayTamilDate.tamilMonth.PeruPoluthu; setTodayDateColor(objTodayTamilDate); }
private void setTodayDateColor(TamilDate objTodayTamilDate) { if (cboMonthName.SelectedValue != null && objTodayTamilDate.tamilMonth.MonthNo.ToString() == cboMonthName.SelectedValue.ToString()) { for (int i = 0; i <= 41; i++) { if (objTodayTamilDate.DayNo.ToString() == this.Controls.Find("lblDay" + i, true)[0].Text) { this.Controls.Find("lblDay" + i, true)[0].BackColor = Color.LightCoral; } } } }
public TamilDate getTamilDate(DateTime dateTime, Eras ers) { TamilDate objTodayTamilDate = new TamilDate(); YearInfo objYearInfo = _YearInfos .Where(w => w.YearNumber == dateTime.Year) .FirstOrDefault(); //Set April Month start date DateTime aprDateTime = new DateTime(dateTime.Year, 4, objYearInfo.ChithiraiStartAprlDay); DateTime objTodayDateOnly = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); double TotalDaysFromAprilStart = (objTodayDateOnly - aprDateTime).TotalDays; int tamilMonthDaysCounter = 0, tamilMonthDaysAntiCounter = 0; int tamilMonthCounter = 0; //objTodayTamilDate.MonthNo = getChithiraiAprilStartDate(dateTime); for (int i = 0; i < objYearInfo.MonthDaysCount.Length; i++) { if (tamilMonthDaysCounter < TotalDaysFromAprilStart) { tamilMonthDaysCounter += getMonthDaysCount(dateTime.Year, i); tamilMonthCounter++; if (tamilMonthDaysCounter < TotalDaysFromAprilStart) { tamilMonthDaysAntiCounter = Convert.ToInt16(Math.Floor(TotalDaysFromAprilStart)) - tamilMonthDaysCounter; tamilMonthDaysAntiCounter++; } } } objTodayTamilDate.tamilMonth = getTamilMonthsWithPeruPoluthu(ers) .Where(w => w.MonthNo == tamilMonthCounter) .FirstOrDefault(); objTodayTamilDate.DayNo = tamilMonthDaysAntiCounter; objTodayTamilDate.tamilYear = getTamilYears(ers) .Where(w => w.yearCount == (dateTime.Year - 1986)) .FirstOrDefault(); //return ", ௨௫, ௨0௧௮"; return(objTodayTamilDate); }