Example #1
0
        public void initiate_send()
        {
            if (handle_left != null)
            {
                requestList.Remove(handle_left);
            }
            int rank = comm.Rank;

            // Console.WriteLine(rank + ": shift-to-left : initiate_send : " + Cell.predecessor);
            handle_left = comm.ImmediateSend <double>(Output_buffer.Array, Cell.predecessor, DEFAULT_TAG);
            requestList.Add(handle_left);
        }
Example #2
0
        //private MPI.Intercommunicator channel;

        private RequestList synchronize_action(object action_id)
        {
            Console.WriteLine("ActionDef.action_ids.Count = " + ActionDef.action_ids.Count);

            int         value        = ActionDef.action_ids[action_id];
            RequestList request_list = new RequestList();

            Trace.WriteLineIf(this.TraceFlag == true, this.ThisFacetInstance + "/" + this.Rank + ": synchronize_action " + action_id + " -1");

            Trace.WriteLineIf(this.TraceFlag == true, this.ThisFacetInstance + "/" + this.Rank + ": synchronize_action " + action_id + " 0");

            foreach (KeyValuePair <int, IDictionary <string, int> > facet in Channel.UnitSizeInFacet)
            {
                if (facet.Key != this.ThisFacetInstance)
                {
                    foreach (KeyValuePair <string, int> unit_team in facet.Value)
                    {
                        for (int i = 0; i < unit_team.Value; i++)
                        {
                            Trace.WriteLineIf(this.TraceFlag == true, "synchronize_action " + action_id + " LOOP SEND " + facet.Key + "/" + i);
                            Request req = Channel.ImmediateSend <object> (value, new Tuple <int, int> (facet.Key, i), value);
                            request_list.Add(req);
                        }
                    }
                }
            }

            Trace.WriteLineIf(this.TraceFlag == true, this.ThisFacetInstance + "/" + this.Rank + ": synchronize_action " + action_id + " 1");

            foreach (KeyValuePair <int, IDictionary <string, int> > facet in Channel.UnitSizeInFacet)
            {
                if (facet.Key != this.ThisFacetInstance)
                {
                    foreach (KeyValuePair <string, int> unit_team in facet.Value)
                    {
                        for (int i = 0; i < unit_team.Value; i++)
                        {
                            Trace.WriteLineIf(this.TraceFlag == true, "synchronize_action " + action_id + " LOOP RECV " + facet.Key + "/" + i);
                            ReceiveRequest req = Channel.ImmediateReceive <object> (new Tuple <int, int> (facet.Key, i), value);
                            request_list.Add(req);
                        }
                    }
                }
            }

            Trace.WriteLineIf(this.TraceFlag == true, this.ThisFacetInstance + "/" + this.Rank + ": synchronize_action " + action_id + " 2");
            return(request_list);
        }
Example #3
0
    // Returns all items in the Request table and fill it in a RequestList
    public static RequestList GetList()
    {
        RequestList tempList = new RequestList();

        using (SqlConnection myConnection = new SqlConnection(AppConfiguration.SqlConnectionString))
        {
            using (SqlCommand myCommand = new SqlCommand("sprocRequestSelectList", myConnection))
            {
                myCommand.CommandType = CommandType.StoredProcedure;
                myConnection.Open();
                using (SqlDataReader myReader = myCommand.ExecuteReader())
                {
                    if (myReader.HasRows)
                    {
                        tempList = new RequestList();
                        while (myReader.Read())
                        {
                            tempList.Add(FillDataRecord(myReader));
                        }
                    }
                    myReader.Close();
                }
            }
        }
        return(tempList);
    }
Example #4
0
        private void RefreshRequest()
        {
            if (_requestService == null)
            {
                _requestService = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
            }
            RequestList.Clear();
            var requests = _requestService.GetRequestList(RequestNum, FilterByCreateDate, FromDate, ToDate,
                                                          ExecuteFromDate, ExecuteToDate,
                                                          FilterStreetList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          _selectedHouse?.Id, SelectedFlat?.Id,
                                                          FilterParentServiceList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          SelectedService?.Id,
                                                          FilterStatusList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterMasterList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterExecuterList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterServiceCompanyList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterUserList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterRatingList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          SelectedPayment?.Id, ServiceCompanyBadWork, OnlyRetry, ClientPhone, OnlyGaranty, OnlyImmediate);

            foreach (var request in requests)
            {
                RequestList.Add(request);
            }
            RequestCount = RequestList.Count;
            OnPropertyChanged(nameof(RequestList));
        }
