コード例 #1
0
 public RequestViewModel(HotelUser worker, vwWorker hotelWorker, RequestView requestViewViewOpen)
 {
     this.worker      = worker;
     this.hotelWorker = hotelWorker;
     requestViewView  = requestViewViewOpen;
     Request          = new Request();
 }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            var connFactory = new Func<SQLiteConnectionWithLock>(() =>
                new SQLiteConnectionWithLock(
                    new SQLitePlatformWin32(),
                    new SQLiteConnectionString("requests.db", false)));

            var sqlite = new SQLiteAsyncConnection(connFactory);
            var sqliteWrapper = new SQLiteAsyncConnectionImpl(sqlite);

            sqlite.CreateTableAsync<HttpRequest>().ContinueWith(_ =>
            {
                var requestHistory = new RequestHistory(sqliteWrapper);

                var historyViewModel = new HistoryViewModel(requestHistory);
                var historyView = new HistoryView(historyViewModel);
                Grid.SetColumn(historyView, 0);
                rootGrid.Children.Add(historyView);

                var requestViewModel = new RequestViewModel(requestHistory, historyViewModel.SelectedRequestObservable);
                var requestView = new RequestView(requestViewModel);
                Grid.SetColumn(requestView, 1);
                rootGrid.Children.Add(requestView);

            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
コード例 #3
0
        public async Task <IActionResult> UpdateRequest(RequestView requestView)
        {
            var requestUpdate = await _context.requestAddTable.FindAsync(requestView.Id);

            if (requestUpdate == null)
            {
                return(NotFound());
            }
            requestUpdate.ID          = requestView.Id;
            requestUpdate.FirstName   = requestView.FirstName;
            requestUpdate.LastName    = requestView.LastName;
            requestUpdate.Email       = requestView.Email;
            requestUpdate.Address     = requestView.Address;
            requestUpdate.PhoneNumber = requestView.PhoneNumber;
            requestUpdate.Role        = requestView.Role;

            try
            {
                _context.requestAddTable.Update(requestUpdate);
                _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                throw e;
            }

            return(NoContent());
        }
コード例 #4
0
        public void CreateOrder(RequestView <RabbitRequestHeader> request)
        {
            var orderId = 0;

            if (request.issuccess && request.result != null &&
                int.TryParse(request.result.BusinessId, out orderId))
            {
                var order = saleOrderDAO.GetOrder(orderId);

                order.SetStateTo(CommData.Orders.OrderStatus.待支付);

                saleOrderDAO.UpdateState(order);

                //下面到时候需要记录日志先不处理吧
                // CacheUnitModel model = new CacheUnitModel
                // {
                //     DataBaseIndex = OrderStaticResource.DBINDEX,
                //     Expire = OrderStaticResource.GetTimeSpan(OrderActionType.订购)
                // };
                //var correlationId= request.result.GetCorrelationId();

                //var key=  OrderStaticResource.
                //                   GetCreateOrderCompleteCorrelationId(correlationId);

                //var result= new RequestView<int>
                // {
                //     issuccess = true,
                //     result = order.Id
                // };
                // _cacheStorage.SetAdd(model, key, result);
            }
        }
コード例 #5
0
        public ResponseView Post([FromBody] RequestView request)
        {
            Stopwatch sw1 = new Stopwatch();

            sw1.Start();
            string    threadId;
            string    state;
            long      processingTime;
            long      responseTime;
            Stopwatch sw2 = new Stopwatch();

            sw2.Start();
            if (request != null)
            {
                threadId = request.ThreadId;
                state    = "OK";
            }
            else
            {
                threadId = null;
                state    = "ERROR";
            }
            sw2.Stop();
            processingTime = sw2.ElapsedMilliseconds;
            sw1.Stop();
            responseTime = sw1.ElapsedMilliseconds;
            var response = new ResponseView {
                State = state, ThreadId = threadId, ResponseTime = responseTime, ProcessingTime = processingTime
            };

            sw1.Reset();
            sw2.Reset();
            return(response);
        }
コード例 #6
0
        public HttpResponseMessage Step1(RequestView data)
        {
            var id = _process.Step(data.Token, data.ProductId, data.StowageFactorId, data.StowageFactor, data.QuantityId, data.Quantity, data.ToleranceId, data.Terms, data.LoadingConditionId, data.UnLoadingConditionId, data.LoadPortId,
                                   data.LoadTerminalId, data.LoadingRate, data.DischargePortId, data.DischargeTerminalId, data.UnLoadingRate, data.StartLaycan, data.EndLaycan, UpdatedId);

            return(Request.CreateResponse(HttpStatusCode.OK, new
            {
                id = id
            }));
        }
コード例 #7
0
        public ActionResult Requests(RequestView model)
        {
            if (ModelState.IsValid)
            {
                // Don't reveal that the user does not exist or is not confirmed
                return(View("Requests"));
            }

            return(View(model));
        }
コード例 #8
0
        public HttpResponseMessage Step2(Guid id, RequestView data)
        {
            var item = _process.Step2(id, data.Status, data.Continue, UpdatedId);

            //var info = _process.GetRequest(id, UpdatedId, 0);
            //Notifications.NotifyClientActivity(info, TypeNotifications.Notifications, $"New Request", HttpStatusCode.OK);
            return(Request.CreateResponse(HttpStatusCode.OK, new
            {
                data = item
            }));
        }
コード例 #9
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
        public Places Countries(string appId, RequestView view = RequestView.Short)
        {
            var response = ChannelCountries(appId, view);
            var results  = response.Results;

            if (results != null)
            {
                results.Items = new ReadOnlyCollection <Place>(results.JsonItems.ToPlaces());
            }
            return(results);
        }
コード例 #10
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
 public Place Place(int woeId, string appId, RequestView view = RequestView.Long)
 {
     try
     {
         var response = ChannelPlace(woeId, appId, view);
         return(response.Result.ToPlace());
     }
     catch (EndpointNotFoundException)
     {
         return(null);
     }
 }
コード例 #11
0
        public RequestView GetRequest(int?souvenirID)
        {
            RequestView rv      = new RequestView();
            var         request = db.requests.Find(souvenirID);

            rv.requestID = request.requestID;
            rv.userName  = request.userName;
            rv.amount    = request.amount;
            rv.reward    = request.reward;
            rv.status    = request.status;

            rv.souvenirName = request.souvenir.souvenirName;
            rv.countrySouv  = request.souvenir.countrySouv;

            rv.price           = request.souvenir.souvenirInfo.price;
            rv.currency        = request.souvenir.souvenirInfo.currency;
            rv.descriptionSouv = request.souvenir.souvenirInfo.descriptionSouv;

            var customer = db.customers.Find(rv.userName);

            rv.eMail           = customer.profile.eMail;
            rv.countryUser     = customer.countryUser;
            rv.firstName       = customer.profile.firstName;
            rv.surname         = customer.profile.surname;
            rv.birthday        = customer.profile.birthday;
            rv.descriptionUser = customer.profile.descriptionUser;

            try
            {
                List <CustomerRating> customerRatings = new List <CustomerRating>();
                customerRatings = customer.customerRatings.ToList();

                foreach (CustomerRating cr in customerRatings)
                {
                    rv.rating += cr.rating.ratingValue;
                }
                rv.ratingCount = customerRatings.Count;
                rv.rating     /= rv.ratingCount;
                rv.rating      = Math.Round(rv.rating, 1);
                int ratingRounded = (int)rv.rating;
                rv.ratingDescription = db.ratings.Find(ratingRounded).ratingValueDescription;
            }
            catch (Exception)
            {
                rv.ratingCount       = 0;
                rv.rating            = 0;
                rv.ratingDescription = "no Ratings";
            }


            return(rv);
        }
コード例 #12
0
        public HttpResponseMessage ChangeStatusRequest(Guid id, RequestView data)
        {
            var onwers = _process.ChangeStatusRequest(id, data.Status, UpdatedId);

            foreach (var item in onwers)
            {
                Notifications.NotifyClientActivity(item, TypeNotifications.Notifications, $"Update Request for Owner Vessel", HttpStatusCode.OK, item.Owner);
            }
            return(Request.CreateResponse(HttpStatusCode.OK, new
            {
                data = data
            }));
        }
コード例 #13
0
 public void AddNewRequestExecute()
 {
     try
     {
         RequestView main = new RequestView(worker, HotelUser);
         main.Show();
         workerLogedInView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #14
0
        public HttpResponseMessage InboxVessel(int pageIndex, int pageSize, RequestView data)
        {
            int _rowcount = 0;

            return(Request.CreateResponse(HttpStatusCode.OK, new
            {
                data = new PagerRecord <dynamic>(list: _process.InboxVesselRequest(pageIndex, pageSize, UpdatedId, UpdatedId, out _rowcount, data.ProductId, data.StowageFactorId, data.QuantityId, data.LoadPortId, data.LoadTerminalId,
                                                                                   data.DischargePortId, data.DischargeTerminalId, data.StartLaycan, data.EndLaycan, data.Status),
                                                 page: pageIndex,
                                                 pageSize: pageSize,
                                                 allItemsCount: _rowcount)
            }));
        }
コード例 #15
0
        private void _btnLog_Click(object sender, RoutedEventArgs e)
        {
            Button btnLog = (Button)sender;

            RequestView        iv  = (RequestView)btnLog.DataContext;
            ServiceHistoryView shv = new ServiceHistoryView()
            {
                AccountID   = int.Parse(iv.AccountID),
                ServiceName = iv.ServiceName,
                InstanceID  = int.Parse(iv.InstanceID),
                Outcome     = iv.Outcome
            };
            Log l = new Log(shv);

            l.Show();
        }
コード例 #16
0
        private void OnInviteFriendsClicked(object sender, RoutedEventArgs e)
        {
            AppContent.Visibility = Visibility.Collapsed;
            FacebookClient client     = new FacebookClient(AccessToken);
            dynamic        parameters = new ExpandoObject();

            parameters.app_id       = ClientId;
            parameters.message      = "Invite your friends";
            parameters.title        = "Invite friends";
            parameters.redirect_uri = "https://wp.qmatteoq.com/";

            Uri dialogUrl = client.GetDialogUrl("apprequests", parameters);

            RequestView.Visibility = Visibility.Visible;
            RequestView.Navigate(dialogUrl);
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: axtox/liepa-demo
        private static async Task <string> Create(int id, string name, string status)
        {
            var request = new RequestView {
                User = new UserView {
                    Id     = id,
                    Name   = name,
                    Status = status
                }
            };

            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));

            var response = await Client.PostAsync("auth/createuser", request,
                                                  new XmlMediaTypeFormatter { UseXmlSerializer = true });

            return(await response.Content.ReadAsStringAsync());
        }
コード例 #18
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
 public Places Counties(int woeId, string appId, RequestView view = RequestView.Short)
 {
     try
     {
         var response = ChannelCounties(woeId, appId, view);
         var results  = response.Results;
         if (results != null)
         {
             results.Items = new ReadOnlyCollection <Place>(results.JsonItems.ToPlaces());
         }
         return(results);
     }
     catch (EndpointNotFoundException)
     {
         return(null);
     }
 }
コード例 #19
0
        public async Task <IActionResult> CreateUser(RequestView requestView)
        {
            if (requestView.User == null)
            {
                return(NoContent());
            }

            var userStatus = await _databaseService.GetStatus(requestView.User.Status);

            var user = new User {
                UserId   = requestView.User.Id,
                Name     = requestView.User.Name,
                StatusId = userStatus.StatusId
            };

            var createdUser = await _databaseService.Put(user);

            return(Created("", new UserView(createdUser)));
        }
コード例 #20
0
 /// <summary>
 /// Creates a new request.
 /// </summary>
 private void CreateRequest()
 {
     if (!SelectedItem.IsAvailable)
     {
         MessageBox.Show("Selected vehicle is not available for requests.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         var request = new RequestViewModel {
             VinNumber = SelectedItem.VinNumber
         };
         var view = new RequestView
         {
             Owner       = Application.Current.MainWindow,
             DataContext = request
         };
         view.ShowDialog();
     }
 }
コード例 #21
0
        private string PrepareRequest()
        {
            var encoding       = Encoding.GetEncoding(ParameterEncodingName);
            var parametersJson = PrepareRequestCore();

            var md5Str = Encrpty.MD5Encrypt(parametersJson + JsonConfig.JsonRead("md5Key", "Installment"));
            var aesStr = Encrpty.AESEecrypt(parametersJson, JsonConfig.JsonRead("aesKey", "Installment"));

            Collection.DDD.Logger.LoggerFactory.Instance.Logger_Info(string.Format("提交参数:{0}", parametersJson), "InstallmentService");

            var request = new RequestView()
            {
                data        = aesStr,
                midPlatform = JsonConfig.JsonRead("md5Key", "midPlatform"),
                sign        = md5Str,
                version     = JsonConfig.JsonRead("md5Key", "version")
            };

            return(JsonConvert.SerializeObject(request));
        }
コード例 #22
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
 public Places Places(string query, string appId, RequestView view = RequestView.Long)
 {
     try
     {
         var response = ChannelPlaces(query, appId, view);
         var results  = response.Results;
         if (results != null)
         {
             results.Items = new ReadOnlyCollection <Place>(
                 results.JsonItems != null
                     ? results.JsonItems.ToPlaces()
                     : new List <Place>()
                 );
         }
         return(results);
     }
     catch (ArgumentException)
     {
         return(null);
     }
 }
コード例 #23
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
 private PlacesResponse ChannelCounties(int woeId, string appId, RequestView view, int retry = 0)
 {
     try
     {
         return(Channel.Counties(woeId.ToString(CultureInfo.InvariantCulture), appId, view));
     }
     catch (ProtocolException ex)
     {
         if (retry < RetryLimit && ex.InnerException is WebException)
         {
             return(ChannelCounties(woeId, appId, view, ++retry));
         }
         throw;
     }
     catch (SerializationException ex)
     {
         if (retry < RetryLimit && ex.Message.StartsWith(XmlDeserializeMessage, StringComparison.Ordinal))
         {
             return(ChannelCounties(woeId, appId, view, ++retry));
         }
         throw;
     }
 }
コード例 #24
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
 private PlacesResponse ChannelPlaces(string query, string appId, RequestView view, int retry = 0)
 {
     try
     {
         return(Channel.Places(query, appId, view));
     }
     catch (ProtocolException ex)
     {
         if (retry < RetryLimit && ex.InnerException is WebException)
         {
             return(ChannelPlaces(query, appId, view, ++retry));
         }
         throw;
     }
     catch (SerializationException ex)
     {
         if (retry < RetryLimit && ex.Message.StartsWith(XmlDeserializeMessage, StringComparison.Ordinal))
         {
             return(ChannelPlaces(query, appId, view, ++retry));
         }
         throw;
     }
 }
コード例 #25
0
ファイル: GeoPlanetClient.cs プロジェクト: eastlands-zz/NGeo
 private PlacesResponse ChannelPlaces(string query, string appId, RequestView view, int retry = 0)
 {
     try
     {
         return(Channel.Places(query, appId, view));
     }
     catch (ProtocolException ex)
     {
         if (retry < RetryLimit && ex.InnerException is WebException)
         {
             return(ChannelPlaces(query, appId, view, ++retry));
         }
         throw;
     }
     catch (SerializationException ex)
     {
         if (retry < RetryLimit && ex.Message.StartsWith("Unable to deserialize XML body"))
         {
             return(ChannelPlaces(query, appId, view, ++retry));
         }
         throw;
     }
 }
コード例 #26
0
ファイル: GeoPlanetClient.cs プロジェクト: eastlands-zz/NGeo
 private PlacesResponse ChannelStates(int woeId, string appId, RequestView view, int retry = 0)
 {
     try
     {
         return(Channel.States(woeId.ToString(CultureInfo.InvariantCulture), appId, view));
     }
     catch (ProtocolException ex)
     {
         if (retry < RetryLimit && ex.InnerException is WebException)
         {
             return(ChannelStates(woeId, appId, view, ++retry));
         }
         throw;
     }
     catch (SerializationException ex)
     {
         if (retry < RetryLimit && ex.Message.StartsWith("Unable to deserialize XML body"))
         {
             return(ChannelStates(woeId, appId, view, ++retry));
         }
         throw;
     }
 }
コード例 #27
0
        public static void Test(HttpClient client)
        {
            var threadName = Thread.CurrentThread.Name;
            var request    = new RequestView {
                ThreadId = threadName
            };
            XmlSerializer serializer   = new XmlSerializer(typeof(RequestView));
            var           subReq       = new RequestView();
            var           xml          = "";
            var           memoryStream = new MemoryStream();

            using (var sww = new StringWriter())
            {
                using (XmlWriter writer = XmlWriter.Create(sww, new XmlWriterSettings()
                {
                    OmitXmlDeclaration = true
                }))
                {
                    serializer.Serialize(writer, request);
                    xml = sww.ToString();
                }
            }
            Stopwatch sw            = new Stopwatch();
            var       stringContent = new StringContent(xml, Encoding.UTF8, "text/xml");

            sw.Start();
            var    response    = client.PostAsync(string.Format("https://localhost:44378/home/Post.xml"), stringContent).Result;
            string apiResponse = response.Content.ReadAsStringAsync().Result;

            Append(apiResponse);
            sw.Stop();
            var time = sw.ElapsedMilliseconds;

            Console.WriteLine(apiResponse);
            Console.WriteLine("Time from request to response for a thread " + threadName + " - " + time);
            sw.Reset();
        }
コード例 #28
0
        // GET: Request/Details/5
        public ActionResult Details(int?id)
        {
            try
            {
                string userName = Session["userName"].ToString();

                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                RequestView request = GetRequest(id);

                if (request == null)
                {
                    return(HttpNotFound());
                }
                return(View(request));
            }
            catch (Exception)
            {
                return(RedirectToAction("Login", "Customer"));
            }
        }
コード例 #29
0
 public Places Places(string query, RequestView view = RequestView.Long)
 {
     return _client.Places(query, _appId, view);
 }
コード例 #30
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
 public Places Level2Admins(int woeId, string appId, RequestView view = RequestView.Short)
 {
     return(Counties(woeId, appId, view));
 }
コード例 #31
0
 public PlaceType Type(int typeCode, RequestView view = RequestView.Short)
 {
     return _client.Type(typeCode, _appId, view);
 }
コード例 #32
0
 public Places Countries(RequestView view = RequestView.Short)
 {
     return _client.Countries(_appId, view);
 }
コード例 #33
0
ファイル: GeoPlanetClient.cs プロジェクト: Nirad/NGeo
        public PlaceType Type(int typeCode, string appId, RequestView view = RequestView.Short)
        {
            var types = Types(appId, view);

            return(types.Items.SingleOrDefault(t => t.Code == typeCode));
        }
コード例 #34
0
 public Places Level2Admins(int woeId, RequestView view = RequestView.Short)
 {
     return(_client.Level2Admins(woeId, _appId, view));
 }
コード例 #35
0
 public Places Level2Admins(int woeId, RequestView view = RequestView.Short)
 {
     return _client.Level2Admins(woeId, _appId, view);
 }
コード例 #36
0
 public PlaceTypes Types(RequestView view = RequestView.Long)
 {
     return _client.Types(_appId, view);
 }
コード例 #37
0
 public Place Parent(int woeId, RequestView view = RequestView.Long)
 {
     return _client.Parent(woeId, _appId, view);
 }
コード例 #38
0
 public Places Ancestors(int woeId, RequestView view = RequestView.Short)
 {
     return _client.Ancestors(woeId, _appId, view);
 }
コード例 #39
0
 public Places Counties(int woeId, RequestView view = RequestView.Short)
 {
     return _client.Counties(woeId, _appId, view);
 }
コード例 #40
0
 public Places BelongTos(int woeId, RequestView view = RequestView.Short)
 {
     return _client.BelongTos(woeId, _appId, view);
 }