Here are the examples of the csharp api System.Convert.ToDateTime(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
604 Examples
19
Source : MockProductCategory.cs
with MIT License
from DevZest
with MIT License
from DevZest
private static DataSet<ProductCategory> MockData()
{
DataSet<ProductCategory> result = DataSet<ProductCategory>.Create().AddRows(13);
ProductCategory _ = result._;
_.SuspendIdenreplacedy();
_.ProductCategoryID[0] = 1;
_.ProductCategoryID[1] = 2;
_.ProductCategoryID[2] = 3;
_.ProductCategoryID[3] = 4;
_.ProductCategoryID[4] = 5;
_.ProductCategoryID[5] = 6;
_.ProductCategoryID[6] = 7;
_.ProductCategoryID[7] = 8;
_.ProductCategoryID[8] = 9;
_.ProductCategoryID[9] = 10;
_.ProductCategoryID[10] = 11;
_.ProductCategoryID[11] = 12;
_.ProductCategoryID[12] = 13;
_.ParentProductCategoryID[0] = null;
_.ParentProductCategoryID[1] = null;
_.ParentProductCategoryID[2] = 1;
_.ParentProductCategoryID[3] = 1;
_.ParentProductCategoryID[4] = 1;
_.ParentProductCategoryID[5] = 1;
_.ParentProductCategoryID[6] = 2;
_.ParentProductCategoryID[7] = 6;
_.ParentProductCategoryID[8] = 6;
_.ParentProductCategoryID[9] = 6;
_.ParentProductCategoryID[10] = 7;
_.ParentProductCategoryID[11] = 7;
_.ParentProductCategoryID[12] = 7;
_.Name[0] = "Bikes";
_.Name[1] = "Other";
_.Name[2] = "Mountain Bikes";
_.Name[3] = "Road Bikes";
_.Name[4] = "Touring Bikes";
_.Name[5] = "Components";
_.Name[6] = "Clothing";
_.Name[7] = "Handlebars";
_.Name[8] = "Bottom Brackets";
_.Name[9] = "Brakes";
_.Name[10] = "Bib-Shorts";
_.Name[11] = "Caps";
_.Name[12] = "Gloves";
_.RowGuid[0] = new Guid("cfbda25c-df71-47a7-b81b-64ee161aa37c");
_.RowGuid[1] = new Guid("09e91437-ba4f-4b1a-8215-74184fd95db8");
_.RowGuid[2] = new Guid("2d364ade-264a-433c-b092-4fcbf3804e01");
_.RowGuid[3] = new Guid("000310c0-bcc8-42c4-b0c3-45ae611af06b");
_.RowGuid[4] = new Guid("02c5061d-ecdc-4274-b5f1-e91d76bc3f37");
_.RowGuid[5] = new Guid("c657828d-d808-4aba-91a3-af2ce02300e9");
_.RowGuid[6] = new Guid("10a7c342-ca82-48d4-8a38-46a2eb089b74");
_.RowGuid[7] = new Guid("3ef2c725-7135-4c85-9ae6-ae9a3bdd9283");
_.RowGuid[8] = new Guid("a9e54089-8a1e-4cf5-8646-e3801f685934");
_.RowGuid[9] = new Guid("d43ba4a3-ef0d-426b-90eb-4be4547dd30c");
_.RowGuid[10] = new Guid("67b58d2b-5798-4a90-8c6c-5ddacf057171");
_.RowGuid[11] = new Guid("430dd6a8-a755-4b23-bb05-52520107da5f");
_.RowGuid[12] = new Guid("92d5657b-0032-4e49-bad5-41a441a70942");
_.ModifiedDate[0] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[1] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[2] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[3] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[4] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[5] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[6] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[7] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[8] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[9] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[10] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[11] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ModifiedDate[12] = Convert.ToDateTime("2002-06-01T00:00:00.000");
_.ResumeIdenreplacedy();
return result;
}
19
Source : MockSalesOrder.cs
with MIT License
from DevZest
with MIT License
from DevZest
private static DataSet<SalesOrderHeader> Headers()
{
DataSet<SalesOrderHeader> result = DataSet<SalesOrderHeader>.Create().AddRows(4);
SalesOrderHeader _ = result._;
_.SuspendIdenreplacedy();
_.SalesOrderID[0] = 1;
_.SalesOrderID[1] = 2;
_.SalesOrderID[2] = 3;
_.SalesOrderID[3] = 4;
_.RevisionNumber[0] = 2;
_.RevisionNumber[1] = 2;
_.RevisionNumber[2] = 2;
_.RevisionNumber[3] = 2;
_.OrderDate[0] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.OrderDate[1] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.OrderDate[2] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.OrderDate[3] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.DueDate[0] = Convert.ToDateTime("2008-06-13T00:00:00.000");
_.DueDate[1] = Convert.ToDateTime("2008-06-13T00:00:00.000");
_.DueDate[2] = Convert.ToDateTime("2008-06-13T00:00:00.000");
_.DueDate[3] = Convert.ToDateTime("2008-06-13T00:00:00.000");
_.ShipDate[0] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ShipDate[1] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ShipDate[2] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ShipDate[3] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.Status[0] = SalesOrderStatus.Shipped;
_.Status[1] = SalesOrderStatus.Shipped;
_.Status[2] = SalesOrderStatus.Shipped;
_.Status[3] = SalesOrderStatus.Shipped;
_.OnlineOrderFlag[0] = false;
_.OnlineOrderFlag[1] = false;
_.OnlineOrderFlag[2] = false;
_.OnlineOrderFlag[3] = false;
_.PurchaseOrderNumber[0] = "PO348186287";
_.PurchaseOrderNumber[1] = "PO19952192051";
_.PurchaseOrderNumber[2] = "PO19604173239";
_.PurchaseOrderNumber[3] = "PO19372114749";
_.AccountNumber[0] = "10-4020-000609";
_.AccountNumber[1] = "10-4020-000106";
_.AccountNumber[2] = "10-4020-000340";
_.AccountNumber[3] = "10-4020-000582";
_.CustomerID[0] = 29847;
_.CustomerID[1] = 30072;
_.CustomerID[2] = 30113;
_.CustomerID[3] = 29485;
_.ShipToAddressID[0] = 1092;
_.ShipToAddressID[1] = 640;
_.ShipToAddressID[2] = 653;
_.ShipToAddressID[3] = 1086;
_.BillToAddressID[0] = 1092;
_.BillToAddressID[1] = 640;
_.BillToAddressID[2] = 653;
_.BillToAddressID[3] = 1086;
_.ShipMethod[0] = "CARGO TRANSPORT 5";
_.ShipMethod[1] = "CARGO TRANSPORT 5";
_.ShipMethod[2] = "CARGO TRANSPORT 5";
_.ShipMethod[3] = "CARGO TRANSPORT 5";
_.CreditCardApprovalCode[0] = null;
_.CreditCardApprovalCode[1] = null;
_.CreditCardApprovalCode[2] = null;
_.CreditCardApprovalCode[3] = null;
_.SubTotal[0] = 880.3484M;
_.SubTotal[1] = 78.8100M;
_.SubTotal[2] = 38418.6895M;
_.SubTotal[3] = 39785.3304M;
_.TaxAmt[0] = 70.4279M;
_.TaxAmt[1] = 6.3048M;
_.TaxAmt[2] = 3073.4952M;
_.TaxAmt[3] = 3182.8264M;
_.Freight[0] = 22.0087M;
_.Freight[1] = 1.9703M;
_.Freight[2] = 960.4672M;
_.Freight[3] = 994.6333M;
_.Comment[0] = null;
_.Comment[1] = null;
_.Comment[2] = null;
_.Comment[3] = null;
_.RowGuid[0] = new Guid("89e42cdc-8506-48a2-b89b-eb3e64e3554e");
_.RowGuid[1] = new Guid("8a3448c5-e677-4158-a29b-dd33069be0b0");
_.RowGuid[2] = new Guid("a47665d2-7ac9-4cf3-8a8b-2a3883554284");
_.RowGuid[3] = new Guid("f1be45a5-5c57-4a50-93c6-5f8be44cb7cb");
_.ModifiedDate[0] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ModifiedDate[1] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ModifiedDate[2] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ModifiedDate[3] = Convert.ToDateTime("2008-06-08T00:00:00.000");
_.ResumeIdenreplacedy();
return result;
}
19
Source : MockSalesOrder.cs
with MIT License
from DevZest
with MIT License
from DevZest
private static DataSet<SalesOrderDetail> Details()
{
DataSet<SalesOrderDetail> result = DataSet<SalesOrderDetail>.Create().AddRows(32);
SalesOrderDetail _ = result._;
_.SuspendIdenreplacedy();
_.SalesOrderID[0] = 1;
_.SalesOrderID[1] = 1;
_.SalesOrderID[2] = 2;
_.SalesOrderID[3] = 3;
_.SalesOrderID[4] = 3;
_.SalesOrderID[5] = 3;
_.SalesOrderID[6] = 3;
_.SalesOrderID[7] = 3;
_.SalesOrderID[8] = 3;
_.SalesOrderID[9] = 3;
_.SalesOrderID[10] = 3;
_.SalesOrderID[11] = 3;
_.SalesOrderID[12] = 3;
_.SalesOrderID[13] = 3;
_.SalesOrderID[14] = 3;
_.SalesOrderID[15] = 3;
_.SalesOrderID[16] = 3;
_.SalesOrderID[17] = 3;
_.SalesOrderID[18] = 3;
_.SalesOrderID[19] = 3;
_.SalesOrderID[20] = 3;
_.SalesOrderID[21] = 3;
_.SalesOrderID[22] = 3;
_.SalesOrderID[23] = 3;
_.SalesOrderID[24] = 3;
_.SalesOrderID[25] = 3;
_.SalesOrderID[26] = 3;
_.SalesOrderID[27] = 3;
_.SalesOrderID[28] = 3;
_.SalesOrderID[29] = 3;
_.SalesOrderID[30] = 3;
_.SalesOrderID[31] = 3;
_.SalesOrderDetailID[0] = 1;
_.SalesOrderDetailID[1] = 2;
_.SalesOrderDetailID[2] = 3;
_.SalesOrderDetailID[3] = 4;
_.SalesOrderDetailID[4] = 5;
_.SalesOrderDetailID[5] = 6;
_.SalesOrderDetailID[6] = 7;
_.SalesOrderDetailID[7] = 8;
_.SalesOrderDetailID[8] = 9;
_.SalesOrderDetailID[9] = 10;
_.SalesOrderDetailID[10] = 11;
_.SalesOrderDetailID[11] = 12;
_.SalesOrderDetailID[12] = 13;
_.SalesOrderDetailID[13] = 14;
_.SalesOrderDetailID[14] = 15;
_.SalesOrderDetailID[15] = 16;
_.SalesOrderDetailID[16] = 17;
_.SalesOrderDetailID[17] = 18;
_.SalesOrderDetailID[18] = 19;
_.SalesOrderDetailID[19] = 20;
_.SalesOrderDetailID[20] = 21;
_.SalesOrderDetailID[21] = 22;
_.SalesOrderDetailID[22] = 23;
_.SalesOrderDetailID[23] = 24;
_.SalesOrderDetailID[24] = 25;
_.SalesOrderDetailID[25] = 26;
_.SalesOrderDetailID[26] = 27;
_.SalesOrderDetailID[27] = 28;
_.SalesOrderDetailID[28] = 29;
_.SalesOrderDetailID[29] = 30;
_.SalesOrderDetailID[30] = 31;
_.SalesOrderDetailID[31] = 32;
_.OrderQty[0] = 1;
_.OrderQty[1] = 1;
_.OrderQty[2] = 1;
_.OrderQty[3] = 4;
_.OrderQty[4] = 2;
_.OrderQty[5] = 6;
_.OrderQty[6] = 2;
_.OrderQty[7] = 1;
_.OrderQty[8] = 1;
_.OrderQty[9] = 1;
_.OrderQty[10] = 4;
_.OrderQty[11] = 2;
_.OrderQty[12] = 4;
_.OrderQty[13] = 1;
_.OrderQty[14] = 6;
_.OrderQty[15] = 1;
_.OrderQty[16] = 2;
_.OrderQty[17] = 3;
_.OrderQty[18] = 1;
_.OrderQty[19] = 2;
_.OrderQty[20] = 2;
_.OrderQty[21] = 3;
_.OrderQty[22] = 3;
_.OrderQty[23] = 2;
_.OrderQty[24] = 3;
_.OrderQty[25] = 5;
_.OrderQty[26] = 3;
_.OrderQty[27] = 1;
_.OrderQty[28] = 2;
_.OrderQty[29] = 1;
_.OrderQty[30] = 7;
_.OrderQty[31] = 1;
_.ProductID[0] = 836;
_.ProductID[1] = 822;
_.ProductID[2] = 907;
_.ProductID[3] = 905;
_.ProductID[4] = 983;
_.ProductID[5] = 988;
_.ProductID[6] = 748;
_.ProductID[7] = 990;
_.ProductID[8] = 926;
_.ProductID[9] = 743;
_.ProductID[10] = 782;
_.ProductID[11] = 918;
_.ProductID[12] = 780;
_.ProductID[13] = 937;
_.ProductID[14] = 867;
_.ProductID[15] = 985;
_.ProductID[16] = 989;
_.ProductID[17] = 991;
_.ProductID[18] = 992;
_.ProductID[19] = 993;
_.ProductID[20] = 984;
_.ProductID[21] = 986;
_.ProductID[22] = 987;
_.ProductID[23] = 981;
_.ProductID[24] = 982;
_.ProductID[25] = 783;
_.ProductID[26] = 809;
_.ProductID[27] = 810;
_.ProductID[28] = 935;
_.ProductID[29] = 925;
_.ProductID[30] = 869;
_.ProductID[31] = 880;
_.UnitPrice[0] = 356.8980M;
_.UnitPrice[1] = 356.8980M;
_.UnitPrice[2] = 63.9000M;
_.UnitPrice[3] = 218.4540M;
_.UnitPrice[4] = 461.6940M;
_.UnitPrice[5] = 112.9980M;
_.UnitPrice[6] = 818.7000M;
_.UnitPrice[7] = 323.9940M;
_.UnitPrice[8] = 149.8740M;
_.UnitPrice[9] = 809.7600M;
_.UnitPrice[10] = 1376.9940M;
_.UnitPrice[11] = 158.4300M;
_.UnitPrice[12] = 1391.9940M;
_.UnitPrice[13] = 48.5940M;
_.UnitPrice[14] = 41.9940M;
_.UnitPrice[15] = 112.9980M;
_.UnitPrice[16] = 323.9940M;
_.UnitPrice[17] = 323.9940M;
_.UnitPrice[18] = 323.9940M;
_.UnitPrice[19] = 323.9940M;
_.UnitPrice[20] = 112.9980M;
_.UnitPrice[21] = 112.9980M;
_.UnitPrice[22] = 112.9980M;
_.UnitPrice[23] = 461.6940M;
_.UnitPrice[24] = 461.6940M;
_.UnitPrice[25] = 1376.9940M;
_.UnitPrice[26] = 37.1520M;
_.UnitPrice[27] = 72.1620M;
_.UnitPrice[28] = 24.2940M;
_.UnitPrice[29] = 149.8740M;
_.UnitPrice[30] = 41.9940M;
_.UnitPrice[31] = 32.9940M;
_.UnitPriceDiscount[0] = 0M;
_.UnitPriceDiscount[1] = 0M;
_.UnitPriceDiscount[2] = 0M;
_.UnitPriceDiscount[3] = 0M;
_.UnitPriceDiscount[4] = 0M;
_.UnitPriceDiscount[5] = 0.4000M;
_.UnitPriceDiscount[6] = 0M;
_.UnitPriceDiscount[7] = 0M;
_.UnitPriceDiscount[8] = 0M;
_.UnitPriceDiscount[9] = 0M;
_.UnitPriceDiscount[10] = 0M;
_.UnitPriceDiscount[11] = 0M;
_.UnitPriceDiscount[12] = 0M;
_.UnitPriceDiscount[13] = 0M;
_.UnitPriceDiscount[14] = 0M;
_.UnitPriceDiscount[15] = 0.4000M;
_.UnitPriceDiscount[16] = 0M;
_.UnitPriceDiscount[17] = 0M;
_.UnitPriceDiscount[18] = 0M;
_.UnitPriceDiscount[19] = 0M;
_.UnitPriceDiscount[20] = 0.4000M;
_.UnitPriceDiscount[21] = 0.4000M;
_.UnitPriceDiscount[22] = 0.4000M;
_.UnitPriceDiscount[23] = 0M;
_.UnitPriceDiscount[24] = 0M;
_.UnitPriceDiscount[25] = 0M;
_.UnitPriceDiscount[26] = 0M;
_.UnitPriceDiscount[27] = 0M;
_.UnitPriceDiscount[28] = 0M;
_.UnitPriceDiscount[29] = 0M;
_.UnitPriceDiscount[30] = 0M;
_.UnitPriceDiscount[31] = 0M;
_.RowGuid[0] = new Guid("e3a1994c-7a68-4ce8-96a3-77fdd3bbd730");
_.RowGuid[1] = new Guid("5c77f557-fdb6-43ba-90b9-9a7aec55ca32");
_.RowGuid[2] = new Guid("6dbfe398-d15d-425e-aa58-88178fe360e5");
_.RowGuid[3] = new Guid("377246c9-4483-48ed-a5b9-e56f005364e0");
_.RowGuid[4] = new Guid("43a54bcd-536d-4a1b-8e69-24d083507a14");
_.RowGuid[5] = new Guid("12706fab-f3a2-48c6-b7c7-1ccde4081f18");
_.RowGuid[6] = new Guid("b12f0d3b-5b4e-4f1f-b2f0-f7cde99dd826");
_.RowGuid[7] = new Guid("f117a449-039d-44b8-a4b2-b12001dacc01");
_.RowGuid[8] = new Guid("92e5052b-72d0-4c91-9a8c-42591803667e");
_.RowGuid[9] = new Guid("8bd33bed-c4f6-4d44-84fb-a7d04afcd794");
_.RowGuid[10] = new Guid("686999fb-42e6-4d00-9a14-83ffa86833e3");
_.RowGuid[11] = new Guid("82940b03-c70b-4183-8660-6b3418908429");
_.RowGuid[12] = new Guid("644b0cd6-b2c3-4e4d-ab43-091c2ef6c829");
_.RowGuid[13] = new Guid("7f5feb17-8ef4-4236-9f1c-15046d9638f0");
_.RowGuid[14] = new Guid("ac78838d-b503-41a5-9791-480e528f028c");
_.RowGuid[15] = new Guid("2c10a282-a13d-442a-8f45-f4d6b23a7d9c");
_.RowGuid[16] = new Guid("654fb79e-70df-4b92-9832-9fa67013215b");
_.RowGuid[17] = new Guid("3d6ca7ab-055e-4536-8940-76234cc9bcde");
_.RowGuid[18] = new Guid("560feee1-dd54-4c34-abb1-4f8841d0aa41");
_.RowGuid[19] = new Guid("19570052-4023-4658-bc56-dc5c619bd00e");
_.RowGuid[20] = new Guid("27562675-f8c3-4a38-bd9e-b366b83e5204");
_.RowGuid[21] = new Guid("e193ce39-ef33-4969-87b1-468d2f7b48ad");
_.RowGuid[22] = new Guid("e38e076f-5072-437a-a771-ada53b5ab803");
_.RowGuid[23] = new Guid("26c00b7d-6e19-4fbf-b9f1-23c2609e8893");
_.RowGuid[24] = new Guid("6666a81b-90a1-4204-a39e-9f660ca43e5f");
_.RowGuid[25] = new Guid("332dcf9e-dfd2-4345-9015-f4b53ac396ee");
_.RowGuid[26] = new Guid("c2b08405-a9be-4f71-906c-5d7b1e26bde4");
_.RowGuid[27] = new Guid("351a29fb-ceb1-4ca6-bb36-506d87b82a95");
_.RowGuid[28] = new Guid("1918cfd2-69e8-4593-b4d6-8677f18b8f62");
_.RowGuid[29] = new Guid("21624302-ca0f-402f-8a46-5a3fffa7d5f3");
_.RowGuid[30] = new Guid("169c75f6-a364-46e3-8ddb-033528177458");
_.RowGuid[31] = new Guid("c3fbb3ec-3ff6-4ee1-88cf-230e128815f3");
_.ModifiedDate[0] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[1] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[2] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[3] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[4] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[5] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[6] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[7] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[8] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[9] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[10] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[11] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[12] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[13] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[14] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[15] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[16] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[17] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[18] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[19] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[20] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[21] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[22] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[23] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[24] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[25] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[26] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[27] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[28] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[29] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[30] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ModifiedDate[31] = Convert.ToDateTime("2008-06-01T00:00:00.000");
_.ResumeIdenreplacedy();
return result;
}
19
Source : MockMovie.cs
with MIT License
from DevZest
with MIT License
from DevZest
private static DataSet<Movie> GetMovies()
{
DataSet<Movie> result = DataSet<Movie>.Create().AddRows(4);
Movie _ = result._;
_.SuspendIdenreplacedy();
_.ID[0] = 1;
_.ID[1] = 2;
_.ID[2] = 3;
_.ID[3] = 4;
_.replacedle[0] = "When Harry Met Sally";
_.replacedle[1] = "Ghostbusters";
_.replacedle[2] = "Ghostbusters 2";
_.replacedle[3] = "Rio Bravo";
_.ReleaseDate[0] = Convert.ToDateTime("1989-02-12T00:00:00");
_.ReleaseDate[1] = Convert.ToDateTime("1984-03-13T00:00:00");
_.ReleaseDate[2] = Convert.ToDateTime("1986-02-23T00:00:00");
_.ReleaseDate[3] = Convert.ToDateTime("1959-04-15T00:00:00");
_.Genre[0] = "Romantic Comedy";
_.Genre[1] = "Comedy";
_.Genre[2] = "Comedy";
_.Genre[3] = "Western";
_.Price[0] = 7.9900M;
_.Price[1] = 8.9900M;
_.Price[2] = 9.9900M;
_.Price[3] = 3.9900M;
_.ResumeIdenreplacedy();
return result;
}
19
Source : Program.cs
with MIT License
from dimitarminchev
with MIT License
from dimitarminchev
static void Main(string[] args)
{
// Входни данни: начало на изпита и пристигане на студента
int h1 = int.Parse(Console.ReadLine());
int m1 = int.Parse(Console.ReadLine());
int h2 = int.Parse(Console.ReadLine());
int m2 = int.Parse(Console.ReadLine());
// Формираме на датите и разликата между тях
DateTime dt1 = Convert.ToDateTime(h1 + ":" + m1);
DateTime dt2 = Convert.ToDateTime(h2 + ":" + m2);
TimeSpan span = dt2.Subtract(dt1);
int m = span.Minutes;
int h = span.Hours;
// Проверки
if (m < -30) Console.WriteLine("Early");
else if (m >= -30 && m <= 0) Console.WriteLine("On time");
else if (m > 0 || h > 0) Console.WriteLine("Lаte");
if (h <= -1) Console.WriteLine("{0}:{1} hours before the start", Math.Abs(h), Math.Abs(m));
else if(m >= -59 && m <= 0) Console.WriteLine("{0} minutes before the start", Math.Abs(m));
else if (h >= 1) Console.WriteLine("{0}:{1} hours after the start", Math.Abs(h), Math.Abs(m));
else if (m >= 1 && m <= 59) Console.WriteLine("{0} minutes after the start", Math.Abs(m));
}
19
Source : BasicConvert.Overload.cs
with MIT License
from Dogwei
with MIT License
from Dogwei
DateTime IXConverter<string, DateTime>.Convert(string value)
=> Convert.ToDateTime(value);
19
Source : BaseModule.cs
with Apache License 2.0
from duyanming
with Apache License 2.0
from duyanming
public DateTime? RequestDateTime(string key)
{
if (RequestContainsKey(key))
{
return Convert.ToDateTime(GetValueByKey(key));
}
else
{
return null;
}
}
19
Source : articleEx.cs
with MIT License
from ecjtuseclab
with MIT License
from ecjtuseclab
public bool SubmitForm(article articleEnreplacedy, string keyValue)
{
if (!string.IsNullOrEmpty(keyValue))
{
int id = Convert.ToInt32(keyValue);
articleEnreplacedy.id = id;
articleEnreplacedy.edittime = Convert.ToDateTime(DateTime.Now.ToString());
db.Update<article>(articleEnreplacedy);
}
else
{
articleEnreplacedy.edittime = Convert.ToDateTime(DateTime.Now.ToString());
articleEnreplacedy.inserttime = Convert.ToDateTime(DateTime.Now.ToString());
db.Insert<article>(articleEnreplacedy);
}
return true;
}
19
Source : articleEx.cs
with MIT License
from ecjtuseclab
with MIT License
from ecjtuseclab
public bool SubmitForm(article articleEnreplacedy, string keyValue)
{
if (!string.IsNullOrEmpty(keyValue))
{
int id = Convert.ToInt32(keyValue);
articleEnreplacedy.id = id;
articleEnreplacedy.edittime = Convert.ToDateTime(DateTime.Now.ToString());
articleEnreplacedy.inserttime = Convert.ToDateTime(DateTime.Now.ToString());
db.Update<article>(articleEnreplacedy);
}
else
{
articleEnreplacedy.edittime = Convert.ToDateTime(DateTime.Now.ToString());
articleEnreplacedy.inserttime = Convert.ToDateTime(DateTime.Now.ToString());
db.Insert<article>(articleEnreplacedy);
}
return true;
}
19
Source : articleEx.cs
with MIT License
from ecjtuseclab
with MIT License
from ecjtuseclab
public void SubmitForm(article articleEnreplacedy, string keyValue)
{
try
{
if (!string.IsNullOrEmpty(keyValue))
{
int id = Convert.ToInt32(keyValue);
articleEnreplacedy.id = id;
articleEnreplacedy.edittime = Convert.ToDateTime(DateTime.Now.ToString());
articleEnreplacedy.inserttime = Convert.ToDateTime(DateTime.Now.ToString());
db.Update<article>(articleEnreplacedy);
}
else
{
articleEnreplacedy.inserttime = Convert.ToDateTime(DateTime.Now.ToString());
articleEnreplacedy.edittime = Convert.ToDateTime(DateTime.Now.ToString());
db.Insert<article>(articleEnreplacedy);
}
}
catch (Exception)
{
}
}
19
Source : JavaDate.cs
with MIT License
from EminemJK
with MIT License
from EminemJK
public static int GetWeekIndex(string strDate)
{
try
{
//需要判断的时间
DateTime dTime = Convert.ToDateTime(strDate);
return GetWeekIndex(dTime);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
19
Source : Program.cs
with MIT License
from EminemJK
with MIT License
from EminemJK
static void TestExplicitKey()
{
ConnectionBuilder.ConfigRegist("Data Source=.;Initial Catalog = AdminLTE.Net.DB;User ID=sa;Preplacedword =mimashi123", DBType.SqlServer);
var repoStudent = new Repository<Student>();
var t = repoStudent.DBConnection.GetType();
var s1 = new Student()
{
Id = Guid.NewGuid().ToString("N"),
Name = "Lio.Huang",
LinkPhone = "15522223333",
Sex = 1,
CreateTime = Convert.ToDateTime("2019-01-03")
};
var bIn = repoStudent.Insert(s1);
var model = repoStudent.Query(s1.Id);
var list = repoStudent.QueryList();
list[0].Name = "Banana";
var b = repoStudent.Update(list[0]);
}
19
Source : Rule_Format.cs
with Apache License 2.0
from Epi-Info
with Apache License 2.0
from Epi-Info
public override void ApplyRule(DataRow row)
{
if (!row.Table.Columns.Contains(this.DestinationColumnName) || !row.Table.Columns.Contains(this.SourceColumnName))
{
return;
}
string value = string.Empty;
if (this.FormatType != FormatTypes.EpiWeek)
{
value = string.Format(System.Globalization.CultureInfo.CurrentCulture, this.GetFormatString(), row[this.SourceColumnName]) + this.Suffix;
value = value.Trim();
}
else
{
StatisticsRepository.EpiWeek epiWeek = new StatisticsRepository.EpiWeek();
if(row[this.SourceColumnName] != null && !string.IsNullOrEmpty(row[this.SourceColumnName].ToString()))
{
string datestring = row[this.SourceColumnName].ToString();
DateTime? dt = Convert.ToDateTime(datestring);
value = epiWeek.GetEpiWeek(dt).ToString();
value = value.Trim();
}
}
if (string.IsNullOrEmpty(value))
{
row[this.DestinationColumnName] = DBNull.Value;
}
else
{
row[this.DestinationColumnName] = value;
}
}
19
Source : getInvoice_Xml.cs
with GNU Affero General Public License v3.0
from ETDA
with GNU Affero General Public License v3.0
from ETDA
public string getReference_template(DataTable reference)
{
try
{
string result = "";
using (StreamReader sr = new StreamReader(absolutepath+"Resources\\reference.xml"))
{
string Template = sr.ReadToEnd();
foreach (DataRow dr in reference.Rows)
{
DateTime dt = Convert.ToDateTime(dr["doreplacedent_date"].ToString());
var param = new Dictionary<string, string>
{
{"*reference_doreplacedent_id",dr["doreplacedent_id"].ToString()},
{"*reference_doreplacedent_date",dt.ToString("yyyy-MM-ddT00:00:00.000") },
{"*reference_doreplacedent_type_code",dr["type_code"].ToString() }
};
// Read the stream to a string, and write the string to the console.
String line = Template;
foreach (var row in param)
{
line = line.Replace(row.Key, row.Value);
}
result = result + line;
}
return result;
}
}
catch (Exception ex)
{
throw ex;
}
}
19
Source : GeneralRecordWrapper.cs
with GNU General Public License v3.0
from faib920
with GNU General Public License v3.0
from faib920
public virtual DateTime GetDateTime(IDataRecord reader, int i)
{
if (reader.IsDBNull(i))
{
return DateTime.MinValue;
}
var type = reader.GetFieldType(i);
if (type == typeof(DateTime))
{
return reader.GetDateTime(i);
}
if (type == typeof(byte[]))
{
var bts = (byte[])GetValue(reader, i);
if (bts.Length == 8)
{
return DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
}
else
{
var str = Encoding.GetEncoding(0).GetString(bts);
return Convert.ToDateTime(str);
}
}
return Convert.ToDateTime(GetValue(reader, i));
}
19
Source : GeneralRecordWrapper.cs
with GNU Lesser General Public License v3.0
from faib920
with GNU Lesser General Public License v3.0
from faib920
public virtual DateTime GetDateTime(IDataRecord reader, int i)
{
if (reader.IsDBNull(i))
{
return DateTime.MinValue;
}
var type = reader.GetFieldType(i);
if (type == typeof(DateTime))
{
return reader.GetDateTime(i);
}
else if (type == typeof(byte[]))
{
var bts = (byte[])GetValue(reader, i);
if (bts.Length == 8)
{
return DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
}
else
{
var str = Encoding.GetEncoding(0).GetString(bts);
return Convert.ToDateTime(str);
}
}
else if (type == typeof(long))
{
return DateTime.FromBinary(reader.GetInt64(i));
}
return Convert.ToDateTime(GetValue(reader, i));
}
19
Source : SysLogService.cs
with MIT License
from feiyit
with MIT License
from feiyit
public async Task<ApiResult<Page<SysLog>>> GetPagesAsync(PageParm parm)
{
var res = new ApiResult<Page<SysLog>>();
try
{
string beginTime = string.Empty, endTime = string.Empty;
if (!string.IsNullOrEmpty(parm.time))
{
var timeRes = Utils.SplitString(parm.time, '-');
beginTime = timeRes[0].Trim();
endTime = timeRes[1].Trim();
}
res.data =await Db.Queryable<SysLog>()
.WhereIF(!string.IsNullOrEmpty(parm.key), m => m.User.Contains(parm.key) || m.Logger.Contains(parm.key))
.WhereIF(!string.IsNullOrEmpty(parm.where), m => m.Level == parm.where)
.WhereIF(!string.IsNullOrEmpty(parm.time), m => m.Logged >= Convert.ToDateTime(beginTime) && m.Logged <= Convert.ToDateTime(endTime))
.OrderBy(m => m.Logged, OrderByType.Desc)
.Mapper((it, cache) =>
{
if (!string.IsNullOrEmpty(it.UserName))
{
it.User = it.UserName;
}
})
.ToPageAsync(parm.page, parm.limit);
}
catch (Exception ex)
{
res.message = ApiEnum.Error.GetEnumText() + ex.Message;
res.statusCode = (int)ApiEnum.Error;
Logger.Default.ProcessError((int)ApiEnum.Error, ex.Message);
}
return res;
}
19
Source : RegisterViewModel.cs
with GNU General Public License v3.0
from FreeDemon2020
with GNU General Public License v3.0
from FreeDemon2020
private bool IsNotExpired(string fileFullPath,ref string expiresDate)
{
bool isNotExpired = false;
if (!System.IO.File.Exists(fileFullPath))
{
return isNotExpired;
}
if (Plugins.Shared.Library.Librarys.Common.CheckAuthorization(fileFullPath, Properties.Resources.verify_public_rsa, ref expiresDate))
{
//授权合法,检查下有效期
if (expiresDate == "forever")
{
isNotExpired = true;
}
else
{
DateTime current = DateTime.Now;
DateTime deadline = Convert.ToDateTime(expiresDate).AddDays(1);//截止日期得再加上一天,因为从当天00:00:00截止
if (current.CompareTo(deadline) < 0)
{
isNotExpired = true;
}
}
}
return isNotExpired;
}
19
Source : SplashScreenViewModel.cs
with GNU General Public License v3.0
from FreeDemon2020
with GNU General Public License v3.0
from FreeDemon2020
private bool IsNotExpired(string fileFullPath, ref string expiresDate)
{
bool isNotExpired = false;
if (!System.IO.File.Exists(fileFullPath))
{
return isNotExpired;
}
if (Plugins.Shared.Library.Librarys.Common.CheckAuthorization(fileFullPath, RPAStudio.Properties.Resources.verify_public_rsa, ref expiresDate))
{
//授权合法,检查下有效期
if (expiresDate == "forever")
{
isNotExpired = true;
}
else
{
DateTime current = DateTime.Now;
DateTime deadline = Convert.ToDateTime(expiresDate).AddDays(1);//截止日期得再加上一天,因为从当天00:00:00截止
if (current.CompareTo(deadline) < 0)
{
isNotExpired = true;
}
}
}
return isNotExpired;
}
19
Source : GlobalAuthUtil.cs
with GNU Affero General Public License v3.0
from fuwei54321
with GNU Affero General Public License v3.0
from fuwei54321
public static DateTime? GetParamDateTime(this Dictionary<string, object> request, string paramName)
{
var paramValue = request.getString(paramName);
if (!string.IsNullOrWhiteSpace(paramValue))
{
try
{
return Convert.ToDateTime(paramValue);
}
catch (Exception ex)
{
return null;
}
}
return null;
}
19
Source : Temporal.cs
with GNU General Public License v3.0
from fynydd
with GNU General Public License v3.0
from fynydd
public static string DateFormat(this string value, DateFormats format)
{
if (string.IsNullOrEmpty(value) == false)
{
try
{
DateTime date = Convert.ToDateTime(value);
return DateFormat(date, format);
}
catch
{
return string.Empty;
}
}
else
{
return string.Empty;
}
}
19
Source : Temporal.cs
with GNU General Public License v3.0
from fynydd
with GNU General Public License v3.0
from fynydd
public static string TimeFormat(this string date, TimeFormats format)
{
return TimeFormat(Convert.ToDateTime(date), format);
}
19
Source : Temporal.cs
with GNU General Public License v3.0
from fynydd
with GNU General Public License v3.0
from fynydd
public static DateRangeStruct DateRange(this DateTime relativeDate, DateRangeOptions dateRangeOptions)
{
DateTime[] dates = { DateTime.Today, DateTime.Today };
DateTime myDate = relativeDate;
switch (dateRangeOptions)
{
case DateRangeOptions.Week:
if (myDate.DayOfWeek > 0) myDate = myDate.AddDays(-1 * Convert.ToInt32(myDate.DayOfWeek));
dates[0] = myDate;
dates[1] = myDate.AddDays(6);
break;
case DateRangeOptions.Month:
if (myDate.Day > 1) myDate = myDate.AddDays(-1 * (myDate.Day - 1));
dates[0] = myDate;
dates[1] = myDate.AddMonths(1);
dates[1] = dates[1].AddDays(-1);
break;
case DateRangeOptions.Quarter:
if (myDate.Month < 4) dates[0] = Convert.ToDateTime("1/1/" + myDate.Year.ToString());
if (myDate.Month > 3 && myDate.Month < 7) dates[0] = Convert.ToDateTime("4/1/" + myDate.Year.ToString());
if (myDate.Month > 6 && myDate.Month < 10) dates[0] = Convert.ToDateTime("7/1/" + myDate.Year.ToString());
if (myDate.Month > 9) dates[0] = Convert.ToDateTime("10/1/" + myDate.Year.ToString());
dates[1] = dates[0].AddMonths(3);
dates[1] = dates[1].AddDays(-1);
break;
case DateRangeOptions.Year:
dates[0] = Convert.ToDateTime("1/1/" + myDate.Year.ToString());
dates[1] = Convert.ToDateTime("12/31/" + myDate.Year.ToString());
break;
}
DateRangeStruct result = new DateRangeStruct();
result.startDate = dates[0];
result.endDate = dates[1];
return result;
}
19
Source : Identify.cs
with GNU General Public License v3.0
from fynydd
with GNU General Public License v3.0
from fynydd
public static bool IsDate(this string value)
{
bool result = false;
if (!String.IsNullOrEmpty(value))
{
try
{
DateTime dt = Convert.ToDateTime(value);
result = true;
}
catch
{
result = false;
}
}
return result;
}
19
Source : Temporal.cs
with GNU General Public License v3.0
from fynydd
with GNU General Public License v3.0
from fynydd
public static DateRangeStruct DateRange(this string relativeDate, DateRangeOptions dateRangeOptions)
{
return DateRange(Convert.ToDateTime(relativeDate), dateRangeOptions);
}
19
Source : RelationshipIdConverterTests.cs
with MIT License
from GavinPower747
with MIT License
from GavinPower747
[Fact]
public void RelationshipIdConverter_Converts_FromJsonApiFormat()
{
TestArticle testArticle = JsonConvert.DeserializeObject<TestArticle>(jsonApiLiteral, new JsonApiSerializerSettings());
testArticle.Id.Should().Equals(1);
testArticle.replacedle.Should().Equals("JSON API paints my bikeshed!");
testArticle.Body.Should().Equals("The shortest article. Ever.");
testArticle.Created.Should().Equals(Convert.ToDateTime("2015-05-22T14:56:29.000Z"));
testArticle.Updated.Should().Equals(Convert.ToDateTime("2015-05-22T14:56:28.000Z"));
testArticle.AuthorIds.Should().NotBeNullOrEmpty();
testArticle.AuthorIds.Should().Contain(new [] { "42", "43", "44", "45" });
}
19
Source : RelationshipIdConverterTests.cs
with MIT License
from GavinPower747
with MIT License
from GavinPower747
[Fact]
public void RelationshipIdConverter_Converts_FromJsonApiFormat_MultipleTimes()
{
TestArticle testArticle = JsonConvert.DeserializeObject<TestArticle>(jsonApiLiteral, new JsonApiSerializerSettings());
var reserializedArticle = JsonConvert.SerializeObject(testArticle);
var deserializedArticle = JsonConvert.DeserializeObject<TestArticle>(reserializedArticle);
deserializedArticle.Id.Should().Equals(1);
deserializedArticle.replacedle.Should().Equals("JSON API paints my bikeshed!");
deserializedArticle.Body.Should().Equals("The shortest article. Ever.");
deserializedArticle.Created.Should().Equals(Convert.ToDateTime("2015-05-22T14:56:29.000Z"));
deserializedArticle.Updated.Should().Equals(Convert.ToDateTime("2015-05-22T14:56:28.000Z"));
deserializedArticle.AuthorIds.Should().NotBeNullOrEmpty();
deserializedArticle.AuthorIds.Should().Contain(new[] { "42", "43", "44", "45" });
}
19
Source : RelationshipIdConverterTests.cs
with MIT License
from GavinPower747
with MIT License
from GavinPower747
[Fact]
public void RelationshipIdConverter_Converts_FromApplicationJson()
{
var baseArticle = new TestArticle
{
Id = 1,
replacedle = "adsd",
Body = "asda",
Created = Convert.ToDateTime("2015-05-22T14:56:29.000Z"),
Updated = Convert.ToDateTime("2015-05-22T14:56:29.000Z"),
AuthorIds = new[] { "11", "12" }
};
var serializedArticle = JsonConvert.SerializeObject(baseArticle);
var deSerialzedArticle = JsonConvert.DeserializeObject<TestArticle>(serializedArticle);
deSerialzedArticle.Id.Should().Equals(baseArticle.Id);
deSerialzedArticle.replacedle.Should().Equals(baseArticle.replacedle);
deSerialzedArticle.Body.Should().Equals(baseArticle.Body);
deSerialzedArticle.Created.Should().Equals(baseArticle.Created);
deSerialzedArticle.Updated.Should().Equals(baseArticle.Updated);
deSerialzedArticle.AuthorIds.Should().NotBeNullOrEmpty();
deSerialzedArticle.AuthorIds.Should().Contain(baseArticle.AuthorIds);
}
19
Source : LogNetAnalysisControl.cs
with GNU Lesser General Public License v3.0
from gentlman2006
with GNU Lesser General Public License v3.0
from gentlman2006
private void replacedysisLogSource(DateTime start,DateTime end,string degree)
{
if (!string.IsNullOrEmpty(m_LogSource))
{
StringBuilder sb = new StringBuilder();
List<Match> collection = new List<Match>(Regex.Matches(m_LogSource, "\u0002\\[[^\u0002]+").OfType<Match>());
int debug = 0;
int info = 0;
int warn = 0;
int error = 0;
int fatal = 0;
int all = 0;
List<DateTime> list = new List<DateTime>();
for (int i = 0; i < collection.Count; i++)
{
Match m = collection[i];
string deg = m.Value.Substring(2, 2);
DateTime dateTime = Convert.ToDateTime(m.Value.Substring(6, 19));
if (start == DateTime.MinValue)
{
if (i == 0)
{
// 提取第一个时间
textBox2.Text = m.Value.Substring(6, 19);
}
if (i == collection.Count - 1)
{
// 提取最后一个时间
textBox3.Text = m.Value.Substring(6, 19);
}
}
if (start <= dateTime && dateTime <= end)
{
if (checkBox1.Checked)
{
// 正则表达式过滤
if (!Regex.IsMatch(m.Value, textBox4.Text))
{
continue;
}
}
switch (deg)
{
case LogNetManagment.TextDebug:
{
debug++;
break;
}
case LogNetManagment.TextInfo:
{
info++;
break;
}
case LogNetManagment.TextWarn:
{
warn++;
break;
}
case LogNetManagment.TextError:
{
error++;
break;
}
case LogNetManagment.TextFatal:
{
fatal++;
break;
}
default: break;
}
all++;
if (degree == LogNetManagment.TextAll || degree == deg)
{
sb.Append(m.Value.Substring(1));
list.Add(dateTime);
}
}
}
userButton_Debug.UIText = $"{LogNetManagment.TextDebug} ({debug})";
userButton_Info.UIText = $"{LogNetManagment.TextInfo} ({info})";
userButton_Warn.UIText = $"{LogNetManagment.TextWarn} ({warn})";
userButton_Error.UIText = $"{LogNetManagment.TextError} ({error})";
userButton_Fatal.UIText = $"{LogNetManagment.TextFatal} ({fatal})";
userButton_All.UIText = $"{LogNetManagment.TextAll} ({all})";
textBox1.Text = sb.ToString();
listPaint = list;
// 设置图形显示
if (pictureBox1.Width > 10)
{
pictureBox1.Image = PaintData(pictureBox1.Width, pictureBox1.Height);
}
}
}
19
Source : ActCreatePDFChart.cs
with Apache License 2.0
from Ginger-Automation
with Apache License 2.0
from Ginger-Automation
private Dictionary<string, string[]> GetRenderingData(string filePath)
{
var data=readDataFromCSV(filePath);
if (data == null)
return null;
Dictionary<string,string[]> tmp = new Dictionary<string,string[]>();
foreach (var el in data)
{
if (el[0] != null && !tmp.Keys.Contains(el[0]))
{
tmp.Add(el[0], el);
}
else if (el[0] != null && tmp.Keys.Contains(el[0]))
{
try
{
if (Convert.ToDateTime(el[1]) >= Convert.ToDateTime(tmp[el[0]][1]))
tmp[el[0]] = el;
}
catch(Exception e)
{
Reporter.ToLog(eLogLevel.DEBUG, "", e);
}
}
else
continue;
}
return tmp;
}
19
Source : VariableDateTime.cs
with Apache License 2.0
from Ginger-Automation
with Apache License 2.0
from Ginger-Automation
public string ConvertDateTimeToSpecificFormat(string format)
{
return Convert.ToDateTime(this.mInitialDateTime).ToString(format, System.Globalization.CultureInfo.InvariantCulture);
}
19
Source : ObjectExtensions.cs
with MIT License
from gordon-matt
with MIT License
from gordon-matt
public static void SetPropertyValue<T>(this T obj, PropertyInfo property, object value)
{
var propertyType = property.PropertyType;
string valuereplacedtring = value.ToString();
if (propertyType == typeof(String))
{
property.SetValue(obj, valuereplacedtring, null);
}
else if (propertyType == typeof(Int32))
{
property.SetValue(obj, Convert.ToInt32(valuereplacedtring), null);
}
else if (propertyType == typeof(Guid))
{
property.SetValue(obj, new Guid(valuereplacedtring), null);
}
else if (propertyType.GetTypeInfo().IsEnum)
{
var enumValue = Enum.Parse(propertyType, valuereplacedtring);
property.SetValue(obj, enumValue, null);
}
else if (propertyType == typeof(Boolean))
{
property.SetValue(obj, Convert.ToBoolean(valuereplacedtring), null);
}
else if (propertyType == typeof(DateTime))
{
property.SetValue(obj, Convert.ToDateTime(valuereplacedtring), null);
}
else if (propertyType == typeof(Single))
{
property.SetValue(obj, Convert.ToSingle(valuereplacedtring), null);
}
else if (propertyType == typeof(Decimal))
{
property.SetValue(obj, Convert.ToDecimal(valuereplacedtring), null);
}
else if (propertyType == typeof(Byte))
{
property.SetValue(obj, Convert.ToByte(valuereplacedtring), null);
}
else if (propertyType == typeof(Int16))
{
property.SetValue(obj, Convert.ToInt16(valuereplacedtring), null);
}
else if (propertyType == typeof(Int64))
{
property.SetValue(obj, Convert.ToInt64(valuereplacedtring), null);
}
else if (propertyType == typeof(Double))
{
property.SetValue(obj, Convert.ToDouble(valuereplacedtring), null);
}
else if (propertyType == typeof(UInt32))
{
property.SetValue(obj, Convert.ToUInt32(valuereplacedtring), null);
}
else if (propertyType == typeof(UInt16))
{
property.SetValue(obj, Convert.ToUInt16(valuereplacedtring), null);
}
else if (propertyType == typeof(UInt64))
{
property.SetValue(obj, Convert.ToUInt64(valuereplacedtring), null);
}
else if (propertyType == typeof(SByte))
{
property.SetValue(obj, Convert.ToSByte(valuereplacedtring), null);
}
else if (propertyType == typeof(Char))
{
property.SetValue(obj, Convert.ToChar(valuereplacedtring), null);
}
else if (propertyType == typeof(TimeSpan))
{
property.SetValue(obj, TimeSpan.Parse(valuereplacedtring), null);
}
else if (propertyType == typeof(Uri))
{
property.SetValue(obj, new Uri(valuereplacedtring), null);
}
else
{
property.SetValue(obj, Convert.ChangeType(value, property.PropertyType));
//property.SetValue(item, value, null);
}
}
19
Source : HttpRequestObject.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void SendRequest()
{
HttpWebResponse response = null;
ulong requestStart = Util.GetLongTickCount();
try
{
Request = (HttpWebRequest)WebRequest.Create(Url);
Request.Method = HttpMethod;
Request.ContentType = HttpMIMEType;
Request.Timeout = HttpTimeout;
Request.ReadWriteTimeout = HttpTimeout;
if (!HttpVerifyCert)
{
Request.Headers.Add("NoVerifyCert", "true");
}
if (!string.IsNullOrEmpty(proxyurl))
{
if (!string.IsNullOrEmpty(proxyexcepts))
{
string[] elist = proxyexcepts.Split(';');
Request.Proxy = new WebProxy(proxyurl, true, elist);
}
else
{
Request.Proxy = new WebProxy(proxyurl, true);
}
}
foreach (KeyValuePair<string, string> entry in ResponseHeaders)
{
// There are some headers (like "user-agent") that cannot be set via the Headers member.
// See https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.headers%28v=vs.110%29.aspx
if (entry.Key.ToLower().Equals("accept"))
Request.Accept = entry.Value;
else
if (entry.Key.ToLower().Equals("content-length"))
Request.ContentLength = Convert.ToInt64(entry.Value);
else
if (entry.Key.ToLower().Equals("content-type"))
Request.ContentType = entry.Value;
else
if (entry.Key.ToLower().Equals("expect"))
Request.Expect = entry.Value;
else
if (entry.Key.ToLower().Equals("host"))
Request.Host = entry.Value;
else
if (entry.Key.ToLower().Equals("date"))
Request.Date = Convert.ToDateTime(entry.Value);
else
if (entry.Key.ToLower().Equals("if-modified-since"))
Request.IfModifiedSince = Convert.ToDateTime(entry.Value);
else
if (entry.Key.ToLower().Equals("range"))
AddRequestRanges(entry.Value);
else
if (entry.Key.ToLower().Equals("user-agent"))
Request.UserAgent = entry.Value;
else
if (entry.Key.ToLower().Equals("transfer-encoding"))
{
Request.SendChunked = true;
Request.TransferEncoding = entry.Value;
}
else
if (entry.Key.ToLower().Equals("connection"))
{
string tempValue = entry.Value.ToLower();
int pos = tempValue.IndexOf("keep-alive");
if (pos >= 0)
{
tempValue = tempValue.Remove(pos, 10).Trim();
Request.KeepAlive = true;
}
else
{
Request.KeepAlive = false;
}
Request.Connection = tempValue;
}
else
Request.Headers[entry.Key] = entry.Value;
}
// Encode outbound data
if (!String.IsNullOrEmpty(OutboundBody))
{
byte[] data = Encoding.UTF8.GetBytes(OutboundBody);
Request.ContentLength = data.Length;
using (Stream requestStream = Request.GetRequestStream())
{
requestStream.Write(data, 0, data.Length);
requestStream.Close();
}
}
response = (HttpWebResponse)Request.GetResponse();
Status = (int)response.StatusCode;
using (Stream responseStream = response.GetResponseStream())
{
int readSoFar = 0;
int count = 0;
byte[] buf = new byte[HttpBodyMaxLength];
do
{
count = responseStream.Read(buf, readSoFar, HttpBodyMaxLength - readSoFar);
if (count > 0) readSoFar += count;
}
while (count > 0 && readSoFar < HttpBodyMaxLength);
// translate from bytes to ASCII text
ResponseBody = Encoding.UTF8.GetString(buf, 0, readSoFar);
}
}
catch (WebException e)
{
if (e.Status == WebExceptionStatus.ProtocolError)
{
HttpWebResponse webRsp = (HttpWebResponse)e.Response;
Status = (int)webRsp.StatusCode;
ResponseBody = webRsp.StatusDescription;
}
else
{
Status = (int)OSHttpStatusCode.ClientErrorJoker;
ResponseBody = e.Message;
}
}
catch (Exception e)
{
Status = (int)OSHttpStatusCode.ClientErrorJoker;
ResponseBody = e.Message;
m_log.ErrorFormat("[HTTPREQUEST]: 499 - Exception on httprequest: {0}", e.ToString());
}
finally
{
if (response != null)
response.Close();
RequestDuration = Util.GetLongTickCount() - requestStart;
}
_finished = true;
}
19
Source : TwitchPubSubMessages.cs
with MIT License
from hardcpp
with MIT License
from hardcpp
private static DateTime DateTimeStringToObject(string p_Str)
{
return p_Str == null ? new DateTime() : Convert.ToDateTime(p_Str);
}
19
Source : Excuse.cs
with MIT License
from head-first-csharp
with MIT License
from head-first-csharp
private void OpenFile(string excusePath)
{
this.ExcusePath = excusePath;
using (StreamReader reader = new StreamReader(excusePath))
{
Description = reader.ReadLine();
Results = reader.ReadLine();
LastUsed = Convert.ToDateTime(reader.ReadLine());
}
}
19
Source : UsefulStuff.cs
with GNU General Public License v3.0
from HicServices
with GNU General Public License v3.0
from HicServices
internal DateTime LooseConvertToDate(object iO)
{
DateTime sDate;
try
{
sDate = Convert.ToDateTime(iO);
}
catch (FormatException)
{
try
{
string sDatereplacedtring = iO.ToString();
if (sDatereplacedtring.Length == 8)
{
sDatereplacedtring = sDatereplacedtring.Substring(0, 2) + "/" + sDatereplacedtring.Substring(2, 2) + "/" +
sDatereplacedtring.Substring(4, 4);
sDate = Convert.ToDateTime(sDatereplacedtring);
}
else if (sDatereplacedtring.Length == 6)
{
sDatereplacedtring = sDatereplacedtring.Substring(0, 2) + "/" + sDatereplacedtring.Substring(2, 2) + "/" +
sDatereplacedtring.Substring(4, 2);
sDate = Convert.ToDateTime(sDatereplacedtring);
}
else
throw;
}
catch (Exception)
{
throw new Exception("Cannot recognise date format :" + iO);
}
}
return sDate;
}
19
Source : LogNetAnalysisControl.cs
with GNU Lesser General Public License v3.0
from HslCommunication-Community
with GNU Lesser General Public License v3.0
from HslCommunication-Community
private void replacedysisLogSource(DateTime start,DateTime end,string degree)
{
if (!string.IsNullOrEmpty(m_LogSource))
{
StringBuilder sb = new StringBuilder();
List<Match> collection = new List<Match>(Regex.Matches(m_LogSource, "\u0002\\[[^\u0002]+").OfType<Match>());
int debug = 0;
int info = 0;
int warn = 0;
int error = 0;
int fatal = 0;
int all = 0;
List<DateTime> list = new List<DateTime>();
for (int i = 0; i < collection.Count; i++)
{
Match m = collection[i];
string deg = m.Value.Substring( 2, 5 );
DateTime dateTime = Convert.ToDateTime( m.Value.Substring( m.Value.IndexOf('2'), 19 ) );
if (start == DateTime.MinValue)
{
if (i == 0)
{
// 提取第一个时间
textBox2.Text = m.Value.Substring( m.Value.IndexOf( '2' ), 19 );
}
if (i == collection.Count - 1)
{
// 提取最后一个时间
textBox3.Text = m.Value.Substring( m.Value.IndexOf( '2' ), 19 );
}
}
if (start <= dateTime && dateTime <= end)
{
if (checkBox1.Checked)
{
// 正则表达式过滤
if (!Regex.IsMatch( m.Value, textBox4.Text ))
{
continue;
}
}
if (deg.StartsWith( StringResources.Language.LogNetDebug ))
debug++;
else if (deg.StartsWith( StringResources.Language.LogNetInfo ))
info++;
else if (deg.StartsWith( StringResources.Language.LogNetWarn ))
warn++;
else if (deg.StartsWith( StringResources.Language.LogNetError ))
error++;
else if (deg.StartsWith( StringResources.Language.LogNetFatal ))
fatal++;
all++;
if (degree == StringResources.Language.LogNetAll || deg.StartsWith(degree))
{
sb.Append( m.Value.Substring( 1 ) );
list.Add( dateTime );
}
}
}
userButton_Debug.UIText = $"{StringResources.Language.LogNetDebug} ({debug})";
userButton_Info.UIText = $"{StringResources.Language.LogNetInfo} ({info})";
userButton_Warn.UIText = $"{StringResources.Language.LogNetWarn} ({warn})";
userButton_Error.UIText = $"{StringResources.Language.LogNetError} ({error})";
userButton_Fatal.UIText = $"{StringResources.Language.LogNetFatal} ({fatal})";
userButton_All.UIText = $"{StringResources.Language.LogNetAll} ({all})";
textBox1.Text = sb.ToString();
listPaint = list;
// 设置图形显示
if (pictureBox1.Width > 10)
{
pictureBox1.Image = PaintData(pictureBox1.Width, pictureBox1.Height);
}
}
}
19
Source : Class1.cs
with Apache License 2.0
from hueifeng
with Apache License 2.0
from hueifeng
public static int GetAgeByIdCard(this string idCard)
{
int age = 0;
if (!string.IsNullOrWhiteSpace(idCard))
{
var subStr = string.Empty;
if (idCard.Length == 18)
{
subStr = idCard.Substring(6, 8).Insert(4, "-").Insert(7, "-");
}
else if (idCard.Length == 15)
{
subStr = ("19" + idCard.Substring(6, 6)).Insert(4, "-").Insert(7, "-");
}
TimeSpan ts = DateTime.Now.Subtract(Convert.ToDateTime(subStr));
age = ts.Days / 365;
}
return age;
}
19
Source : New_Patient_Page.cs
with BSD 3-Clause "New" or "Revised" License
from Ideasis
with BSD 3-Clause "New" or "Revised" License
from Ideasis
public void edit_start()
{
if (GlobalVariables.Is_Edit == true)
{
using (VivosEnreplacedies db = new VivosEnreplacedies())
{
List<Patient> patientlist = (from x in db.Patients select x).ToList();
for (int i = 0; i < patientlist.Count; i++)
{
if(patientlist[i].Id==GlobalVariables.Edit_ID)
{
txtPatientCode.Text = patientlist[i].Code;
txtDescription.Text= patientlist[i].Notes;
if(patientlist[i].DateOfBirth!=null)
{
string[] datetime = ((patientlist[i].DateOfBirth).ToString()).Split(' ');
clndrBirthday.Value =Convert.ToDateTime(datetime[0]);
}
}
}
}
}
}
19
Source : TimeServiceClient.cs
with MIT License
from inflames2k
with MIT License
from inflames2k
public async Task<TimeInfo> GetInfoAsync()
{
XDoreplacedent doreplacedent = await this.InvokeAsync("GetInfo", null);
TimeInfo info = new TimeInfo();
info.NTPServer1 = IPAddress.TryParse(doreplacedent.Descendants("NewNTPServer1").First().Value, out IPAddress ntp1) ? ntp1 : IPAddress.None;
info.NTPServer2 = IPAddress.TryParse(doreplacedent.Descendants("NewNTPServer2").First().Value, out IPAddress ntp2) ? ntp2 : IPAddress.None;
info.CurrentLocalTime = Convert.ToDateTime(doreplacedent.Descendants("NewCurrentLocalTime").First().Value);
info.LocalTimeZone = doreplacedent.Descendants("NewLocalTimeZone").First().Value;
info.LocalTimeZoneName = doreplacedent.Descendants("NewLocalTimeZoneName").First().Value;
info.DaylightSavingsUsed = doreplacedent.Descendants("NewDaylightSavingsUsed").First().Value == "1";
info.DaylightSavingsStart = Convert.ToDateTime(doreplacedent.Descendants("NewDaylightSavingsStart").First().Value);
info.DaylightSavingsEnd = Convert.ToDateTime(doreplacedent.Descendants("NewDaylightSavingsEnd").First().Value);
return info;
}
19
Source : PrimitiveTypeEncoder.cs
with MIT License
from iothua
with MIT License
from iothua
public object Decode(Type type, string input)
{
#if NETFX_CORE
TypeCode typeCode = WinRTLegacy.TypeExtensions.GetTypeCode(type);
#else
TypeCode typeCode = Type.GetTypeCode(type);
#endif
switch (typeCode)
{
case TypeCode.String:
return input;
case TypeCode.Boolean:
return Convert.ToBoolean(input);
case TypeCode.SByte:
return Convert.ToSByte(input);
case TypeCode.Byte:
return Convert.ToByte(input);
case TypeCode.Int16:
return Convert.ToInt16(input);
case TypeCode.UInt16:
return Convert.ToUInt16(input);
case TypeCode.Int32:
return Convert.ToInt32(input);
case TypeCode.UInt32:
return Convert.ToUInt32(input);
case TypeCode.Int64:
return Convert.ToInt64(input);
case TypeCode.UInt64:
return Convert.ToUInt64(input);
case TypeCode.Char:
return Convert.ToChar(input);
case TypeCode.Single:
return Convert.ToSingle(input);
case TypeCode.Double:
return Convert.ToDouble(input);
case TypeCode.Decimal:
return Convert.ToDecimal(input);
case TypeCode.DateTime:
return Convert.ToDateTime(input);
}
throw new NotSupportedException();
}
19
Source : Response.cs
with MIT License
from iwate
with MIT License
from iwate
public T ReadAs<T>(string jsonPath, IJsonSerializer serializer)
{
if (Body == null)
return default(T);
if (MediaType == "application/json")
{
if (jsonPath == null)
return serializer.Deserialize<T>(Body);
else
return serializer.Deserialize<T>(Body, jsonPath);
}
var type = typeof(T);
if (MediaType == "text/plain")
{
if (type == typeof(string))
return (T)(object)Body;
if (type == typeof(int) || type == typeof(int?))
return (T)(object)Convert.ToInt32(Body);
if (type == typeof(long) || type == typeof(long?))
return (T)(object)Convert.ToInt64(Body);
if (type == typeof(float) || type == typeof(float?))
return (T)(object)Convert.ToSingle(Body, CultureInfo.InvariantCulture);
if (type == typeof(double) || type == typeof(double?))
return (T)(object)Convert.ToDouble(Body, CultureInfo.InvariantCulture);
if (type == typeof(decimal) || type == typeof(decimal?))
return (T)(object)Convert.ToDecimal(Body, CultureInfo.InvariantCulture);
if (type == typeof(DateTime) || type == typeof(DateTime?))
return (T)(object)Convert.ToDateTime(Body);
if (type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?))
return (T)(object)DateTimeOffset.Parse(Body);
}
if (MediaType == "application/octet-stream")
{
if (type == typeof(byte[]))
return (T)(object)Binary;
if (type == typeof(Stream))
return (T)(object)new MemoryStream(Binary);
}
throw new NotSupportedException();
}
19
Source : Program.cs
with MIT License
from JackQChen
with MIT License
from JackQChen
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
MessageBoxEx.time = args.Length == 0 ? 0 : 5000;
bool createdNew = false;
Mutex instance = new Mutex(true, Application.ExecutablePath.Replace("\\", "/"), out createdNew);
if (createdNew)
{
UpdateCheck check = new UpdateCheck();
var localTime = Convert.ToDateTime(ConfigurationManager.AppSettings["UpdateTime"]);
var remoteTime = check.GetUpdateTime();
var needUpdate = args.Length == 0 ? true : localTime < remoteTime;
if (needUpdate)
{
var frm = new FrmMain();
//无参启动不更新时间
frm.remoteTime = args.Length == 0 ? localTime : remoteTime;
Application.Run(frm);
}
if (args.Length == 0)
MessageBoxEx.Show("自动更新完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
Process.Start(AppDomain.CurrentDomain.BaseDirectory + args[0], "AutoUpdate " + needUpdate.ToString());
//检查更新自身
UpdateSelf();
}
else
{
MessageBoxEx.Show("自动更新正在运行中!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
19
Source : UpdateCheck.cs
with MIT License
from JackQChen
with MIT License
from JackQChen
public DateTime GetUpdateTime(string remoteFilePath, string remoteFileName)
{
FtpWebRequest reqFTP;
DateTime dtUpdate = DateTime.MinValue;
try
{
reqFTP = (FtpWebRequest)WebRequest.Create(new Uri(string.Format("{0}//{1}", remoteFilePath, remoteFileName)));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserName, ftpPreplacedword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
StreamReader streamReader = new StreamReader(ftpStream, Encoding.UTF8);
dtUpdate = Convert.ToDateTime(streamReader.ReadToEnd());
streamReader.Close();
ftpStream.Close();
response.Close();
}
catch (Exception ex)
{
MessageBoxEx.Show(ex.Message, "自动更新失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return dtUpdate;
}
19
Source : Validate.cs
with MIT License
from JackQChen
with MIT License
from JackQChen
private bool IsValidity(string validity)
{
return DateTime.Now < Convert.ToDateTime(validity);
}
19
Source : InAppBilling.uwp.cs
with MIT License
from jamesmontemagno
with MIT License
from jamesmontemagno
public static IEnumerable<InAppBillingPurchase> ToInAppBillingPurchase(this string xml, ProductPurchaseStatus status)
{
var purchases = new List<InAppBillingPurchase>();
var xmlDoc = new XmlDoreplacedent();
try
{
xmlDoc.LoadXml(xml);
}
catch
{
//Invalid XML, we haven't finished this transaction yet.
}
// Iterate through all ProductReceipt elements
var xmlProductReceipts = xmlDoc.GetElementsByTagName("ProductReceipt");
for (var i = 0; i < xmlProductReceipts.Count; i++)
{
var xmlProductReceipt = xmlProductReceipts[i];
// Create new InAppBillingPurchase with values from the xml element
var purchase = new InAppBillingPurchase()
{
Id = xmlProductReceipt.Attributes["Id"].Value,
TransactionDateUtc = Convert.ToDateTime(xmlProductReceipt.Attributes["PurchaseDate"].Value),
ProductId = xmlProductReceipt.Attributes["ProductId"].Value,
AutoRenewing = false // Not supported by UWP yet
};
purchase.PurchaseToken = purchase.Id;
purchase.ProductIds = new string[] { purchase.ProductId };
// Map native UWP status to PurchaseState
switch (status)
{
case ProductPurchaseStatus.AlreadyPurchased:
case ProductPurchaseStatus.Succeeded:
purchase.State = PurchaseState.Purchased;
break;
case ProductPurchaseStatus.NotFulfilled:
purchase.State = PurchaseState.Deferred;
break;
case ProductPurchaseStatus.NotPurchased:
purchase.State = PurchaseState.Canceled;
break;
default:
purchase.State = PurchaseState.Unknown;
break;
}
// Add to list of purchases
purchases.Add(purchase);
}
return purchases;
}
19
Source : Issues.cs
with GNU Lesser General Public License v2.1
from jet-global
with GNU Lesser General Public License v2.1
from jet-global
private void LoadData(FileInfo MyFile)
{
if (MyFile.Exists)
{
MyFile.Delete(); // ensures we create a new workbook
}
using (ExcelPackage EP = new ExcelPackage(MyFile))
{
// add a new worksheet to the empty workbook
ExcelWorksheet wsData = EP.Workbook.Worksheets.Add("Data");
//Add the headers
wsData.Cells[1, 1].Value = "INVOICE_DATE";
wsData.Cells[1, 2].Value = "TOTAL_INVOICE_PRICE";
wsData.Cells[1, 3].Value = "EXTENDED_PRICE_VARIANCE";
wsData.Cells[1, 4].Value = "AUDIT_LINE_STATUS";
wsData.Cells[1, 5].Value = "RESOLUTION_STATUS";
wsData.Cells[1, 6].Value = "COUNT";
//Add some items...
wsData.Cells["A2"].Value = Convert.ToDateTime("04/2/2012");
wsData.Cells["B2"].Value = 33.63;
wsData.Cells["C2"].Value = (-.87);
wsData.Cells["D2"].Value = "Unfavorable Price Variance";
wsData.Cells["E2"].Value = "Pending";
wsData.Cells["F2"].Value = 1;
wsData.Cells["A3"].Value = Convert.ToDateTime("04/2/2012");
wsData.Cells["B3"].Value = 43.14;
wsData.Cells["C3"].Value = (-1.29);
wsData.Cells["D3"].Value = "Unfavorable Price Variance";
wsData.Cells["E3"].Value = "Pending";
wsData.Cells["F3"].Value = 1;
wsData.Cells["A4"].Value = Convert.ToDateTime("11/8/2011");
wsData.Cells["B4"].Value = 55;
wsData.Cells["C4"].Value = (-2.87);
wsData.Cells["D4"].Value = "Unfavorable Price Variance";
wsData.Cells["E4"].Value = "Pending";
wsData.Cells["F4"].Value = 1;
wsData.Cells["A5"].Value = Convert.ToDateTime("11/8/2011");
wsData.Cells["B5"].Value = 38.72;
wsData.Cells["C5"].Value = (-5.00);
wsData.Cells["D5"].Value = "Unfavorable Price Variance";
wsData.Cells["E5"].Value = "Pending";
wsData.Cells["F5"].Value = 1;
wsData.Cells["A6"].Value = Convert.ToDateTime("3/4/2011");
wsData.Cells["B6"].Value = 77.44;
wsData.Cells["C6"].Value = (-1.55);
wsData.Cells["D6"].Value = "Unfavorable Price Variance";
wsData.Cells["E6"].Value = "Pending";
wsData.Cells["F6"].Value = 1;
wsData.Cells["A7"].Value = Convert.ToDateTime("3/4/2011");
wsData.Cells["B7"].Value = 127.55;
wsData.Cells["C7"].Value = (-10.50);
wsData.Cells["D7"].Value = "Unfavorable Price Variance";
wsData.Cells["E7"].Value = "Pending";
wsData.Cells["F7"].Value = 1;
using (var range = wsData.Cells[2, 1, 7, 1])
{
range.Style.Numberformat.Format = "mm-dd-yy";
}
wsData.Cells.AutoFitColumns(0);
EP.Save();
}
}
19
Source : UnitTest1.cs
with MIT License
from jianxuanbing
with MIT License
from jianxuanbing
[TestMethod]
public void Test_Conv_DateTime()
{
string time = "2018-02-01";
var result = Convert.ToDateTime(time);
Console.WriteLine(time);
}
19
Source : BaseShared.cs
with Apache License 2.0
from JoesWeek
with Apache License 2.0
from JoesWeek
public DateTime GetDateTime(string key)
{
return Convert.ToDateTime(Get(key, DateTime.MinValue.ToString()));
}
19
Source : ViewObject.ascx.cs
with MIT License
from Kentico
with MIT License
from Kentico
protected void WriteTablesContent()
{
foreach (object[] table in tables)
{
// Prepare the components
DataTable dt = (DataTable)table[0];
LiteralControl ltlContent = (LiteralControl)table[1];
UIPager pagerElem = (UIPager)table[2];
UniPagerConnector connectorElem = (UniPagerConnector)table[3];
// Handle the different types of direct page selector
int currentPageSize = pagerElem.CurrentPageSize;
if (currentPageSize > 0)
{
if (connectorElem.PagerForceNumberOfResults / (float)currentPageSize > 20.0f)
{
pagerElem.DirectPageControlID = "txtPage";
}
else
{
pagerElem.DirectPageControlID = "drpPage";
}
}
// Bind the pager first
connectorElem.RaiseOnPageBinding(null, null);
// Prepare the string builder
StringBuilder sb = new StringBuilder();
// Prepare the indexes for paging
int pageSize = pagerElem.CurrentPageSize;
int startIndex = (pagerElem.CurrentPage - 1) * pageSize + 1;
int endIndex = startIndex + pageSize;
// Process all items
int index = 0;
bool all = (endIndex <= startIndex);
if (dt.Columns.Count > 6)
{
// Write all rows
foreach (DataRow dr in dt.Rows)
{
index++;
if (all || (index >= startIndex) && (index < endIndex))
{
sb.Append("<table clreplaced=\"table table-hover\">");
// Add header
sb.AppendFormat("<thead><tr clreplaced=\"unigrid-head\"><th>{0}</th><th clreplaced=\"main-column-100\">{1}</th></tr></thead><tbody>", GetString("General.FieldName"), GetString("General.Value"));
// Add values
foreach (DataColumn dc in dt.Columns)
{
object value = dr[dc.ColumnName];
// Binary columns
string content;
if ((dc.DataType == typeof(byte[])) && (value != DBNull.Value))
{
byte[] data = (byte[])value;
content = "<" + GetString("General.BinaryData") + ", " + DataHelper.GetSizeString(data.Length) + ">";
}
else
{
content = ValidationHelper.GetString(value, String.Empty);
}
if (!String.IsNullOrEmpty(content))
{
sb.AppendFormat("<tr><td><strong>{0}</strong></td><td clreplaced=\"wrap-normal\">", dc.ColumnName);
// Possible DataTime columns
if ((dc.DataType == typeof(DateTime)) && (value != DBNull.Value))
{
DateTime dateTime = Convert.ToDateTime(content);
CultureInfo cultureInfo = CultureHelper.GetCultureInfo(MembershipContext.AuthenticatedUser.PreferredUICultureCode);
content = dateTime.ToString(cultureInfo);
}
// Process content
ProcessContent(sb, dr, dc.ColumnName, ref content);
sb.Append("</td></tr>");
}
}
sb.Append("</tbody></table>\n");
}
}
}
else
{
sb.Append("<table clreplaced=\"table table-hover\">");
// Add header
sb.Append("<thead><tr clreplaced=\"unigrid-head\">");
int h = 1;
foreach (DataColumn column in dt.Columns)
{
sb.AppendFormat("<th{0}>{1}</th>", (h == dt.Columns.Count) ? " clreplaced=\"main-column-100\"" : String.Empty, column.ColumnName);
h++;
}
sb.Append("</tr></thead><tbody>");
// Write all rows
foreach (DataRow dr in dt.Rows)
{
index++;
if (all || (index >= startIndex) && (index < endIndex))
{
sb.Append("<tr>");
// Add values
foreach (DataColumn dc in dt.Columns)
{
object value = dr[dc.ColumnName];
// Possible DataTime columns
if ((dc.DataType == typeof(DateTime)) && (value != DBNull.Value))
{
DateTime dateTime = Convert.ToDateTime(value);
CultureInfo cultureInfo = CultureHelper.GetCultureInfo(MembershipContext.AuthenticatedUser.PreferredUICultureCode);
value = dateTime.ToString(cultureInfo);
}
string content = ValidationHelper.GetString(value, String.Empty);
content = HTMLHelper.HTMLEncode(content);
sb.AppendFormat("<td{0}>{1}</td>", (content.Length >= 100) ? " clreplaced=\"wrap-normal\"" : String.Empty, content);
}
sb.Append("</tr>");
}
}
sb.Append("</tbody></table>\n");
}
ltlContent.Text = sb.ToString();
}
}
See More Examples