示例#1
0
        public void TestingSomeLinq()
        {
            var client = new RequestClient("http://localhost:5984/");
            var api = new CouchApi(client, "trivial");

            //var cars = query.Where(p => (((p.Make == "Saab" || (p.Model == "1337" && p.HorsePowers == 200)) || p.Make != "Volvo") && p.Model != "2013")).ToList();
            //var cars = query.Where(p => (p.Make == "Saab" && (p.Model == "1337" || p.HorsePowers == 1337))).ToList();
            Console.WriteLine("Starting to process queries...");
            var stopwatch = new Stopwatch();
            stopwatch.Start();
            var cars = new List<object>();
            for (var i = 0; i < 1000; i++)
            {
                var car = new Car {Id = Guid.NewGuid().ToString(), HorsePowers = 10 + i, Make = "Audi", Model = i.ToString()};
                dynamic obj = new CouchObjectProxy<Car>(car);
                obj.Test = "Test123";
                cars.Add(obj);
            }
            var request = new BulkDocsRequest(cars);
            var responseData = api.Root().Db("trivial").BulkDocs().Post<BulkDocsRequest, BulkDocsResponse>(request);

            stopwatch.Stop();
            Console.WriteLine("Finished!");
            Console.WriteLine("Elapsed: {0}", stopwatch.ElapsedMilliseconds);
        }
示例#2
0
 protected void btnRequestCancel_Click(object sender, EventArgs e)
 {
     if (hidRequestID.Value == "")
     {
         return;
     }
     else
     {
         RequestClient client = new RequestClient();
         //call cancel request
         int requestID = int.Parse(hidRequestID.Value);
         try
         {
             client.CancelRequest(NUSNetUser(), requestID);
             retRequest(requestID);
             Alert.Show("Request Cancelled!");
         }
         catch (Exception)
         {
             Alert.Show("Request Failed to cancel!");
         }
         finally
         {
             client.Close();
         }
     }
 }
示例#3
0
        public async void GetAsyncMethodWithoutQueryStringShouldReturnValidResult()
        {
            //Act
            var result = await RequestClient.SetBaseUri(BaseUri).GetAsync <ResultDto>($"{Action}");

            //Assert
            Assert.NotNull(result);
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.NotNull(result.Result);
            Assert.Null(result.Result.args.test);
        }
示例#4
0
        public async Task <IActionResult> DriverEdit(RequestClient request)
        {
            User user = db.Users.FirstOrDefault(r => r.Id == request.UserId);



            db.RequestClients.Update(request);
            await db.SaveChangesAsync();

            return(RedirectToAction("Driver", user));
        }
        public void PutMethodWithoutBodyShouldReturnValidResult()
        {
            //Act
            var result = RequestClient.SetBaseUri(BaseUri).Put <ResultDto>(Action);

            //Assert
            Assert.NotNull(result);
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.NotNull(result.Result);
            Assert.Null(result.Result.json);
        }
        public async void PutAsyncMethodWithoutBodyAndWithStringReturnTypeShouldReturnValidResult()
        {
            //Act
            var result = await RequestClient.SetBaseUri(BaseUri).PutAsync(Action);

            //Assert
            Assert.NotNull(result);
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.NotNull(result.Result);
            Assert.Null(result.Result.Deserialize <ResultDto>().json);
        }
示例#7
0
        private static void RefreshDancers()
        {
            GetDancersInterval.Change(Timeout.Infinite, Timeout.Infinite);

            RequestClient.GetGame(GameId).ContinueWith(getGameTask =>
            {
                Dancers = getGameTask.Result ?? Dancers;
                lock (STATE_CHANGED_LOCK) ChangeState = true;
                GetDancersInterval.Change(1000, 1000);
            });
        }
        /// <summary>
        /// Cancel the currently ongoing web request for the tile's image.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">There is no request in progress.</exception>
        public void CancelImageRequest()
        {
            if (!isPerformingRequest)
            {
                throw new InvalidOperationException("There is no request to cancel.");
            }

            IsRequestCancelled = true;

            RequestClient.CancelAsync();
        }
 public void GetListUsers_ValidateResponseTimeShouldbeLessThanAMinute()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var watch    = Stopwatch.StartNew();
         var response = client.Get(urlParams: ListUsersEndPoint);
         watch.Stop();
         response.StatusCode.Should().Be(HttpStatusCode.OK);
         watch.ElapsedMilliseconds.Should().BeLessThan(60000);
     }
 }
