Exemple #1
0
        private string AddToDB(string json)
        {
            qc = JsonConvert.DeserializeObject <QContact>(json);
            QContactDB qcdb = new QContactDB();

            string[] friendId = qc.myIdfriendId.Split(',');
            qc.myIdfriendId = Helpers.Settings.UserId + "," + friendId[0];
            qc.LastModified = System.DateTime.Now;

            if (qcdb.ExistQContact(qc.myIdfriendId))
            {
                qcdb.UpdateQContact(qc);
            }
            else
            {
                qcdb.AddQContact(qc);
            }

            return(qc.FirstName + " " + qc.LastName);
        }
        public void onPeOkClicked(object sender, EventArgs args)
        {
            QContact   qc   = new QContact();
            QContactDB qcdb = new QContactDB();

            qc.myIdfriendId = fbId + "," + fbId;
            qc.FirstName    = peFirstName.Text;
            qc.LastName     = peLastName.Text;
            qc.Company      = peCompany.Text;
            qc.Mobile       = peMobile.Text;
            qc.HomePhone    = peHomePhone.Text;
            qc.WorkPhone    = peWorkFax.Text;
            qc.HomeFax      = peHomeFax.Text;
            qc.WorkFax      = peWorkFax.Text;
            qc.Addr         = peAddr.Text;
            qc.Email        = peEmail.Text;
            qc.Birthday     = peBirthday.Date;
            qc.URL          = peURL.Text;
            qc.Skype        = peSkype.Text;
            qc.Facebook     = peFacebook.Text;
            qc.LinkedIn     = peLinkedIn.Text;
            qc.Twitter      = peTwitter.Text;
            qc.Instagram    = peInstagram.Text;
            qc.LastModified = DateTime.Now.ToLocalTime();
            Debug.WriteLine(DateTime.Now.ToLocalTime().ToString());

            if (qcdb.ExistQContact(qc.myIdfriendId))
            {
                qcdb.UpdateQContact(qc);
            }
            else
            {
                qcdb.AddQContact(qc);
            }

            Application.Current.MainPage = new MainPage();
        }