예제 #1
0
        public IActionResult GetCallsForDevices(DeviceDTO[] body)
        {
            List <CallDTO> ret  = new List <CallDTO>();
            List <string>  adrs = new List <string>();

            foreach (DeviceDTO d in body)
            {
                if (!adrs.Contains(d.Street))
                {
                    adrs.Add(d.Street);
                }
            }
            foreach (Call c in data.Calls)
            {
                if (adrs.Contains(c.Street.Name))
                {
                    User   temp     = authentication.Users.FirstOrDefault(x => x.Id == c.UserID);
                    string username = "******";
                    if (temp != null)
                    {
                        username = temp.FullName;
                    }
                    CallDTO call = new CallDTO();
                    call.UserId  = username;
                    call.Comment = c.Comment;
                    call.Hazard  = c.Hazard;
                    call.Reason  = c.Reason;
                    call.Street  = c.Street.Name;

                    ret.Add(call);
                }
            }
            return(Ok(new { retval = ret }));
        }
예제 #2
0
        public async Task <XElement> Get(Guid callid, string sessionKey, long requestId)
        {
            #region Заглушка
            var hubConn  = new HubConnection(Settings.Default.ResponseHubUrl);
            var hubProxy = hubConn.CreateHubProxy("ResponseHub");
            await hubConn.Start();

            var result = CallDTO.ToXElement(new CallDTO()
            {
                Id                       = Guid.NewGuid(),
                Phone                    = "+7(123)235-14-11",
                Client                   = "Валерий Рябов",
                DateTime                 = DateTime.Now,
                CallReceiver             = "Артем Аленин",
                IsRepeatCall             = false,
                EventStatus              = "Принят",
                EventResultType          = "Передан",
                DepartmentUser           = "******",
                DepartmentUserDepartment = "ОП 3-2"
            });
            result.Add(new XElement("rc", 0));
            result.Add(new XElement("msg", ""));


            hubProxy.Invoke("OperationCallback", sessionKey, requestId, result);
            return(zapad.Model.API.ReturnCodes.BuildRcAnswer(0, "Успешно"));

            #endregion
        }
예제 #3
0
 public CallViewModel(CallDTO callDTO)
 {
     this.Id                       = callDTO.Id;
     this.Phone                    = callDTO.Phone;
     this.Client                   = callDTO.Client;
     this.DateTime                 = callDTO.DateTime.ToString("dd.MM.yyyy hh:mm");
     this.CallReceiver             = callDTO.CallReceiver;
     this.IsRepeatCall             = callDTO.IsRepeatCall ? "Да" : "Нет";
     this.EventStatus              = callDTO.EventStatus;
     this.EventResultType          = callDTO.EventResultType;
     this.DepartmentUser           = callDTO.DepartmentUser;
     this.DepartmentUserDepartment = callDTO.DepartmentUserDepartment;
 }
예제 #4
0
        public JsonResult GetCalls(long?page, long?pageSize, KendoFilter filter = null, string searchTerm = "")
        {
            var requestParameters = new CallsRequest()
            {
                SessionKey = session.Key,
                Page       = page.HasValue ? page.Value : 0,
                PageSize   = pageSize.HasValue ? pageSize.Value : 0,
                SearchTerm = searchTerm,
                Filters    = filter
            };
            var response = WebHostCache.Current.GetResponse <XElement>(@"api\CallRegistry\GetCalls", CallsRequest.ToXElement(requestParameters), WebHostCache.ContentTypes.xml);
            var result   = CallDTO.ArrayFromXElement(response).ViewModelList();

            return(Json(new { rc = 0, Items = result, Total = response.Element("Total").getValue(Int32.MinValue) }, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public async Task <XElement> GetCalls([FromBody] XElement requestParameters)
        {
            #region Заглушка
            var hubConn  = new HubConnection(Settings.Default.ResponseHubUrl);
            var hubProxy = hubConn.CreateHubProxy("ResponseHub");
            await hubConn.Start();

            var result = CallDTO.ArrayToXElement(new CallDTO[]
            {
                new CallDTO
                {
                    Id                       = Guid.NewGuid(),
                    Phone                    = "+7(123)235-14-11",
                    Client                   = "Валерий Рябов",
                    DateTime                 = DateTime.Now,
                    CallReceiver             = "Артем Аленин",
                    IsRepeatCall             = false,
                    EventStatus              = "Принят",
                    EventResultType          = "Передан",
                    DepartmentUser           = "******",
                    DepartmentUserDepartment = "ОП 3-2"
                },
                new CallDTO
                {
                    Id                       = Guid.NewGuid(),
                    Phone                    = "+7(355)221-22-11",
                    Client                   = "Иванов Георгий",
                    DateTime                 = DateTime.Now,
                    CallReceiver             = "Иванов Александр",
                    IsRepeatCall             = true,
                    EventStatus              = "ПРОПУЩЕН!",
                    EventResultType          = "ПЕРЕЗВОНИТЬ",
                    DepartmentUser           = "******",
                    DepartmentUserDepartment = "ОП 3-1"
                }
            });
            result.Add(new XElement("Total", 50));
            result.Add(new XElement("rc", 0));
            result.Add(new XElement("msg", ""));

            hubProxy.Invoke("OperationCallback", requestParameters.Element("sessionKey").Value, long.Parse(requestParameters.Element("requestId").Value), result);
            return(zapad.Model.API.ReturnCodes.BuildRcAnswer(0, "Успешно"));

            #endregion
        }