Exemple #1
0
        private void Update_abonnement_in_crm(crm.Abonnement crm_abonnement, of.data.Subscription of_abonnement)
        {
            Mapping.Subscription.To_crm(crm_abonnement, of_abonnement, _tracingService);

            Add_crm_contact_to_abonnement(crm_abonnement, of_abonnement);

            crm_abonnement.Update(Mapping.Subscription.Needs_update_in_crm(crm_abonnement, of_abonnement));
        }
Exemple #2
0
 private void Attach_of_contact_if_missing(crm.Abonnement crm_abonnement)
 {
     if (crm_abonnement.Nrq_subscriber != null)
     {
         crm.Contact crm_contact = new crm.Contact(_service, _tracingService);
         crm_contact.Get_by_reference(crm_abonnement.Nrq_subscriber);
         Create_or_update_one_contact_in_of(crm_contact);
     }
 }
Exemple #3
0
        private crm.Abonnement Create_abonnement_in_crm(of.data.Subscription of_abonnement)
        {
            crm.Abonnement crm_abonnement = new crm.Abonnement(_service, _tracingService);

            Mapping.Subscription.To_crm(crm_abonnement, of_abonnement, _tracingService);

            Add_crm_contact_to_abonnement(crm_abonnement, of_abonnement);

            crm_abonnement.Create();

            return(crm_abonnement);
        }
Exemple #4
0
        private void Add_subscription_to_aftale(crm.Aftale crm_aftale, of.data.Agreement of_agreement)
        {
            if (of_agreement.Subscription_id.HasValue == false)
            {
                return;
            }

            of.data.Subscription of_subscription  = _of_connection.Subscription.Get(of_agreement.Subscription_id.Value);
            crm.Abonnement       crm_subscription = Create_or_update_one_abonnement_in_crm(of_subscription);

            crm_aftale.nrq_subscription = new EntityReference("nrq_subscription", crm_subscription.Id);
        }
 //todo felter
 public static void To_of(crm.Abonnement crm_abonnement, of.data.Subscription of_subscription)
 {
     of_subscription.Bank_account_no = crm_abonnement.Nrq_bank_account_no;
     of_subscription.Bank_sort_code  = crm_abonnement.Nrq_bank_sort_code;
     of_subscription.Contact_id      = crm_abonnement.Nrq_of_contact_id;
     of_subscription.Of_id           = crm_abonnement.Nrq_of_id;
     //of_subscription.Order_id = crm_abonnement.Nrq_order_id;
     of_subscription.Payment_gateway = crm_abonnement.Nrq_PaymentGateway.SelectedValue;
     of_subscription.Payment_media   = crm_abonnement.Nrq_PaymentMedia.SelectedValue;
     //of_subscription.Payment_media_type = crm_abonnement.;
     //of_subscription.State = crm_abonnement.Nrq_state;
     //of_subscription.Status = crm_abonnement.Nrq_status;
     //of_subscription.Subscription_customer_no = crm_abonnement.Nrq_Subscription_customer_no;
     of_subscription.Crm_id = crm_abonnement.Id.ToString().ToLower();
 }
Exemple #6
0
        private void Update_of_abonnement(crm.Abonnement crm_abonnement, of.data.Subscription of_abonnement)
        {
            List <string> parameters = Mapping.Subscription.Needs_update_in_of(crm_abonnement, of_abonnement);

            if (parameters.Any() == false)
            {
                return;
            }

            Mapping.Subscription.To_of(crm_abonnement, of_abonnement);

            Attach_of_contact_if_missing(crm_abonnement);

            _of_connection.Subscription.Patch(of_abonnement.Of_id.Value, of_abonnement, parameters);
        }
 public static void To_crm(crm.Abonnement crm_abonnement, of.data.Subscription of_subscription, ITracingService tracingService)
 {
     crm_abonnement.Nrq_bank_account_no = of_subscription.Bank_account_no;
     crm_abonnement.Nrq_bank_sort_code  = of_subscription.Bank_sort_code;
     //crm_abonnement.Nrq_Bse_guid = of_subscription.Bse_guid;
     crm_abonnement.Nrq_of_contact_id = of_subscription.Contact_id;
     //crm_abonnement.Nrq_msisdn = of_subscription.Msisdn;
     crm_abonnement.Nrq_of_id = of_subscription.Of_id;
     //crm_abonnement.Nrq_order_id = of_subscription.Order_id;
     crm_abonnement.Nrq_PaymentGateway.Select(of_subscription.Payment_gateway, tracingService);
     crm_abonnement.Nrq_PaymentMedia.Select(of_subscription.Payment_media, tracingService);
     //crm_abonnement.Nrq_payment_media_type = of_subscription.Payment_media_type;
     crm_abonnement.Nrq_state.Select(of_subscription.State, tracingService);
     //crm_abonnement.Nrq_status = of_subscription.Status;
     //crm_abonnement.Nrq_Subscription_customer_no = of_subscription.Subscription_customer_no;
 }
