public void ChangeEmployerTradeDate(int EmployerID) { if (EmployerID == 0) { return; } Employer employer = Employer.Find(this.iSabayaContext, EmployerID); if (employer != null) { Session["SessionEmployer"] = employer; IList <ProvidentFund> IsNotMasterFundLists = new List <ProvidentFund>(); foreach (ProvidentFund item in employer.GetFundsOn(DateTime.Today)) { if (item.IsMasterFund != true) { IsNotMasterFundLists.Add(item); } } ProvidentFund EmpMasterFund = employer.GetMainFundOn(DateTime.Today); IList <InstrumentTransactionType> fundTransactionCalendars = new List <InstrumentTransactionType>(); if (EmpMasterFund != null) { fundTransactionCalendars = EmpMasterFund.InstrumentTransactionTypes; } if (fundTransactionCalendars.Count <= 0) { foreach (ProvidentFund item in IsNotMasterFundLists) { if (item.InstrumentTransactionTypes.Count > 0) { fundTransactionCalendars = item.InstrumentTransactionTypes; } } } DateTime tradeDate = TimeInterval.MinDate; DateTime effectiveDate; DateTime settlementDate; //TimeSchedule schedule = fundTransactionCalendars[0].TradeCalendar; for (int i = 0; i < fundTransactionCalendars.Count; i++) { if (fundTransactionCalendars[i].InvestmentTransactionType.Code == PFConstants.PFTTCodeContFileImport) { Session["SessionScheduleId"] = fundTransactionCalendars[i].TradeCalendar; fundTransactionCalendars[i].FindTransactionDates(iSabayaContext, DateTime.Now, out tradeDate, out effectiveDate, out settlementDate); break; } } if (tradeDate == TimeInterval.MinDate) { Session["SessionTradeDate"] = null; Session["SessionScheduleId"] = null; } else { Session["SessionTradeDate"] = tradeDate; } } else { Session["SessionEmployer"] = null; Session["SessionScheduleId"] = null; Session["SessionTradeDate"] = null; } }