Add() 공개 메소드

public Add ( key, int value ) : void
value int
리턴 void
예제 #1
0
        public virtual String GetAuthorizationFullUrl()
        {
            UriBuilder ub = new UriBuilder( this.AuthorizationUrl );

            QueryParams queryItems = new QueryParams();

            queryItems.Add( "client_id", this.ConsumerKey );
            queryItems.Add( "redirect_uri", this.CallbackUrl );
            queryItems.Add( "response_type", "code" );

            queryItems.Add( "scope", this.Scope );

            return ub.ToString() + "?" + queryItems.ToEncodedString();
        }
예제 #2
0
        public virtual HttpRequestBuilder AddQueryParam(string key, object value, bool replace = false)
        {
            if (replace)
            {
                QueryParams.RemoveAll(v => v.Key == key);
                SuffixQueryParams.RemoveAll(v => v.Key == key);
            }

            QueryParams.Add(key, value.ToString());

            return(this);
        }
예제 #3
0
 public PutObjectRequest(string bucketName, string objectName, Guid jobId, long offset, Stream content)
 {
     this.BucketName = bucketName;
     this.ObjectName = objectName;
     this.JobId      = jobId;
     this.Offset     = offset;
     this._content   = content;
     if (jobId != Guid.Empty)
     {
         QueryParams.Add("job", jobId.ToString());
         QueryParams.Add("offset", offset.ToString());
     }
 }
예제 #4
0
 public GetObjectRequest(string bucketName, string ds3ObjectName, Guid jobId, long offset, Stream destinationStream)
 {
     this.BucketName        = bucketName;
     this.ObjectName        = ds3ObjectName;
     this.JobId             = jobId;
     this.Offset            = offset;
     this.DestinationStream = destinationStream;
     if (jobId != Guid.Empty)
     {
         QueryParams.Add("job", jobId.ToString());
         QueryParams.Add("offset", offset.ToString());
     }
 }
예제 #5
0
        public RestRouteMetadata ReceivesQueryParam(string name, TypeCode typeCode, bool required = false, object defaultValue = null, string description = null)
        {
            QueryParams.Add(new QueryParam
            {
                Name         = name,
                TypeCode     = typeCode,
                Required     = required,
                DefaultValue = defaultValue,
                Description  = description
            });

            return(this);
        }
예제 #6
0
        public RequestMatchBuilder ContainingQueryParam(string name, string value)
        {
            if (MatchUrlWithQuery)
            {
                throw new InvalidOperationException($"You cannot use ContainingQueryParam as Url has already been configured to match with a QueryString. '{Url}'");
            }

            if (m_ParentTrackingBuilder.HasMatchUrlWithQuery())
            {
                throw new InvalidOperationException("You cannot use ContainingQueryParam as request matches already exist with QueryString matching.");
            }

            QueryParams.Add(name, value);
            return(this);
        }
예제 #7
0
        protected override int OnQuery(object sender, object neuObject)
        {
            this.QuerySqlTypeValue = QuerySqlType.id;
            this.QuerySql          = "WinForms.Report.Finance.FinOpb.ucFinOpbPactStat";
            this.DataCrossValues   = "2";
            this.DataCrossColumns  = "1";
            this.DataCrossRows     = "0";


            QueryParams.Clear();
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", this.dtpBeginTime.Value.ToString(), ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", this.dtpEndTime.Value.ToString(), ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", reportCode, ""));

            Neusoft.HISFC.Models.Base.Employee employee = new Neusoft.HISFC.Models.Base.Employee();

            employee = (Neusoft.HISFC.Models.Base.Employee) this.dataBaseManager.Operator;

            this.neuSpread1_Sheet1.SetText(1, 0, "统计科别:" + employee.Dept.Name);

            return(base.OnQuery(sender, neuObject));
        }
