Exemple #1
0
        public bool InsertDisQualifiedLeadtoBitrixQueue(QualifiedLead form, bool isQualified, string status)
        {
            Bitrix24Services objService = new Bitrix24Services();

            try
            {
                DisqualifiedLead disQualifiedLead             = new DisqualifiedLead();
                List <string>    nextDepartmentAttendantQueue = GetNextUserDepartmentLeadDisQualifield();
                string           webHookPath = nextDepartmentAttendantQueue[2];

                disQualifiedLead.AttendantID   = int.Parse(nextDepartmentAttendantQueue[1]);
                disQualifiedLead.DateBorn      = form.DateBorn;
                disQualifiedLead.DateJobEnd    = form.DateJobEnd;
                disQualifiedLead.DepartmentID  = int.Parse(nextDepartmentAttendantQueue[0]);
                disQualifiedLead.FirstName     = form.FirstName;
                disQualifiedLead.Phone         = form.Phone;
                disQualifiedLead.PrevSituation = form.PrevSituation;
                disQualifiedLead.SegJobReceive = form.SegJobReceive;
                disQualifiedLead.Situation     = form.Situation;
                disQualifiedLead.InsertDate    = DateTime.Now;

                objService.CreateDisQualifiedLead(disQualifiedLead, webHookPath, "*****@*****.**", status, false);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #2
0
        public int SincronizeDepartmentWithBitrix()
        {
            Bitrix24Services _serviceBitrix  = new Bitrix24Services();
            WebhookServices  _serviceWebhook = new WebhookServices();

            try
            {
                IList <Webhook> lstWebhook = _serviceWebhook.GetWebhooks();
                DeleteAllDepartments();

                foreach (Webhook webhook in lstWebhook)
                {
                    IList <Department> lstDepartment = _serviceBitrix.GetDepartments(webhook.WebhookPath);

                    foreach (Department department in lstDepartment)
                    {
                        if (GetDepartmentsById(department.DepartmentId) == null)
                        {
                            department.WebhookId = webhook.WebhookID;
                            _departmentRepository.Add(department);
                        }
                    }
                }
                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public int ReprocessQualifiedLeadsContingency()
        {
            DepartmentServices _serviceDepartment = new DepartmentServices();
            Bitrix24Services   objService         = new Bitrix24Services();

            try
            {
                foreach (QualifiedLead lead in GetAll())
                {
                    Department itemDepartment = _serviceDepartment.GetDepartmentsById(lead.DepartmentID);
                    string     webHookPath    = itemDepartment.WebHook.WebhookPath;

                    objService.CreateQualifiedLead(lead, webHookPath, "*****@*****.**", "", true);
                }
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Exemple #4
0
        public bool InsertQualifiedLeadtoBitrixQueue(QualifiedLead form, bool isQualified, string status)
        {
            Bitrix24Services objService = new Bitrix24Services();

            try
            {
                List <string> nextDepartmentAttendantQueue = GetNextUserDepartmentLeadQualifield();
                form.InsertDate   = DateTime.Now;
                form.AttendantID  = int.Parse(nextDepartmentAttendantQueue[1]);
                form.DepartmentID = int.Parse(nextDepartmentAttendantQueue[0]);
                string webHookPath = nextDepartmentAttendantQueue[2];

                objService.CreateQualifiedLead(form, webHookPath, "*****@*****.**", status, false);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #5
0
        public int SincronizeAttendantWithBitrix()
        {
            Bitrix24Services   _serviceBitrix     = new Bitrix24Services();
            WebhookServices    _serviceWebhook    = new WebhookServices();
            DepartmentServices _serviceDepartment = new DepartmentServices();

            try
            {
                IList <Webhook> lstWebhook = _serviceWebhook.GetWebhooks();
                DeleteAllAttendants();

                foreach (Webhook webhook in lstWebhook)
                {
                    IList <Department> lstDepartment = _serviceBitrix.GetDepartments(webhook.WebhookPath);

                    foreach (Department departItem in lstDepartment)
                    {
                        IList <Attendant> lstAttendant = _serviceBitrix.GetEmployeeDepartments(webhook.WebhookPath,
                                                                                               departItem.DepartmentId);

                        foreach (Attendant attendants in lstAttendant)
                        {
                            if (GetAttendantsByID(attendants.AttendantId).Count == 0)
                            {
                                _attendantRepository.Add(attendants);
                            }
                        }
                    }
                }
                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }