Example #1
0
        /// <summary>
        /// Поиск имеющейся в системе информации по номеру телефона
        /// </summary>
        /// <param name="call">Объект типа "Звонок"</param>
        /// <param name="PhoneNum">Номер телефона</param>
        /// <returns></returns>
        private RelationshipCall FindOrCreateContacts(RelationshipCall call, string PhoneNum)
        {
            Lead lead = EntityManager <Lead> .Instance.Find(string.Format("Phone in(PhoneString='{0}')", PhoneNum))?.FirstOrDefault();

            Contact contact = EntityManager <Contact> .Instance.Find(string.Format("Phone in(PhoneString='{0}')", PhoneNum))?.FirstOrDefault();

            Contractor contractor = EntityManager <Contractor> .Instance.Find(string.Format("Phone in(PhoneString='{0}')", PhoneNum))?.FirstOrDefault();

            if (lead == null && contact == null && contractor == null)
            {
                lead = EntityManager <Lead> .Instance.Create();

                lead.Name           = "Телефонный контакт с " + PhoneNum;
                lead.CreationAuthor = call.CreationAuthor;
                lead.CreationDate   = DateTime.Now;
                lead.Status         = EleWise.ELMA.CRM.Enums.LeadStatus.New;
                lead.Source         =
                    EntityManager <LeadSource> .Instance
                    .Find(f => f.Uid == Guid.Parse("e03a36f5-58d6-4be0-9b70-64b55902c529"))
                    .FirstOrDefault();

                Phone phone = EntityManager <Phone> .Instance.Create();

                phone.PhoneString = PhoneNum;
                phone.Save();
                lead.Phone.Add(phone);
                lead.Save();
            }
            call.Lead       = lead;
            call.Contact    = contact;
            call.Contractor = contractor;
            return(call);
        }
Example #2
0
        ///// <summary>
        ///// Новая задача
        ///// </summary>
        ///// <param name="Call"></param>
        ///// <param name="subject"></param>
        ///// <returns></returns>
        //private Task NewTask(RelationshipCall Call, string subject)
        //{
        //    Task task = EntityManager<Task>.Instance.Create();
        //    task.CreationDate = DateTime.Now;
        //    task.CreationAuthor = Call.CreationAuthor;
        //    task.Subject = subject;
        //    task.Executor = Call.CreationAuthor;
        //    task.StartDate = DateTime.Now;
        //    task.EndDate = DateTime.Now.AddDays(1);
        //    task.Status = TaskBaseStatus.NewOrder;
        //    task.Save();
        //    return task;
        //}
        //private ICollection<Task> FindAllTaskByCall(RelationshipCall Call, User Executor)
        //{
        //    string eqlFindStr;
        //    if (Call.Contractor != null)
        //        eqlFindStr = string.Format("Contractor in({0}) AND Executor in({1})", Call.Contractor.Id.ToString(), Executor.Id.ToString());
        //    else
        //        eqlFindStr = string.Format("Lead in(Id={0}) AND Executor in({1})", Call.Lead.Id.ToString(), Executor.Id.ToString());

        //    try
        //    {
        //        var tmp = EntityManager<Task>.Instance.Find(eqlFindStr);
        //        SendMessage(sysAdmin, "Поиск задач", "Количество задач " + tmp.Count.ToString());
        //    }
        //    catch
        //    {
        //        SendMessage(sysAdmin, "Поиск задач", "Error find of Task");
        //    }

        //    return EntityManager<Task>.Instance.Find(eqlFindStr);
        //}

        /// <summary>
        /// Запланировать звонок
        /// </summary>
        /// <param name="calls"></param>
        private void PlaningFutureCall(RelationshipCall calls)
        {
            RelationshipCall call = EntityManager <RelationshipCall> .Instance.Create();

            call.CreationDate   = DateTime.Now;
            call.CreationAuthor =
                EntityManager <User> .Instance.LoadOrNull(Guid.Parse("f0e949bf-4da4-4c02-b04c-ca61964b4fe8")); //System

            call.Completed  = false;
            call.Contact    = calls.Contact;
            call.Contractor = calls.Contractor;

            var calendar = Locator.GetServiceNotNull <IProductionCalendarService>();//TODO Планирование звонков на час вперед

            call.StartDate = calendar.EvalTargetTime(DateTime.Now, 1);
            call.EndDate   = calendar.EvalTargetTime(DateTime.Now, 1);
            //call.StartDate= DateTime.Now.AddDays(1);
            //call.EndDate = DateTime.Now.AddDays(1);

            if (calls.Contractor != null)
            {
                call.Theme = "Перезвонить абоненту " + calls.Contractor.Name;
            }
            else
            {
                call.Theme = "Перезвонить абоненту " + calls.Lead.Name;
            }
            //SendMessage(sysAdmin, "Plane call", "Создаем участников");
            call.RelationshipUsers.Add(CreateParticipant(calls.CreationAuthor));
            call.Save();
            //SendMessage(sysAdmin, "Планирование звонка", "Звонок запланирован успешно");
        }
