public static string GetUrlFromSocialContactMethod(ContactMethod contactMethod) { switch (contactMethod.Type) { case ContactType.NotSet: return(string.Empty); case ContactType.Facebook: return($"http://facebook.com/{contactMethod.ContactInfo}"); case ContactType.Twitter: return($"http://twitter.com/{contactMethod.ContactInfo}"); case ContactType.YouTube: return($"http://youtube.com/{contactMethod.ContactInfo}"); case ContactType.WebSite: return(contactMethod.ContactInfo); case ContactType.WebSiteContact: return(contactMethod.ContactInfo); default: return(string.Empty); } }
public ContactsVM() { int i = 0; _DB = new CSharpContext(); Contacts = new ObservableCollection <Contact>(); SaveCommand = new DelegateCommand(() => _DB.SaveChanges()); AddCommand = new DelegateCommand(() => { CurrentContact = new Contact(); Contacts.Add(CurrentContact); _DB.Contacts.Add(CurrentContact); }); AddEmailCommand = new DelegateCommand(() => { var cm = new ContactMethod(); CurrentContact.ContactMethods.Add(cm); }); DeleteCommand = new DelegateCommand(() => { _DB.Contacts.Remove(CurrentContact); Contacts.Remove(CurrentContact); }); Init(); }
private static ContactMethod GetUserContactMethod(Invitee invitee) { List <ContactMethod> newContactMethods = new List <ContactMethod> { ContactMethod.Email, ContactMethod.Mail, ContactMethod.Phone, ContactMethod.WhatsApp }; ContactMethod methods = new ContactMethod(); do { int i = 1; Console.WriteLine("kies een contact methode"); foreach (var item in newContactMethods) { Console.WriteLine($"{i}) {item}"); i++; } int result; if (int.TryParse(Console.ReadLine(), out result) && result > 0 && result <= newContactMethods.Count) { methods |= newContactMethods[result - 1]; newContactMethods.RemoveAt(result - 1); } else { Console.WriteLine($"geef een numer tussen 1 en {newContactMethods.Count} op"); } } while (GetUserInput("wilt u meer toevoegen? druk \"y\" en ENTER", false) == "y" || newContactMethods.Count == 4); GetRelevantContactMethods(invitee, methods); return(methods); }
private static Intent GetIntentForContactPhone(ContactMethod contacMethod) { var uri = Android.Net.Uri.Parse("tel:" + contacMethod.ContactInfo); var intent = new Intent(Intent.ActionDial, uri); return(intent); }
public static Intent GetIntentForContactMethod(ContactMethod contactMethod) { var intent = new Intent(Intent.ActionView); switch (contactMethod.Type) { case ContactType.NotSet: break; case ContactType.Email: return(GetIntentForContactEmail(contactMethod)); case ContactType.Phone: return(GetIntentForContactPhone(contactMethod)); case ContactType.Mail: return(GetIntentForContactAddress(contactMethod)); case ContactType.Facebook: case ContactType.Twitter: case ContactType.YouTube: case ContactType.WebSite: case ContactType.WebSiteContact: return(GetIntentForContactWebsite(contactMethod)); default: return(intent); } return(intent); }
public static void Initialize(ApplicationDbContext context) { context.Database.EnsureCreated(); // Add the contact methods if (!context.ContactMethods.Any()) { var contactMethods = new ContactMethod[] { new ContactMethod { ContactMethodId = 1, Description = "30 Second Survey" }, new ContactMethod { ContactMethodId = 2, Description = "Soul Winning" }, new ContactMethod { ContactMethodId = 3, Description = "Event" }, new ContactMethod { ContactMethodId = 4, Description = "Personal Invite" }, new ContactMethod { ContactMethodId = 5, Description = "Website" }, new ContactMethod { ContactMethodId = 6, Description = "Misc" }, }; foreach (var currentItem in contactMethods) { context.ContactMethods.Add(currentItem); } context.SaveChanges(); } // Add the questions if (!context.Questions.Any()) { var questions = new Question[] { new Question { QuestionId = 1, Description = "Which of these is the most important for you to experience during college?" }, new Question { QuestionId = 2, Description = "On a scale from 1-10 how important is the spiritual area of your life?" }, new Question { QuestionId = 3, Description = "I am interested in hearing more about Driven Student Ministry" }, }; foreach (var currentItem in questions) { context.Questions.Add(currentItem); } context.SaveChanges(); } }
public static bool DeleteContactMethod(ContactMethod objContactMethod) { //Pre-step: Replace the general object parameter with the appropriate business class object that you are using to insert data in the underline database table string SQLStatement = String.Empty; //Uncomment either Example #1 or #2 to use appropriate connection string //Example #1 for connecting to a remote SQL Server instance via IP address and SQL Server authenication..For Meramec //string connectionString = "Server=mc-sluggo.stlcc.edu;Database=IS253_251;User Id=csharp2;Password=csharp2;"; //Example #2 for connecting to SQL Server locally with Windows Authenication. Change accordingly to your environment. //string connectionString = @"Data Source=STEVIE-LAPTOP\MSSQLSERVER1;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False"; int rowsAffected = 0; SqlCommand objCommand = null; SqlConnection objConn = null; string sqlString; try { using (objConn = AccessDataSQLServer.GetConnection()) { //Open the connection to the datbase objConn.Open(); sqlString = "Delete contact_method where id = @contactMethod_id"; //Create a command object with the SQL statement using (objCommand = new SqlCommand(sqlString, objConn)) { //Use the command parameters method to set the paramater values of the SQL Insert statement objCommand.Parameters.AddWithValue("@contactMethod_id", objContactMethod.ID); //Execute the SQL and return the number of rows affected rowsAffected = objCommand.ExecuteNonQuery(); } if (rowsAffected > 0) { return(true); } else { return(false); } } } catch (SqlException ex) { throw ex; } finally { //Finally will always be called in a try..catch..statem. You can use to to close the connection //especially if an error is thrown if (objConn != null) { objConn.Close(); } } }
private void FormCommPrefPicker_Load(object sender, EventArgs e) { if (ContMethCur == null) { ContMethCur = new ContactMethod(); } fillGrid(); }
private static Intent GetIntentForContactAddress(ContactMethod contactMethod) { //var geoUri = "http://maps.google.co.in/maps?q=" + contactMethod.ContactInfo; // WebUtility.UrlEncode(contactMethod.ContactInfo) var geoUri = Android.Net.Uri.Parse("geo:0,0?q=" + WebUtility.UrlEncode(contactMethod.ContactInfo + " Washington DC")); var intent = new Intent(Intent.ActionView, geoUri); return(intent); }
private void butOK_Click(object sender,EventArgs e) { if(gridMain.GetSelectedIndex()==-1) { MsgBox.Show(this,"Please select a communication preference first."); return; } ContMethCur=(ContactMethod)gridMain.GetSelectedIndex(); DialogResult=DialogResult.OK; }
public Contact( ContactType contactType, ContactMethod contactMethod, string contactValue) { ContactType = contactType; ContactMethod = contactMethod; ContactValue = contactValue; }
public IHttpActionResult Delete(ContactMethod contactMehtod) { var mng = new ContactMethodManagement(); mng.Delete(contactMehtod); apiResponse.Message = "Action was excecute"; return(Ok(apiResponse)); }
public IHttpActionResult Put(ContactMethod contactMethod) { var mng = new ContactMethodManagement(); mng.Update(contactMethod); apiResponse.Message = "Action was excecuted!"; return(Ok(apiResponse)); }
public Dictionary <string, object> ToDictionary() { return(new Dictionary <string, object> { { JsonProperties.Type, ContactType.ToString() }, { JsonProperties.Method, ContactMethod.ToString() }, { JsonProperties.Contact, ContactValue } }); }
private static Intent GetIntentForContactWebsite(ContactMethod contactMethod) { var intent = new Intent(Intent.ActionView); var url = Util.GetUrlFromSocialContactMethod(contactMethod); var uri = Android.Net.Uri.Parse(url); intent.SetData(uri); return(intent); }
private static CustomerReachOut GenerateCustomerReachOut(string idString) { ContactMethod contactMethod = new ContactMethod(ContactMethodType.Email) { Email = "*****@*****.**" }; return(new CustomerReachOut(idString, contactMethod)); }
private void butOK_Click(object sender, EventArgs e) { if (gridMain.GetSelectedIndex() == -1) { MsgBox.Show(this, "Please select a communication preference first."); return; } ContMethCur = (ContactMethod)gridMain.GetSelectedIndex(); DialogResult = DialogResult.OK; }
private static Intent GetIntentForContactEmail(ContactMethod contactMethod) { var to = contactMethod.ContactInfo; var subject = ""; var body = ""; var intent = AndroidHelper.GetSendEmailIntent(to, subject, body, string.Empty); return(intent); }
public static ContactMethod GetContactMethod(int contactMethodID) { //Pre-step: Replace the general object parameter with the appropriate data type parameter for retrieving a specific item from the specific database table. string SQLStatement = String.Empty; //Change the MyCustomObject references to your customer business object //ContactMethod objTemp = new ContactMethod(); string sqlString = "Select id, name from contact_method where id = @contactMethod_id order by id"; SqlCommand objCommand = null; SqlConnection objConn = null; SqlDataReader custReader = null; ContactMethod objContactMethod = null; try { using (objConn = AccessDataSQLServer.GetConnection()) { //Open the connection to the datbase objConn.Open(); //Create a command object with the SQL statement using (objCommand = new SqlCommand(sqlString, objConn)) { //Set command parameter objCommand.Parameters.AddWithValue("@contactMethod_id", contactMethodID); //Execute the SQL and return a DataReader using (custReader = objCommand.ExecuteReader()) { while (custReader.Read()) { objContactMethod = new ContactMethod(); //Fill the customer object if found objContactMethod.ID = custReader["id"].ToString(); objContactMethod.Name = custReader["name"].ToString(); } } } return(objContactMethod); } } catch (SqlException ex) { throw ex; } finally { //Finally will always be called in a try..catch..statem. You can use to to close the connection //especially if an error is thrown if (objConn != null) { objConn.Close(); } } }
public static bool UpdateContactMethod(ContactMethod objContactMethod) { string SQLStatement = String.Empty; int rowsAffected = 0; SqlCommand objCommand = null; SqlConnection objConn = null; string sqlString; try { using (objConn = AccessDataSQLServer.GetConnection()) { //Open the connection to the datbase objConn.Open(); sqlString = "UPDATE contact_method " + Environment.NewLine + "set name = @contactMethod_name " + Environment.NewLine + "where id = @contactMethod_id "; //Create a command object with the SQL statement using (objCommand = new SqlCommand(sqlString, objConn)) { //Use the command parameters method to set the paramater values of the SQL Insert statement objCommand.Parameters.AddWithValue("@contactMethod_name", objContactMethod.Name); objCommand.Parameters.AddWithValue("@contactMethod_id", objContactMethod.ID); //Execute the SQL and return the number of rows affected rowsAffected = objCommand.ExecuteNonQuery(); } if (rowsAffected > 0) { return(true); } else { return(false); } } } catch (SqlException ex) { throw ex; } finally { //Finally will always be called in a try..catch..statem. You can use to to close the connection //especially if an error is thrown if (objConn != null) { objConn.Close(); } } }
public ActionResult Apply(MakeApplicationViewModel model) { if (ModelState.IsValid) { _logic.MakeApplication(model); ContactMethod.SendSms(model.Phone, "Application to attend JG Zuma High was received. You will receive feedback within 15 days."); return(RedirectToAction("ApplicationSuccess")); } ViewBag.Gender = new SelectList(gnd.GetGenders(), dataValueField: "GenderTitle", dataTextField: "GenderTitle", selectedValue: gnd.GenderTitle); return(View(model)); }
public static void SetLegislatorContactMthdVisibility(View imageButton, ContactMethod contactMethod, Android.Util.TypedValue selectableItemBackground) { imageButton.Visibility = contactMethod.IsEmpty ? ViewStates.Gone : ViewStates.Visible; if (selectableItemBackground != null) { imageButton.SetBackgroundResource(selectableItemBackground.ResourceId); } }
public static bool AddContactMethod(ContactMethod objContactMethod) { //Pre-step: Replace the general object parameter with the appropriate business class object that you are using to insert data in the underline database table string SQLStatement = String.Empty; int rowsAffected = 0; SqlCommand objCommand = null; SqlConnection objConn = null; string sqlString; try { using (objConn = AccessDataSQLServer.GetConnection()) { //Open the connection to the datbase objConn.Open(); sqlString = "INSERT into contact_method(id, name) values (@contactMethod_id, @contactMethod_name)"; //Create a command object with the SQL statement using (objCommand = new SqlCommand(sqlString, objConn)) { //Use the command parameters method to set the paramater values of the SQL Insert statement objCommand.Parameters.AddWithValue("@contactMethod_id", objContactMethod.ID); objCommand.Parameters.AddWithValue("@contactMethod_name", objContactMethod.Name); //Execute the SQL and return the number of rows affected rowsAffected = objCommand.ExecuteNonQuery(); } if (rowsAffected > 0) { return(true); } else { return(false); } } } catch (SqlException ex) { throw ex; } finally { //Finally will always be called in a try..catch..statem. You can use to to close the connection //especially if an error is thrown if (objConn != null) { objConn.Close(); } } }
public IHttpActionResult Get(string id) { var mng = new ContactMethodManagement(); var contactMethod = new ContactMethod { OwnerId = id }; apiResponse.Data = contactMethod; return(Ok(contactMethod)); }
internal static string ToSerializedValue(this ContactMethod value) { switch (value) { case ContactMethod.Email: return("Email"); case ContactMethod.Sms: return("Sms"); } return(null); }
public Response <int> AddContact([FromBody] ContactMethod contact) { var checkCode = CheckLoginAndPerson(contact); if (checkCode != ResponseCode.OK) { return(CreateResponse <int>(-1, checkCode)); } var res = persons.AddContactNumber(contact); return(CreateResponse(res ? contact.Id : -1, res ? ResponseCode.OK : ResponseCode.FAIL)); }
public override int GetHashCode() { var hc = 21; var salt = 571; unchecked { hc = (hc * salt) + ContactType.GetHashCode(); hc = (hc * salt) + ContactMethod.GetHashCode(); hc = (hc * salt) + ContactValue.GetHashCode(); } return(hc); }
public BaseEntity BuildObject(Dictionary <string, object> row) { var contactMethod = new ContactMethod { Type = GetStringValue(row, DB_COL_TYPE), Value = GetStringValue(row, DB_COL_VALUE), Description = GetStringValue(row, DB_COL_DESCRIPTION), INDPublicidad = GetStringValue(row, DB_COL_INDPUBLICIDAD), OwnerId = GetStringValue(row, DB_COL_OWNER_ID) }; return(contactMethod); }
//[HttpPost] public ActionResult UpdateStatus(string id) { var app = _logic.GetApplication(id); _logic.UpdateStatus(app); if (app.Status.Equals("Accepted")) { string message = "Dear applicant, please be advised that your application was approved. You will be notified about the date of registration"; ContactMethod.SendSms(app.Phone, message); } return(View(app)); }
public void GetCollection_Property_ShouldReturnCollection() { var person = new Person(); var expected = new ContactMethod { Type = ContactMethodType.HomePhone, Value = "555-1234" }; var mapping = new CollectionChildElementMapping<Person, ContactMethod>(Ns + "ContactMethod", x => x.ContactMethods); mapping.GetCollection(person).ShouldBe(null); mapping.AddToCollection(person, expected); mapping.GetCollection(person).ShouldNotBe(null); mapping.GetCollection(person).ShouldBe(person.ContactMethods); }
//Instructions: //Replace all ???TableNameHere phrases with the name of your specific SQL Server Database Table Name //Replace yourCustomeObject phrase with the name of the business object (represents database table name) you are referencing or returning //Replace datatype phrase with the appropriate C# data type or custom data type based on Project #2 CRUD specs //Replace parameter phrase with the appropriate input parameter based on Project #2 CRUD specs //Refer to the ADO.Net Demo for method examples below public static List <ContactMethod> GetContactMethods() { //Change the MyCustomObject name to your customer business object that is returning data from the specific table List <ContactMethod> objTemp = new List <ContactMethod>(); string SQLStatement = "select id, name from contact_method order by id"; SqlCommand objCommand = null; SqlConnection objConn = null; SqlDataReader objReader = null; try { //using (objConn = AccessDataSQLServer.GetConnection()) using (objConn = AccessDataSQLServer.GetConnection()) { //Open the connection to the database objConn.Open(); //Create a command object with the SQL statement using (objCommand = new SqlCommand(SQLStatement, objConn)) { //Execute the SQL and return a DataReader Object using (objReader = objCommand.ExecuteReader()) { while (objReader.Read()) { ContactMethod objContactMethod = new ContactMethod(); objContactMethod.ID = objReader["id"].ToString(); objContactMethod.Name = objReader["name"].ToString(); //Add the contactMethod to the collection objTemp.Add(objContactMethod); } } } } } catch (Exception ex) { throw ex; } finally { if (objConn != null) { objConn.Close(); } } return(objTemp); }
public void AddToCollection_Property_ShouldAddMemberAndInstantiateCollectionIfRequired() { var person = new Person(); var expected = new ContactMethod{Type = ContactMethodType.HomePhone, Value = "555-1234"}; var mapping = new CollectionChildElementMapping<Person, ContactMethod>(Ns + "ContactMethod", x => x.ContactMethods); mapping.CreateInstance().ShouldBeTypeOf(typeof(ContactMethod)); mapping.NamespaceUri.ShouldBe(Ns.NamespaceName); mapping.LocalName.ShouldBe("ContactMethod"); mapping.AddToCollection(person, expected); person.ContactMethods[0].ShouldBe(expected); }
public void AddToCollection_ContainingCollection_ShouldAddMemberToMethodArgument() { var person = new Person {ContactMethods = new List<ContactMethod>()}; var expected = new ContactMethod {Type = ContactMethodType.HomePhone, Value = "555-1234"}; var mapping = new CollectionChildElementMapping<Person, ContactMethod>(Ns + "ContactMethod", null); mapping.CreateInstance().ShouldBeTypeOf(typeof(ContactMethod)); mapping.NamespaceUri.ShouldBe(Ns.NamespaceName); mapping.LocalName.ShouldBe("ContactMethod"); mapping.AddToCollection(person.ContactMethods, expected); person.ContactMethods[0].ShouldBe(expected); }
private void OnActionButtonClick(int position, int buttonResourceId) { var legislator = GetLegislatorAtPosition(position); if (legislator == null) { Logger.Error($"Unable to process legislator's action button click. Unable to find legislator at position {position}"); _fragment.ShowToast(AndroidHelper.GetString(Resource.String.unableToProcessAction)); return; } ContactMethod contactMethod = null; switch (buttonResourceId) { case Resource.Id.legislatorCtrl_email: contactMethod = legislator.Email; break; case Resource.Id.legislatorCtrl_phone: contactMethod = legislator.OfficeNumber; break; case Resource.Id.legislatorCtrl_address: contactMethod = legislator.OfficeAddress; break; case Resource.Id.legislatorCtrl_facebook: contactMethod = legislator.FacebookId; break; case Resource.Id.legislatorCtrl_twitter: contactMethod = legislator.TwitterId; break; case Resource.Id.legislatorCtrl_youtube: contactMethod = legislator.YouTubeId; break; case Resource.Id.legislatorCtrl_webpage: contactMethod = legislator.Website; break; } if (contactMethod != null) { AppHelper.PerformContactMethodIntent(_fragment, contactMethod, false); } }
public void Build_ShouldCreateValidMapping() { var person = new Person(); var method = new ContactMethod {Type = ContactMethodType.HomePhone, Value = "555-1234"}; var builder = new CollectionChildElementMappingBuilder<Person, ContactMethod, object>(null, Ns + "ContactMethod", x => x.ContactMethods); builder.Attribute(Ns + "Value", x => x.Value); builder.CollectionElement<string>(Ns + "Value1"); builder.CollectionElement(Ns + "Value2", x => x.AdditionalValues); var actual = (CollectionChildElementMapping<Person, ContactMethod>)builder.Build(); actual.AddToCollection(person, method); person.ContactMethods[0].ShouldBe(method); actual.Attributes.Length.ShouldBe(1); actual.ChildElements.Length.ShouldBe(2); }
private void FormCommPrefPicker_Load(object sender,EventArgs e) { if(ContMethCur==null) { ContMethCur=new ContactMethod(); } fillGrid(); }
/// <summary> /// Chooses method of uploading a contact list /// </summary> /// <param name="listName"></param> /// <param name="termsAgree"></param> /// <param name="method"></param> public void CreateContactListSetup(string listName, bool termsAgree, ContactMethod method) { //UIUtilityProvider.UIHelper.SelectPopUpFrame("plain"); //UIUtilityProvider.UIHelper.WaitForPageToLoad(); UIUtil.DefaultProvider.Type(ListNameLocator, listName, LocateBy.Id); UIUtil.DefaultProvider.SetCheckbox(ContactListTemsLocator, termsAgree, LocateBy.Id); switch(method) { case ContactMethod.Import: UIUtil.DefaultProvider.WaitForDisplayAndClick(string.Format(MethodLocatorConstructor, 0), LocateBy.Id); break; case ContactMethod.Manual: UIUtil.DefaultProvider.WaitForDisplayAndClick(string.Format(MethodLocatorConstructor, 1), LocateBy.Id); break; case ContactMethod.Filtered: UIUtil.DefaultProvider.WaitForDisplayAndClick(string.Format(MethodLocatorConstructor, 2), LocateBy.Id); break; } UIUtil.DefaultProvider.WaitForDisplayAndClick(ContactListStartNextLocator, LocateBy.Id); UIUtil.DefaultProvider.WaitForPageToLoad(); }
private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { ContMethCur=(ContactMethod)e.Row; DialogResult=DialogResult.OK; }