Exemple #8
0
        public crm.Abonnement Create_or_update_one_abonnement_in_crm(of.data.Subscription of_abonnement)
        {
            crm.Abonnement crm_abonnement = new crm.Abonnement(_service, _tracingService);
            crm_abonnement.Get_by_of_id(of_abonnement.Of_id.Value);

            if (crm_abonnement.CrmEntity == null)
            {
                crm_abonnement = Create_abonnement_in_crm(of_abonnement);
            }
            else
            {
                Update_abonnement_in_crm(crm_abonnement, of_abonnement);
            }

            return(crm_abonnement);
        }
Exemple #9
0
        private void Create_of_abonnement(crm.Abonnement crm_abonnement)
        {
            of.data.Subscription of_abonnement = new of.data.Subscription();

            Mapping.Subscription.To_of(crm_abonnement, of_abonnement);

            Attach_of_contact_if_missing(crm_abonnement);

            of.data.IdResponse id_response = _of_connection.Subscription.Post(of_abonnement);

            crm.Abonnement crm_abonnement_update = new crm.Abonnement(_service, _tracingService)
            {
                Id        = crm_abonnement.Id,
                Nrq_of_id = id_response.Id
            };
            crm_abonnement_update.Update();
        }
Exemple #10
0
        public void Create_or_update_one_abonnement_in_of(crm.Abonnement crm_abonnement)
        {
            of.data.Subscription of_abonnement = null;

            if (crm_abonnement.Nrq_of_id.HasValue)
            {
                of_abonnement = _of_connection.Subscription.Get(crm_abonnement.Nrq_of_id.Value);
            }

            if (of_abonnement == null)
            {
                Create_of_abonnement(crm_abonnement);
            }
            else
            {
                Update_of_abonnement(crm_abonnement, of_abonnement);
            }
        }
        protected override void Execute(CodeActivityContext codeActivityContext)
        {
            try
            {
                Initialize(codeActivityContext);

                EntityReference abonnementEntityReference = AbonnementEntityReference.Get <EntityReference>(codeActivityContext);

                crm.Abonnement crm_abonnement = new crm.Abonnement(_service, _tracingService);
                crm_abonnement.Get_by_reference(abonnementEntityReference);

                Maintain maintain = new Maintain(_service, _tracingService, _config, _of_connection);
                maintain.Create_or_update_one_abonnement_in_of(crm_abonnement);
            }
            catch (Exception exception)
            {
                Write_exception(exception);
            }
        }
        public static List <string> Needs_update_in_of(crm.Abonnement crm_abonnement, of.data.Subscription of_subscription)
        {
            List <string> parameters = new List <string>();

            Mapping_update_helper.Add_if_unequal(parameters, "Bank_account_no", crm_abonnement.Nrq_bank_account_no, of_subscription.Bank_account_no);
            Mapping_update_helper.Add_if_unequal(parameters, "Bank_sort_code", crm_abonnement.Nrq_bank_sort_code, of_subscription.Bank_sort_code);
            //Mapping_update_helper.Add_if_unequal(parameters, "Bse_guid", crm_abonnement.Nrq_Bse_guid, of_subscription.Bse_guid);
            Mapping_update_helper.Add_if_unequal(parameters, "Contact_id", crm_abonnement.Nrq_of_contact_id, of_subscription.Contact_id);
            //Mapping_update_helper.Add_if_unequal(parameters, "Msisdn", crm_abonnement.Nrq_msisdn, of_subscription.Msisdn);
            Mapping_update_helper.Add_if_unequal(parameters, "Crm_id", crm_abonnement.Id.ToString().ToLower(), of_subscription.Crm_id);
            //Mapping_update_helper.Add_if_unequal(parameters, "Order_id", crm_abonnement.Nrq_order_id, of_subscription.Order_id);
            Mapping_update_helper.Add_if_unequal(parameters, "Payment_gateway", crm_abonnement.Nrq_PaymentGateway.SelectedValue, of_subscription.Payment_gateway);
            Mapping_update_helper.Add_if_unequal(parameters, "Payment_media", crm_abonnement.Nrq_PaymentMedia.SelectedValue, of_subscription.Payment_media);
            //Mapping_update_helper.Add_if_unequal(parameters, "Payment_media_type", crm_abonnement.Nrq_payment_media_type, of_subscription.Payment_media_type);
            //Mapping_update_helper.Add_if_unequal(parameters, "State", crm_abonnement.Nrq_state, of_subscription.State);
            //Mapping_update_helper.Add_if_unequal(parameters, "Status", crm_abonnement.Nrq_status, of_subscription.Status);
            //Mapping_update_helper.Add_if_unequal(parameters, "Subscription_customer_no", crm_abonnement.Nrq_Subscription_customer_no, of_subscription.Subscription_customer_no);

            return(parameters);
        }
Exemple #13
0
        private void Add_crm_contact_to_abonnement(crm.Abonnement crm_abonnement, of.data.Subscription of_abonnement)
        {
            crm.Contact crm_contact = Get_or_create_crm_contact(of_abonnement.Contact_id.Value);

            crm_abonnement.Nrq_subscriber = crm_contact.Get_entity_reference();
        }