示例#10
0
        public async void PostAsyncMethodWithNullBodyShouldReturnValidResult()
        {
            //Act
            var result = await RequestClient.SetBaseUri(BaseUri).PostAsync <ResultDto>(Action, null);

            //Assert
            Assert.NotNull(result);
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.NotNull(result.Result);
            Assert.Null(result.Result.json);
        }
        public void DeleteMethodWithoutQueryStringShouldReturnValidResult()
        {
            //Act
            var result = RequestClient.SetBaseUri(BaseUri).Delete <ResultDto>(Action);

            //Assert
            Assert.NotNull(result);
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.NotNull(result.Result);
            Assert.Null(result.Result.args.test);
        }
示例#12
0
 void SendCommand(object sender, EventArgs e)
 {
     //Verifica o tipo de controle
     if (controle.conexao == "1" || controle.conexao == "3")
     {
         //SendViaBluetooth(controle.bluetooth);
     }
     else
     {
         RequestClient.SendControle(controle.ip, "/?1");
     }
 }
示例#13
0
    private static void DownloadPlayer(RequestClient c, int playerId, string dataDirPath)
    {
        var playerPath = Path.Combine(dataDirPath, "player", playerId.ToString(provider: null));
        var d          = new JsonDownloader(c, playerPath);

        d.Update(filenameOrRelPath: "player.json", c => c.GetPlayerAsync(playerId));
        d.Update(filenameOrRelPath: "godranks.json", c => c.GetPlayerGodRanksAsync(playerId));
        d.Update(filenameOrRelPath: "friends.json", c => c.GetPlayerFriendsAsync(playerId));
        d.Update(filenameOrRelPath: "achievements.json", c => c.GetPlayerAchievementsAsync(playerId));
        d.Update(filenameOrRelPath: "status.json", c => c.GetPlayerStatusAsync(playerId));
        d.Update(filenameOrRelPath: "matchhistory.json", c => c.GetPlayerMatchHistoryAsync(playerId));
    }
示例#14
0
        public async Task Post(bool success, string name, string email, string address, string state, string city, string zipCode, string phone)
        {
            RequestClient client = new RequestClient()
            {
                Address = address, City = city, Email = email, Name = name, Phone = phone, State = state, ZipCode = zipCode
            };
            var httpClient  = _factory.CreateClient();
            var httpContent = new StringContent(JsonConvert.SerializeObject(client, serializerSettings), Encoding.UTF8, "application/json");
            var response    = await httpClient.PostAsync("/api/Client", httpContent);

            Assert.AreEqual(success, response.EnsureSuccessStatusCode());
        }
示例#15
0
 public IActionResult Result(RequestClient request)
 {
     if (request != null)
     {
         var result = db.RequestClients.Include(u => u.User).FirstOrDefault(r => r.Id == request.Id);
         return(View(result));
     }
     else
     {
         return(BadRequest());
     }
 }
示例#16
0
        // Retrieves novel text
        /// <summary>
        /// View the full contents of a novel.
        /// </summary>
        /// <param name="id">The ID of the novel to view.</param>
        /// <returns><seealso cref="NovelText"/></returns>
        public async Task <NovelText> ViewNovelTextAsync(string id)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "novel_id", id }
            };
            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.ViewNovelText, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <NovelText>(response));
        }
示例#17
0
        /// <summary>
        /// Gets a list of novels by the specified user.
        /// </summary>
        /// <param name="UserID">The ID of the user to view novels of.</param>
        /// <returns><seealso cref="NovelSearchResult"/></returns>
        public async Task <NovelSearchResult> UserNovelsAsync(string UserID)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "user_id", UserID }
            };
            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.ProfileNovels, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <NovelSearchResult>(response));
        }
示例#18
0
        /// <summary>
        /// Gets a list of replies to a comment.
        /// </summary>
        /// <param name="id">The ID of the comment to get replies for.</param>
        /// <returns><seealso cref="CommentList"/></returns>
        public async Task <CommentList> NovelCommentRepliesAsync(string id)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "comment_id", id }
            };
            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.NovelCommentReplies, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <CommentList>(response));
        }
