public void AddOrUpdateCountryLocale(CountryText countryLocale) { System.Linq.Expressions.Expression <Func <CountryText, bool> > expresion = (c => c.CountryId == countryLocale.CountryId && c.Locale.Equals(countryLocale.Locale)); _dbLocaleRepository.AddOrUpdateRecord(countryLocale, expresion); }
private void AddButton_Click(object sender, EventArgs e) { Location p = new Location(); p.City = CityText.Text; p.Country = CountryText.Text; p.Year = Int32.Parse(YearText.Text); locations.Add(p); History.Items.Add(string.Format("{0} | {1}, {2}", p.Year, p.City, p.Country)); CityText.Clear(); CountryText.Clear(); YearText.Clear(); }
private void InsertAvailableCountries(List <CountryLocaleList> availableCountries) { CountryText countryLocale; foreach (CountryLocaleList countryRowRecord in availableCountries) { // Insert for each locale country information. foreach (CountryInfo countryInfo in countryRowRecord.Countries) { countryLocale = new CountryText(); // Insert Country countryLocale.CountryId = _dbRepository.AddCountry(countryInfo); countryLocale.Locale = countryRowRecord.Locale; countryLocale.Name = countryInfo.CountryName; _dbRepository.AddOrUpdateCountryLocale(countryLocale); } } }
public void TaoBussiness(string mail) { driver.Navigate().GoToUrl("https://business.facebook.com/overview"); if (library.IsAjaxLoaded() && library.IsLoadingComplete()) { try { if (library.ElementIsVisible(ButtonTaoTaiKhoan)) { ButtonTaoTaiKhoan.Click(); } else if (library.ElementIsVisible(ButtonTaoTaiKhoanDaCo)) { ButtonTaoTaiKhoanDaCo.Click(); } } catch (Exception ex) { Email = "Lỗi tạo tài khoản!!"; driver.Close(); return; } if (library.ElementsIsVisible(By.XPath("//input[@class='_4b7k _4b7k_big _53rs']"))) { string[] str = CompanyInfo[1].GetAttribute("value").ToString().Split('0'); try { string strName = str.Length > 1 ? str[0] + " 0" + int.Parse(str[1]).ToString() + 1 : str[0] + " 01"; if (library.ElementIsVisible(CompanyForm[0])) { CompanyInfo[0].SendKeys(strName); } if (library.ElementIsVisible(CompanyForm[2])) { CompanyInfo[2].SendKeys(mail); } } catch { CompanyInfo[0].SendKeys(CompanyInfo[1].GetAttribute("value").ToString()); CompanyInfo[2].SendKeys(mail); } if (library.ElementIsVisible(ButtonContinue)) { ButtonContinue.Click(); if ( library.IsAjaxLoaded() && library.ElementsIsVisible(By.XPath("//div//div//div//div//div//div//div//div//div//div//label//input[@class='_4b7k _4b7k_big _53rs']"))) { // Input form if (library.ElementIsVisible(CompanyForm[1])) { CompanyForm[1].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[2])) { CompanyForm[2].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[3])) { CompanyForm[3].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[4])) { CompanyForm[4].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[5])) { CompanyForm[5].SendKeys("0385102879"); } if (library.ElementIsVisible(CompanyForm[6])) { CompanyForm[6].SendKeys("https://www.24h.com.vn/"); } if (library.ElementIsVisible(CompanyForm[0])) { CompanyForm[0].SendKeys(RandomString(20)); } if (library.ElementIsVisible(ButtomCombobox)) { ButtomCombobox.Click(); if (library.ElementIsVisible(CountryText)) { CountryText.SendKeys("Vi"); if (library.ElementsIsVisible(By.XPath("//div//div//div//div//div//div//span//div//div//div//div//div//div"))) { if (library.IsAjaxLoaded() && library.ElementIsVisible(ListCountry[0])) { ListCountry[0].Click(); } } else { Email = "Chọn quốc gia thất bại"; driver.Close(); return; } } else { Email = "Chọn quốc gia thất bại"; driver.Close(); return; } } else { Email = "Chọn quốc gia thất bại"; driver.Close(); return; } if (library.ElementsIsVisible(By.XPath("//div//span//div//div//button"))) { if (library.ElementIsVisible(ButtonSubmit[1])) { ButtonSubmit[1].Click(); if (library.IsAjaxLoaded() && library.IsLoadingComplete() && library.IsLoadingComplete()) { if (library.ElementIsVisible(ButtonFinish)) { ButtonFinish.Click(); } if (library.IsAjaxLoaded() && library.IsLoadingComplete()) { Email = "Thành công!!"; // driver.Close(); // Console.WriteLine("12312"); // TO BE CONTINUE. } } } else { Email = "Gửi submit thất bại!!"; driver.Close(); return; } } } } else { Email = "Click tiếp tục thất bại"; driver.Close(); return; } } else { Email = "Nhập thông tin BM thất bại"; driver.Close(); return; } } else { Email = "Tài khoản đã được tạo"; driver.Close(); return; } }
private void InitFields() { var context = new PSOConnect(); var team = context.team.FirstOrDefault(teams => teams.idTeam == Login.CurrentUser.idTeam); foreach (var disaster in context.disaster) { SelectDisasterField.Items.Add($"{ disaster.idDisaster}-СТРАНА: { disaster.country} ГОРОД: { disaster.city} ДАТА: { disaster.date.Value.ToLongDateString()}"); if (team.idDisaster == null || team.idDisaster != disaster.idDisaster) { continue; } SelectDisasterField.SelectedItem = SelectDisasterField.Items[SelectDisasterField.Items.Count - 1]; _disaster = disaster; CountyResultText.Text = disaster.country.ToString(); CityResultText.Text = disaster.city.ToString(); DateResultText.Text = disaster.date.Value.ToShortDateString(); ReasonText.Text = disaster.reason.Count > 1 ? "Причины" : "Причина"; foreach (var reason in disaster.reason) { ListInfo.Items.Add($"ТИП: {reason.typeReason} ПРИЧИНА: {reason.reason1}"); } } NoFoundDisasterText.Hide(); if (team.idDisaster == null) { ListInfo.Hide(); ReasonText.Hide(); DateResultText.Hide(); DateText.Hide(); CountryText.Hide(); CountyResultText.Hide(); CityResultText.Hide(); CityText.Hide(); SelectDisasterField.Show(); SelectDisasterText.Show(); SelectedButton.Show(); CompletedButton.Hide(); if (SelectDisasterField.Items.Count > 0) { SelectDisasterField.SelectedIndex = 0; } else { SelectedButton.Hide(); NoFoundDisasterText.Show(); SelectDisasterField.Hide(); } } else { ListInfo.Show(); ReasonText.Show(); DateResultText.Show(); DateText.Show(); CountryText.Show(); CountyResultText.Show(); CityResultText.Show(); CityText.Show(); SelectDisasterField.Hide(); SelectDisasterText.Hide(); SelectedButton.Hide(); CompletedButton.Show(); } if (SelectDisasterField.Items.Count == 0) { SelectDisasterField.Hide(); NoFoundDisasterText.Show(); CompletedButton.Hide(); } }