Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                GoogleContacts gc = new GoogleContacts("id", "pass");

                // gc.GetContacts();

                //List<ConciseContact> ccList = gc.GetContactsWithBirthdaysToday();

                //ContactCleaner.CleanseContacts(ccList);

                Way2SmsAPI w2sAPI = new Way2SmsAPI("9999999999", "ffsf");

                // For testing
                //w2sAPI.SendSms("9920999713", "Happy birthday !! " + "friend" + " " + "From: Sender");

                bool Addr = w2sAPI.GetAddressBook();

                //"9999999999"
                //foreach (ConciseContact cc in ccList)
                //{
                //    if(cc.IsValidPhone)
                //        w2sAPI.SendSms(cc.PhoneNumber, "Happy birthday !! " + cc.AddressingName + " " + "From: Munish Goyal");
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnLoginSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                ValidateLogin();

                ValidatePassword();

                // Validate
                if (!string.IsNullOrEmpty(errorProvider1.GetError(tbLogin)) ||
                    !string.IsNullOrEmpty(errorProvider2.GetError(tbPassword)))
                {
                    HandleError(null, MSG_APP_ERROR_INPUT);
                    return;
                }

                // If all conditions have been met, clear the ErrorProvider of errors.
                //errorProvider1.SetError(tbLogin, "");
                //errorProvider2.SetError(tbPassword, "");

                lblLog.Text = MSG_APP_PROCESSING;

                _ud._w2s_id     = tbLogin.Text;
                _ud._w2s_pwd    = tbPassword.Text;
                _ud._isRemember = cbLoginRemember.Checked;

                if (_ud._isRemember)
                {
                    // Serialize user data
                    using (Stream stream = File.Open(AppConfig.UdStoreFile, FileMode.Create))
                    {
                        var bformatter = new BinaryFormatter();
                        bformatter.Serialize(stream, _ud);
                    }
                }


                //AddressBook.
                // Run the app in a new thread
                //ParameterizedThreadStart pts = new ParameterizedThreadStart(SmsSender.SendWishes1);
                //Thread th = new Thread(pts);

                //th.Start(_ud);
                w2sAPI = new Way2SmsAPI(_ud._w2s_id, _ud._w2s_pwd);
                w2sAPI.Login();
                isLoginDone = true;
                lblLog.Text = MSG_APP_WELCOME;

                tabcMain.SelectedTab = tabpAddrbook;
            }
            catch (Exception ex)
            {
                HandleError(ex, "");
            }
        }
Ejemplo n.º 3
0
        public static void SendWishes(UserData ud, GreetingsData gd)
        {
            GoogleContacts gc = new GoogleContacts(ud._goog_id, ud._goog_pwd);

            // gc.GetContacts();

            List <ConciseContact> ccList = gc.GetContactsWithBirthdaysToday();

            ContactCleaner.CleanseContacts(ccList);

            Logger.LogIt("Fetched List of birthdays today. Count = " + ccList.Count);

            Way2SmsAPI w2sAPI = new Way2SmsAPI(ud._w2s_id, ud._w2s_pwd);

            // For testing
            //app.SendSms("9999999999", "Dear ....." + "Happy birthday !! " + " " + "~~ From: Munish Goyal ~~");

            foreach (ConciseContact cc in ccList)
            {
                if (cc.IsValidPhone)
                {
                    ContactData cd = null;
                    if (!gd.WishTable.TryGetValue(cc.PhoneNumber, out cd))
                    {
                        cd = new ContactData(cc);
                        gd.WishTable.Add(cc.PhoneNumber, cd);
                        gd.TotalCount++;
                    }

                    if (!cd.isWished)
                    {
                        if (w2sAPI.SendSms(cc.PhoneNumber, ud._msg + cc.AddressingName + " " + ud._signature))
                        {
                            Logger.LogIt("Wished " + cc.AddressingName + " at " + cc.PhoneNumber);
                            cd.isWished = true;
                            gd.DoneCount++;
                        }
                    }
                }
            }
        }