Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var proxy = new ContactClient();

            var c = proxy.GetByContactId(1);
            if (c != null) Console.WriteLine("{0} -> {1}", c.ContactID, c.FirstName);

            c = proxy.GetByContactId(10);
            if (c != null) Console.WriteLine("{0} -> {1}", c.ContactID, c.FirstName);

            c = proxy.GetByContactId(100);
            if (c != null) Console.WriteLine("{0} -> {1}", c.ContactID, c.FirstName);

            c = proxy.GetByContactId(1000);
            if (c != null) Console.WriteLine("{0} -> {1}", c.ContactID, c.FirstName);

            c = proxy.GetByContactId(10000);
            if (c != null) Console.WriteLine("{0} -> {1}", c.ContactID, c.FirstName);

            Console.WriteLine();

            var contatos = proxy.GetFirst10();

            foreach (var item in contatos)
            {
                Console.WriteLine(item.FirstName);
            }

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 //- @LoadContact -//
 public static Contact LoadContact(String contactGuid)
 {
     using (ContactClient client = new ContactClient(ServiceConfiguration.ActiveContactServiceEndpoint))
     {
         return client.LoadContact(contactGuid);
     }
 }
Ejemplo n.º 3
0
 //- @LoadContactList -//
 public static List<Contact> LoadContactList()
 {
     using (ContactClient client = new ContactClient(ServiceConfiguration.ActiveContactServiceEndpoint))
     {
         return client.LoadContactList();
     }
 }
Ejemplo n.º 4
0
        public void pDataTest()
        {
            var newtraceLog = new TraceLog("SingtelTest", "Zero1", null);

            using (var eventClient = new EventClient(Helpers.GetSelcommWsEndpointName()))
            {
                ServiceClient serviceclient = new ServiceClient(Helpers.GetSelcommWsEndpointName());
                ContactClient contactClient = new ContactClient(Helpers.GetSelcommWsEndpointName());

                //Create the session.
                var authService = new SelcommWSsvc.SelcommWSAll.AuthenticationClient(Helpers.GetSelcommWsEndpointName());
                var sessionKey  = authService.AuthenticateSimpleCreateSessionAndAuthenticateContact("2041591443", "webuser", "resubew", "40000287", "1234");

                //Adding a new service to an existing account
                var pack = new SelcommWSsvc.SelcommWSAll.PackagesClient(Helpers.GetSelcommWsEndpointName())
                {
                };
                var packageList = pack.PackageDisplayListCurrent(sessionKey, false);
                var newId       = serviceclient.ServiceAddNewSimple(sessionKey, "40000287", DateTime.Now, packageList[0].Code, 1, 1, "MRBR", "0298" + (new System.Random()).Next(0, 1000000).ToString("000000"), "1234");

                //creating new event associated with service Id
                Event NewEvent = new Event
                {
                    EventType = new EventType
                    {
                        EventTypeMember = "CM",
                        EventCode       = "IC",
                    },
                    Schedule = new EventSchedule
                    {
                        ToLogin      = "******",
                        ToDepartment = new Department {
                            Code = "SYS"
                        },
                        EventScheduleType = new EventScheduleType {
                            Code = "ACT"
                        },
                        EventScheduleStatus = new EventScheduleStatus {
                            Code = "O"
                        }
                    },
                    Note = string.Format("Event opened for sp_cn_ref {0}", newId)
                };


                var testevent = eventClient.EventAddForService(sessionKey, NewEvent, new Service {
                    ServiceId = newId
                });
                var eventDisplay = eventClient.EventDisplay(sessionKey, testevent, true);
                newtraceLog.CreateLog($"Global ServiceId: " + newId);
                newtraceLog.CreateLog($"Event Display: " + eventDisplay);

                SelcommWebServices.SelcommOSS.Singtel.MD.Processes.ActionHandler.pDataActionHandler a = new SelcommWebServices.SelcommOSS.Singtel.MD.Processes.ActionHandler.pDataActionHandler("2041591443");
                var response = a.ProcessEvent(eventDisplay, newtraceLog);
                newtraceLog.CreateLog($"Command string: " + response);

                Assert.AreEqual(response.Length, 82, "length of Command string for pdata are equal");
            }
        }
