Exemplo n.º 1
0
        private static void UpdateLeadIn1C(Amo amo, Log log, Lead lead, Guid lead_id_1C, int amo_acc, Cred1C cred1C)
        {
            var repo1C = new LeadRepository(cred1C);

            Lead1C lead1C = repo1C.GetLead(lead_id_1C);

            if (lead1C == default)
            {
                throw new Exception($"Unable to update lead in 1C. 1C returned no lead {lead_id_1C}.");
            }

            PopulateCFs(lead, amo_acc, lead1C);

            lead1C.responsible_user = UserList.Get1CUser(lead.responsible_user_id);

            if (string.IsNullOrEmpty(lead1C.lead_status))
            {
                lead1C.lead_status = "ВРаботе";
            }

            if (amo_acc == 19453687)
            {
                lead1C.is_corporate = true;
            }

            repo1C.UpdateLead(lead1C);
        }