Ejemplo n.º 1
0
 public ContactsVM()
 {
     _DB = new ContactsContext();
     soapClient = new SoapService.SoapServiceClient();
     Contacts = new ObservableCollection<Contact>();
     Addresses = new ObservableCollection<Address>();
     Companies = new ObservableCollection<Company>();
     AddressIDs = new ObservableCollection<int>();
     /* Old save command
     SaveCommand = new DelegateCommand(() => {
         _DB.SaveChanges();
     });
      */
     SaveCommand = new DelegateCommand(() => {
         foreach (var x in Contacts) {
             soapClient.AddContact(x);
         }
         soapClient.Save();
     });
     /*old Add Contact
     AddContactCommand = new DelegateCommand(() => {
         ViewingContact = new Contact();
         Contacts.Add(ViewingContact);
         _DB.Contacts.Add(VewingContact);
     });
      */
     AddContactCommand = new DelegateCommand(() => {
         ViewingContact = new Contact();
         Contacts.Add(ViewingContact);
         //soapClient.AddContactAsync(ViewingContact);
     });
     AddCompanyCommand = new DelegateCommand(() => {
         ViewingCompany = new Company();
         Companies.Add(ViewingCompany);
         _DB.Companies.Add(ViewingCompany);
     });
     AddAddressCommand = new DelegateCommand(() => {
         ViewingAddress = new Address();
         Addresses.Add(ViewingAddress);
         _DB.Addresses.Add(ViewingAddress);
     });
     DeleteContactCommand = new DelegateCommand(() => {
         _DB.Contacts.Remove(ViewingContact);
         Contacts.Remove(ViewingContact);
     });
     DeleteCompanyCommand = new DelegateCommand(() => {
         _DB.Contacts.Remove(ViewingContact);
         Contacts.Remove(ViewingContact);
     });
     DeleteAddressCommand = new DelegateCommand(() => {
         _DB.Contacts.Remove(ViewingContact);
         Contacts.Remove(ViewingContact);
     });
     AddContactMethodCommand = new DelegateCommand(() => {
         var cm = new ContactMethod();
         ViewingContact.ContactMethods.Add(cm);
     });
     init();
 }
Ejemplo n.º 2
0
        bool SendWhatsAppMessage(String receiver, String Message)
        {
            bool result = false;

            try
            {
                //Send ( button_click )

                DataAccess.RedaV1Entities db      = ModuleClass.GetConnection();//= new DataAccess.RedaV1Entities(ModuleClass.Connect());
                DataAccess.Company        company = db.Companies.Take(1).SingleOrDefault();

                string WhatsAppCode   = company.WhatsAppCode;   // UserData.Default.WhatsAppCode;
                string WhatsAppSender = company.WhatsAppSender; // UserData.Default.WhatsAppSender;



                string from = WhatsAppSender;
                string to   = receiver;
                string msg  = Message;

                WhatsApp wa = new WhatsApp(from, WhatsAppCode, "RedaPos", false, true);

                wa.OnConnectSuccess += () =>
                {
                    //   MessageBox.Show("Connected to whatsapp...");

                    wa.OnLoginSuccess += (phoneNumber, data) =>
                    {
                        wa.SendMessage(to, msg);
                        result = true;
                    };

                    wa.OnLoginFailed += (data) =>
                    {
                        MessageBox.Show("Login Failed : {0}", data);
                        result = false;
                    };

                    wa.Login();
                };

                wa.OnConnectFailed += (ex) =>
                {
                    MessageBox.Show("Connection Failed...");
                    result = false;
                };

                wa.Connect();
            }
            catch (Exception ex2)
            {
                result = false;
            }

            return(result);
        }
Ejemplo n.º 3
0
		private void detach_Company(Company entity)
		{
			this.SendPropertyChanging();
			entity.City = null;
		}
Ejemplo n.º 4
0
		private void attach_Company(Company entity)
		{
			this.SendPropertyChanging();
			entity.City = this;
		}
Ejemplo n.º 5
0
 partial void DeleteCompany(Company instance);
Ejemplo n.º 6
0
 partial void UpdateCompany(Company instance);
Ejemplo n.º 7
0
 partial void InsertCompany(Company instance);