예제 #8
0
        protected override int OnQuery(object sender, object neuObject)
        {
            string[] feeStatStr = this.feeStatList.ToArray();
            if (string.IsNullOrEmpty(reportCode))
            {
                MessageBox.Show("请选择统计大类!");
                return(-1);
            }

            if (comDept.Text == "按患者所在科室查询")
            {
                this.QuerySqlTypeValue = QuerySqlType.id;
                this.QuerySql          = "WinForms.Report.Finance.FinIpb.ucFinIpbStatFeeInhosDept";
                //this.DataCrossValues = "2";
                //this.DataCrossColumns = "1";
                //this.DataCrossRows = "0";
            }
            if (comDept.Text == "按医生所在科室查询")
            {
                this.QuerySqlTypeValue = QuerySqlType.id;
                this.QuerySql          = "WinForms.Report.Finance.FinIpb.ucFinIpbStatFeeDOCDept";
                //this.DataCrossValues = "2";
                //this.DataCrossColumns = "1";
                //this.DataCrossRows = "0";
            }
            if (comDept.Text == "按执行科室查询")
            {
                this.QuerySqlTypeValue = QuerySqlType.id;
                this.QuerySql          = "WinForms.Report.Finance.FinIpb.ucFinIpbStatFeeEXEDept";
                //this.DataCrossValues = "2";
                //this.DataCrossColumns = "1";
                //this.DataCrossRows = "0";
            }

            //this.QuerySqlTypeValue = QuerySqlType.id;
            //this.QuerySql = "WinForms.Report.Finance.FinOpb.ucFinOpbStatFeeDoct";
            this.DataCrossValues   = "2";
            this.DataCrossRows     = "0";
            this.DataCrossColumns  = "1";
            this.DataBeginRowIndex = 5;
            QueryParams.Clear();
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", this.dtpBeginTime.Value.ToShortDateString() + " 00:00:00", ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", this.dtpEndTime.Value.ToShortDateString() + " 23:59:59", ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", reportCode, ""));
            string feeStr = string.Empty;

            if (this.feeStatList != null)
            {
                if (this.feeStatList.Count != 0)
                {
                    foreach (string str in feeStatList)
                    {
                        feeStr = feeStr + "'" + str + "',";
                    }
                    feeStr = feeStr.Substring(0, feeStr.Length - 1);
                }
            }
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", feeStr, ""));



            Neusoft.HISFC.Models.Base.Employee employee = new Neusoft.HISFC.Models.Base.Employee();

            employee     = (Neusoft.HISFC.Models.Base.Employee) this.dataBaseManager.Operator;
            hospitalName = this.conManager.GetHospitalName();

            this.neuSpread1_Sheet1.SetText(3, 0, "统计日期:" + this.dtpBeginTime.Value.ToShortDateString() + " 00:00:00" + "---" + this.dtpEndTime.Value.ToShortDateString() + " 23:59:59");
            this.neuSpread1_Sheet1.Cells[3, 0].ColumnSpan = 10;
            this.neuSpread1_Sheet1.SetText(4, 0, "制表人:" + employee.Name);
            this.neuSpread1_Sheet1.Cells[4, 0].ColumnSpan = 6;
            this.neuSpread1_Sheet1.SetText(4, 6, "打印日期:" + System.DateTime.Now.ToString());
            this.neuSpread1_Sheet1.Cells.Get(4, 6).ColumnSpan = 6;
            this.neuSpread1_Sheet1.SetText(0, 0, hospitalName);
            this.neuSpread1_Sheet1.Cells.Get(0, 0).Font = new System.Drawing.Font("SimSun", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.neuSpread1_Sheet1.Cells.Get(0, 0).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
            this.neuSpread1_Sheet1.Cells[0, 0].ColumnSpan = 10;
            this.neuSpread1_Sheet1.SetText(1, 0, "住院收入统计汇总表(在院+出院)");
            this.neuSpread1_Sheet1.Cells[1, 0].ColumnSpan = 10;
            this.neuSpread1_Sheet1.Cells.Get(1, 0).Font   = new System.Drawing.Font("SimSun", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.neuSpread1_Sheet1.Cells.Get(1, 0).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
            neuSpread1.Sheets[0].FrozenRowCount = 6;
            return(base.OnQuery(sender, neuObject));
        }
예제 #9
0
        static void Main(string[] args)
        {
            var queryParams = new QueryParams()
            {
                ParamDictionary =
                {
                    { "@p1", "territorycode" },
                    { "@p2", "creditonhold"  }
                }
            };

            queryParams.Add(new QueryParam("@p3", "createdon"));
            queryParams.Add("@p4", "statecode");
            var queryOptions = new QueryOptions()
            {
                new QuerySelect("name", "modifiedon", "createdon", "versionnumber"),
                new QueryCount(true),
                new QueryFilter(new FilterExpression()
                {
                    FilterOperator = LogicalOperator.LogicalAnd,
                    Conditions     =
                    {
                        new ConditionExpression("@p1", ConditionOperator.Equal,               1),
                        new ConditionExpression("@p2", ConditionOperator.Equal,           false),
                        new ConditionExpression("@p3", ConditionOperator.LessThanOrQqual, DateTime.Now)
                    },
                    Filters =
                    {
                        new FilterExpression(LogicalOperator.LogicalOr)
                        {
                            Conditions =
                            {
                                new ConditionExpression("@p4", ConditionOperator.Equal,    0),
                                new ConditionExpression("@p5", ConditionOperator.NotEqual,
                                                        Guid.Parse("381512cc-f1cb-e611-80fb-00155d392b01"))
                            }
                        },
                    }
                }),

                new QueryOrderBy(true, "@p3", "@p6"),
                queryParams,
                new QueryParam("@p5", "_ownerid_value"),
                new QueryParam("@p6", "name")
            };

            Console.WriteLine(queryOptions);
            var crmApiService = new WebApiService();
            var whoImI        = crmApiService.WhoImIAsync().Result;

            Console.WriteLine(whoImI);
            var contact = crmApiService.ReadAsync("contact").Result;

            Console.WriteLine(contact);

            var account1 = crmApiService.ReadAsync("account", queryOptions).Result;

            Console.WriteLine(account1);

            var queryOptionsNew = new QueryOptions()
            {
                new QuerySelect("name", "modifiedon", "createdon", "versionnumber"),
                new QueryCount(true),
                new QueryFilter(new FilterExpression()
                {
                    FilterOperator = LogicalOperator.LogicalAnd,
                    Conditions     =
                    {
                        new ConditionExpression("@p1", ConditionOperator.Equal,               1),
                        new ConditionExpression("@p2", ConditionOperator.Equal,           false),
                        new ConditionExpression("@p3", ConditionOperator.LessThanOrQqual, DateTime.Now)
                    },
                    Filters =
                    {
                        new FilterExpression(LogicalOperator.LogicalOr)
                        {
                            Conditions =
                            {
                                new ConditionExpression("@p4", ConditionOperator.Equal,    0),
                                new ConditionExpression("@p5", ConditionOperator.NotEqual,
                                                        Guid.Parse("381512cc-f1cb-e611-80fb-00155d392b01"))
                            }
                        },
                    }
                }),
                new QueryExpand()
                {
                    ExpandNavigationProperties =
                    {
                        {
                            "primarycontactid", new List <QueryOption>()
                            {
                                new QuerySelect("fullname")
                            }
                        },
                        {
                            "Account_Tasks", new List <QueryOption>()
                            {
                                new QuerySelect("subject", "scheduledstart"),
                                new QueryTop(3),
                                new QueryOrderBy("scheduledstart")
                            }
                        }
                    }
                },
                new QueryParams()
                {
                    ParamDictionary =
                    {
                        { "@p1", "territorycode"  },
                        { "@p2", "creditonhold"   },
                        { "@p3", "createdon"      },
                        { "@p4", "statecode"      },
                        { "@p5", "_ownerid_value" },
                        { "@p6", "name"           }
                    }
                }
            };

            var account3 = crmApiService.ReadAsync("account", queryOptionsNew).Result;

            Console.WriteLine(account3);



            var e = crmApiService.ReadAsync("account", "$select=name").Result;

            Console.WriteLine(e);

            var f = crmApiService.ReadAsync("account", "$select=name").Result;

            Console.WriteLine(f);
            Console.ReadKey();
        }
예제 #10
0
        public static void Run()
        {
            //testFile
            var testFilePath = "testFile.txt";

            File.WriteAllText(testFilePath, "this is file content.BY 张贺", new UTF8Encoding(false));//No BOM


            var req1 = new HttpRequest("http://localhost:9999/GetJson?Query=Value#Fragment");

            Console.WriteLine(req1);

            var req2 = new HttpRequest("/GetJson?Query=Value#Fragment");

            req2.Url.Scheme    = "http";
            req2.Url.Authority = "localhost:9999";

            var req3 = new HttpRequest();

            req3.Url.AbsoluteUri = "http://localhost:9999/GetJson?Query=Value#Fragment";

            var req4 = new HttpRequest();

            req4.Url.Scheme    = "http";
            req4.Url.Authority = "localhost:9999";
            //OR
            //req4.Url.Host = "localhost";
            //req4.Url.Port = 9999;
            req4.Url.AbsolutePath = "/GetJson?Query=Value#Fragment";
            //OR
            //req4.Url.Path = "/GetJson";
            //req4.Url.Query = "?Query=Value";
            //req4.Url.Fragment = "#Fragment";

            //QueryParams
            req1.Method  = HttpMethod.Get;
            req1.Version = HttpVersion.Version11;
            req1.Headers.Add(HttpHeaders.UserAgent, "My-Client");
            var queryParams1 = new QueryParams();

            queryParams1.Add("Name", "张贺");
            queryParams1.Add("Age", "10");
            queryParams1.Add("Sex", "");
            //OR
            //var queryParams1 = new QueryParams()
            //{
            //    {"Name", "张贺"},
            //    {"Age", "10"},
            //    {"Sex", ""}
            //};
            queryParams1.Parse("TestKey1=TestValue1&TestKey2=TestValue2");
            queryParams1.Join(req1.Url);
            Console.WriteLine(req1);
            var queryParams2 = req1.QueryParams();

            foreach (var item in queryParams2)
            {
                Console.WriteLine($"{item.Key}={item.Value}");
            }
            var     q1      = queryParams2.GetValue <string>("Name");
            var     q2      = queryParams2.GetValue <int>("Age");
            var     q3      = queryParams2.GetValue <int?>("Sex");
            var     qModel1 = queryParams2.GetValue <Model>();
            var     q4      = qModel1.Name;
            var     q5      = qModel1.Age;
            var     q6      = qModel1.Sex;
            dynamic qObj1   = queryParams2.GetValue <DynamicObject>();
            var     q7      = (string)qObj1.Name;
            var     q8      = (int)qObj1.Age;
            var     q9      = (int?)qObj1.Sex;

            //FormParams
            req2.Method  = HttpMethod.Post;
            req2.Version = HttpVersion.Version11;
            req2.Headers[HttpHeaders.UserAgent] = "My-Client";
            var formParams1 = new FormParams();

            formParams1.Add("Name", "张贺1");
            formParams1.Add("Age", "11");
            formParams1.Add("Sex", "");
            //OR
            //var formParams1 = new FormParams()
            //{
            //    {"Name", "张贺1"},
            //    {"Age", "11"},
            //    {"Sex", ""}
            //};
            req2.UseForm(formParams1);
            //OR
            //req2.UseForm(formParams,Encoding.UTF8);
            Console.WriteLine(req2);
            //await
            FeaturesExtensions.ReadFormAsync(req2, 1024 * 1024, 10 * 1024 * 1024).Wait();//1M ,10M
            var formParams2 = req2.FormParams();

            foreach (var item in formParams2)
            {
                Console.WriteLine($"{item.Key}={item.Value}");
            }
            var     f1      = formParams2.GetValue <string>("Name");
            var     f2      = formParams2.GetValue <int>("Age");
            var     f3      = formParams2.GetValue <int?>("Sex");
            var     fModel1 = formParams2.GetValue <Model>();
            var     f4      = fModel1.Name;
            var     f5      = fModel1.Age;
            var     f6      = fModel1.Sex;
            dynamic fObj1   = formParams2.GetValue <DynamicObject>();
            var     f7      = (string)fObj1.Name;
            var     f8      = (int)fObj1.Age;
            var     f9      = (int?)fObj1.Sex;


            //FormParams FormFileParams
            var formParams3 = new FormParams();

            formParams3.Add("Key1", "Value1");
            formParams3.Add("姓名", "张贺");
            var fileParams1 = new FormFileParams();

            fileParams1.Add("Upload1", testFilePath);                                //MimeTypes.Default
            fileParams1.Add("Upload2", "myfile.html", "text/html", new FileInfo(testFilePath));
            fileParams1.Add("Upload3", new BytesFileParams(new byte[] { 1, 2, 3 })); //custom
            req3.UseFormData(formParams3, fileParams1);
            //OR
            //req3.UseFormData(formParams3, fileParams1, "my-random-boundary");
            //req3.UseFormData(formParams3, fileParams1, "my-random-boundary", Encoding.UTF8);
            Console.WriteLine(req3);
            //await
            FeaturesExtensions.ReadFormAsync(req3, 1024 * 1024, 10 * 1024 * 1024).Wait();//1M ,10M
            var formParams4 = req3.FormParams();

            foreach (var item in formParams4)
            {
                Console.WriteLine($"{item.Key}={item.Value}");
            }
            var fileParams2 = req3.FormFileParams();

            foreach (var item in fileParams2)
            {
                Console.WriteLine(item.Key);
                var upload = item.Value;
                Console.WriteLine(upload.Length);
                Console.WriteLine(upload.ContentType);
                Console.WriteLine(upload.FileName);
                upload.TryGetExtension(out var extName);
                Console.WriteLine(extName);
                //await upload.SaveAsync()
            }

            //Cookie
            req4.Headers.Add(HttpHeaders.Cookie, "cookieName1=cookieValue1; cookieName2=cookieValue2");
            var cookieParams1 = req4.CookieParams();

            foreach (var item in cookieParams1)
            {
                Console.WriteLine($"{item.Key}={item.Value}");
            }
            //cookieParams1.GetValue<>
            var sb1 = StringContent.Rent(out var disposable1);

            req4.RegisterForDispose(disposable1);
            sb1.Write("this ");
            sb1.Write(" is Request Content");
            req4.Content = StringContent.Create(sb1.Sequence);
            //OR MemoryContent.Rent()
            Console.WriteLine(req4.Content.ReadStringAsync().Result);//await

            var req5 = new HttpRequest();

            req5.UseJson(new { Data = "Request Json" });
            req5.Headers.TryGetValue(HttpHeaders.ContentType, out var contentType1);
            Console.WriteLine(contentType1);
            Console.WriteLine(req5.Content.ReadStringAsync().Result);//await

            req1.Dispose();
            req2.Dispose();
            req3.Dispose();
            req4.Dispose();
            req5.Dispose();


            var resp1 = new HttpResponse();

            resp1.Headers.Add(HttpHeaders.Server, "My-Web-Server");
            resp1.UseCookie("cookieName1", "cookieValue1");
            resp1.UseCookie("cookieName2", "cookieValue2", domain: "localhost", maxAge: 1000, httpOnly: true, secure: true);
            var cookies1 = resp1.Headers.GetValues(HttpHeaders.SetCookie);

            foreach (var item in cookies1)
            {
                Console.WriteLine(item);
            }


            var resp2 = new HttpResponse();

            resp2.Headers[HttpHeaders.Server] = "My-Web-Server";
            resp2.UseRedirect("http://localhost:9999/Redirect");
            Console.WriteLine(resp2.StatusCode);//302
            resp2.Headers.TryGetValue(HttpHeaders.Location, out var location1);
            Console.WriteLine(location1);


            Console.WriteLine("UseFile");
            var resp3 = new HttpResponse();

            resp3.UseFile(testFilePath);
            Console.WriteLine(resp3.Content.Length);
            Console.WriteLine(resp3.Content.ReadStringAsync().Result);//await
            //UseFile(HttpRequest
            //ETag
            var resp4   = new HttpResponse();
            var etagReq = new HttpRequest();

            resp4.UseFile(etagReq, testFilePath);
            resp4.Headers.TryGetValue(HttpHeaders.AcceptRanges, out var acceptRanges);
            Console.WriteLine(acceptRanges);
            resp4.Headers.TryGetValue(HttpHeaders.ETag, out var etag1);
            Console.WriteLine(etag1);
            //Range
            var resp5    = new HttpResponse();
            var rangeReq = new HttpRequest();

            rangeReq.Headers.Add(HttpHeaders.Range, "bytes=0-3");
            resp5.UseFile(rangeReq, testFilePath);
            Console.WriteLine(resp5.StatusCode);                       //206 Partial Content
            Console.WriteLine(resp5.Content.Length);
            Console.WriteLine(resp5.Content.ReadStringAsync().Result); //await

            var resp6 = new HttpResponse();

            resp6.UseJson(new { Code = 0, Msg = "OK" });
            Console.WriteLine(resp6.Content.ReadStringAsync().Result);//await

            var resp7 = new HttpResponse();
            var sb2   = StringContent.Rent(out var disposable2);

            resp7.RegisterForDispose(disposable2);
            sb1.Write("this ");
            sb1.Write(" is Response Content");
            resp7.Content = StringContent.Create(sb1.Sequence);
            //OR MemoryContent.Rent()
            resp7.Headers.Add(HttpHeaders.ContentType, "text/html; charset=utf-8");
            Console.WriteLine(resp7.Content.ReadStringAsync().Result);//await

            //Compression
            //resp.UseCompression("gzip", 9);//0-9
            //resp.UseCompression("deflate", 9);//0-9
            //resp.UseCompression("br", 11);//0-11

            resp1.Dispose();
            resp2.Dispose();
            resp3.Dispose();
            resp4.Dispose();
            resp5.Dispose();
            resp6.Dispose();
            resp7.Dispose();

            //FeaturesExtensions.RegisterForDispose(req1, resp1);


            //Excpetion
            FeaturesExtensions.UseException((req, resp, ex) => {
                resp.StatusCode = ex.StatusCode() ?? 500;
                resp.Content    = StringContent.Create("ERROR");
                return(Task.CompletedTask);
            });

            //FeaturesExtensions.GetEncoding();
            //FeaturesExtensions.GetReasonPhrase();
            //FeaturesExtensions.GetValue();Register

            Console.WriteLine(HttpVersion.Version9);
            Console.WriteLine(HttpVersion.Version10);
            Console.WriteLine(HttpVersion.Version11);
            Console.WriteLine(HttpVersion.Version20);
            Console.WriteLine(HttpMethod.Get);
            Console.WriteLine(HttpMethod.Put);
            Console.WriteLine(HttpMethod.Post);
            Console.WriteLine(HttpMethod.Head);
            Console.WriteLine(HttpMethod.Trace);
            Console.WriteLine(HttpMethod.Patch);
            Console.WriteLine(HttpMethod.Delete);
            Console.WriteLine(HttpMethod.Options);
            Console.WriteLine(HttpMethod.Connect);
            Console.WriteLine(FeaturesExtensions.GetReasonPhrase(200));
            Console.WriteLine(FeaturesExtensions.GetReasonPhrase(404));

            var queryParam2 = new QueryParams();
            var url         = new Url("http://localhost:9999/Test?q1=v1&q2=v2");

            queryParam2.Parse(url);
            queryParam2.Parse("q3=v3&q4=v4");
            foreach (var item in queryParam2)
            {
                Console.WriteLine($"{item.Key}={item.Value}");
            }


            //HttpHeaders
            Console.WriteLine(HttpHeaders.Accept);
            Console.WriteLine(HttpHeaders.AcceptCharset);
            Console.WriteLine(HttpHeaders.AcceptEncoding);
            Console.WriteLine(HttpHeaders.AcceptLanguage);
            Console.WriteLine(HttpHeaders.AcceptRanges);
            Console.WriteLine(HttpHeaders.AccessControlAllowOrigin);
            //....
            Console.WriteLine(HttpHeaders.Warning);
            Console.WriteLine(HttpHeaders.WwwAuthenticate);

            var contentType2 = "text/json; charset=utf-8; q=0.9; v=1.1";

            HttpHeaders.TryParse(contentType2, out var h1);
            Console.WriteLine(new string(h1));
            HttpHeaders.TryParse(contentType2, out var h2, "charset", out var hv2);
            Console.WriteLine(new string(h2));
            Console.WriteLine(new string(hv2));
            HttpHeaders.TryParse(contentType2, out var h3, "charset", out var hv3, "v", out var hvv3);
            Console.WriteLine(new string(h3));
            Console.WriteLine(new string(hv3));
            Console.WriteLine(new string(hvv3));

            var accept1     = "text/html;q=,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3";
            var acceptSpan1 = accept1.AsSpan();

            while (HttpHeaders.TryParse(ref acceptSpan1, out var a1, "q", out var aq1, "v", out var av1))
            {
                Console.WriteLine(new string(a1));
                if (aq1 != null)
                {
                    Console.WriteLine("q=" + new string(aq1));
                }
                if (av1 != null)
                {
                    Console.WriteLine("v=" + new string(av1));
                }
            }

            //IHttpContent
            IHttpContent testContent = StringContent.Create("{\"Name\":\"Zhang\",\"Age\":30}");

            Console.WriteLine(testContent.Length);
            Console.WriteLine(testContent.Available);
            var length1 = testContent.ComputeLength();//TryComputeLength

            Console.WriteLine(testContent.Length);

            var b1 = testContent.ReadAsync(new byte[1024]);
            var b2 = testContent.ReadAsync(new byte[1024]);

            Console.WriteLine(b1);
            Console.WriteLine(b2);

            Console.WriteLine(testContent.Available);
            testContent.Rewind();
            Console.WriteLine(testContent.Available);
            testContent.DrainAsync().Wait();
            Console.WriteLine(testContent.Available);

            //testContent.ReadJsonAsync<>()
            //testContent.ReadStringAsync();
            //testContent.ReadStreamAsync();
            //testContent.ReadFileAsync();
            //testContent.ReadFormAsync();
            //testContent.ReadFormDataAsync();


            //IHttpHandler
            var handler1 = HttpHandler.Create((req, resp) => {
                Console.WriteLine("handler1");
            });
            var handler2 = HttpHandler.Create(async(req, resp) => {
                await Task.CompletedTask;
                Console.WriteLine("handler2");
            });
            var handler3 = HttpHandler.Create((req) => {
                Console.WriteLine("handler3");
                return(Task.FromResult(new HttpResponse()));
            });
            var handler4 = HttpHandler.Create(async(req) => {
                await Task.CompletedTask;
                Console.WriteLine("handler4");
                return(new HttpResponse());
            });

            handler1.HandleAsync(new HttpRequest()).Wait();
            handler2.HandleAsync(new HttpRequest()).Wait();
            handler3.HandleAsync(new HttpRequest()).Wait();
            handler4.HandleAsync(new HttpRequest()).Wait();


            var module1 = HttpHandler.CreateModule((req, handler) => {
                Console.WriteLine("module1");
                return(handler.HandleAsync(req));
            });
            var module2 = HttpHandler.CreateModule(async(req, handler) => {
                var resp = await handler.HandleAsync(req);
                Console.WriteLine("module2");
                return(resp);
            });
            var handler5 = HttpHandler.Create(async(req) => {
                await Task.CompletedTask;
                Console.WriteLine("handler5");
                return(null);
            });
            var handler6 = HttpHandler.CreatePipeline(new[] { module1, module2, handler5, handler1 });

            handler6.HandleAsync(new HttpRequest()).Wait();
        }
예제 #11
0
 /**
  * Adds Parameter. Parameter could be part of URL, POST data.
  *
  * @param name
  *            parameter name with no URL encoding applied
  * @param value
  *            parameter value with no URL encoding applied
  */
 public void addParameter(string name, string value)
 {
     QueryParams.Add(new Parameter(name, value));
 }
예제 #12
0
 public void AddQueryParameter(string name, string value) => QueryParams.Add(new KeyValuePair <string, string>(name, value));
예제 #13
0
 public RiakRestRequest AddQueryParam(string key, string value)
 {
     QueryParams.Add(key, value);
     return(this);
 }
예제 #14
0
        protected override int OnQuery(object sender, object neuObject)
        {
            if (comDept.Items[comDept.SelectedIndex] == "按挂号科室查询")
            {
                this.QuerySqlTypeValue = QuerySqlType.id;
                this.QuerySql          = "WinForms.Report.Finance.FinOpb.ucDeptFeeNumREGDept";
                //this.DataCrossValues = "2";
                //this.DataCrossColumns = "1";
                //this.DataCrossRows = "0";
            }
            if (comDept.Items[comDept.SelectedIndex] == "按医生所在科室查询")
            {
                this.QuerySqlTypeValue = QuerySqlType.id;
                this.QuerySql          = "WinForms.Report.Finance.FinOpb.ucDeptFeeNumDOCDept";
                //this.DataCrossValues = "2";
                //this.DataCrossColumns = "1";
                //this.DataCrossRows = "0";
            }
            if (comDept.Items[comDept.SelectedIndex] == "按执行科室查询")
            {
                this.QuerySqlTypeValue = QuerySqlType.id;
                this.QuerySql          = "WinForms.Report.Finance.FinOpb.ucDeptFeeNumEXEDept";
                //this.DataCrossValues = "2";
                //this.DataCrossColumns = "1";
                //this.DataCrossRows = "0";
            }
            QueryParams.Clear();
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", this.dtpBeginTime.Value.ToString(), ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", this.dtpEndTime.Value.ToString(), ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", reportCode, ""));
            QueryParams.Add(new Neusoft.FrameWork.Models.NeuObject("", pactCode, ""));

            Neusoft.HISFC.Models.Base.Employee employee = new Neusoft.HISFC.Models.Base.Employee();

            employee = (Neusoft.HISFC.Models.Base.Employee) this.dataBaseManager.Operator;

            //  this.neuSpread1_Sheet1.SetText(1, 0, "统计科别:" + employee.Dept.Name);

            base.OnQuery(sender, neuObject);

            //加合计
            int rowCount = 0;

            //rowCount = this.neuSpread1_Sheet1.RowCount;
            for (int i = this.DataBeginRowIndex; i < neuSpread1_Sheet1.Rows.Count; i++)
            {
                if (string.IsNullOrEmpty(neuSpread1_Sheet1.Cells[i, this.DataBeginColumnIndex].Text) == true)
                {
                    rowCount = i;
                    break;
                }
            }
            decimal sumNum5 = 0;
            decimal sumNum4 = 0;
            decimal sumNum3 = 0;
            decimal sumNum2 = 0;
            decimal sumNum1 = 0;

            for (int i = this.DataBeginRowIndex; i < rowCount; i++)
            {
                sumNum1 = sumNum1 + NConvert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 1].Text);
                sumNum2 = sumNum2 + NConvert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 2].Text);
                sumNum3 = sumNum3 + NConvert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 3].Text);
                sumNum4 = sumNum4 + NConvert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 4].Text);
                sumNum5 = sumNum5 + NConvert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 5].Text);
            }

            this.neuSpread1_Sheet1.Rows.Add(rowCount, 1);
            this.neuSpread1_Sheet1.Cells[rowCount, 0].Text = "合计:";
            this.neuSpread1_Sheet1.Cells[rowCount, 1].Text = sumNum1.ToString();
            this.neuSpread1_Sheet1.Cells[rowCount, 2].Text = sumNum2.ToString();
            this.neuSpread1_Sheet1.Cells[rowCount, 3].Text = sumNum3.ToString();
            this.neuSpread1_Sheet1.Cells[rowCount, 4].Text = sumNum4.ToString();
            this.neuSpread1_Sheet1.Cells[rowCount, 5].Text = sumNum5.ToString();



            return(1);
        }
 public void AddQueryParameter(string name, object value)
 {
     QueryParams.Add(name, value);
     request.AddParameter(name, value, ParameterType.QueryString);
 }