Ejemplo n.º 5
0
        public ActionResult Details(int id)
        {
            ContactClient cc      = new ContactClient();
            Contacts      contact = new Contacts();

            contact = cc.GetContact(id);
            return(View("Details", contact));
        }
Ejemplo n.º 6
0
        public ActionResult GoDelete(int id)
        {
            ContactClient cc      = new ContactClient();
            Contacts      contact = new Contacts();

            contact = cc.GetContact(id);
            return(View("Delete", contact));
        }
        public ActionResult Edit(int id)
        {
            ContactClient    contactclient = new ContactClient();
            ContactViewModel contactVM     = new ContactViewModel();

            contactVM.contact = contactclient.find(id);
            return(View("Edit", contactVM));
        }
Ejemplo n.º 8
0
        public async Task GetAsync_ReturnsList()
        {
            // Act
            var data = (await ContactClient.List().GetAsync()).AssertResult();

            // Assert
            Assert.NotNull(data);
            Assert.Greater(data.Items.Count(), 0);
        }
Ejemplo n.º 9
0
 public ActionResult Edit(Contacts contact)
 {
     if (ModelState.IsValid)
     {
         ContactClient cc = new ContactClient();
         cc.EditContact(contact);
         return(RedirectToAction("Index", "Contact"));
     }
     return(View("Edit"));
 }
Ejemplo n.º 10
0
        private void SetAccountSource(ContactClient rec)
        {
            var cache = GetCache(rec._DCType);

            if (cache != null)
            {
                rec.accntSource = cache.GetNotNullArray;
                if (rec.accntSource != null)
                {
                    rec.NotifyPropertyChanged("AccountSource");
                }
            }
        }
Ejemplo n.º 11
0
    protected void BtnConfirmer_Click(object sender, EventArgs e)
    {
        ContactClient contactNouveauClient = new ContactClient(TxtNomCLient.Text, TxtMatrimoniale.Text, TxtTelephoneClient.Text, TxtEmailClient.Text, TxtAdressseClient.Text, TxtAdresse2Client.Text, TxtCpClient.Text, TxtVilleClient.Text);
        Client        nouveauClient        = new Client();

        nouveauClient.ListeContactClient.Add(contactNouveauClient);
        nouveauClient.Name = contactNouveauClient.Nom;

        ClientRepository clientRepository = new ClientRepository();

        clientRepository.Add(nouveauClient);
        Response.Redirect("NouveauDevis.aspx");
    }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            c = new ContactClient();

            c.BeginGetFirst10(new AsyncCallback(GetFirst10Completed), null);

            c.BeginGetByContactId(1, new AsyncCallback(GetByContactIdCompleted), null);
            c.BeginGetByContactId(10, new AsyncCallback(GetByContactIdCompleted), null);
            c.BeginGetByContactId(100, new AsyncCallback(GetByContactIdCompleted), null);
            c.BeginGetByContactId(1000, new AsyncCallback(GetByContactIdCompleted), null);
            c.BeginGetByContactId(10000, new AsyncCallback(GetByContactIdCompleted), null);

            Console.ReadKey();
        }
