public HedgeGroupConditions GetConditions(HedgeGroupSearchType type) { var c = new HedgeGroupConditions(); if(type == HedgeGroupSearchType.Free) { c.StartDate = StartDate; c.EndDate = EndDate; c.HedgeNme = HedgeName; } if(type == HedgeGroupSearchType.CurrentMonth) { var startDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); var endDate = startDate.AddMonths(1).AddDays(-1); c.StartDate = startDate; c.EndDate = endDate; } if(type == HedgeGroupSearchType.LastMonth) { var startDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(-1); var endDate = startDate.AddMonths(1).AddDays(-1); c.StartDate = startDate; c.EndDate = endDate; } if(type == HedgeGroupSearchType.CurrentYear) { var startDate = new DateTime(DateTime.Today.Year, 1, 1); var endDate = startDate.AddYears(1).AddDays(-1); c.StartDate = startDate; c.EndDate = endDate; } if(type == HedgeGroupSearchType.LastYear) { var startDate = new DateTime(DateTime.Today.Year - 1, 1, 1); var endDate = startDate.AddYears(1).AddDays(-1); c.StartDate = startDate; c.EndDate = endDate; } return c; }
public HedgeGroupListVM(HedgeGroupConditions conditions) { Conditions = conditions; BuildQueryStrAndParam(); }