Example #5
0
 private async void InitializeRequestList()
 {
     foreach (Request r in await DataTransferUtility.GetRequests())
     {
         RequestList.Add(r);
     }
 }
Example #6
0
        private void RefreshRequest()
        {
            RequestList.Clear();
            var requests = _requestService.GetAlertRequestList(SelectedServiceCompany?.Id, ShowDoned).ToArray();

            foreach (var request in requests)
            {
                RequestList.Add(request);
            }
            RequestCount = RequestList.Count;
            OnPropertyChanged(nameof(RequestList));
        }
        public void ListenerThread(string requestUrl)
        {
            ProcessStatus = (int)AkeneoProductIndexerStatuses.ListingInProgress;
            HttpManager   = new BaseWebClientWriter();
            try
            {
                var response = HttpManager.GetData(requestUrl, new WebClientHeader("Authorization", $"Bearer {AuthToken}"));
                AkeneoIndexedProductDto dto = JsonConvert.DeserializeObject <AkeneoIndexedProductDto>(response);
                if (dto.LinksCollection.NextLink != null)
                {
                    var thread = new Thread(() =>
                    {
                        ListenerThread(dto.LinksCollection.NextLink.Href);
                    });
                    thread.Start();
                }

                if (dto.Embed.ItemsCollection != null && dto.Embed.ItemsCollection.Count > 0)
                {
                    var converter = new AkeneoBaseProductIndexerConverter();
                    foreach (var selected in dto.Embed.ItemsCollection)
                    {
                        try
                        {
                            var tempProductStorage = converter.ConvertToApplicationEntity(selected);
                            lock (RequestList)
                            {
                                RequestList.Add(tempProductStorage);
                            }
                        }
                        catch (Exception e)
                        {
                            _logger.error(
                                $"(AkeneoBaseProductIndexerConverter exception): Cannot convert dto entity:  {e.Message}");
                        }
                    }
                }

                if (dto.LinksCollection.NextLink == null)
                {
                    ProcessStatus = (int)AkeneoProductIndexerStatuses.ListingFinished;
                    InvokeOnFinishedListing();
                }
            }
            catch (Exception e)
            {
                _logger.error(e.Message);
            }
        }
Example #8
0
        public void TestRequestList()
        {
            var list = new RequestList <int>(5, 25, new TestSerializer());

            Assert.IsNull(list.Add(1000000000));
            Assert.IsNull(list.Add(1000000001));

            Assert.IsNotNull(list.Add(1));
            Assert.IsNull(list.Add(2));
            Assert.IsNull(list.Add(3));
            Assert.IsNull(list.Add(4));
            Assert.IsNotNull(list.Add(5));
        }
Example #9
0
        static List <Timetable> generateTimetable(Intracommunicator comm)
        {
            RequestList           requestList = new RequestList();
            List <ReceiveRequest> reqs        = new List <ReceiveRequest>();

            var classes = System.IO.File.ReadAllLines("input.txt").OfType <string>().Select(line =>
            {
                var l = line.Trim().Split(';');
                return(new Class(l[1], l[0]));
            }).ToList();


            int id = 1;


            foreach (Class c in classes)
            {
                if (id == comm.Size)
                {
                    id = 1;
                }

                Timetable t = new Timetable();
                t.Table[Day.MONDAY][8].Add(c);

                var clone = copy(classes);
                clone.Remove(c);

                comm.Send(false, id, 1);
                comm.Send(new Payload {
                    timetable = t.toList(), classes = clone, day = Day.MONDAY, hour = 8
                }, id, 0);
                reqs.Add(comm.ImmediateReceive <List <Pair <Day, List <Pair <int, List <Class> > > > > >(id++, 0));
                requestList.Add(reqs.Last());
            }

            requestList.WaitAll();

            for (int i = 1; i < comm.Size; i++)
            {
                comm.Send(true, i, 1);
            }

            return(reqs.Select(r =>
            {
                r.Wait();
                return new Timetable((List <Pair <Day, List <Pair <int, List <Class> > > > >)r.GetValue());
            }).Where(t => t.Table.Count != 0).ToList());
        }