Ejemplo n.º 13
0
        public static void ContactGetContactsTest()
        {
            var client = new ContactClient();

            var resultGetContacts = client.GetContacts(siteId, userName, password,
                                                       @"<LeadForceRequest>
	<Contact>
		<Params>			
			<LastActivityAt start=""2013-10-11"" end=""2013-10-21"" />
        </Params>
    </Contact>
</LeadForceRequest>");

            Console.WriteLine(resultGetContacts);
        }
 public CreditorOrdersPage2(CrudAPI crudApi, UnicontaBaseEntity master) /* called for edit from particular account */
     : base(crudApi, "")
 {
     InitializeComponent();
     if (master != null)
     {
         Creditor = master as CreditorClient;
         if (Creditor == null)
         {
             Contact  = master as ContactClient;
             Creditor = Contact?.Creditor;
         }
     }
     InitPage(api);
 }
        public void BasicTests()
        {
            var connector = new ContactClient();

            Assert.AreEqual("FileSystem Contact Connector - one file for all contacts", connector.FriendlyClientName);

            var tempFolder          = PrepareFolder(false);
            var listWithTwoContacts = connector.GetAll(Path.Combine(tempFolder, "file1")).ToStdContacts();

            Assert.AreEqual(2, listWithTwoContacts.Count);
            Assert.AreEqual(0, listWithTwoContacts.GetElementById <StdContact>(ContactWithoutPicture).PictureData.Length);
            Assert.AreEqual(2090, listWithTwoContacts.GetElementById <StdContact>(ContactWithPicture).PictureData.Length);
            Assert.AreEqual("Sven", listWithTwoContacts.GetElementById <StdContact>(ContactWithPicture).Name.FirstName);
            Assert.AreEqual(
                Gender.Male, listWithTwoContacts.GetElementById <StdContact>(ContactWithPicture).PersonGender);
            Assert.AreEqual(
                Gender.Female, listWithTwoContacts.GetElementById <StdContact>(ContactWithoutPicture).PersonGender);
        }
 public DebtorOfferPage2(UnicontaBaseEntity sourcedata, UnicontaBaseEntity master) /* called for edit from particular account */
     : base(sourcedata, true)
 {
     InitializeComponent();
     if (master != null)
     {
         Debtor = master as DebtorClient;
         if (Debtor == null)
         {
             Prospect = master as CrmProspectClient;
             if (Prospect == null)
             {
                 Contact = master as ContactClient;
             }
         }
     }
     InitPage(api, master);
 }
 public DebtorOfferPage2(CrudAPI crudApi, UnicontaBaseEntity master) /* called for add from particular account */
     : base(crudApi, "")
 {
     InitializeComponent();
     if (master != null)
     {
         Debtor = master as DebtorClient;
         if (Debtor == null)
         {
             Prospect = master as CrmProspectClient;
             if (Prospect == null)
             {
                 Contact = master as ContactClient;
             }
         }
     }
     InitPage(crudApi, master);
 }
Ejemplo n.º 18
0
    public void Add(ContactClient contactClient, int clientId)
    {
        CONTACT_CLIENT entity = new CONTACT_CLIENT();

        entity.CLIENT_ID        = clientId;
        entity.CONTACT_ADRESSE  = contactClient.Adresse;
        entity.CONTACT_ADRESSE2 = contactClient.Adresse2;
        entity.CONTACT_CP       = contactClient.Cp;
        entity.CONTACT_MAIL     = contactClient.Email;
        entity.CONTACT_NOM      = contactClient.Nom;
        entity.CONTACT_CLIENT_SITUATION_MATRIMONIALE = contactClient.SituationMatrimoniale;
        entity.CONTACT_TELEPHONE = contactClient.Telephone;
        entity.CONTACT_VILLE     = contactClient.Ville;
        using (var db = new maderaEntities())
        {
            db.CONTACT_CLIENT.Add(entity);
            db.SaveChanges();
        }
    }
        public void CopyTestsCSV()
        {
            var connector    = new ContactClient();
            var csvConnector = new GenericClientCsv <StdContact>();
            var tempFolder   = PrepareFolder(false);
            var file1        = Path.Combine(tempFolder, "file1");
            var file2        = Path.Combine(tempFolder, "file2");
            var path1        = Path.Combine(tempFolder, "csv.csv");

            var originalList = connector.GetAll(file1);

            originalList.Add(new StdContact());
            csvConnector.WriteRange(originalList, path1);
            var copyList = csvConnector.GetAll(path1);

            copyList.Add(new StdContact());
            connector.WriteRange(copyList, file2);

            AssertOriginalAndCopyCompare(originalList, copyList, true);
        }
        public void CopyTestsIndividualFiles()
        {
            var connector = new ContactClient();
            var individualFilesConnector = new ContactClientIndividualFiles();
            var tempFolder = PrepareFolder(false);
            var file1      = Path.Combine(tempFolder, "file1");
            var file2      = Path.Combine(tempFolder, "file2");
            var path1      = Path.Combine(tempFolder, "vCards");

            var originalList = connector.GetAll(file1);

            originalList.Add(new StdContact());
            individualFilesConnector.WriteRange(originalList, path1);
            var copyList = individualFilesConnector.GetAll(path1);

            copyList.Add(new StdContact());
            connector.WriteRange(copyList, file2);

            AssertOriginalAndCopyCompare(originalList, copyList, false);
        }
Ejemplo n.º 21
0
        public void GoogleConnectorTestDataCheck()
        {
            var original = Contacts.GetStandardContactList(false);

            var connector = new ContactClient
            {
                LogOnUserId   = "*****@*****.**",
                LogOnPassword = Tools.GetRegValue("Software\\Sem.Sync\\Test", "GoogleTestPassword", string.Empty)
            };

            connector.WriteRange(original.ToStdElements(), string.Empty);
            var received = connector.GetAll(string.Empty).ToStdContacts();

            var originalText = Contacts.SerializeList(original);
            var receivedText = Contacts.SerializeList(received);

            connector.DeleteElements(original.ToStdElements(), string.Empty);

            Assert.IsTrue(originalText == receivedText);
        }
Ejemplo n.º 22
0
        public static void ContactUpdateContactTest()
        {
            var client = new ContactClient();

            var resultUpdateContact = client.UpdateContact(siteId, userName, password,
                                                           @"<LeadForceRequest>
                <Contact ContactID=""A6A19108-27EB-11E1-BB0D-DA8C4824019B"">	
                    <UserFullName>Белик Алексей2 Викторович</UserFullName>
                    <Email>[email protected]</Email>
                    <Phone>5555555555</Phone>	
                    <Status>Активна</Status>	
                    <IsNameChecked>1</IsNameChecked>
                    <Surname>Белик</Surname>
                    <Name>Алексей2</Name>
                    <Patronymic>Викторович</Patronymic>
                    <CellularPhone>111111111</CellularPhone>
                    <CellularPhoneStatus>0</CellularPhoneStatus>
                    <EmailStatus>0</EmailStatus>
                    <JobTitle>Web developer</JobTitle>
                    <Company>dfgds fgsdf test company</Company>
                    <Owner>Current</Owner>
                    <BirthDate>1985-05-30T00:00:00</BirthDate>
                    <ContactFunctionInCompany>ИТ</ContactFunctionInCompany>
                    <ContactJobLevel>Сотрудник</ContactJobLevel>	
                    <ContactType></ContactType>
                    <Reffer></Reffer>
                    <AdvertisingType>Тип рекламы 1</AdvertisingType>
                    <AdvertisingCampaign>Рекламная кампания 10</AdvertisingCampaign>
                    <AdvertisingPlatform>Рекламная площадка 3</AdvertisingPlatform>
                    <Address Address=""Украина, Центральная Украина, Кировоградская область, Кировоград"">
                        <Country>Украина</Country>
                        <Region>Центральная Украина</Region>
                        <District>Кировоградская область</District>
                        <City>Кировоград</City>
                    </Address>
                    <Tags>API тег 1, API тег 2</Tags>
                </Contact>
            </LeadForceRequest>");

            Console.WriteLine(resultUpdateContact);
        }
Ejemplo n.º 23
0
        public async Task GetListAsync_WithLambdaReturningSpecificType_Success()
        {
            // Act
            var contacts = (await ContactClient.List()
                            .GetAsync(c => new CustomContactModel
            {
                CompanyName = c.CompanyName.ToUpper(CultureInfo.InvariantCulture),
                Name = c.Firstname + " " + c.Surname,
                Address = $"{c.Street} {c.City} {c.PostalCode}",
                Discount = c.CompanyName.Length > 10 ? 10.0m : c.DiscountPercentage
            })).AssertResult();

            // Assert
            Assert.IsNotEmpty(contacts.Items);
            var contact = contacts.Items.First(c => !string.IsNullOrWhiteSpace(c.Name));

            Assert.IsNotEmpty(contact.CompanyName);
            Assert.IsNotEmpty(contact.Name);
            Assert.IsNotEmpty(contact.Address);
            Assert.NotNull(contact.Discount);
        }
Ejemplo n.º 24
0
        private void DataControl_CurrentItemChanged(object sender, DevExpress.Xpf.Grid.CurrentItemChangedEventArgs e)
        {
            ContactClient oldSelectedItem = e.OldItem as ContactClient;

            if (oldSelectedItem != null)
            {
                oldSelectedItem.PropertyChanged -= ContactClient_PropertyChanged;
                var cache = GetCache(oldSelectedItem._DCType);
                if (cache != null && cache.Count > 1000)
                {
                    oldSelectedItem.accntSource = null;
                    oldSelectedItem.NotifyPropertyChanged("AccountSource");
                }
            }
            ContactClient selectedItem = e.NewItem as ContactClient;

            if (selectedItem != null)
            {
                selectedItem.PropertyChanged += ContactClient_PropertyChanged;
            }
        }
Ejemplo n.º 25
0
        void InitPage(CrudAPI crudapi, UnicontaBaseEntity master)
        {
            var Comp = api.CompanyEntity;

            BusyIndicator = busyIndicator;
            layoutControl = layoutItems;
            StartLoadCache();
            if (LoadedRow == null)
            {
                if (editrow == null)
                {
                    editrow = CreateNew() as ContactClient;
                    editrow.SetMaster(master != null ? master : api.CompanyEntity);
                }
                else
                {
                    var dct = editrow._DCType;
                    var dca = editrow._DCAccount;
                    SetTemplate();
                    editrow._DCType    = dct;
                    editrow._DCAccount = dca;
                }
                frmRibbon.DisableButtons("Delete");
            }
            lookupDCAccount.api      = crudapi;
            layoutItems.DataContext  = editrow;
            frmRibbon.OnItemClicked += frmRibbon_OnItemClicked;

            if (master == null)
            {
                itmDCType.Visibility = itemDCAccount.Visibility = Visibility.Visible;
            }
            if (Comp.CRM)
            {
                crmGroup.Visibility = Visibility.Visible;
                GetInterestAndProduct();
            }
        }
 public DebtorOrdersPage2(CrudAPI crudApi, UnicontaBaseEntity master) /* called for add from particular account */
     : base(crudApi, "")
 {
     InitializeComponent();
     if (master != null)
     {
         Debtor = master as DebtorClient;
         if (Debtor == null)
         {
             Contact = master as ContactClient;
             if (Contact == null)
             {
                 Project = master as ProjectClient;
                 Debtor  = Project?.Debtor;
             }
             else
             {
                 Debtor = Contact.Debtor;
             }
         }
     }
     InitPage(api);
 }
 public DebtorOrdersPage2(UnicontaBaseEntity sourcedata, UnicontaBaseEntity master) /* called for edit from particular account */
     : base(sourcedata, true)
 {
     InitializeComponent();
     if (master != null)
     {
         Debtor = master as DebtorClient;
         if (Debtor == null)
         {
             Contact = master as ContactClient;
             if (Contact == null)
             {
                 Project = master as ProjectClient;
                 Debtor  = Project?.Debtor;
             }
             else
             {
                 Debtor = Contact.Debtor;
             }
         }
     }
     InitPage(api);
 }
Ejemplo n.º 28
0
        public async Task GetDetailAsync_WithLambdaReturningAnonymousType_Success()
        {
            // Act
            var contact = (await ContactClient.Detail(ContactId)
                           .Include(c => c.Bank, c => c.Country.Currency)
                           .GetAsync(c => new
            {
                CompanyName = c.CompanyName.ToUpper(CultureInfo.InvariantCulture),
                Currency = c.Country.Currency.Name,
                Bank = c.Bank.Name,
                Name = c.Firstname + " " + c.Surname,
                Address = $"{c.Street} {c.City} {c.PostalCode}",
                Discount = c.CompanyName.Length > 10 ? 10.0m : c.DiscountPercentage
            })).AssertResult();

            // Assert
            Assert.IsNotEmpty(contact.CompanyName);
            Assert.IsNotEmpty(contact.Currency);
            Assert.IsNotEmpty(contact.Bank);
            Assert.IsNotEmpty(contact.Name);
            Assert.IsNotEmpty(contact.Address);
            Assert.NotNull(contact.Discount);
        }
Ejemplo n.º 29
0
        public JsonResult Send(ContactClient model)
        {
            int  result = 0;
            bool status = false;

            if (ModelState.IsValid)
            {
                try
                {
                    object[] parameters =
                    {
                        model.Name,
                        model.Phone,
                        model.Email,
                        model.Content
                    };
                    result = objContact.Insert(parameters);
                    if (result == 1)
                    {
                        status = true;
                        return(Json(new
                        {
                            success = status,
                            message = Constants.AddSuccess
                        }));
                    }
                }
                catch
                { }
            }
            return(Json(new
            {
                success = status,
                errors = ModelState.Keys.SelectMany(i => ModelState[i].Errors).Select(m => m.ErrorMessage).ToArray(),
                message = Constants.AddFail
            }));
        }
Ejemplo n.º 30
0
    public ICollection <ContactClient> GetById(int id)
    {
        ICollection <ContactClient> contacts = new List <ContactClient>();

        using (var db = new maderaEntities())
        {
            var query = from a in db.CONTACT_CLIENT where a.CLIENT_ID.Equals(id) select a;
            foreach (var item in query)
            {
                ContactClient contactClient = new ContactClient(
                    item.CONTACT_NOM,
                    item.CONTACT_CLIENT_SITUATION_MATRIMONIALE,
                    item.CONTACT_TELEPHONE,
                    item.CONTACT_MAIL,
                    item.CONTACT_ADRESSE,
                    item.CONTACT_ADRESSE2,
                    item.CONTACT_CP,
                    item.CONTACT_VILLE);
                contacts.Add(contactClient);
            }

            return(contacts);
        }
    }
Ejemplo n.º 31
0
        static void Main(string[] args)
        {
            using (ContactClient client = new ContactClient())
            {
                //Add(7, new Contact(7, "manager", 25));
                Console.WriteLine("Press any key when service started ...");
                Console.ReadLine();

                // 提取一个对象的相关属性只需要1次调用
                Contact contact = client.CreateDTO(7);
                Assert.AreEqual <string>("manager", contact.Title);
                Assert.AreEqual <int>(25, contact.Age);
                Console.WriteLine("7\t" + contact.Title + "\t" + contact.Age);

                // 修改一个对象只需1次调用
                contact.Title = "vice president";
                contact.Age   = 30;
                Assert.AreEqual <string>("vice president", contact.Title);
                Assert.AreEqual <int>(30, contact.Age);
                Console.WriteLine("7\t" + contact.Title + "\t" + contact.Age);

                Console.ReadLine();
            }
        }
Ejemplo n.º 32
0
 public void Init()
 {
     _client = new ContactClient("site", "user", "password", "https://secure.eloqua.com/API/REST/2.0");
 }
Ejemplo n.º 33
0
 public ContactController(ContactClient contactClient) => _contactClient = contactClient;
Ejemplo n.º 34
0
 public void OneTimeSetUp()
 {
     InitDokladApi();
     ContactClient = DokladApi.ContactClient;
 }
 public void Init()
 {
     _client = new ContactClient("site", "user", "password",
                                                    "https://secure.eloqua.com/API/REST/1.0/");
 }