private void GetCurDateTime() { try { string _tableName = "DashboardRanges"; string _columnName = "MonthValue,YearValue"; string _whereClause = "DashboardParameter='CurrentMonth'"; DataSet dsDashboardRange = SqlHelper.ExecuteDataset(reportsConnectionString, SP_GENERALSELECT, new SqlParameter("@tableName", _tableName), new SqlParameter("@columnNames", _columnName), new SqlParameter("@whereCondition", _whereClause)); if (dsDashboardRange != null && dsDashboardRange.Tables[0].Rows.Count > 0) { curMonth = dsDashboardRange.Tables[0].Rows[0]["MonthValue"].ToString(); curYear = dsDashboardRange.Tables[0].Rows[0]["YearValue"].ToString(); } fiscalCalendar = new FiscalCalendar(curMonth, curYear); int test = fiscalCalendar.CurrentWorkDay; } catch (Exception ex) { throw ex; } }
public string GetCondition() { try { FiscalCalendar fiscalCalendar = new FiscalCalendar(); DateTime dtCurrentMonth = DateTime.Now.AddMonths(-1); string currentFiscalMonth = dtCurrentMonth.Month.ToString(); string currentFiscalYear = dtCurrentMonth.Year.ToString(); //int lastFiscalMonth = dtCurrentMonth.Month - 1; //string PreviousYear = Convert.ToString(dtCurrentMonth.Year - 1); //string strCondition = "(( CurYear = '" + currentFiscalYear + "' AND CurMonth <= '" + currentFiscalMonth + "') or ( CurYear = '" + PreviousYear + "' AND CurMonth > '" + lastFiscalMonth + "'))"; //return strCondition; string strCondition = "CurYear = '" + CurYear + "' AND CurMonth = '" + CurMonth + "'"; return(strCondition); } catch (Exception ex) { return(""); } }
public void init() { fiscalCalendar = new FiscalCalendar(); AddActionClassesToList(fiscalCalendar); }