Example #10
0
        private void RefreshRequest()
        {
            if (_requestService == null)
            {
                _requestService = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
            }
            RequestList.Clear();
            var requests = _requestService.GetAlertedRequests();

            foreach (var request in requests)
            {
                RequestList.Add(request);
            }
            RequestCount = RequestList.Count;
            OnPropertyChanged(nameof(RequestList));
        }
        private void RefreshRequest()
        {
            if (_requestService == null)
            {
                _requestService = new RequestService(AppSettings.DbConnection);
            }
            RequestList.Clear();
            var requests = string.IsNullOrEmpty(RequestNum) ? _requestService.GetRequestList(FromDate, ToDate, SelectedStreet?.Id, _selectedHouse?.Id, SelectedFlat?.Id, SelectedParentService?.Id, SelectedService?.Id, SelectedStatus?.Id, SelectedWorker?.Id)
                :_requestService.GetRequestById(RequestNum);

            foreach (var request in requests)
            {
                RequestList.Add(request);
            }
            OnPropertyChanged(nameof(RequestList));
        }
 public void ListenerThread(string requestUrl)
 {
     ProcessStatus = AkeneoProductIndexerStatuses.ListingInProgress;
     HttpManager   = new BaseWebClientWriter();
     try
     {
         var data = HttpManager.GetData(requestUrl, new WebClientHeader("Authorization", $"Bearer {AuthToken}"));
         AkeneoIndexedCategoriesDto dto = JsonConvert.DeserializeObject <AkeneoIndexedCategoriesDto>(data);
         if (!ReferenceEquals(dto.LinksCollection.NextLink, null))
         {
             new Thread(() => {
                 ListenerThread(dto.LinksCollection.NextLink.Href);
             }).Start();
         }
         if (dto.Embed.ItemsCollection.Count > 0)
         {
             foreach (var selected in dto.Embed.ItemsCollection)
             {
                 var _c = new AkeneoBaseCategoriesIndexerConverter();
                 try
                 {
                     var _t = _c.ConvertToApplicationEntity(selected);
                     lock (RequestList)
                     {
                         RequestList.Add(_t);
                     }
                 }
                 catch (Exception e)
                 {
                     _l.error($"AkeneoBaseCategoriesListener exception: cannot convert dto entity to application entity: {e.Message} -> {e.StackTrace}");
                 }
             }
         }
         if (ReferenceEquals(dto.LinksCollection.NextLink, null))
         {
             ProcessStatus = AkeneoProductIndexerStatuses.ListingFinished;
             InvokeOnFinishedListing();
         }
     }
     catch (Exception e)
     {
         _l.error($"Akeneo categories indexer: error occured - {e.Message} -> {e.StackTrace}");
     }
 }
Example #13
0
        /// <summary>
        /// Use the given data source to push the data after the given checkpoint to the Bing for Commerce endpoint.
        /// </summary>
        /// <param name="data">the data source to use to poll the data from.</param>
        public void Push(IDataReader data)
        {
            log.Debug($"Starting a data push, starting from the checkpoint: {this.checkpointAcceptor.Checkpoint.GetValue()}.");

            this.tracker.Start();

            var    requestList      = new RequestList <IDictionary <string, object> >(this.config.MaxBatchCount, this.config.MaxRequestSize, this.Serializer);
            string latestCheckpoint = null;

            foreach (var record in data.ReadNext(this.checkpointAcceptor.Checkpoint))
            {
                if (record.OperationType == DataOperation.Update)
                {
                    var updates = requestList.Add(record.Record);
                    if (updates != null)
                    {
                        string localCheckpoint = latestCheckpoint;
                        this.checkpointAcceptor.Pending(localCheckpoint);
                        this.taskManager.Add(() => this.SendRequestAsync(updates, () => this.checkpointAcceptor.Accept(localCheckpoint)));
                    }

                    latestCheckpoint = record.Checkpoint;
                }
                else
                {
                    throw new NotSupportedException($"Operation is not supported: {record.OperationType}");
                }
            }

            var updatedRecords = requestList.ResetList();

            if (updatedRecords.Count > 0)
            {
                this.checkpointAcceptor.Pending(latestCheckpoint);
                this.taskManager.Add(() => this.SendRequestAsync(updatedRecords, () => this.checkpointAcceptor.Accept(latestCheckpoint)));
            }

            log.Debug($"Ending a data push. Current checkpoint: {this.checkpointAcceptor.Checkpoint.GetValue()}.");
        }