示例#19
0
        public async Task <IActionResult> Done(int?id)
        {
            if (id != null)
            {
                RequestClient request = await db.RequestClients.FirstOrDefaultAsync(r => r.Id == id);

                if (request != null)
                {
                    return(View(request));
                }
            }
            return(NotFound());
        }
        /**
         * GET /PCMIS_App.asmx/UpdateApp_CarOrderInfo?&Signature=14fe20b552b80d6c02988fc2e948f49d9c2feb02&Nonce=1215511576&Timestamp=1215511376&RecordID=0155be1d4a394150a00a1c6a099a56ba&GradeType=3&GradeContent=%E5%BE%88%E5%A5%BD&TeacherStar=05&SchoolStar=05&TeacherScoreCodes=050101|050201|050301|050401|050501&SchoolScoreCodes=050101|050201|050301 HTTP/1.1
         */

        public static ModelBase DoComment(ApiCode code, string reserveRecordId)
        {
            var request = GetNewRequest(code, UrlManager.UpdateApp_CarOrderInfo);

            request.AddParameter("RecordID", reserveRecordId);
            request.AddParameter("GradeType", 3);
            request.AddParameter("GradeContent", UrlManager.MyComment);
            request.AddParameter("TeacherStar", "05");
            request.AddParameter("SchoolStar", "05");
            request.AddParameter("TeacherScoreCodes", "050101|050201|050301|050401|050501");
            request.AddParameter("SchoolScoreCodes", "050101|050201|050301");
            return(RequestClient.DoWithRequest <ModelBase>(request));
        }
示例#21
0
 public void Login_UserShouldGetValidErrorMessageWithInvaildParameters()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var data = new LoginCredentials()
         {
             email = "*****@*****.**",
         };
         var response = client.Post <ErrorMessage, LoginCredentials>(data,
                                                                     LoginEndPoint);
         response.error.Should().Be("Missing password");
     }
 }
示例#22
0
 public void Login_UserShouldGetBadRequestStatusCodeWithInvalidValidCredentials()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var data = new LoginCredentials()
         {
             email = "*****@*****.**",
         };
         var response = client.Post(data,
                                    LoginEndPoint);
         response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
     }
 }
示例#23
0
        private static async Task JoinGame()
        {
            Dancers = null;

            do
            {
                Console.WriteLine("Enter Id of game to join: ");
                GameId = Console.ReadLine();

                if (GameId?.ToUpper() == "Q")
                {
                    return;
                }

                Dancers = await RequestClient.GetGame(GameId);

                if (Dancers == null)
                {
                    Console.WriteLine($"No dancers found for gameId: {GameId}");
                }
            } while (Dancers == null);
            //Found a game

            Console.CursorVisible = false;

            var response = await User.JoinGame(GameId);

            if (response == null)
            {
                Debugger.Launch();
            }

            User          = response;
            User.Position = new Point(-1, -1); // HACK

            GetDancersInterval.Change(100, 100);
            DrawInterval.Change(100, 100); //start the fun
            while (GetDirection())
            {
                if (Q.Count > 0)
                {
                    Dancers = await new MoveRequest
                    {
                        Direction = Q.Dequeue(),
                        Identity  = User.Identity
                    }.SubmitMove(GameId);
                    lock (STATE_CHANGED_LOCK)
                        ChangeState = true;
                }
            }
        }
示例#24
0
        public InventoryVm(RequestClient client, Player player, SceneManagerVm sceneManager)
        {
            this.client       = client;
            this.player       = player;
            this.sceneManager = sceneManager;

            client.SubscribeTo <DroppedItemAlert>(this, OnDroppedItemsAlert);
            client.SubscribeTo <PickupItemAlert>(this, OnPickupItemAlert);

            Items        = new DroppableList();
            DroppedItems = new DroppableList();
            Equipment    = new Equipment();
            GetInventory();
        }
示例#25
0
 public void Login_UserShouldGetCookiesInResponseHeaderWithValidCredentials()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var data = new LoginCredentials()
         {
             email    = "*****@*****.**",
             password = "******"
         };
         var response = client.Post(data,
                                    LoginEndPoint);
         response.Headers.GetValues("Set-Cookie").Should().NotBeNull();
     }
 }
