/// <summary> /// Returns true if Prevalence instances are equal /// </summary> /// <param name="other">Instance of Prevalence to be compared</param> /// <returns>Boolean</returns> public bool Equals(Prevalence other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DiseaseName == other.DiseaseName || DiseaseName != null && DiseaseName.Equals(other.DiseaseName) ) && ( CountryName == other.CountryName || CountryName != null && CountryName.Equals(other.CountryName) ) && ( Population == other.Population || Population != null && Population.Equals(other.Population) ) && ( PrevalanceFactor == other.PrevalanceFactor || PrevalanceFactor != null && PrevalanceFactor.Equals(other.PrevalanceFactor) )); }
public void RandomNameIsReturned() { var sut = new CountryName(); var value = sut.GetValue(); Assert.False(string.IsNullOrEmpty(value)); }
//calculates the price of the package, depending on weight and where it is going public string CalculatePrice(Mail mail, CountryName country) { double price; switch (mail.Type) { case PackageType.Letter: if (country == CountryName.Denmark) { price = mail.Weight / 5; return("Prisen er sgu : " + price.ToString()); } else if (country == CountryName.England) { price = mail.Weight / 5 + 10; return("The amount of coins you need to retrieve out of your wallet is: " + price); } else { price = mail.Weight / 5 + 10; return("THE GOD DAMN PRICE IS " + price + " OK?!"); } case PackageType.Package: return("To be implemented :)"); } return("Something went horrible wrong"); }
public IHttpActionResult PutCountryName(int id, CountryName countryName) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != countryName.C_id) { return(BadRequest()); } db.Entry(countryName).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CountryNameExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void RandomNameIsReturned() { var sut = new CountryName(); var value = sut.GetValue(); Assert.False(string.IsNullOrEmpty(value)); }
public override string ToString() { return(JointIsoCtt.ToString() + " " + Country.ToString() + " " + CountryName.ToString() + " " + IdentifiedOrganization.ToString() + " " + DlmsUA.ToString() + " " + AuthenticationMechanismName.ToString() + " " + MechanismId.ToString()); }
/// <summary> /// Authorizes the mobile phone number. /// </summary> /// <param name="mobilePhoneNumber">The mobile phone number.</param> /// <param name="countryName">Name of the country.</param> /// <returns></returns> public InfoAccumulator AuthorizeMobilePhoneNumber(string mobilePhoneNumber, CountryName countryName = CountryName.UK) { InfoAccumulator errors = new InfoAccumulator(); //validate debug mode if (IsInDebugMode(mobilePhoneNumber)) { return(errors); } CountInfo countInfo = MobilePhoneQueries.GetCurrentMobileCodeCountInfo(mobilePhoneNumber); //check whether can continue or not if (!CanGenerateCodeAndSendSms(countInfo, mobilePhoneNumber, errors)) { return(errors); } //generate code string code = GenerateAuthorizationCode(); //save phone number and generated code //we do not care whether this operation is succeeded or not (only put logs) and continue SaveGeneratedCodeAndPhoneNumber(mobilePhoneNumber, code, errors); string message = string.Format("Your authentication code is: {0}", code); //send sms and save it in DB //we do not care whether this operation is succeeded or not and continue SendSmsAndSave(mobilePhoneNumber, message, countryName, errors); return(errors); }
public void OnRetCheckName(string char_name, uint err_code) { if (err_code == 0) { //ęå”åØč¦ę±éęŗ m_sel_country = (CountryName)UnityEngine.Random.Range((int)CountryName.Sky, (int)CountryName.Fire + 1); ushort wdFace = (ushort)(m_sel_sex == enmCharSex.MALE ? UnityEngine.Random.Range(0, 100) : UnityEngine.Random.Range(101, 200)); DataManager.Instance.Sender.CreateSelectUser(char_name, (byte)m_curPro, (byte)m_sel_country, wdFace, ""); } else { //0 ę²”ęéčÆÆ 1 ååéå¤ 2 ååå å«äøåę³ēå 容 string tips = ""; TextManager tmgr = DataManager.Manager <TextManager>(); if (err_code == 1) { tips = tmgr.GetLocalText(LocalTextType.Local_TXT_Warning_NameExist); } else { tips = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Warning_FM_IllegalChar, tmgr.GetLocalText(LocalTextType.Local_TXT_Name)); } TipsManager.Instance.ShowTips(tips); //m_input_input_name.value = string.Empty; //m_input_input_name.isSelected = true; } }
public override string ToString() { return(LogicalName + " " + JointIsoCtt.ToString() + " " + Country.ToString() + " " + CountryName.ToString() + " " + IdentifiedOrganization.ToString() + " " + DlmsUA.ToString() + " " + ApplicationContext.ToString() + " " + ContextId.ToString()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (DiseaseName != null) { hashCode = hashCode * 59 + DiseaseName.GetHashCode(); } if (CountryName != null) { hashCode = hashCode * 59 + CountryName.GetHashCode(); } if (Population != null) { hashCode = hashCode * 59 + Population.GetHashCode(); } if (PrevalanceFactor != null) { hashCode = hashCode * 59 + PrevalanceFactor.GetHashCode(); } return(hashCode); } }
public static Quickpay.country ConvertCountryName(CountryName c) { switch (c) { default: return Quickpay.country.CL; } }
public string GetAddress() => StringUtil.ConcatNonEmpties(", ", Details.Address.Line1, Details.Address.Line2, Details.Address.Line3, Details.Address.CityOrTown, CountyName.Replace("Not recorded", string.Empty), Details.Address.PostCode, CountryName.Replace("Not recorded", string.Empty));
public static Quickpay.country ConvertCountryName(CountryName c) { switch (c) { default: return(Quickpay.country.CL); } }
public void Save(SQLiteDatabase sqLiteDatabase) { if (sqLiteDatabase.IsOpen) { if (IsNew) { try { string[] columns = { "CountryName", "PoliceNumber", "AmbulanceNumber", "FireNumber", "Notes" }; ContentValues values = new ContentValues(); values.Put("CountryName", CountryName.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("PoliceNumber", PoliceNumber.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("AmbulanceNumber", AmbulanceNumber.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("FireNumber", FireNumber.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("Notes", Notes.Trim().Replace("'", "''").Replace("\"", "\"\"")); EmergencyNumberID = (int)sqLiteDatabase.Insert("EmergencyNumbers", null, values); IsNew = false; IsDirty = false; } catch (Exception newE) { throw new Exception("Unable to Save EmergencyNumber in database - " + newE.Message); } } if (IsDirty) { try { ContentValues values = new ContentValues(); values.Put("CountryName", CountryName.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("PoliceNumber", PoliceNumber.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("AmbulanceNumber", AmbulanceNumber.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("FireNumber", FireNumber.Trim().Replace("'", "''").Replace("\"", "\"\"")); values.Put("Notes", Notes.Trim().Replace("'", "''").Replace("\"", "\"\"")); string whereClause = "EmergencyNumberID = " + EmergencyNumberID; sqLiteDatabase.Update("EmergencyNumbers", values, whereClause, null); IsDirty = false; } catch (Exception dirtyE) { throw new Exception("Unable to Update Emergency Number in database - " + dirtyE.Message); } } } }
public string GetOrderTypeCode() { if (OrderType == WebOrderType.Standard && PaymentType == "PO" && !ContainsInstrument) { return("ZWEB"); } if (OrderType == WebOrderType.Standard && PaymentType == "CC" && !ContainsInstrument) { return("ZWCC"); } if (OrderType == WebOrderType.Scheduled && PaymentType == "PO") { return("ZWSA"); } if (OrderType == WebOrderType.Scheduled && PaymentType == "PO") { return("ZWSC"); } if (OrderType == WebOrderType.Scheduled && CountryName.ToUpper() == "KOREA") { return("ZWEX"); } if ((OrderType == WebOrderType.Scheduled && CountryName == "KOREA" && IsDealer) || ZWESCountries.Contains(CountryName, StringComparer.OrdinalIgnoreCase)) { return("ZWSA"); } if (ContainsInstrument && CountryName.ToUpper() != "CANADA" && !EUCountries.Contains(CountryName, StringComparer.OrdinalIgnoreCase)) { return("ZGNA"); } if (ContainsInstrument && PaymentType == "CC" && CountryName == "USA") { return("ZWSA"); } if (ContainsInstrument && CountryName == "CANADA") { return("ZGCA"); } if (ContainsInstrument && PaymentType == "CC" && CountryName == "CANADA") { return("ZGCC"); } if (ContainsInstrument && CountryName != "ITALY" && EUCountries.Contains(CountryName, StringComparer.OrdinalIgnoreCase)) { return("ZGO"); } if (ContainsInstrument && CountryName != "ITALY") { return("ZGEX"); } if (OrderType == WebOrderType.Scheduled && CountryName == "CHINA") { return("ZWSV"); } return("ZWEB"); }
//Implementation of IFiltrable public bool FilterClause(string filter) { return(City.ToLower().Contains(filter) || CountryName.ToLower().Contains(filter) || Forename.ToLower().Contains(filter) || PersonTypeName.ToLower().Contains(filter) || Postcode.ToLower().Contains(filter) || Surname.ToLower().Contains(filter)); }
public async Task <ActionResult> DeleteConfirmed(string id) { CountryName countryName = await db.CountryNames.FindAsync(id); db.CountryNames.Remove(countryName); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public override bool Equals(object obj) { if (obj is CountryCodeEntry entry) { return(Alpha2.Equals(entry.Alpha2) & Alpha3.Equals(entry.Alpha3) & CountryName.Equals(entry.CountryName) & IsSEPAMember == entry.IsSEPAMember & IsUsingEuros == entry.IsUsingEuros); } return(false); }
public override int GetHashCode() { unchecked { var hashCode = Id; hashCode = (hashCode * 397) ^ (CountryName != null ? CountryName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CountryCode != null ? CountryCode.GetHashCode() : 0); return(hashCode); } }
public IHttpActionResult GetCountryName(int id) { CountryName countryName = db.CountryNames.Find(id); if (countryName == null) { return(NotFound()); } return(Ok(countryName)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] CountryName countryName) { if (ModelState.IsValid) { db.Entry(countryName).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(countryName)); }
private Country GetCountryFromName(CountryName countryName) { foreach (Country country in countries) { if (country.countryName == countryName) { return(country); } } Debug.Log("No country found with the name " + countryName); return(null); }
public User(uint ID, string UserName, string Team, CountryName Country, string Project, DateTime RegDate, float AvgScore, uint AllScore) { this.ID = ID; this.UserName = UserName; this.Team = Team; this.Country = Country; this.Project = Project; this.RegDate = RegDate; this.AvgScore = AvgScore; this.AllScore = AllScore; }
public async Task <ActionResult> Create([Bind(Include = "Id,Name")] CountryName countryName) { if (ModelState.IsValid) { db.CountryNames.Add(countryName); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(countryName)); }
public IHttpActionResult PostCountryName(CountryName countryName) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CountryNames.Add(countryName); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = countryName.C_id }, countryName)); }
public void Update() { string strsql = "update Country set " + "CountryName= '" + CountryName.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "' " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }
/// <summary> /// Sends the SMS and if sent saves it in DB. /// </summary> /// <param name="phoneNumber">The phone number.</param> /// <param name="message">The message.</param> /// <param name="country">The country.</param> /// <param name="errors">The errors.</param> /// <returns></returns> private async Task <bool> SendSmsAndSave(string phoneNumber, string message, CountryName country, InfoAccumulator errors) { //validate phone number if (string.IsNullOrEmpty(phoneNumber)) { String errorMessage = "attempt to send sms to an empty phone number"; Log.Error(errorMessage); errors.AddError(errorMessage); return(false); } //validate debug mode if (IsInDebugMode(phoneNumber)) { return(true); } string toPhoneNumber = NormalizePhoneNumber(phoneNumber, country); //validate message if (string.IsNullOrEmpty(message)) { errors.AddInfo("not sending empty message"); Log.Warn("attempt to send empty message to phone number: " + toPhoneNumber + " . SMS was not send"); return(false); } Log.InfoFormat("Sending sms to phone number: {0}, message: {1}", toPhoneNumber, message); //send sms TwilioSendSmsCommandResponse twilioResponse = await TwilioSmsSender.SendAsync(ThirdPartyService.Address, new TwilioSendSmsCommand { Message = message, PhoneNumber = toPhoneNumber }); if (twilioResponse.Sms == null) { return(false); } //save sms in DB if (!MobilePhoneQueries.SaveTwilioSms(twilioResponse.Sms)) { string errorMsg = String.Format("Failed to save Twilio SMS response to DB: {0}", message); Log.Error(errorMsg); errors.AddError(errorMsg); return(false); } return(true); }
// GET: CountryNames/Edit/5 public async Task <ActionResult> Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CountryName countryName = await db.CountryNames.FindAsync(id); if (countryName == null) { return(HttpNotFound()); } return(View(countryName)); }
public IHttpActionResult DeleteCountryName(int id) { CountryName countryName = db.CountryNames.Find(id); if (countryName == null) { return(NotFound()); } db.CountryNames.Remove(countryName); db.SaveChanges(); return(Ok(countryName)); }
public void TestGetValue_WithMaxLengthRestriction() { // Arrange const int maxLength = 2; // Arrange var columnInfo = new CountryColumnInfo { IsNullable = false, MaxLength = maxLength }; var strategy = new CountryColumnValueStrategy(RepoFactory); // Act string value = strategy.GetValue(columnInfo); // Assert Assert.AreEqual(CountryName.Substring(0, maxLength), value); }
public bool IsValid() { bool result = true; if (FirstName.Trim().Length < 1) { result = false; } if (LastName.Trim().Length < 1) { result = false; } if (Line1.Trim().Length < 1) { result = false; } if (CountryBvin.Trim().Length < 1) { result = false; } if (CountryName.Trim().Length < 1) { result = false; } if (CountryBvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0") { if (RegionBvin.Trim().Length < 1) { if (RegionName.Trim().Length < 1) { result = false; } } } if (_PostalCode.Trim().Length < 1) { result = false; } return(result); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { //Composite Key modelBuilder.Entity <PassengerRegistration>() .HasKey(o => new { o.ID, o.PassengerID }); modelBuilder.Entity <DriverRegistration>() .HasKey(o => new { o.ID, o.DriverID }); CountryName countryName = new CountryName(); countryName.CountryNameData(modelBuilder); StateName stateName = new StateName(); stateName.StateNameData(modelBuilder); DistrictName districtName = new DistrictName(); districtName.DistrictNameData(modelBuilder); }
public Country(CountryName name, int population, string continent) { _name = name; Population = population; Continent = continent; }
public EuCountry(CountryName name, int population, string currency) : base(name, population, ContinentName) { _currency = currency; }