Example #14
0
        public void RequestElevator(IMovable RequestFloor, int height)

        {
            //Extra Check
            //Check for Current floor

            if (RequestFloor.FinalDes.Position.Y <= height && RequestFloor.FinalDes.Position.Y >= 0)
            {
                RequestList.Add(RequestFloor);
                //Goes UP
                if (RequestFloor.Position.Y < Position.Y)
                {
                    Up.Add(RequestFloor.Position.Y);
                    UpdateList();
                }
                //Goes DOWN
                else
                {
                    Down.Add(RequestFloor.Position.Y);
                    UpdateList();
                }
            }
        }
 public void initiate_send_west()
 {
     //int rank = comm.Rank;
     //Console.Write(rank + ": x - initiate_send_west :");
     if (Shift_x_west.HandleLeft != null)
     {
         requestList.Remove(Shift_x_west.HandleLeft);
     }
     //if (Shift_x_west.HandleRight != null)
     //		requestList.Remove(Shift_x_west.HandleRight);
     Shift_x_west.initiate_send();
     requestList.Add(Shift_x_west.HandleLeft);
     //requestList.Add(Shift_x_west.HandleRight);
 }
Example #16
0
 public void SaveRequest(Request request)
 {
     lock (RequestList) {
         RequestList.Add(request);
     }
 }
Example #17
0
        private void FindRequests(TcpConnection conn, int direction)
        {
            Int64 totalRequestLength = conn.Stream(direction).Data.Length;

            ReqStateType state = ReqStateType.ReqStateStartMethod;

            Byte[]      data = conn.Stream(direction).Data.ToArray();
            int         cur  = 0;
            HttpRequest req  = null;

            while (cur < data.Length)
            {
                switch (state)
                {
                case ReqStateType.ReqStateStartMethod:
                    // Try to find a word describing a method.
                    // These are all the methods defined in
                    // draft-ietf-http-v11-spec-rev-06
                    bool         found      = false;
                    HttpMethod[] allmethods = (HttpMethod[])Enum.GetValues(typeof(HttpMethod));
                    foreach (var method in allmethods)
                    {
                        string str       = method.ToString() + ' ';
                        int    methodlen = str.Length;
                        if (strncasecmp(data, cur, methodlen, str))
                        {
                            found = true;
                            // Make a new record for this entry
                            req        = new HttpRequest();
                            req.Method = method;

                            cur  += methodlen;
                            state = ReqStateType.ReqStateFinishMethod;
                            break;
                        }
                    }

                    // Couldn't find a valid method,
                    // so increment and attempt to resynchronize.
                    // This shouldn't happen often.
                    if (!found)
                    {
                        cur++;
                    }
                    break;

                case ReqStateType.ReqStateFinishMethod:
                    // RequestURI
                    cur += req.ParseRequestURI(data, cur);

                    // Http version
                    cur += req.ParseHttpVersion(data, cur);

                    state = ReqStateType.ReqStateFindContentLength;
                    break;

                case ReqStateType.ReqStateFindContentLength:
                    // Locate content-length field, if any
                    if (strncasecmp(data, cur, 17, "\r\nContent-Length:"))
                    {
                        cur += 17;
                        // skip leading spaces
                        while (data[cur] == 0x20) // data[cur] == '<space>'
                        {
                            cur++;
                        }

                        cur += req.ParseContentLength(data, cur);
                    }
                    else if (strncasecmp(data, cur, 4, "\r\n\r\n"))
                    {
                        // if no content-length header detected, assume zero.
                        // fall through
                        req.ContentLength = 0;
                        state             = ReqStateType.ReqStateFinishHeader;
                    }
                    else if (strncasecmp(data, cur, 2, "\r\n"))
                    {
                        cur += 2;
                        // Try to fatch other possible headers
                        int pos = cur;
                        while (data[pos] != 0x0D && // data[pos] != '\n'
                               data[pos] != 0x0A) // data[pos] != '\r'
                        {
                            pos++;
                        }

                        string str = Encoding.ASCII.GetString(data, cur, pos - cur);
                        int    idx = str.IndexOf(":");
                        if (idx != -1)
                        {
                            string field = str.Substring(0, idx).Trim();
                            string value = str.Substring(idx + 1).Trim();
                            req.OtherHeaders[field] = value;
                        }
                        else
                        {
                            // This should not happen during a specific compatate connection.
                            // But if it happened, only we can do is to ignore it.
                        }

                        cur = pos;
                    }
                    else
                    {
                        cur++;
                    }
                    break;

                case ReqStateType.ReqStateFinishHeader:
                    if (strncasecmp(data, cur, 4, "\r\n\r\n"))
                    {
                        // Found end of header
                        cur += 4;

                        if (req.ContentLength > 0)
                        {
                            req.Body = new Byte[req.ContentLength];
                            Array.Copy(data, cur, req.Body, 0, req.ContentLength);
                        }
                        else
                        {
                            // QUESTION: What if a POST with no content-length?
                            req.Body = null;
                        }

                        state = ReqStateType.ReqStateStartMethod;

                        // Fill in other infos.
                        req.Source       = conn.Pair.EndPoint(direction);
                        req.Destination  = conn.Pair.EndPoint(1 - direction);
                        req.ConnectionID = conn.ConnectionID;
                        RequestList.Add(req);
                    }
                    else
                    {
                        cur++;
                    }
                    break;
                }
            }
        }