Example #3
0
        /// <summary>
        /// Обработка события начала разговора
        /// </summary>
        /// <param name="newDial"></param>
        public void ProcessingAnswerCall(Dial newDial)
        {
            try
            {
                User Abonent = BeelineManager.Instance.BeelineConnect.FindAbonentsBy(newDial.SubscriptionID).Key;
                TelephonyManager.TelephonyLog.Debug("Начало разговора для " + Abonent.UserName + " CallEventsController.ProcessingAnswerCall");
                RelationshipCall call = FindLastRelationsByCallID(newDial.TrackingId);
                if (call == null)
                {
                    call           = CreateRelationshipCall(newDial);
                    call.Theme     = "Входящий звонок от " + newDial.RemoteAddress;
                    call.Type      = EleWise.ELMA.CRM.Enums.RelationshipCallType.Input;
                    call.KollCentr = false;
                }
                call.StatusRazgovora = EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.RazgovorNachat;

                if (call.Lead != null && call.Lead.Status != EleWise.ELMA.CRM.Enums.LeadStatus.Qualified)
                {
                    call.Lead.Responsible = Abonent;
                    call.Lead.Status      = EleWise.ELMA.CRM.Enums.LeadStatus.InHand;
                    call.Lead.Save();
                }
                call.Save();
                TelephonyManager.TelephonyLog.Debug("Начало разговора выполнено для " + Abonent.UserName + " CallEventsController.ProcessingAnswerCall");
            }
            catch (Exception ex)
            {
                SendMessage(sysAdmin, "error in ProcessingAnswerCall", string.Format("{0} || {1}", ex.Message, ex.TargetSite));
            }
        }
Example #4
0
        /// <summary>
        /// Создать новый звонок
        /// </summary>
        /// <param name="newDial">Структура параметров вызова</param>
        /// <returns></returns>
        public RelationshipCall CreateRelationshipCall(Dial newDial)
        {
            User             abonent = BeelineManager.Instance.BeelineConnect.FindAbonentsBy(newDial.SubscriptionID).Key;
            Abonent          ab      = BeelineManager.Instance.BeelineConnect.FindAbonentsBy(newDial.SubscriptionID).Value;
            RelationshipCall call    = EntityManager <RelationshipCall> .Instance.Create();

            call.CreationDate   = DateTime.Now;
            call.CreationAuthor = abonent;
            call                 = FindOrCreateContacts(call, newDial.RemoteAddress);
            call.UniqueId        = newDial.TrackingId;
            call.StatusRazgovora = EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.Novyy;
            call.SsylkaNaZapisj  = new Uri(BeelineManager.Instance.BeeConnect.Api.getRecordFile(newDial.TrackingId, ab.phone).uri);
            //lock (dbLock)
            call.Save();
            call.RelationshipUsers.Add(CreateParticipant(abonent));
            return(call);
        }
Example #5
0
 /// <summary>
 /// Создать новый входящий звонок
 /// </summary>
 /// <param name="newDial">Параметры звонка</param>
 /// <returns>true - если успешно, false - неудача</returns>
 public bool CreateNewInnerCall(Dial newDial)
 {
     try
     {
         User Abonent = BeelineManager.Instance.BeelineConnect.FindAbonentsBy(newDial.SubscriptionID).Key;
         TelephonyManager.TelephonyLog.Debug("Начало обработки события для " + Abonent.UserName + " CallEventsController.CreateNewInnerCall");
         RelationshipCall call = CreateRelationshipCall(newDial);
         call.Theme     = "Входящий звонок от " + newDial.RemoteAddress;
         call.Type      = EleWise.ELMA.CRM.Enums.RelationshipCallType.Input;
         call.KollCentr = false;
         call.Save();
         TelephonyManager.TelephonyLog.Debug("Обработано успешно для " + Abonent.UserName + " CallEventsController.CreateNewInnerCall");
     }
     catch (Exception ex)
     {
         SendMessage(sysAdmin, "error in CreateNewInnerCall", string.Format("{0} || {1}", ex.Message, ex.TargetSite));
         return(false);
     }
     return(true);
 }