示例#26
0
 public void Login_UserShouldGetTokenValueWithValidCredentials()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var data = new LoginCredentials()
         {
             email    = "*****@*****.**",
             password = "******"
         };
         var response = client.Post <Success, LoginCredentials>(data,
                                                                LoginEndPoint);
         response.token.Should().NotBe(null);
     }
 }
示例#27
0
        private void retrieveRequesteePW()
        {
            RequestClient client = new RequestClient();
            try{
               string pw =  client.GetOtp(txtEmail.Text.Trim());

               MailHandler.sendForgetPassword(pw, txtEmail.Text.Trim(), 2);

            }catch(Exception ex){
                Alert.Show(ex.Message);
            }

            client.Close();
        }
示例#28
0
        /// <summary>
        /// Gets a list of recommended novels.
        /// </summary>
        /// <param name="RankingNovels">Whether to include ranking novels.</param>
        /// <param name="PrivacyPolicy"></param>
        /// <returns><seealso cref="RecommendedNovels"/></returns>
        public async Task <RecommendedNovels> RecommendedNovelsAsync(bool RankingNovels = true, bool PrivacyPolicy = true)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "include_ranking_novels", RankingNovels.ToString().ToLower() },
                { "include_privacy_policy", PrivacyPolicy.ToString().ToLower() }
            };
            FormUrlEncodedContent encodedParmas = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.RecommendedNovels, encodedParmas).ConfigureAwait(false);

            return(Json.DeserializeJson <RecommendedNovels>(response));
        }
示例#29
0
        protected void btnRequestSave_Click(object sender, EventArgs e)
        {
            //WARNING: Do not use a fake email to test!
            if (hidRequestID.Value == "")
            {
                //Add New Request
                RequestClient client = new RequestClient();
                try
                {
                    string otp = client.CreateNewRequest(NUSNetUser(), EventID(), txtToWho.Text.Trim(), txtRequestDesc.Text.Trim(), txtFileUrl.Text.Trim(), txtRequestTitle.Text.Trim());

                    string url = Request.Url.ToString().Replace(Request.RawUrl.Replace("%2f", "/"), "") + "/SignIn.aspx?mode=2";
                    MailHandler.sendRequesteeMail(NUSNetUser().Name, EventID(), txtRequestTitle.Text.Trim(), txtToWho.Text.Trim(), url, otp);

                    Alert.Show("Request Created Successfully!");
                    btnRequestNew_Click(sender, e);
                    RequestEvents(dpFrom.CalDate, dpTo.CalDate);

                }
                catch (Exception ex)
                {
                    Alert.Show("Error Creating Request with error: " + ex.Message);
                    //throw;
                }
                finally
                {
                    client.Close();
                }
            }
            else
            {
                int requestID = int.Parse(hidRequestID.Value);
                RequestClient client = new RequestClient();
                try
                {
                    client.EditRequest(NUSNetUser(), requestID, txtRequestDesc.Text.Trim(), txtFileUrl.Text.Trim());
                    retRequest(requestID);
                    Alert.Show("Request updated Successfully!");
                }
                catch (Exception)
                {
                    Alert.Show("Error Updating Request");
                    //throw;
                }
                finally
                {
                    client.Close();
                }
            }
        }
示例#30
0
        /// <summary>
        /// Gets a list of novels bookmarked by the given user.
        /// </summary>
        /// <param name="UserID">The ID of the user to view novel bookmarks of.</param>
        /// <param name="restrict">The publicity of bookmarks to view. Can be: 'all', 'public' or 'private'.</param>
        /// <returns><seealso cref="NovelSearchResult"/></returns>
        public async Task <NovelSearchResult> BookmarkedNovelsAsync(string UserID, Publicity restrict = Publicity.Public)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "user_id", UserID },
                { "restrict", restrict.JsonValue() }
            };
            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.BookmarkedNovels, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <NovelSearchResult>(response));
        }
示例#31
0
        /// <summary>
        /// Gets information about a novel series.
        /// </summary>
        /// <param name="novelSeriesID">The novel series ID to get information for.</param>
        /// <returns><seealso cref="NovelSeriesInfo"/></returns>
        public async Task <NovelSeriesInfo> NovelSeriesInfoAsync(string novelSeriesID)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "series_id", novelSeriesID }
            };

            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.NovelSeries, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <NovelSeriesInfo>(response));
        }