Example #18
0
 private void AddRequest()
 {
     RequestList.Add(new RequestItemViewModel());
 }
Example #19
0
    // Returns items in the User table based on search criteria and fill it in a UserList
    public static RequestList GetList(RequestSearchCriteria requestSearchCriteria)
    {
        RequestList tempList = new RequestList();

        using (SqlConnection myConnection = new SqlConnection(AppConfiguration.SqlConnectionString))
        {
            using (SqlCommand myCommand = new SqlCommand("sprocRequestSearchList", myConnection))
            {
                myCommand.CommandType = CommandType.StoredProcedure;
                if (!string.IsNullOrEmpty(requestSearchCriteria.CreatedBy))
                {
                    myCommand.Parameters.AddWithValue("@CreatedBy", requestSearchCriteria.CreatedBy);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.ClosedBy))
                {
                    myCommand.Parameters.AddWithValue("@ClosedBy", requestSearchCriteria.ClosedBy);
                }
                if (requestSearchCriteria.CreateDateFrom != DateTime.MinValue)
                {
                    myCommand.Parameters.AddWithValue("@CreateDateFrom", requestSearchCriteria.CreateDateFrom);
                }
                if (requestSearchCriteria.CreateDateTo != DateTime.MinValue)
                {
                    myCommand.Parameters.AddWithValue("@CreateDateTo", requestSearchCriteria.CreateDateTo);
                }
                if (requestSearchCriteria.CloseDateFrom != DateTime.MinValue)
                {
                    myCommand.Parameters.AddWithValue("@CloseDateFrom", requestSearchCriteria.CloseDateFrom);
                }
                if (requestSearchCriteria.CloseDateTo != DateTime.MinValue)
                {
                    myCommand.Parameters.AddWithValue("@CloseDateTo", requestSearchCriteria.CloseDateTo);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.AssignedUser))
                {
                    myCommand.Parameters.AddWithValue("@AssignedUser", requestSearchCriteria.AssignedUser);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.AssignedDepartment))
                {
                    myCommand.Parameters.AddWithValue("@AssignedDepartment", requestSearchCriteria.AssignedDepartment);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.RequestStatus))
                {
                    myCommand.Parameters.AddWithValue("@RequestStatus", requestSearchCriteria.RequestStatus);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.CaseName))
                {
                    myCommand.Parameters.AddWithValue("@CaseName", requestSearchCriteria.CaseName);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.TicketNumber))
                {
                    myCommand.Parameters.AddWithValue("@TicketNumber", requestSearchCriteria.TicketNumber);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.PNR))
                {
                    myCommand.Parameters.AddWithValue("@PNR", requestSearchCriteria.PNR);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.FlightNumber))
                {
                    myCommand.Parameters.AddWithValue("@FlightNumber", requestSearchCriteria.FlightNumber);
                }
                if (requestSearchCriteria.FlightDate != DateTime.MinValue)
                {
                    myCommand.Parameters.AddWithValue("@FlightDate", requestSearchCriteria.FlightDate);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.DepartureSector))
                {
                    myCommand.Parameters.AddWithValue("@DepartureSector", requestSearchCriteria.DepartureSector);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.ArrivalSector))
                {
                    myCommand.Parameters.AddWithValue("@ArrivalSector", requestSearchCriteria.ArrivalSector);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.TicketCabin))
                {
                    myCommand.Parameters.AddWithValue("@TicketCabin", requestSearchCriteria.TicketCabin);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.TravelCabin))
                {
                    myCommand.Parameters.AddWithValue("@TravelCabin", requestSearchCriteria.TravelCabin);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.Justification))
                {
                    myCommand.Parameters.AddWithValue("@Justification", requestSearchCriteria.Justification);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.Mobile))
                {
                    myCommand.Parameters.AddWithValue("@PassengerMobile", requestSearchCriteria.Mobile);
                }
                if (!string.IsNullOrEmpty(requestSearchCriteria.Email))
                {
                    myCommand.Parameters.AddWithValue("@PassengerEmail", requestSearchCriteria.Email);
                }
                myConnection.Open();
                using (SqlDataReader myReader = myCommand.ExecuteReader())
                {
                    if (myReader.HasRows)
                    {
                        tempList = new RequestList();
                        while (myReader.Read())
                        {
                            tempList.Add(FillDataRecord(myReader));
                        }
                    }
                    myReader.Close();
                }
            }
        }
        return(tempList);
    }
