public AddContact_ViewModel(INavigation navigation, IDataStore dataStore, Token_Model token, List <Wilaya_Model> wilayas, List <Commune> communes, List <string> speciality) { Navigation = navigation; DataStore = dataStore; Contact = new NewContact_Model(); Wilaya = wilayas; Speciality = speciality; All_Commune = communes; Token = token; PermissionsRequest = new PermissionsRequest(); Speciality.Remove("Tous"); Speciality.Remove("Pharmacien"); Speciality.Remove("Sage-femme"); Speciality.Remove("Chirugien-dentiste"); Speciality.Remove("Grossiste"); GetPositionCommand = new Command(async() => { await ExecuteOnGetPosition(); }); TakePictureCommand = new Command(async() => { await ExecuteOnTakePicture(); }); AddContactCommand = new Command(async() => { await ExecuteOnAddContact(); }); PictureTappedCommand = new Command(async() => { await ExecuteOnPictureTapped(); }); }
private void Initilize() { NewContact = new NewContact_Model(); NewContact.address = Contact.address; NewContact.age = Contact.age; NewContact.business_type = Contact.business_type; Selected_Profession = Contact.business_type; NewContact.city = Contact.city; NewContact.company = Contact.company; NewContact.email = Contact.email; NewContact.fax = Contact.fax; NewContact.firstname = Contact.firstname; NewContact.landline = Contact.landline; NewContact.lastname = Contact.lastname; NewContact.local_appearance = Contact.local_appearance; if (Contact.location.coordinates.Count() > 0) { if (Contact.location.coordinates[0].HasValue) { NewContact.location.coordinates.lat = Contact.location.coordinates[0].ToString().Replace(",", "."); NewContact.location.coordinates.lng = Contact.location.coordinates[1].ToString().Replace(",", "."); Position = NewContact.location.coordinates.lat + ";" + NewContact.location.coordinates.lng; } } NewContact.phone = Contact.phone; NewContact.placement = Contact.placement; NewContact.potential = Contact.potential; Selected_Potential = (Contact.potential.Exists(i => i.network == Token.network)) ? Contact.potential.Single(i => i.network == Token.network).value : null; NewContact.prescription = Contact.prescription; NewContact.sector = Contact.sector; NewContact.sex = Contact.sex; NewContact.speciality = Contact.speciality; NewContact.wilaya = Contact.wilaya; NewContact._id = Contact._id; if (Contact.sex == "Homme") { Male_Cheked = true; } else { Femele_Cheked = true; } Speciality.Remove("Tous"); Speciality.Remove("Pharmacien"); Speciality.Remove("Sage-femme"); Speciality.Remove("Chirugien-dentiste"); Speciality.Remove("Grossiste"); }