示例#32
0
 public void CreateUser_ValidateUserShouldNotBeAbleToCreateUserWithSameExistingId()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var data = new User()
         {
             name = "morpheus",
             job  = "leader",
             id   = "799"
         };
         var response = client.Post(data, CreateUserEndPoint);
         response.Should().NotBe(HttpStatusCode.Created);
     }
 }
示例#33
0
 public void CreateUser_ValidateResponseHeadersAreComingAsExpected()
 {
     using (var client = new RequestClient(BaseAddress))
     {
         var data = new User()
         {
             name = "Sanjeev",
             job  = "Test Engineer"
         };
         var response = client.Post(data, CreateUserEndPoint);
         response.Headers.GetValues("Server").Should().Contain("cloudflare");
         response.Headers.GetValues("Set-Cookie").Should().NotBeNull();
     }
 }
示例#34
0
        public void CreateUser_UserShouldGetCreatedStatusCodeWithValidData()
        {
            using (var client = new RequestClient(BaseAddress))
            {
                var data = new User()
                {
                    name = "Sanjeev",
                    job  = "Test Engineer"
                };

                var response = client.Post(data, CreateUserEndPoint);
                response.StatusCode.Should().Be(HttpStatusCode.Created);
            }
        }
示例#35
0
        public void When_getting_data_from_then_server__Then_it_should_be_deserialized()
        {
            var client = new RequestClient("http://localhost:5984/");
            var api = new CouchApi(client);

            var responseData = api.Root().Stats().Get<dynamic>();

            var rootData = api.Root().Get<HttpGetRoot>();
            Assert.IsNotNull(rootData);

            var configData = api.Root().Config().Get<dynamic>();
            Assert.IsNotNull(configData);

            var configSectionData = api.Root().Config().Section("daemons").Get<dynamic>();
            var indexServer = configSectionData.DataDeserialized.index_server.ToString();
            Assert.IsNotNull(configSectionData);

            var dbData = api.Root().Db("Test").Get<dynamic>();
            if (dbData.StatusCode != HttpStatusCode.OK)
            {
                var newDbData = api.Root().Db("Test").Put<dynamic, object>();
            }
            var person = new Person();
            person.FirstName = "André";
            person.LastName = "Biseth";
            person.BirthDate = new DateTime(1974, 3, 12);
            person.Weight = 78;
            person.Height = 178;

            var post = api.Root().Db("test").Doc().Post<Person, dynamic>(person);
            Assert.IsNotNull(post);

            var getDoc = api.Root().Db("test").Doc("Test").Get<Person>();
            Assert.IsNotNull(getDoc);

            getDoc.DataDeserialized.Weight = 77;

            var postDoc = api.Root().Db("test").Doc("Test").Put<Person, dynamic>(getDoc.DataDeserialized, (string)getDoc.DynamicData._rev);
            Assert.IsNotNull(postDoc);
        }
示例#36
0
        bool AuthRequestees(string username, string password)
        {
            RequestClient reqClient = new RequestClient();

            try
            {
                Requestee r = reqClient.ValidateRequestee(username, password);
                reqClient.Close();
                Session["ReQuestEE"] = r;
                return true;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message, false);
            }
            finally
            {
                reqClient.Close();
            }
            return false;
        }
示例#37
0
 protected BaseService()
 {
     Client = RequestClient.Instance;
 }
