private void btnFind_Click(object sender, EventArgs e) { btnUserFind.Enabled = false; pbarSearchProgressBar.Visible = true; pbarSearchProgressBar.StartWaiting(); try { RSIFeaturesWS.RSIService searchService = new Remwave.Client.RSIFeaturesWS.RSIService(); //U.USERNAME || ' ' || C.COMPANY || ' '|| C.LAST_NAME || ' ' || C.FIRST_NAME || ' ' || C.COMMENT_DATA|| ' ' || C.CITY || ' ' || CTR.NAME || ' ' string keywords = ""; keywords += "%" + tbxSearchKeyWords.Text.Replace("%", "").Replace("?", "") + "%"; keywords += tbxSearchCity.Text.Replace("%", "").Replace("?", "") + " %"; keywords += tbxSearchCountry.Text.Replace("%", "").Replace("?", "") + " %"; searchService.utilsSearchUserCompleted += new Remwave.Client.RSIFeaturesWS.utilsSearchUserCompletedEventHandler(searchService_utilsSearchUserCompleted); searchService.utilsSearchUserAsync(myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, keywords); } catch (Exception) { btnUserFind.Enabled = true; pbarSearchProgressBar.Visible = false; pbarSearchProgressBar.EndWaiting(); } }
public void Save() { #region Local Store if (UseLocalStore) { try { if (!Directory.Exists(mStoreUserDirectory)) { Directory.CreateDirectory(mStoreUserDirectory); } NTContact[] contacts = new NTContact[this.Count]; int j = 0; lock (this) { for (int i = this.Count - 1; i >= 0; i--) { if (this[i].NTContactStore == NTContactStoreType.Local && this[i].NTDeleted != "true") { contacts[j] = this[i]; j++; } } } try { Array.Resize(ref contacts, j); XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); StreamWriter sw = new StreamWriter(mStoreUserDirectory + mStoreFilename); xser.Serialize(sw, contacts); sw.Close(); } catch (Exception ex) { #if (TRACE) Console.WriteLine("Save Contacts Book | Local Store : Failed - " + ex.Message); #endif } } catch (Exception) { #if (DEBUG) throw; #endif } } #endregion #if !(REMWAVE_LITE) #region Server Store if (UseServerStore) { try { NTContact[] contacts = new NTContact[this.Count]; int j = 0; lock (this) { for (int i = this.Count - 1; i >= 0; i--) { if (this[i].NTContactStore == NTContactStoreType.Server & (this[i].NTContactChanged | this[i].NTDeleted == "true")) { contacts[j] = this[i]; contacts[j].NTContactChanged = false; j++; } } } Array.Resize(ref contacts, j); Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService(); XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); StringWriter sw = new StringWriter(); xser.Serialize(sw, contacts); ss.servicePhonebookPutAsync(mUserAccount.Username, mUserAccount.Password, mProperties, sw.ToString()); sw.Close(); } catch (Exception ex) { #if (TRACE) Console.WriteLine("Save Contacts Book | Server Store : Failed - " + ex.Message); #endif } } #endregion #region Outlook Store if (UseOutlookStore) { try { //TODO CREATE OR UPDATE lock (this) { for (int i = this.Count - 1; i >= 0; i--) { if (this[i].NTContactStore == NTContactStoreType.Outlook && (this[i].NTContactChanged || this[i].NTDeleted == "true")) { try { Outlook.ContactItem oItem = NTTranslator(this[i]); if (this[i].NTDeleted == "true") { oItem.Delete(); } else { oItem.Save(); } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Save Contacts Book | Outlook Store : Failed - " + ex.Message); #endif } this[i].NTContactChanged = false; } } } } catch (Exception) { #if (DEBUG) throw; #endif } } #endregion #endif }
public void Load(UserAccount userAccount) { mUserAccount = userAccount; #region Local Store if (UseLocalStore) { try { XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); StreamReader sr = new StreamReader(mStoreUserDirectory + mStoreFilename); NTContact[] contacts = (NTContact[])xser.Deserialize(sr); sr.Close(); lock (this) { foreach (NTContact contact in contacts) { contact.NTContactStore = NTContactStoreType.Local; if (!this.Contains(contact) && contact.NTDeleted != "true") this.Add(contact); } } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load Contacts Book | Local Store : Failed - " + ex.Message); #endif } } #endregion #if !(REMWAVE_LITE) #region Server Store if (UseServerStore) { try { Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService(); XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); string sout = ss.servicePhonebookGet(mUserAccount.Username, mUserAccount.Password, mProperties, null); #if (TRACE) Console.WriteLine("PHONEBOOK-GET: " + userAccount.Username + " Done"); #endif StringReader sr = new StringReader(sout); NTContact[] ntc = (NTContact[])xser.Deserialize(sr); sr.Close(); lock (this) { foreach (NTContact contact in ntc) { contact.NTContactStore = NTContactStoreType.Server; if (!this.Contains(contact)) this.Add(contact); } } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load Contacts Book | Server Store : Failed - " + ex.Message); #endif } } #endregion #region Outlook Store if (UseOutlookStore) { Outlook.Application oApp = new Outlook.Application(); Outlook.NameSpace oNS = oApp.GetNamespace("MAPI"); Outlook.MAPIFolder oContactsFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); try { string filter = "[MessageClass] = \"IPM.Contact\""; Outlook.Items oContactItems = oContactsFolder.Items.Restrict(filter); lock (this) { foreach (Outlook.ContactItem item in oContactItems) { try { NTContact contact = NTTranslator((Outlook.ContactItem)item); contact.NTContactStore = NTContactStoreType.Outlook; if (!this.Contains(contact)) this.Add(contact); } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load : UseOutlookStore - " + ex.Message); #endif } } } oContactItems = null; } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load Contacts Book | Outlook Store : Failed - " + ex.Message); #endif } oApp = null; oNS = null; } #endregion #endif OnUpdateCompleted(this, new EventArgs()); }
private void btnFind_Click(object sender, EventArgs e) { btnUserFind.Enabled = false; pbarSearchProgressBar.Visible = true; pbarSearchProgressBar.StartWaiting(); try { RSIFeaturesWS.RSIService searchService = new Remwave.Client.RSIFeaturesWS.RSIService(); //U.USERNAME || ' ' || C.COMPANY || ' '|| C.LAST_NAME || ' ' || C.FIRST_NAME || ' ' || C.COMMENT_DATA|| ' ' || C.CITY || ' ' || CTR.NAME || ' ' string keywords = ""; keywords += "%"+tbxSearchKeyWords.Text.Replace("%","").Replace("?","") + "%"; keywords += tbxSearchCity.Text.Replace("%", "").Replace("?", "") + " %"; keywords += tbxSearchCountry.Text.Replace("%", "").Replace("?", "") + " %"; searchService.utilsSearchUserCompleted += new Remwave.Client.RSIFeaturesWS.utilsSearchUserCompletedEventHandler(searchService_utilsSearchUserCompleted); searchService.utilsSearchUserAsync(myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, keywords); } catch (Exception) { btnUserFind.Enabled = true; pbarSearchProgressBar.Visible = false; pbarSearchProgressBar.EndWaiting(); } }
private void getPrepaidStatus() { myPrepaidAmountRefreshToolStripLabel.Visible = false; try { Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService(); ss.servicePrepaidAmountCompleted += new Remwave.Client.RSIFeaturesWS.servicePrepaidAmountCompletedEventHandler(ss_servicePrepaidAmountCompleted); ss.servicePrepaidAmountAsync(mUserAccount.Username, mUserAccount.Password); } catch (Exception) { ; } }
void myPhone2PhoneWindow_FormClosing(object sender, FormClosingEventArgs e) { if (myPhone2PhoneWindow.StartCall) { string result = "-1"; try { RSIFeaturesWS.RSIService nikotalkWS = new Remwave.Client.RSIFeaturesWS.RSIService(); result = nikotalkWS.serviceCallNow(mUserAccount.Username, mUserAccount.Password, myPhone2PhoneWindow.CallFrom, myPhone2PhoneWindow.CallTo); } catch (Exception ex) { } if (result == "0") { myNotifyIcon.ShowBalloonTip( 10, Properties.Localization.txtInfoPhone2Phone, String.Format(Properties.Localization.txtInfoPhone2PhoneTrying, new object[]{ myPhone2PhoneWindow.CallFrom , myPhone2PhoneWindow.CallTo}), ToolTipIcon.Info ); } else if (result == "2") { myNotifyIcon.ShowBalloonTip( 10, Properties.Localization.txtInfoPhone2Phone, String.Format(Properties.Localization.txtInfoPhone2PhonePaymentRequired, new object[]{ myPhone2PhoneWindow.CallFrom , myPhone2PhoneWindow.CallTo}), ToolTipIcon.Error); } else { myNotifyIcon.ShowBalloonTip( 10, Properties.Localization.txtInfoPhone2Phone, String.Format(Properties.Localization.txtInfoPhone2PhoneUnableToStartCall, new object[]{ myPhone2PhoneWindow.CallFrom , myPhone2PhoneWindow.CallTo}), ToolTipIcon.Error); } } }
public void Save() { #region Local Store if (UseLocalStore) { try { if (!Directory.Exists(mStoreUserDirectory)) { Directory.CreateDirectory(mStoreUserDirectory); } NTContact[] contacts = new NTContact[this.Count]; int j = 0; lock (this) { for (int i = this.Count - 1; i >= 0; i--) { if (this[i].NTContactStore == NTContactStoreType.Local && this[i].NTDeleted != "true") { contacts[j] = this[i]; j++; } } } try { Array.Resize(ref contacts, j); XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); StreamWriter sw = new StreamWriter(mStoreUserDirectory + mStoreFilename); xser.Serialize(sw, contacts); sw.Close(); } catch (Exception ex) { #if (TRACE) Console.WriteLine("Save Contacts Book | Local Store : Failed - " + ex.Message); #endif } } catch (Exception) { #if (DEBUG) throw; #endif } } #endregion #if !(REMWAVE_LITE) #region Server Store if (UseServerStore) { try { NTContact[] contacts = new NTContact[this.Count]; int j = 0; lock (this) { for (int i = this.Count - 1; i >= 0; i--) { if (this[i].NTContactStore == NTContactStoreType.Server & (this[i].NTContactChanged | this[i].NTDeleted == "true")) { contacts[j] = this[i]; contacts[j].NTContactChanged = false; j++; } } } Array.Resize(ref contacts, j); Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService(); XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); StringWriter sw = new StringWriter(); xser.Serialize(sw, contacts); ss.servicePhonebookPutAsync(mUserAccount.Username, mUserAccount.Password, mProperties, sw.ToString()); sw.Close(); } catch (Exception ex) { #if (TRACE) Console.WriteLine("Save Contacts Book | Server Store : Failed - " + ex.Message); #endif } } #endregion #region Outlook Store if (UseOutlookStore) { try { //TODO CREATE OR UPDATE lock (this) { for (int i = this.Count - 1; i >= 0; i--) { if (this[i].NTContactStore == NTContactStoreType.Outlook && (this[i].NTContactChanged || this[i].NTDeleted == "true")) { try { Outlook.ContactItem oItem = NTTranslator(this[i]); if (this[i].NTDeleted == "true") { oItem.Delete(); } else { oItem.Save(); } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Save Contacts Book | Outlook Store : Failed - " + ex.Message); #endif } this[i].NTContactChanged = false; } } } } catch (Exception) { #if (DEBUG) throw; #endif } } #endregion #endif }
public void Load(UserAccount userAccount) { mUserAccount = userAccount; #region Local Store if (UseLocalStore) { try { XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); StreamReader sr = new StreamReader(mStoreUserDirectory + mStoreFilename); NTContact[] contacts = (NTContact[])xser.Deserialize(sr); sr.Close(); lock (this) { foreach (NTContact contact in contacts) { contact.NTContactStore = NTContactStoreType.Local; if (!this.Contains(contact) && contact.NTDeleted != "true") { this.Add(contact); } } } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load Contacts Book | Local Store : Failed - " + ex.Message); #endif } } #endregion #if !(REMWAVE_LITE) #region Server Store if (UseServerStore) { try { Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService(); XmlSerializer xser = new XmlSerializer(typeof(NTContact[])); string sout = ss.servicePhonebookGet(mUserAccount.Username, mUserAccount.Password, mProperties, null); #if (TRACE) Console.WriteLine("PHONEBOOK-GET: " + userAccount.Username + " Done"); #endif StringReader sr = new StringReader(sout); NTContact[] ntc = (NTContact[])xser.Deserialize(sr); sr.Close(); lock (this) { foreach (NTContact contact in ntc) { contact.NTContactStore = NTContactStoreType.Server; if (!this.Contains(contact)) { this.Add(contact); } } } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load Contacts Book | Server Store : Failed - " + ex.Message); #endif } } #endregion #region Outlook Store if (UseOutlookStore) { Outlook.Application oApp = new Outlook.Application(); Outlook.NameSpace oNS = oApp.GetNamespace("MAPI"); Outlook.MAPIFolder oContactsFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); try { string filter = "[MessageClass] = \"IPM.Contact\""; Outlook.Items oContactItems = oContactsFolder.Items.Restrict(filter); lock (this) { foreach (Outlook.ContactItem item in oContactItems) { try { NTContact contact = NTTranslator((Outlook.ContactItem)item); contact.NTContactStore = NTContactStoreType.Outlook; if (!this.Contains(contact)) { this.Add(contact); } } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load : UseOutlookStore - " + ex.Message); #endif } } } oContactItems = null; } catch (Exception ex) { #if (TRACE) Console.WriteLine("Load Contacts Book | Outlook Store : Failed - " + ex.Message); #endif } oApp = null; oNS = null; } #endregion #endif OnUpdateCompleted(this, new EventArgs()); }