Example #1
0
        public SearchReq PreparesSearchObj()
        {
            try
            {
                SearchReq searchInputData = new SearchReq();
                searchInputData.CheckInDate      = Convert.ToDateTime(searchData.DateFrom);
                searchInputData.CheckOutDate     = Convert.ToDateTime(searchData.DateTo);
                searchInputData.RoomGuests       = new List <RoomGuest>();
                searchInputData.GuestNationality = searchData.Nat;
                searchInputData.HotelCodeList    = HotelIds;
                searchInputData.NoOfRooms        = searchData.SearchRooms.Count;
                searchInputData.CityId           = int.Parse(searchData.CityName);
                foreach (var item in searchData.SearchRooms)
                {
                    RoomGuest guest = new RoomGuest
                    {
                        AdultCount = item.Adult,
                        ChildAge   = item.Child.ToArray(),
                        ChildCount = item.Child.Count
                    };

                    searchInputData.RoomGuests.Add(guest);
                }


                return(searchInputData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public void FinishSearch(string reason)
        {
            Finished     = true;
            FinishReason = reason;

            if (ProxyTcp != null)
            {
                if (ProxyTcp.Proxy == ProxyType.ClientBlocked)
                {
                    SearchAck ack = new SearchAck();
                    ack.Source   = Network.GetLocalSource();
                    ack.SearchID = SearchID;

                    foreach (DhtLookup lookup in LookupList)
                    {
                        ack.ContactList.Add(lookup.Contact);
                    }
                }

                SearchReq req = new SearchReq();
                req.SearchID       = SearchID;
                req.EndProxySearch = true;

                ProxyTcp.SendPacket(req);
            }

            if (DoneEvent != null)
            {
                DoneEvent.Invoke(this);
            }
        }
Example #3
0
        public List <ShortestResponse> GetAllPaths(SearchReq request)
        {
            MethodBase currentMethod = MethodBase.GetCurrentMethod();

            try
            {
                DepthFirstTraversal graph = new DepthFirstTraversal(9);
                graph.addEdge(0, 1);
                graph.addEdge(0, 2);
                graph.addEdge(1, 2);
                graph.addEdge(1, 4);
                graph.addEdge(2, 1);
                graph.addEdge(2, 6);
                graph.addEdge(3, 8);
                graph.addEdge(4, 0);
                graph.addEdge(4, 2);
                graph.addEdge(5, 0);
                graph.addEdge(5, 6);
                graph.addEdge(6, 5);
                graph.addEdge(6, 7);
                graph.addEdge(7, 8);
                graph.addEdge(8, 2);
                graph.addEdge(8, 3);
                var source      = graph.datacode.FirstOrDefault(x => x.Key == request.source).Value;
                var destination = graph.datacode.FirstOrDefault(x => x.Key == request.destination).Value;
                graph.printAllPaths(source, destination);
                return(graph.ShortestResponses);
            }
            catch (Exception ex)
            {
                AirlineLogManager.Error(null, CurrentClass, currentMethod, ex);
            }
            return(null);
        }
Example #4
0
        public IActionResult SearchOrder([FromBody] SearchReq req)
        {
            var res = new SingleRsp();

            res.Data = _svc.SearchOrder(req);
            return(Ok(res));
        }
        public IActionResult SearchTTTuyenDung([FromBody] SearchReq req)
        {
            var res = new SingleRsp();

            res.Data = _svc.SearchTTTuyenDung(req.Keyword, req.Page, req.Size);
            return(Ok(res));
        }
        //map general req to TBO req
        public static HotelSearchRequest MapSearchReq(SearchReq searchReq)
        {
            List <TBO.WSDL.hotelServiceRef.RoomGuest> guests = new List <TBO.WSDL.hotelServiceRef.RoomGuest>();

            foreach (var item in searchReq.RoomGuests)
            {
                guests.Add(new TBO.WSDL.hotelServiceRef.RoomGuest()
                {
                    AdultCount = item.AdultCount,
                    ChildAge   = item.ChildAge,
                    ChildCount = item.ChildCount
                });
            }
            HotelSearchRequest TBOReq = new HotelSearchRequest
            {
                CheckInDate      = searchReq.CheckInDate.Date,
                CheckOutDate     = searchReq.CheckOutDate.Date,
                CityId           = searchReq.CityId,
                CityName         = searchReq.CityName,
                CountryName      = searchReq.CountryName,
                GuestNationality = searchReq.GuestNationality,
                NoOfRooms        = searchReq.NoOfRooms,
                RoomGuests       = guests.ToArray(),
                Filters          = new Filters {
                    HotelCodeList = string.Join(",", searchReq.HotelCodeList.ToArray())
                }
            };

            return(TBOReq);
        }
Example #7
0
        public IActionResult SelOrderInTime([FromBody] SearchReq req)
        {
            var res = new SingleRsp();

            res.Data = _svc.SearchBaiHat(req.Keyword, req.Page, req.Size);
            return(Ok(res));
        }
Example #8
0
        private string SearchPrompt(SearchReq sj, ref int np)
        {
            for (int idx = 0; idx < sj.actualHits.Count; idx++)
            {
                ADLUpdates.CallLogUpdate($"{idx} -- {sj.actualHits[idx].name} | Ratings: {sj.actualHits[idx].GetRating()}/10\n       tags:{sj.actualHits[idx].tagsAsString()}\n       desc:{new string(sj.actualHits[idx].description.Replace("<p>", string.Empty).Replace("</p>", string.Empty).Replace("\n", string.Empty).Take(60).ToArray())}\n\n");
            }

            ADLUpdates.CallLogUpdate($"\nCommands: \n     page {{page}}/{sj.nbPages}\n     select {{episode num}}");
c:
            String[] input = Console.ReadLine().ToLower().Split(' ');

            switch (input[0])
            {
            case "select":
                videoInfo = new Constructs.Video()
                {
                    hentai_video = new HentaiVideo()
                    {
                        slug = $"https://hanime.tv/videos/hentai/{sj.actualHits[int.Parse(input[1])].slug}"
                    }
                };
                ADLUpdates.CallThreadChange(false);
                return($"https://hanime.tv/videos/hentai/{sj.actualHits[int.Parse(input[1])].slug}");

            case "page":
                Console.Clear();
                np = int.Parse(input[1]);
                return("CNT");

            default:
                goto c;
            }
        }
Example #9
0
        public void SendRequest(DhtAddress address, UInt64 targetID, uint searchID, uint service, uint datatype, byte[] parameters)
        {
            SearchReq request = new SearchReq();

            request.Source     = Network.GetLocalSource();
            request.SearchID   = searchID;
            request.TargetID   = targetID;
            request.Service    = service;
            request.DataType   = datatype;
            request.Parameters = parameters;

            int sentBytes = 0;

            TcpConnect direct = Network.TcpControl.GetProxy(address);

            if (direct != null)
            {
                sentBytes = direct.SendPacket(request);
            }
            else
            {
                sentBytes = Network.SendPacket(address, request);
            }

            Core.ServiceBandwidth[request.Service].OutPerSec += sentBytes;
        }
Example #10
0
        public IActionResult getAllLop(SearchReq req)
        {
            var res     = new SingleRsp();
            var listLop = _svc.getAllLop(req.page, req.size, req.keyword);

            res.Data = listLop;
            return(Ok(res));
        }
Example #11
0
 public async Task <PageListResp <UploadFileMo> > GetUploadImgs([FromBody] SearchReq req)
 {
     if (req == null)
     {
         return(new PageListResp <UploadFileMo>().WithResp(RespTypes.ParaError, "参数错误!"));
     }
     return(await _service.GetUploadImgs(req));
 }
Example #12
0
        public IActionResult getAllHocSinh([FromBody] SearchReq req)
        {
            var res = new SingleRsp();
            var hs  = _svc.getAllHocSinh(req.page, req.size, req.keyword);

            res.Data = hs;
            return(Ok(res));
        }
Example #13
0
        public IActionResult getHocSinhByNameAndClass([FromBody] SearchReq req)
        {
            var res    = new SingleRsp();
            var listHS = _svc.getHocSinhByNameAndClass(req.page, req.size, req.keyword);

            res.Data = listHS;
            return(Ok(res));
        }
        public IActionResult getAllGiaoVien([FromBody] SearchReq req)
        {
            var res = new SingleRsp();
            var gv  = _svc.getAllGiaoVien(req.page, req.size, req.keyword);

            res.Data = gv;
            return(Ok(res));
        }
Example #15
0
        public IActionResult GetProductByCategoryName_Linq([FromBody] SearchReq req)
        {
            var res  = new SingleRsp();
            var hist = _svc.GetProductByCategoryName_Linq(req.Keyword, req.Page, req.Size, req.CategoryName, req.Gender);

            res.Data = hist;
            return(Ok(res));
        }
Example #16
0
        public IActionResult SearchProductByGender([FromBody] SearchReq req)
        {
            var res = new SingleRsp();
            var pro = _svc.SearchProductByGender(req.Keyword, req.Page, req.Size, req.Gender);

            res.Data = pro;
            return(Ok(res));
        }
Example #17
0
        public IActionResult SearchPlayList([FromBody] SearchReq req)
        {
            var res  = new SingleRsp();
            var pros = _svc.SearchPlayList(req.Keyword, req.Page, req.Size);

            res.Data = pros;
            return(Ok(res));
        }
        public IActionResult SearchCapBac([FromBody] SearchReq req)
        {
            var res       = new SingleRsp();
            var nguoidung = _svc.SearchCapBac(req.Keyword, req.Page, req.Size);

            res.Data = nguoidung;
            return(Ok(res));
        }
Example #19
0
 public Task <PageListResp <AdminInfoMo> > SearchAdmins([FromBody] SearchReq req)
 {
     if (req == null)
     {
         return(Task.FromResult(new PageListResp <AdminInfoMo>().WithResp(RespTypes.ParaError, "参数不能为空!")));
     }
     return(_service.SearchAdmins(req));
 }
Example #20
0
        public IActionResult SearchCategory([FromBody] SearchReq req)
        {
            var res = new SingleRsp();
            var pro = _svc.SearchCategory(req.Keyword, req.Page, req.Size);

            res.Data = pro;
            return(Ok(res));
        }
Example #21
0
        public IActionResult SearchNguoiDung([FromBody] SearchReq req)
        {
            var res  = new SingleRsp();
            var pros = _svc.SearchQuanTriVien(req.Keyword, req.Page, req.Size);

            res.Data = pros;
            return(Ok(res));
        }
Example #22
0
        public IActionResult SearchProducts([FromBody] SearchReq req)
        {
            var res  = new SingleRsp();
            var pros = _svc.SearchProduct(req);

            res.Data = pros;
            return(Ok(res));
        }
Example #23
0
        public IActionResult SearchAllProduct_NoPagination([FromBody] SearchReq req)
        {
            var res    = new SingleRsp();
            var search = _svc.SearchAllProduct_NoPagination(req.Keyword);

            res.Data = search;

            return(Ok(res));
        }
Example #24
0
        public async Task <PageListResp <UserInfoBigMo> > SearchUsers([FromBody] SearchReq req)
        {
            if (req == null)
            {
                return(new PageListResp <UserInfoBigMo>().WithResp(RespTypes.ParaError, "参数错误"));
            }

            return(await _service.SearchUsers(req));
        }
Example #25
0
        protected override string BuildSimpleSearchTableName(SearchReq req)
        {
            //  可能涉及领域内表关联
            var tableSql = new StringBuilder(TableName).Append(" t")
                           .Append(" inner join ").Append(RoleRep.Instance.TableName).Append(" rt")
                           .Append(" on t.role_id=rt.id");

            return(tableSql.ToString());
        }
Example #26
0
        public IActionResult SearchProduct([FromBody] SearchReq req)
        {
            var res    = new SingleRsp();
            var search = _svc.SearchProduct(req.Keyword, req.Page, req.Size);

            res.Data = search;

            return(Ok(res));
        }
        public IActionResult GetProductByCategoryId_NoPagination([FromBody] SearchReq req)
        {
            var res    = new SingleRsp();
            var cateId = _svc.GetProductByCategoryId_NoPagination(req.CategoryId);

            res.Data = cateId;

            return(Ok(res));
        }
Example #28
0
        protected Task <PageListResp <RType> > SimpleSearch <RType>(SearchReq req)
        {
            var offCount = req.GetStartRow();
            var whereSql = BuildSimpleSearchWhereSql(req.filters, out var sqlParas);

            var totalSql  = string.Concat("select count(1) from ", BuildSimpleSearchTableName(req), whereSql);
            var selectSql = string.Concat("select ", BuildSimpleSearchSelectColumns(req), " from ", BuildSimpleSearchTableName(req), whereSql, defaultOrderSql, " limit ", req.size, " offset ", offCount);

            return(GetPageList <RType>(selectSql, sqlParas, totalSql));
        }
Example #29
0
        public override string Search(bool promptUser = true)
        {
            int    np = 0;
            string a;

a:
            try
            {
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://search.htv-services.com/");
                httpWebRequest.ContentType = "application/json";
                httpWebRequest.Method      = "POST";

                string json = $"{{\"search_text\":\"{ao.term}\",\"tags\":[],\"tags_mode\":\"AND\",\"brands\":[],\"blacklist\":[],\"order_by\":\"released_at_unix\",\"ordering\":\"asc\",\"page\":{np.ToString()}}}";

                using (StreamWriter sw = new StreamWriter(httpWebRequest.GetRequestStream()))
                    sw.Write(json);

                HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();

                using (StreamReader sr = new StreamReader(response.GetResponseStream()))
                    a = sr.ReadToEnd();

                SearchReq sj = JsonSerializer.Deserialize <SearchReq>(a);

                if (sj.actualHits.Count <= 0)
                {
                    ADLUpdates.CallLogUpdate($"No videos matching search query.");
                    return(null);
                }

                ADLUpdates.CallLogUpdate($"Hits: {sj.actualHits.Count} {np}/{sj.nbPages} page");

                if (promptUser)
                {
                    ADLUpdates.CallThreadChange(true);
                    while (true)
                    {
                        string searchResponse = SearchPrompt(sj, ref np);
                        if (searchResponse == "CNT")
                        {
                            goto a;
                        }
                        return(searchResponse);
                    }
                }
                else
                {
                    return($"https://hanime.tv/videos/hentai/{sj.actualHits[0].slug}"); // Else return first video returned.
                }
            }
            catch
            {
                goto a;
            }
        }
Example #30
0
        /// <summary>
        ///  获取列表信息
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public async Task <PageListResp <UploadFileMo> > GetPageList(SearchReq search)
        {
            var whereSql = BuildSimpleSearchWhereSql(search.filters, out var sqlParas);
            var offCount = search.GetStartRow();

            var selectSql = string.Concat("select * from ", TableName, whereSql, defaultOrderSql,
                                          " limit ", search.size, " offset ", offCount);
            var totalSql = string.Concat("select count(1) from ", TableName, whereSql);

            return(await GetPageList(selectSql, sqlParas, totalSql));
        }
Example #31
0
        public void FinishSearch(string reason)
        {
            Finished     = true;
            FinishReason = reason;

            if (ProxyTcp != null)
            {
                if (ProxyTcp.Proxy == ProxyType.ClientBlocked)
                {
                    SearchAck ack = new SearchAck();
                    ack.Source = Network.GetLocalSource();
                    ack.SearchID = SearchID;

                    foreach (DhtLookup lookup in LookupList)
                        ack.ContactList.Add(lookup.Contact);
                }

                SearchReq req = new SearchReq();
                req.SearchID = SearchID;
                req.EndProxySearch = true;

                ProxyTcp.SendPacket(req);
            }

            if(DoneEvent != null)
                DoneEvent.Invoke(this);
        }
Example #32
0
        public void SendRequest(DhtAddress address, UInt64 targetID, uint searchID, uint service, uint datatype, byte[] parameters)
        {
            SearchReq request = new SearchReq();

            request.Source = Network.GetLocalSource();
            request.SearchID = searchID;
            request.TargetID = targetID;
            request.Service = service;
            request.DataType = datatype;
            request.Parameters = parameters;

            int sentBytes = 0;

            TcpConnect direct = Network.TcpControl.GetProxy(address);

            if (direct != null)
                sentBytes = direct.SendPacket(request);
            else
                sentBytes = Network.SendPacket(address, request);

            Core.ServiceBandwidth[request.Service].OutPerSec += sentBytes;
        }
Example #33
0
        // sends a direct request, no acks are returned, if  host has what is requested it sends a store request as a reply
        // make sure whatevers calling this handles the resulting store request
        public void SendDirectRequest(DhtAddress dest, ulong target, uint service, uint datatype, byte[] parameters)
        {
            SearchReq request = new SearchReq();

            request.Source      = Network.GetLocalSource();
            request.TargetID    = target;
            request.Service     = service;
            request.DataType    = datatype;
            request.Parameters  = parameters;
            request.Nodes       = false;

            int sentBytes = 0;

            TcpConnect socket = Network.TcpControl.GetProxy(dest);

            if (socket != null)
                sentBytes = socket.SendPacket(request);

            else if (dest.TunnelClient != null)
                sentBytes = Network.SendTunnelPacket(dest, request);

            else if (Core.Firewall == FirewallType.Blocked)
            {
                request.ToAddress = dest;
                sentBytes = Network.TcpControl.SendRandomProxy(request);
            }
            else
                sentBytes = Network.UdpControl.SendTo(dest, request);

            Core.ServiceBandwidth[request.Service].OutPerSec += sentBytes;

            // if remote end has what we need they will send us a store request
        }
Example #34
0
        public void Send_ProxySearchRequest()
        {
            SearchReq request = new SearchReq();

            request.Source    = Network.GetLocalSource();
            request.SearchID  = SearchID;
            request.TargetID  = TargetID;
            request.Service   = Service;
            request.DataType  = DataType;
            request.Parameters = Parameters;

            ProxyTcp.SendPacket(request);
        }
Example #35
0
        private void SendAck(G2ReceivedPacket packet, SearchReq request, SearchAck ack)
        {
            // if request came in tcp, send back tcp - scenario happens in these situations
                // req u-> open t-> fw ack t-> open u-> remote
                // fw req t-> open ack t-> fw
                // fw1 req t-> open t-> fw2 ack t-> open t-> fw1

            int bytesSent = 0;

            if (packet.ReceivedTcp)
            {
                ack.ToAddress = packet.Source;
                bytesSent = packet.Tcp.SendPacket(ack);
            }
            else
                bytesSent = Network.SendPacket(packet.Source, ack);

            Core.ServiceBandwidth[ack.Service].OutPerSec += bytesSent;
        }