示例#38
0
        private void retRequest(int RequestID, int page = 0)
        {
            Request request;
            hidRequestID.Value = RequestID.ToString();
            RequestClient client = new RequestClient();
            request = client.GetRequest(RequestID);
            client.Close();

            txtFrmWho.Text = RequestorName(request.Requestor);
            txtRequestTitle.Text = request.Title;
            txtRequestDesc.Text = request.Description;

            for (int i = 0; i < ddlRequesteeStatus.Items.Count; i++)
            {
                if (ddlRequesteeStatus.Items[i].Value == request.Status.ToString())
                {
                    ddlRequesteeStatus.SelectedIndex = i;
                    break;
                }
            }

            if (request.Status == RequestStatus.Pending)
            {
                btnApprove.Visible = true;
                btnReject.Visible = true;
                txtRemarks.Text = "";
                txtRemarks.ReadOnly = false;
            }
            else
            {
                btnApprove.Visible = false;
                btnReject.Visible = false;
                txtRemarks.Text = request.Remark;
                txtRemarks.ReadOnly = true;
            }

            hypLnkFileUrl.Visible = false;
            if (request.URL.Trim().Length > 0)
            {
                hypLnkFileUrl.Visible = true;
                hypLnkFileUrl.NavigateUrl = request.URL;
            }

            if (request.Logs.Count() > 0)
            {
                lblRequestLogLabel.Visible = true;
                gvRequestLog.Visible = true;
                gvRequestLog.DataSource = request.Logs;
                gvRequestLog.PageIndex = page;
                gvRequestLog.DataBind();
            }
        }
示例#39
0
        private void UpdateRequestFromRequestee(RequestStatus requestStatus)
        {
            if (hidRequestID.Value == "")
                return;
            RequestClient client = new RequestClient();
            int requestID = int.Parse(hidRequestID.Value);
            Request r = client.GetRequest(requestID);
            try
            {
                client.ChangeStatus(RequesteeUser(), r.RequestID, requestStatus, txtRemarks.Text.Trim());
                retRequest(requestID);
                MailHandler.sendRequestorMail(txtRequestTitle.Text, RequestorEmail(r.Requestor),
                    txtRemarks.Text.Trim(), requestStatus.ToString(), RequesteeUser().TargetEmail);
                if (requestStatus==RequestStatus.Approved)
                {
                    Alert.Show("The Request has been successfully approved!");
                }
                else
                    Alert.Show("The Request has been successfully rejected!");

            }
            catch (Exception ex)
            {
                Alert.Show("Error Updating the request with message: " + ex.Message);
                //throw;
            }
            finally
            {
                client.Close();
            }
            Clear();
            RequestEvents(dpFrom.CalDate, dpTo.CalDate);
        }
示例#40
0
 public CouchDatabase(string serverUrl)
 {
     ServerUrl = serverUrl;
     _client = new RequestClient(serverUrl);
     _api = new CouchApi(_client);
 }
示例#41
0
        private void RequestEvents(DateTime start, DateTime end)
        {
            bool viewAll = true;
            RequestStatus requestStatus;
            try
            {
                requestStatus = (RequestStatus)Enum.Parse(typeof(RequestStatus), ddlStatus.SelectedValue);
                viewAll = false;
            }
            catch (Exception)
            {
                requestStatus = (RequestStatus)Enum.Parse(typeof(RequestStatus), ddlStatus.Items[0].Value);
            }

            List<Request> requests;
            try
            {
                RequestClient client = new RequestClient();
                requests = client.ViewRequestViaRequester(EventID(), NUSNetUser(), start, end, requestStatus, viewAll).ToList<Request>();
                client.Close();

                lstRequest.Items.Clear();

                if (requests.Count() > 0)
                {
                    lstRequest.DataSource = requests;
                    lstRequest.DataTextField = "Title";
                    lstRequest.DataValueField = "RequestID";
                    lstRequest.DataBind();
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message, false, "~/Default.aspx");
                return;
            }
        }
示例#42
0
        private void retRequest(int RequestID, int page = 0)
        {
            Request request;
            hidRequestID.Value = RequestID.ToString();
            RequestClient client = new RequestClient();
            request = client.GetRequest(RequestID);
            client.Close();

            if (txtToWho.Text.Trim() == "")
            {
                txtToWho.Text = request.TargetEmail;
                txtRequestTitle.Text = request.Title;
                txtRequestDesc.Text = request.Description;
                txtFileUrl.Text = request.URL;
            }
            txtToWho.ReadOnly = true;
            txtRequestTitle.ReadOnly = true;
            lblRequestLogLabel.Visible = false;
            gvRequestLog.DataSource = null;
            gvRequestLog.DataBind();

            if (request.Logs.Count() > 0)
            {
                lblRequestLogLabel.Visible = true;
                gvRequestLog.Visible = true;
                gvRequestLog.DataSource = request.Logs;
                gvRequestLog.PageIndex = page;
                gvRequestLog.DataBind();
            }
        }