public CELGenerateCalendarPlusCore(GCAL.ContentServer content) { GPLocationProvider locProv = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; locProv = content.getLocationWithPostfix(""); if (locProv == null) { HtmlText = "<p>Error: location provider is null"; return; } startWesternTime = new GPGregorianTime(locProv); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); GPVedicTime startVedicTime, endVedicTime; int unitType = content.getInt("endperiodtype", 3); int nCount = content.getInt("endperiodlength", 1); GPEngine.VCTIMEtoVATIME(startWesternTime, out startVedicTime, locProv); GPEngine.CalcEndDate(locProv, startWesternTime, startVedicTime, out endWesternTime, out endVedicTime, unitType, GPEngine.CorrectedCount(unitType, nCount)); SetData(locProv, startWesternTime, endWesternTime); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCalendarPlusCoreHTML_BodyTable(CalculatedObject as GPCalendarPlusEventsResults, sb); HtmlText = sb.ToString(); }
public CELGenerateAppearanceDay(GCAL.ContentServer content) { GPLocationProvider locProv = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; locProv = content.getLocationWithPostfix(""); if (locProv == null) { locProv = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProv); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); startWesternTime.setDayHours(content.getInt("starthour", startWesternTime.getHour()) / 24.0 + content.getInt("startmin", startWesternTime.getMinuteRound()) / 1440.0); SetData(locProv, startWesternTime); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteAppDayHTML_BodyTable(CalculatedObject as GPAppDayResults, sb); HtmlText = sb.ToString(); }
private void VedicChanged() { if (keepSycnhro) { int gyear; keepSycnhro = false; if (location != null && int.TryParse(textBox2.Text, out gyear)) { GPGregorianTime vc = null; GPVedicTime va = new GPVedicTime(comboBox3.SelectedIndex, GPAppHelper.ComboMasaToMasa(comboBox4.SelectedIndex), gyear); GPEngine.VATIMEtoVCTIME(va, out vc, location); comboBox2.SelectedIndex = vc.getMonth() - 1; textBox1.Text = vc.getYear().ToString(); comboBox1.SelectedIndex = vc.getDay() - 1; } keepSycnhro = true; } }
public CELGenerateCalendarTwoLocs(GCAL.ContentServer content) { GPLocationProvider locProvA = null; GPLocationProvider locProvB = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; locProvA = content.getLocationWithPostfix("a"); if (locProvA == null) { locProvA = GPAppHelper.getMyLocation(); } locProvB = content.getLocationWithPostfix("b"); if (locProvB == null) { locProvB = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProvA); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); GPVedicTime startVedicTime, endVedicTime; int unitType = content.getInt("endperiodtype", 3); int nCount = content.getInt("endperiodlength", 1); GPEngine.VCTIMEtoVATIME(startWesternTime, out startVedicTime, locProvA); GPEngine.CalcEndDate(locProvA, startWesternTime, startVedicTime, out endWesternTime, out endVedicTime, unitType, GPEngine.CorrectedCount(unitType, nCount)); nCount = Convert.ToInt32(endWesternTime.getJulianGreenwichNoon() - startWesternTime.getJulianGreenwichNoon()); SetData(locProvA, locProvB, startWesternTime, nCount); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCompareCalendarHTML_BodyTable(CalculatedObject as GPCalendarTwoLocResults, sb); HtmlText = sb.ToString(); }
public CELGenerateCoreEvents(GCAL.ContentServer content) { GPLocationProvider locProv = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; /*if (content.getString("locationtype") == "selected") * { * GPLocation loc = GPLocationList.getShared().findLocationById(content.getInt("locationid")); * if (loc != null) * locProv = new GPLocationProvider(loc); * }*/ locProv = content.getLocationWithPostfix(""); if (locProv == null) { locProv = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProv); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); GPVedicTime startVedicTime, endVedicTime; int unitType = content.getInt("endperiodtype", 3); int nCount = content.getInt("endperiodlength", 1); GPEngine.VCTIMEtoVATIME(startWesternTime, out startVedicTime, locProv); GPEngine.CalcEndDate(locProv, startWesternTime, startVedicTime, out endWesternTime, out endVedicTime, unitType, GPEngine.CorrectedCount(unitType, nCount)); nCount = Convert.ToInt32(endWesternTime.getJulianGreenwichNoon() - startWesternTime.getJulianGreenwichNoon()); SetData(locProv, startWesternTime, endWesternTime); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteEventsHTML_BodyTable(CalculatedObject as GPCoreEventResults, sb); HtmlText = sb.ToString(); }
public CELGenerateCalendarTravelling(GCAL.ContentServer content) { GPLocationProvider locProvA = null; GPLocationProvider locProvB = null; GPGregorianTime startWesternTime = null; //GPGregorianTime endWesternTime = null; locProvA = content.getLocationWithPostfix("a"); if (locProvA == null) { locProvA = GPAppHelper.getMyLocation(); } locProvB = content.getLocationWithPostfix("b"); if (locProvB == null) { locProvB = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProvA); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); double travelStart = content.getInt("starttravelhr", 12) * 1.0 + content.getInt("starttravelmin", 0) / 60.0; double travelDuration = content.getInt("durtravelhr", 6) * 1.0 + content.getInt("durtravelmin", 0) / 60.0; startWesternTime.setDayHours(travelStart / 24.0); SetData(locProvA, locProvB, startWesternTime, travelDuration); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCalendarHTML(CalculatedObject as GPCalendarResults, sb); HtmlText = sb.ToString(); }
protected override void Execute() { ResultsList.Clear(); //ClearControlList(); int limit; if (Location == null || p_text == null || p_text.Length == 0) { return; } // find in texts StringBuilder sb = new StringBuilder(); Results res = new Results(this, p_text); GPGregorianTime vc = new GPGregorianTime(Location); vc.Today(); // // today results (this day, tomorrow and day after // #region today screen results limit = GPUserDefaults.IntForKey("search.today.days", 3); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); FormaterPlain.AvcGetTodayInfo(vc, Location, sb); res.Title = GPAppHelper.getDateText(vc); res.Type = GPStrings.getString(174); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.Today; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); res.ActionScript += string.Format("scriptObject.setMyDate({0},{1},{2});", vc.getYear(), vc.getMonth(), vc.getDay()); res.ActionScript += "window.location.href='today.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.NextDay(); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region calendar results limit = GPUserDefaults.IntForKey("search.calendar.months", 12); GPCalendarResults rcal = new GPCalendarResults(); vc.Today(); vc.AddDays(1 - vc.getDay()); for (int i = 0; i < limit; i++) { rcal.CalculateCalendar(vc, GPGregorianTime.GetMonthMaxDays(vc.getYear(), vc.getMonth())); FormaterPlain.FormatCalendarPlain(rcal, sb); res.Title = string.Format("{0} {1}", GPStrings.getString(759 + vc.getMonth()), vc.getYear()); res.Type = GPStrings.getString(44); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.Calendar; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); GPGregorianTime vc2 = vc.Copy(); vc2.AddMonths(1); res.Parameters.Add(GPCalculationParameters.EndWesternDate, vc2); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('startmonth', '" + vc.getMonth() + "');"; res.ActionScript += "saveString('startday', '" + vc.getDay() + "');"; res.ActionScript += "saveString('endperiodtype', '3');"; res.ActionScript += "saveString('endperiodlength', '1');"; res.ActionScript += "window.location.href='calendar.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddMonths(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region core events results limit = GPUserDefaults.IntForKey("search.coreevents.months", 1); GPCoreEventResults reve = new GPCoreEventResults(); vc.Today(); vc.AddDays(1 - vc.getDay()); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); GPGregorianTime vcEnd = vc.Copy(); vcEnd.AddDays(31); reve.CalculateEvents(Location, vc, vcEnd); FormaterPlain.FormatEventsText(reve, sb); res.Title = string.Format("{0} {1}", GPStrings.getString(759 + vc.getMonth()), vc.getYear()); res.Type = GPStrings.getString(46); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.CoreEvents; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); res.Parameters.Add(GPCalculationParameters.EndWesternDate, vcEnd); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('startmonth', '" + vc.getMonth() + "');"; res.ActionScript += "saveString('startday', '" + vc.getDay() + "');"; res.ActionScript += "saveString('endperiodtype', '3');"; res.ActionScript += "saveString('endperiodlength', '1');"; res.ActionScript += "window.location.href='coreevents.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddMonths(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region masa list limit = GPUserDefaults.IntForKey("search.masalist.years", 3); GPMasaListResults rmas = new GPMasaListResults(); vc.Today(); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); rmas.CalcMasaList(Location, vc.getYear(), 1); FormaterPlain.FormatMasaListText(rmas, sb); res.Title = string.Format("{0}", vc.getYear()); res.Type = GPStrings.getString(48); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.MasaList; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartYear, vc.getYear()); res.Parameters.Add(GPCalculationParameters.CountYear, 1); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('yearcount', '1');"; res.ActionScript += "window.location.href='masalist.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddYears(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion finished = true; }