Exemplo n.º 1
0
        static void AddEventToDB(AsteriskEvent asteriskEvent)
        {
            var repository = new EFAsteriskEventRepository("Data Source=.\\SQLEXPRESS; Initial Catalog=ccrm_db; Integrated Security=True;");

            switch (asteriskEvent.Event)
            {
            case AsteriskEvent.DIAL_EVENT_CODE:
                repository.Insert(asteriskEvent);
                if (string.IsNullOrEmpty(asteriskEvent.State))
                {
                    repository.AddEvent(asteriskEvent);
                }
                else
                {
                    repository.UpdateEventStatus(asteriskEvent);
                }
                break;

            case AsteriskEvent.NEW_EVENT_STATE_EVENT_CODE:
                repository.Insert(asteriskEvent);
                if (asteriskEvent.State == "Up")
                {
                    repository.UpdateEventStatus(asteriskEvent);
                }
                break;
            }
        }
Exemplo n.º 2
0
        static void FillAndAddEventToDB(string eventType, string channel, string state, string callerId, string callerNum, string uniqueId, DateTime receivedTime, string destination)
        {
            AsteriskEvent astEvent = new AsteriskEvent();

            astEvent.Event        = eventType;
            astEvent.Channel      = channel;
            astEvent.State        = state;
            astEvent.CallerIdName = callerId;
            astEvent.CallerIdNum  = callerNum;
            astEvent.UniqueId     = uniqueId;
            astEvent.ReceivedTime = receivedTime;
            astEvent.Destination  = destination;
            astEvent.IsServedBy   = false;

            AddEventToDB(astEvent);
        }
Exemplo n.º 3
0
        static void AddEventToDB(AsteriskEvent asteriskEvent)
        {

            var repository = new EFAsteriskEventRepository("Data Source=.\\SQLEXPRESS; Initial Catalog=ccrm_db; Integrated Security=True;");

            switch (asteriskEvent.Event)
            {
                case AsteriskEvent.DIAL_EVENT_CODE:
                    repository.Insert(asteriskEvent);
                    if (string.IsNullOrEmpty(asteriskEvent.State))
                        repository.AddEvent(asteriskEvent);
                    else
                        repository.UpdateEventStatus(asteriskEvent);
                    break;
                case AsteriskEvent.NEW_EVENT_STATE_EVENT_CODE:
                    repository.Insert(asteriskEvent);
                    if (asteriskEvent.State == "Up")
                        repository.UpdateEventStatus(asteriskEvent);
                    break;
            }

        }
Exemplo n.º 4
0
        static void FillAndAddEventToDB(string eventType, string channel, string state, string callerId, string callerNum, string uniqueId, DateTime receivedTime, string destination)
        {
            AsteriskEvent astEvent = new AsteriskEvent();

            astEvent.Event = eventType;
            astEvent.Channel = channel;
            astEvent.State = state;
            astEvent.CallerIdName = callerId;
            astEvent.CallerIdNum = callerNum;
            astEvent.UniqueId = uniqueId;
            astEvent.ReceivedTime = receivedTime;
            astEvent.Destination = destination;
            astEvent.IsServedBy = false;

            AddEventToDB(astEvent);
        }