/// <summary> /// Base to document that should be called from child classes which adds search result information to the document /// </summary> /// <returns></returns> public virtual Lucene.Net.Documents.Document ToDocument() { var doc = new Document(); var keyField = new Field("Key", Key, Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.NO); doc.Add(keyField); var urlField = new Field("Url", Url, Field.Store.YES, Field.Index.NO, Field.TermVector.NO); doc.Add(urlField); var countryIdField = new Field("Country", CountryID.ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO); doc.Add(countryIdField); var titleField = new Field("Title", Title, Field.Store.YES, Field.Index.NO, Field.TermVector.NO); doc.Add(titleField); var excerptField = new Field("Excerpt", Excerpt, Field.Store.YES, Field.Index.NO, Field.TermVector.NO); doc.Add(excerptField); return(doc); }
internal StockExchangeTimeZoneData(StockExchangeID p_stockExchangeID, CountryID p_countryID, TimeZoneId p_timeZoneID, TimeZoneInfo p_timeZoneInfo) { StockExchangeID = p_stockExchangeID; CountryID = p_countryID; TimeZoneID = p_timeZoneID; TimeZoneInfo = p_timeZoneInfo; }
protected override string[] GetContent() { return(new[] { ID.ToString(), Name, CountryID == 0 ? "" : CountryID.ToString() }); }
protected override string[] GetContent() { return(new[] { ID.ToString(), Name, CountryID.ToString(), Description }); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { Insurance.LabelAttributes.Add("ID", "lblInsurance"); CountryID.DataBind(); EmergencyCountryID.DataBind(); HowHearTextID.DataBind(); WhereStayID.DataBind(); DiveLevelID.DataBind(); DiveOrgID.DataBind(); LanguageID.DataBind(); //Add blank item at index 0 CountryID.Items.Insert(0, new ListItem("--Select--", "0")); CountryID.SelectedIndex = -1; EmergencyCountryID.Items.Insert(0, new ListItem("--Select--", "0")); EmergencyCountryID.SelectedIndex = -1; Gender.Items.Insert(0, new ListItem("--Select--", "0")); DiveOrgID.Items.Insert(0, new ListItem("--Select--", "0")); DiveLevelID.Items.Insert(0, new ListItem("--Select--", "0")); WhereStayID.Items.Insert(0, new ListItem("--Select--", "0")); HowHearTextID.Items.Insert(0, new ListItem("--Select--", "0")); LanguageID.Items.Insert(0, new ListItem("--Select--", "0")); // var Termsdt = new DataTable(); Termsdt = SQLTools.GetDataTable("SELECT TermsText, ShowTerms, [Language] FROM GlobalSettings, [Language] WHERE GlobalSettings.LanguageID = [Language].LanguageID"); if (Termsdt.Rows[0]["ShowTerms"] == "True") { this.Session["ShowTerms"] = true; pTerms.InnerHtml = Termsdt.Rows[0]["TermsText"].ToString().Replace(System.Environment.NewLine, "<br />"); } else { this.Session["ShowTerms"] = false; } string language = Termsdt.Rows[0]["Language"].ToString(); optLanguage.SelectedValue = language; var sectionsdt = new DataTable(); var fieldsdt = new DataTable(); sectionsdt = SQLTools.GetDataTable("SELECT * FROM RegisterFormSection"); this.Session["sectionsdt"] = sectionsdt; fieldsdt = SQLTools.GetDataTable("SELECT * FROM RegisterFormField WHERE RegisterFormSectionID in (Select RegisterFormSectionID From RegisterFormSection WHERE Display=True)"); this.Session["fieldsdt"] = fieldsdt; SetColors(); ChangeForm(); if (useCamera == "Yes") { FileUploadValidator.Enabled = false; } } }
public override string ToString() { StringBuilder b = new StringBuilder(); b.AppendLine(Name); b.AppendLine(Password); b.AppendLine(CountryID.ToString()); b.AppendLine(IsAdmin.ToString()); b.AppendLine(ClientID.ToString()); return(b.ToString()); }
/// <summary> Precondition: p_dateLocal.TimeOfDay == 0 </summary> // See also http://www.isthemarketopen.com/, // http://www.chronos-st.org/NYSE_Observed_Holidays-1885-Present.html public static bool IsMarketOpenDayLoc(DateTime p_dateLocal, CountryID p_countryID) { DayOfWeek day = p_dateLocal.DayOfWeek; if (day == DayOfWeek.Sunday || day == DayOfWeek.Saturday) return false; var marketClosedDays = GetMarketClosedDates()[p_countryID]; DateTime dateLocalDate = p_dateLocal.Date; var foundInd = marketClosedDays.BinarySearch(dateLocalDate); bool isMarketClosed = foundInd >= 0; return !isMarketClosed; }
protected void lvMDCountry_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 CountryID; Int64.TryParse(e.CommandArgument.ToString(), out CountryID); if (CountryID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _CountryID = CountryID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDCountryEntity.FLD_NAME_CountryID, CountryID.ToString(), SQLMatchType.Equal); MDCountryEntity mDCountryEntity = new MDCountryEntity(); result = FCCMDCountry.GetFacadeCreate().Delete(mDCountryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _CountryID = 0; _MDCountryEntity = new MDCountryEntity(); PrepareInitialView(); BindMDCountryList(); MiscUtil.ShowMessage(lblMessage, "Country has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Country.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { this.Session["imgFilePath"] = ""; Country.InitCountries(); CountryID.DataSource = Country.Countries; CountryID.DataBind(); Insurance.SelectedValue = "-1"; CertifiedDiver.SelectedValue = "-1"; EmergencyCountryID.DataSource = Country.Countries; EmergencyCountryID.DataBind(); NationalityCountryID.DataSource = Country.Countries; NationalityCountryID.DataBind(); HowHearTextID.DataBind(); WhereStayID.DataBind(); DiveLevelID.DataBind(); DiveOrgID.DataBind(); LanguageID.DataBind(); CheckinInstructorID.DataBind(); //Add blank item at index 0 CountryID.Items.Insert(0, new ListItem("--Select--", "0")); CountryID.SelectedIndex = -1; EmergencyCountryID.Items.Insert(0, new ListItem("--Select--", "0")); EmergencyCountryID.SelectedIndex = -1; NationalityCountryID.Items.Insert(0, new ListItem("--Select--", "0")); NationalityCountryID.SelectedIndex = -1; Gender.Items.Insert(0, new ListItem("--Select--", "0")); DiveOrgID.Items.Insert(0, new ListItem("--Select--", "0")); DiveLevelID.Items.Insert(0, new ListItem("--Select--", "0")); WhereStayID.Items.Insert(0, new ListItem("--Select--", "0")); HowHearTextID.Items.Insert(0, new ListItem("--Select--", "0")); LanguageID.Items.Insert(0, new ListItem("--Select--", "0")); CheckinInstructorID.Items.Insert(0, new ListItem("--Select--", "0")); var Termsdt = new DataTable(); Termsdt = OleDbTools.GetDataTable("SELECT TermsText, ShowTerms, [Language] FROM GlobalSettings, [Language] WHERE GlobalSettings.LanguageID = [Language].LanguageID"); if (Termsdt.Rows[0]["ShowTerms"].ToString() == "True") { this.Session["ShowTerms"] = true; pTerms.InnerHtml = Termsdt.Rows[0].ItemArray[0].ToString().Replace(System.Environment.NewLine, "<br />"); } else { this.Session["ShowTerms"] = false; } SetColors(); string language = Termsdt.Rows[0]["Language"].ToString(); optLanguage.SelectedValue = language; var sectionsdt = new DataTable(); sectionsdt = OleDbTools.GetDataTable("SELECT * FROM RegisterFormSection"); var fieldsdt = new DataTable(); fieldsdt = OleDbTools.GetDataTable("SELECT * FROM RegisterFormField WHERE RegisterFormSectionID in (Select RegisterFormSectionID From RegisterFormSection WHERE Display=True)"); this.Session["sectionsdt"] = sectionsdt; this.Session["fieldsdt"] = fieldsdt; ChangeForm(); if (useCamera.ToLower() == "yes") { FileUploadValidator.Enabled = false; } } }
public static DateTime GetNextOrPreviousMarketOpenDayLoc(this DateTime p_timeLoc, CountryID p_countryID, bool p_currentDayAcceptable /* Inclusive */, bool p_isNext) { DateTime timeToTestLoc = (p_currentDayAcceptable) ? p_timeLoc.Date : ((p_isNext) ? p_timeLoc.Date.AddDays(1) : p_timeLoc.Date.AddDays(-1)); int iLoop = 0; while (true) { if (iLoop++ > 50) { Utils.Logger.Error($"Avoiding infinite loop. GetNextOrPreviousUsaMarketOpenDayLoc() iLoop is too high: {iLoop}. There is no marketOpen day in the next/previous 50 days. Impossible."); return DateTime.MaxValue; } bool isMarketTradingDay = IsMarketOpenDayLoc(timeToTestLoc, p_countryID); if (isMarketTradingDay) // Postcondition: result.TimeOfDay == local 00:00 converted to UTC { return timeToTestLoc; } timeToTestLoc = (p_isNext) ? timeToTestLoc.AddDays(1) : timeToTestLoc.AddDays(-1); } // while }
//Comapring the names of the countries to sort them by name public int CompareTo(Country other) { return(CountryID.CompareTo(other.CountryID)); }
/// <summary> /// Loads the countries. /// </summary> /// <param name="isShowAll">if set to <c>true</c> [is show all].</param> public void LoadCountries(bool isShowAll) { List <Country> countries = null; if (!isShowAll) { countries = (from c in DataContext.Countries where c.IsActive == true && c.SortOrder == 1 orderby c.CountryName select c).ToList <Country>(); //Default selection if (CountryID == 0 || CountryID == -1) { Country country = new Country(); country.CountryName = "-- Please select --"; country.CountryId = -1;//This is to track whether a country is not being selected countries.Insert(0, country); } Country countryALL = new Country(); countryALL.CountryName = "-- Show all countries--"; countryALL.CountryId = 0;//This is to track whether a country is not being selected countries.Add(countryALL); } else { countries = (from c in DataContext.Countries where c.IsActive == true orderby c.CountryName select c).ToList <Country>(); //Default selection if (CountryID == 0 || CountryID == -1) { Country country = new Country(); country.CountryName = "-- Select from all countries --"; country.CountryId = -1;//This is to track whether a country is not being selected countries.Insert(0, country); } } if (CountryID > 0) //If there is a countryID, check whether the country is in list, else add it to the list. { Country country = countries.Find(delegate(Country c) { return(c.CountryId == CountryID); } ); if (country == null) { //Needs to get the country and add to the list countries.Insert(0, (DataContext.Countries.First(c => c.CountryId == CountryID))); } else { //Means it is in the list. ddCountry.SelectedValue = CountryID.ToString(); } } ddCountry.DataSource = countries; ddCountry.DataBind(); }