Example #6
0
        //
        // GET: /BeeOpenCall/

        public ActionResult Index(string trackNum)
        {
            RelationshipCall call = EntityManager <RelationshipCall> .Instance.Find(
                string.Format("UniqueId='{0}'", trackNum))
                                    .LastOrDefault();

            //return Redirect(string.Format("~/CRM/RelationshipCall/Details/{0}", call.Id));
            if (call.StatusRazgovora == EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.RazgovorNachat)
            {
                ViewData["status"]    = "Запуск процесса обработки клиента";
                ViewData["callTheme"] = call.Theme;
                return(View());
            }
            else
            {
                return(Redirect(string.Format("~/CRM/RelationshipCall/Details/{0}", call.Id)));
            }

            //if (call != null)
            //    return Redirect(string.Format("~/CRM/RelationshipCall/Details/{0}", call.Id));
            //else
            //    return View();
        }
Example #7
0
 /// <summary>
 /// Обработка логики события завершения звонка на колл-центр
 /// </summary>
 /// <param name="call">Объект "Звонок"</param>
 /// <param name="newDial">Информация о вызове тип Dial</param>
 private void LogicEndeCallCenterCall(RelationshipCall call, Dial newDial) //TODO Придумать с заверщениями звонка Колл-центра
 {
     //string tmp = string.Format("{0} {1}",
     //    newDial.CallOutEvent.releasingParty != null ? newDial.CallOutEvent.releasingParty.ToString() : "",
     //    newDial.CallOutEvent.releasingParty);
     //SendMessage(sysAdmin, "TEST 1 clothed Call-Center", tmp);
     if (/*newDial.CallOutEvent.releasingParty != null && */ newDial.CallOutEvent.releasingParty == Schema.ReleasingParty.localRelease)
     {
         //SendMessage(sysAdmin, "TEST 2 clothed Call-Center", tmp);
         if (call.StatusRazgovora == EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.Novyy)
         {
             call.StatusRazgovora = EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.VypolnenNeUspeshno;
             //call.Theme = string.Format("Неотвеченный звонок '{0}' от {1}", newDial.CallOutEvent.acdCallInfo.acdName, newDial.RemoteAddress);
         }
         else if (call.StatusRazgovora == EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.RazgovorNachat)
         {
             call.StatusRazgovora = EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.VypolnenUspeshno;
         }
         call.EndDate   = DateTime.Now;
         call.Completed = true;
         call.Save();
     }
 }
Example #8
0
 /// <summary>
 /// Обработка события окончания разговора
 /// </summary>
 /// <param name="newDial"></param>
 public void ProcessingReleaseCall(Dial newDial)
 {
     try
     {
         User Abonent = BeelineManager.Instance.BeelineConnect.FindAbonentsBy(newDial.SubscriptionID)
                        .Key;
         TelephonyManager.TelephonyLog.Debug("Окончание разговора для " + Abonent.UserName + " CallEventsController.ProcessingReleaseCall");
         RelationshipCall call = FindLastRelationsByCallID(newDial.TrackingId);
         if (call == null)
         {
             return;
         }
         if (call.StatusRazgovora == EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.Novyy)
         {
             if (call.KollCentr)
             {
                 LogicEndeCallCenterCall(call, newDial);
                 #region Block for Debug
                 //SendMessage(sysAdmin,
                 //    string.Format("Пропущенный вызов {0}", newDial.CallOutEvent?.acdCallInfo.acdName),
                 //    string.Format("Неотвечен вызов Колл-центра абонентом - {0}", Abonent.FullName));
                 #endregion
                 #region Block for release
                 foreach (var item in call.RelationshipUsers)
                 {
                     SendMessage(item.User,
                                 string.Format("Пропущенный вызов {0}", newDial.CallOutEvent?.acdCallInfo.acdName),
                                 string.Format("Неотвечен вызов Колл-центра абонентом - {0}", item.User.FullName));
                 }
                 #endregion
             }
             else
             {
                 if (call.Type == EleWise.ELMA.CRM.Enums.RelationshipCallType.Input)
                 {
                     call.Theme = "Пропущенный вызов от " + newDial.RemoteAddress;
                 }
                 else
                 {
                     call.Theme = "Несостоявшийся разговор " + newDial.RemoteAddress;
                 }
                 call.StatusRazgovora = EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.VypolnenNeUspeshno;
                 call.Completed       = true;
                 //SendMessage(sysAdmin, "3-e Событие личный звонок", "Надо запланировать звонок");
                 PlaningFutureCall(call);
                 call.Save();
             }
         }
         else if (call.StatusRazgovora == EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.RazgovorNachat)
         {
             call.StatusRazgovora = EleWise.ELMA.ConfigurationModel.SostoyanieVyzova.VypolnenUspeshno;
             call.EndDate         = DateTime.Now;
             call.Completed       = true;
             call.Save();
         }
         TelephonyManager.TelephonyLog.Debug("Окончание разговора для " + Abonent.UserName + " выполнено CallEventsController.ProcessingReleaseCall");
     }
     catch (Exception ex)
     {
         SendMessage(sysAdmin, "error in ProcessingReleaseCall", string.Format("{0} || {1}", ex.Message, ex.TargetSite));
     }
 }