Example #20
0
    static void TestRequests(Intracommunicator comm, RequestList requestList)
    {
        int datum         = comm.Rank;
        int expectedDatum = (comm.Rank + comm.Size - 1) % comm.Size;

        int[]    intArraySendBuffer = new int[comm.Rank + 1];
        string[] strArraySendBuffer = new string[comm.Rank + 1];
        for (int i = 0; i <= comm.Rank; ++i)
        {
            intArraySendBuffer[i] = i;
            strArraySendBuffer[i] = i.ToString();
        }

        int[]     intArrayRecvBuffer = new int[expectedDatum + 1];
        string[]  strArrayRecvBuffer = new string[expectedDatum + 1];
        Request[] requests           = new Request[8];
        requests[0] = comm.ImmediateReceive <int>(Communicator.anySource, 0);
        requests[1] = comm.ImmediateReceive <string>(Communicator.anySource, 1);
        requests[2] = comm.ImmediateReceive(Communicator.anySource, 2, intArrayRecvBuffer);
        requests[3] = comm.ImmediateReceive(Communicator.anySource, 3, strArrayRecvBuffer);
        requests[4] = comm.ImmediateSend(datum, (comm.Rank + 1) % comm.Size, 0);
        requests[5] = comm.ImmediateSend(datum.ToString(), (comm.Rank + 1) % comm.Size, 1);
        requests[6] = comm.ImmediateSend(intArraySendBuffer, (comm.Rank + 1) % comm.Size, 2);
        requests[7] = comm.ImmediateSend(strArraySendBuffer, (comm.Rank + 1) % comm.Size, 3);

        if (requestList == null)
        {
            // Complete all communications manually
            bool allDone = false;
            while (!allDone)
            {
                allDone = true;
                for (int i = 0; i < requests.Length; ++i)
                {
                    allDone = allDone && requests[i].Test() != null;
                }
            }
        }
        else
        {
            // Use the request list to complete all communications
            for (int i = 0; i < requests.Length; ++i)
            {
                requestList.Add(requests[i]);
            }
            requestList.WaitAll();
        }

        ReceiveRequest  intRecv   = (ReceiveRequest)requests[0];
        CompletedStatus intStatus = intRecv.Wait();

        if ((int)intRecv.GetValue() != expectedDatum ||
            intStatus.Source != expectedDatum ||
            intStatus.Tag != 0)
        {
            System.Console.Error.WriteLine("error in non-blocking receive of integer: got " + (int)intRecv.GetValue() + " from "
                                           + intStatus.Source + " on tag " + intStatus.Tag + ", expected " + expectedDatum);
            MPI.Environment.Abort(-1);
        }

        ReceiveRequest  strRecv   = (ReceiveRequest)requests[1];
        CompletedStatus strStatus = strRecv.Wait();

        if ((string)strRecv.GetValue() != expectedDatum.ToString() ||
            strStatus.Source != expectedDatum ||
            strStatus.Tag != 1)
        {
            System.Console.Error.WriteLine("error in non-blocking receive of string: got " + strRecv.GetValue() + " from "
                                           + strStatus.Source + " on tag " + strStatus.Tag + ", expected " + expectedDatum);
            MPI.Environment.Abort(-1);
        }

        ReceiveRequest  intArrayRecv   = (ReceiveRequest)requests[2];
        CompletedStatus intArrayStatus = intArrayRecv.Wait();

        if (intArrayRecv.GetValue() != intArrayRecvBuffer ||
            intArrayStatus.Source != expectedDatum ||
            intArrayStatus.Tag != 2)
        {
            System.Console.WriteLine("error: received into the wrong integer array");
            MPI.Environment.Abort(-1);
        }
        for (int i = 0; i <= expectedDatum; ++i)
        {
            if (intArrayRecvBuffer[i] != i)
            {
                System.Console.WriteLine("error: intArrayRecv[" + i + "] is " + intArrayRecvBuffer[i] + ", expected " + i);
                MPI.Environment.Abort(-1);
            }
        }

        ReceiveRequest  strArrayRecv   = (ReceiveRequest)requests[3];
        CompletedStatus strArrayStatus = strArrayRecv.Wait();

        if (strArrayRecv.GetValue() != strArrayRecvBuffer ||
            strArrayStatus.Source != expectedDatum ||
            strArrayStatus.Tag != 3)
        {
            System.Console.WriteLine("error: received into the wrong string array");
            MPI.Environment.Abort(-1);
        }
        for (int i = 0; i <= expectedDatum; ++i)
        {
            if (strArrayRecvBuffer[i] != i.ToString())
            {
                System.Console.WriteLine("error: strArrayRecv[" + i + "] is " + strArrayRecvBuffer[i] + ", expected " + i.ToString());
                MPI.Environment.Abort(-1);
            }
        }
    }
        public async Task Init()
        {
            if (CountryList.Count == 0)
            {
                var anyCountry = new Country
                {
                    CountryId = -1,
                    Name      = "Any"
                };

                CountryList.Add(anyCountry);
                var countryList = await _countryService.GetAll <List <Country> >();

                foreach (var country in countryList)
                {
                    CountryList.Add(country);
                }

                SelectedCountry = anyCountry;
            }
            if (StatusList.Count == 0)
            {
                var anyStatus = new Model.Status
                {
                    StatusId = -1,
                    Name     = "Any"
                };

                StatusList.Add(anyStatus);
                var statusList = await _statusService.GetAll <List <Model.Status> >();

                foreach (var status in statusList)
                {
                    StatusList.Add(status);
                }
                SelectedStatus = anyStatus;
            }

            int?maximumRoomsInt = null;
            int?minimumPriceInt = null;

            try
            {
                maximumRoomsInt = int.Parse(MaximumRooms);
            }
            catch (System.Exception)
            {}

            try
            {
                minimumPriceInt = int.Parse(MinimumPrice);
            }
            catch (System.Exception)
            { }

            var searchRequest = new RequestSearchRequest
            {
                MaximumRooms = maximumRoomsInt,
                MinimumPrice = minimumPriceInt,
                ShowInactive = false
            };

            if (SelectedCountry != null && SelectedCountry.CountryId != -1)
            {
                searchRequest.CountryId = SelectedCountry.CountryId;
            }

            if (SelectedStatus != null && SelectedStatus.StatusId != -1)
            {
                searchRequest.StatusId = SelectedStatus.StatusId;
            }

            var requestList = await _requestService.GetAll <List <Request> >(searchRequest);

            RequestList.Clear();
            foreach (var request in requestList)
            {
                var user = await _authService.GetById(request.ClientId);

                var userAddress = await _addressService.GetById <Address>((int)user.AddressId);

                var userCountry = await _countryService.GetById <Country>((int)userAddress.CountryId);

                var requestAddress = await _addressService.GetById <Address>(request.DeliveryAddress);

                var requestCountry = await _countryService.GetById <Country>((int)requestAddress.CountryId);

                var newRequest = new RequestModel
                {
                    FromCountry = userCountry.Name,
                    FullName    = user.FirstName + " " + user.LastName,
                    Price       = request.Price,
                    RequestId   = request.RequestId,
                    ToCountry   = requestCountry.Name
                };
                RequestList.Add(newRequest);
            }

            if (RequestList.Count > 0)
            {
                ShowList = true;
                HideList = false;
            }
            else
            {
                ShowList = false;
                HideList = true;
            }
        }