예제 #1
0
        public void CreateActivity(ActivityModel model)
        {
            string result = null;

            try {
                Model = model.ToJsonExtension();
                if (this.loginResult != null && !string.IsNullOrEmpty(this.loginResult.sessionId))
                {
                    var response = this.api.CreateActivity(
                        new SalesForceServiceNS.SessionHeader {
                        sessionId = this.loginResult.sessionId
                    },
                        new SalesForceServiceNS.CallOptions(),
                        new SalesForceServiceNS.DebuggingHeader(),
                        new SalesForceServiceNS.AllowFieldTruncationHeader(),
                        Model,
                        out result);

                    Log.DebugFormat("Debug log: {0}", response == null ? "" : response.debugLog);
                }
            } catch (Exception ex) {
                var resultModel = new ApiResponse(null, ex.Message);
                result = resultModel.ToJsonExtension();
            }
            LogResult("CreateActivity", result, model.Email);
        }
예제 #2
0
        public void TestRequestsToJson()
        {
            Log.Debug("call CreateUpdateLeadAccount");
            LeadAccountModel model = new LeadAccountModel {
                Email  = "[email protected]",
                Origin = "ezbob",

                AddressCountry           = "Country",
                AddressCounty            = "County",
                AddressLine1             = "Line1",
                AddressLine2             = "Line2",
                AddressLine3             = "Line3",
                AddressPostcode          = "Postcode",
                AddressTown              = "Town",
                CompanyName              = "CompanyName",
                Name                     = "CustomerName",
                TypeOfBusiness           = "Limited",
                CompanyNumber            = "056456446",
                DateOfBirth              = new DateTime(1966, 12, 11),
                EzbobSource              = "EzbobSource",
                EzbobStatus              = "Status",
                Gender                   = "M",
                Industry                 = "Building",
                IsBroker                 = false,
                LeadSource               = "LeadSource",
                PhoneNumber              = "0564564654",
                MobilePhoneNumber        = "07401201987",
                RegistrationDate         = new DateTime(2015, 01, 27),
                RequestedLoanAmount      = 10000,
                IsTest                   = false,
                Promocode                = "promo code test",
                BrokerEmail              = "*****@*****.**",
                BrokerFirmName           = "Broker Firm Name",
                BrokerName               = "Broker Name",
                BrokerPhoneNumber        = "01234567890",
                CollectionStatus         = "Active",
                ExternalCollectionStatus = "None"
            };

            Log.Debug(model.ToJsonExtension());
            Log.Debug("call CreateOpportunity/UpdateOpportunity");

            var opModel = new OpportunityModel {
                Email  = "[email protected]",
                Origin = "ezbob",

                ApprovedAmount  = 10000,
                ExpectedEndDate = new DateTime(2015, 01, 29),
                Stage           = OpportunityStage.s90.DescriptionAttr(),
                Name            = "opName",
            };

            Log.Debug(opModel.ToJsonExtension());


            Log.Debug("call CreateUpdateContact");

            var cModel = new ContactModel {
                Email  = "[email protected]",
                Origin = "ezbob",

                AddressCountry  = "Country",
                AddressCounty   = "County",
                AddressLine1    = "Line1",
                AddressLine2    = "Line2",
                AddressLine3    = "Line3",
                AddressPostcode = "Postcode",
                AddressTown     = "Town",
                ContactEmail    = "*****@*****.**",
                DateOfBirth     = new DateTime(1976, 10, 21),
                Gender          = "F",
                Name            = "ContactName",
                Type            = "Director",
                PhoneNumber     = "065645745"
            };

            Log.Debug(cModel.ToJsonExtension());


            Log.Debug("call CreateTask");

            var tModel = new TaskModel {
                Email  = "[email protected]",
                Origin = "ezbob",

                CreateDate  = new DateTime(2015, 01, 27),
                DueDate     = new DateTime(2015, 01, 29),
                Originator  = "Originator",
                Status      = "Status",
                Subject     = "Subject",
                Description = "Subject"
            };

            Log.Debug(tModel.ToJsonExtension());
            Log.Debug("call CreateActivity");

            var aModel = new ActivityModel {
                Email  = "[email protected]",
                Origin = "ezbob",

                Description   = "Description",
                Type          = "Mail",
                Originator    = "Originator",
                StartDate     = new DateTime(2015, 01, 27),
                EndDate       = new DateTime(2015, 01, 28),
                IsOpportunity = false,
            };

            Log.Debug(aModel.ToJsonExtension());
            Log.Debug("call ChangeEmail");

            var changeModel = new ChangeEmailModel {
                currentEmail = "[email protected]",
                Origin       = "ezbob",

                newEmail = "[email protected]"
            };

            Log.Debug(changeModel.ToJsonExtension());


            Log.Debug("call GetActivity");
            var gaModel = new GetActivityModel {
                Email  = "[email protected]",
                Origin = "ezbob"
            };

            Log.Debug(gaModel.ToJsonExtension());

            Log.Debug("All methods response");

            var rModel = new ApiResponse("Success", "");

            Log.Debug(rModel.ToJsonExtension());
        }