本文整理汇总了C#中System.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# System.Insert方法的具体用法?C# System.Insert怎么用?C# System.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System.Insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DuplicateIP
/// <summary>
/// 중복 아이피 접근 체크
/// </summary>
/// <param name="ConnectHost"></param>
/// <param name="Cache"></param>
/// <returns></returns>
public string DuplicateIP(string ConnectHost, System.Web.Caching.Cache Cache)
{
DateTime CurrentTime = Convert.ToDateTime(DateTime.Now.ToString("HH:mm"));
//접속 가능 시간 체크
if (CurrentTime >= Convert.ToDateTime("03:00") && CurrentTime <= Convert.ToDateTime("07:00"))
{
if (Cache == null || Cache["ConnectIP"] == null)
{
//Cache가 없을 경우, 접속IP로 Cache 생성
Cache.Insert("ConnectIP", ConnectHost, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero);
return "접속 가능 (첫 접속)";
}
else
{
if (Cache["ConnectIP"].ToString() == ConnectHost)
{
//5분이내 같은 IP주소로 접속한 경우
return "5분이내에 같은 IP로 접속했습니다! 5분 후에 다시 시도해 주세요.";
}
else
{
//다른 IP로 접속했을 경우 Cache에 업데이트
Cache.Remove("ConnectIP");
Cache.Insert("ConnectIP", ConnectHost, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero);
return "접속 가능 (Cache 업데이트)";
}
}
}
else
{
return "접속 가능 시간이 아닙니다.(03:00~07:00)";
}
}
示例2: Prepare
/// <summary>
/// Perform mapping for each character of input.
/// </summary>
/// <param name="result">Result is modified in place.</param>
public override void Prepare(System.Text.StringBuilder result)
{
// From RFC3454, section 3: Mapped characters are not
// re-scanned during the mapping step. That is, if
// character A at position X is mapped to character B,
// character B which is now at position X is not checked
// against the mapping table.
int pos;
string map;
int len;
for (int i=0; i<result.Length; i++)
{
pos = Array.BinarySearch(m_table, result[i], m_comp);
if (pos < 0)
continue;
map = m_table[pos];
len = map.Length;
if (len == 1)
{
result.Remove(i, 1);
i--;
}
else
{
result[i] = map[1];
if (len > 2)
{
result.Insert(i+1, map.ToCharArray(2, len - 2));
i += len - 2;
}
}
}
}
示例3: ModifyWizardPages
public override void ModifyWizardPages(object source, GXPropertyPageType type, System.Collections.Generic.List<Control> pages)
{
if (type == GXPropertyPageType.Device)
{
pages.Insert(1, new GXDLT645DeviceWizardDlg());
}
else if (type == GXPropertyPageType.Property ||
type == GXPropertyPageType.Table)
{
//Remove default pages.
pages.Clear();
pages.Add(new AddressDlg());
}
else if (type == GXPropertyPageType.Import)
{
pages.Insert(1, new DeviceImportForm());
}
}
示例4: GetInsertCacheItem
public static object GetInsertCacheItem(System.Web.Caching.Cache cache, string key, Delegate action, object[] args, bool flushCache = false)
{
var cacheItem = cache[key];
if (cacheItem != null && !flushCache) return cacheItem;
cacheItem = action.DynamicInvoke(args);
cache.Insert(key, cacheItem);
return cacheItem;
}
示例5: InsertToolStripTypeItem
private static void InsertToolStripTypeItem(System.Collections.IList items, ToolStripItem newItem)
{
ToolStripItem item2 = newItem;
ToolStripMenuItem menuItem2 = item2 as ToolStripMenuItem;
for (int i = 0; i < items.Count; i++)
{
ToolStripItem item1 = items[i] as ToolStripItem;
ToolStripMenuItem menuItem1 = item1 as ToolStripMenuItem;
if (item1 == null)
continue;
bool item1IsType = item1.Tag is Type;
bool item2IsType = item2.Tag is Type;
System.Reflection.Assembly assembly1 = item1.Tag is Type ? (item1.Tag as Type).Assembly : item1.Tag as System.Reflection.Assembly;
System.Reflection.Assembly assembly2 = item2.Tag is Type ? (item2.Tag as Type).Assembly : item2.Tag as System.Reflection.Assembly;
int result =
(assembly2 == typeof(DualityApp).Assembly ? 1 : 0) -
(assembly1 == typeof(DualityApp).Assembly ? 1 : 0);
if (result > 0)
{
items.Insert(i, newItem);
return;
}
else if (result != 0) continue;
result =
(item2IsType ? 1 : 0) -
(item1IsType ? 1 : 0);
if (result > 0)
{
items.Insert(i, newItem);
return;
}
else if (result != 0) continue;
result = string.Compare(item1.Text, item2.Text);
if (result > 0)
{
items.Insert(i, newItem);
return;
}
else if (result != 0) continue;
}
items.Add(newItem);
}
示例6: PublishResults
private static void PublishResults(decimal initialTime, decimal baseTime, int warmupSamples, decimal warmupMean, decimal warmupStandardDeviation, int testSamples, decimal testMean, decimal testStandardDeviation)
{
Trace.WriteLine(string.Format("initialTime: {0}:", FormatTime(1, initialTime)));
Trace.WriteLine(string.Format("baseTime: {0}:", FormatTime(1, baseTime)));
Trace.WriteLine(string.Format("warmupSamples: {0}", warmupSamples));
Trace.WriteLine(string.Format("warmupMean: {0}:", FormatTime(warmupSamples, warmupMean, warmupStandardDeviation)));
Trace.WriteLine(string.Format("testSamples: {0}", testSamples));
Trace.WriteLine(string.Format("testMean: {0}:", FormatTime(testSamples, testMean, testStandardDeviation)));
var testName = TestContext.CurrentContext.Test.FullName;
var resultsFolder = Path.Combine(
TestContext.CurrentContext.TestDirectory,
"performance");
var outputPath = Path.Combine(
resultsFolder,
testName + ".csv");
var columns = "date,testSamples,testMean,testStandardDeviation,warmupSamples,warmupMean,warmupStandardDeviation,initialTime,baseTime,machine";
if (File.Exists(outputPath))
{
var lines = File.ReadAllLines(outputPath);
Assume.That(lines.Length, Is.GreaterThanOrEqualTo(1));
Assume.That(lines[0], Is.EqualTo(columns));
}
else
{
if (!Directory.Exists(resultsFolder))
{
Directory.CreateDirectory(resultsFolder);
}
File.WriteAllLines(outputPath, new[]
{
columns
});
}
var data = new[] { testSamples, testMean, testStandardDeviation, warmupSamples, warmupMean, warmupStandardDeviation, initialTime, baseTime }.Select(d => d.ToString(CultureInfo.InvariantCulture)).ToList();
data.Insert(0, DateTime.UtcNow.ToString("O"));
data.Insert(9, Environment.MachineName);
File.AppendAllLines(outputPath, new[]
{
string.Join(",", data),
});
}
示例7: Can_insert_and_select_from_ModelWithFieldsOfDifferentAndNullableTypes_table_impl
private void Can_insert_and_select_from_ModelWithFieldsOfDifferentAndNullableTypes_table_impl(System.Data.IDbConnection db)
{
{
db.CreateTable<ModelWithFieldsOfDifferentAndNullableTypes>(true);
var row = ModelWithFieldsOfDifferentAndNullableTypes.Create(1);
Console.WriteLine(OrmLiteConfig.DialectProvider.ToInsertRowStatement(null, row));
db.Insert(row);
var rows = db.Select<ModelWithFieldsOfDifferentAndNullableTypes>();
Assert.That(rows, Has.Count.EqualTo(1));
ModelWithFieldsOfDifferentAndNullableTypes.AssertIsEqual(rows[0], row);
}
}
示例8: Insert
public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
{
string sqlCount;
string sqlInsert;
System.Data.DataView selectTable = new System.Data.DataView();
int count;
sqlCount = "SELECT * FROM " + table;
dataSource.SelectCommand = sqlCount;
selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);
//find out how many records are in the table in order to set the primary key
count = selectTable.Count;
//Insert
sqlInsert = "INSERT INTO " + table
+ "(suncrylicRoofID,partName,description,partNumber,color,maxLength,lengthUnits,usdPrice,cadPrice,status)"
+ "VALUES"
+ "(" + (count + 1) + ",'" + SuncrylicName + "','" + SuncrylicDescription + "','" + PartNumber + "','" + SuncrylicColor + "'," + SuncrylicMaxLength + ",'" + SuncrylicLengthUnits + "',"
+ UsdPrice + "," + CadPrice + "," + 1 + ")";
dataSource.InsertCommand = sqlInsert;
dataSource.Insert();
}
示例9: parseDate
/// <summary>
/// Parse a rfc 2822 date and time specification. rfc 2822 section 3.3
/// </summary>
/// <param name="date">rfc 2822 date-time</param>
/// <returns>A <see cref="System.DateTime" /> from the parsed header body</returns>
public static System.DateTime parseDate( System.String date )
{
if ( date==null || date.Equals(System.String.Empty) )
return System.DateTime.MinValue;
System.DateTime msgDateTime;
date = anmar.SharpMimeTools.SharpMimeTools.uncommentString (date);
msgDateTime = new System.DateTime (0);
try {
// TODO: Complete the list
date = date.Replace("UT", "+0000");
date = date.Replace("GMT", "+0000");
date = date.Replace("EDT", "-0400");
date = date.Replace("EST", "-0500");
date = date.Replace("CDT", "-0500");
date = date.Replace("MDT", "-0600");
date = date.Replace("MST", "-0600");
date = date.Replace("EST", "-0700");
date = date.Replace("PDT", "-0700");
date = date.Replace("PST", "-0800");
date = date.Replace("AM", System.String.Empty);
date = date.Replace("PM", System.String.Empty);
int rpos = date.LastIndexOfAny(new Char[]{' ', '\t'});
if (rpos>0 && rpos != date.Length - 6)
date = date.Substring(0, rpos + 1) + "-0000";
date = date.Insert(date.Length-2, ":");
msgDateTime = DateTime.ParseExact(date,
_date_formats,
System.Globalization.CultureInfo.CreateSpecificCulture("en-us"),
System.Globalization.DateTimeStyles.AllowInnerWhite);
#if LOG
} catch ( System.Exception e ) {
if ( log.IsErrorEnabled )
log.Error(System.String.Concat("Error parsing date: [", date, "]"), e);
#else
} catch ( System.Exception ) {
#endif
msgDateTime = new System.DateTime (0);
}
return msgDateTime;
}
示例10: Insert
public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
{
string sqlCount;
string sqlInsert;
string inchesInsert;
System.Data.DataView selectTable = new System.Data.DataView();
int count;
sqlCount = "SELECT * FROM " + table;
dataSource.SelectCommand = sqlCount;
selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);
//find out how many records are in the table in order to set the primary key
count = selectTable.Count;
if (Sunrail300MaxLengthInches == null)
{
inchesInsert = "null,null,";
}
else
{
inchesInsert = Sunrail300MaxLengthInches + ",'" + Sunrail300MaxLengthInchesUnits + "',";
}
//Insert
sqlInsert = "INSERT INTO " + table
+ "(sr300ID,partName,description,partNumber,color,maxLengthFeet,lengthFeetUnits,maxLengthInches,lengthInchesUnits,usdPrice,cadPrice,status)"
+ "VALUES"
+ "(" + (count + 1) + ",'" + Sunrail300Name + "','" + Sunrail300Description + "','" + PartNumber + "','" + Sunrail300Color + "'," + Sunrail300MaxLengthFeet + ",'"
+ Sunrail300MaxLengthFeetUnits + "'," + inchesInsert
+ Sunrail300UsdPrice + "," + Sunrail300CadPrice + "," + 1 + ")";
dataSource.InsertCommand = sqlInsert;
dataSource.Insert();
}
示例11: determineFirstDigit
/// <summary> Based on pattern of odd-even ('L' and 'G') patterns used to encoded the explicitly-encoded
/// digits in a barcode, determines the implicitly encoded first digit and adds it to the
/// result string.
///
/// </summary>
/// <param name="resultString">string to insert decoded first digit into
/// </param>
/// <param name="lgPatternFound">int whose bits indicates the pattern of odd/even L/G patterns used to
/// encode digits
/// </param>
/// <throws> ReaderException if first digit cannot be determined </throws>
private static void determineFirstDigit(System.Text.StringBuilder resultString, int lgPatternFound)
{
for (int d = 0; d < 10; d++)
{
if (lgPatternFound == FIRST_DIGIT_ENCODINGS[d])
{
resultString.Insert(0, ((char)('0' + d)).ToString());
//resultString.Insert(0, (char) ('0' + d));
return ;
}
}
throw ReaderException.Instance;
}
示例12: Insert
public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
{
string sqlCount;
string sqlInsert;
System.Data.DataView selectTable = new System.Data.DataView();
int count;
sqlCount = "SELECT * FROM " + table;
dataSource.SelectCommand = sqlCount;
selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);
//find out how many records are in the table in order to set the primary key
count = selectTable.Count;
//Insert
sqlInsert = "INSERT INTO " + table
+ "(rollID,partName,partNumber,color,width,widthUnits,weight,weightUnits,usdPrice,cadPrice,status)"
+ "VALUES"
+ "(" + (count + 1) + ",'" + VinylRollName + "','" + PartNumber + "','" + VinylRollColor + "'," + VinylRollWidth + ",'" + VinylRollWidthUnits + "',"
+ VinylRollWeight + ",'" + VinylRollWeightUnits + "',"
+ UsdPrice + "," + CadPrice + "," + 1 + ")";
dataSource.InsertCommand = sqlInsert;
dataSource.Insert();
}
示例13: RegisterRoutes
public void RegisterRoutes(System.Web.Routing.RouteCollection routes)
{
ViewEngines.Engines.Insert(0, new AUConsignorViewEngine());
//this is needed to get sename converted to category id - not using as it's too difficult to munge in sale id
////routes.MapGenericPathRoute("SaleUrl",
//// "{generic_se_name}",
//// new { controller = "Common", action = "GenericUrl" },
//// new[] { "Nop.Web.Controllers" });
////////this will map seo name to your controller/action --- this gets to your action without saleId
//////routes.MapLocalizedRoute("SaleCategory",
////// "{SeName}",
////// new { controller = "AUConsignor", action = "Category" },
////// new[] { "Nop.Web.Controllers" });
//////GOT RID OF THIS
//////routes.MapLocalizedRoute("AUProductDetails",
////// "{productid}", //these names must match the names passed in @Url.RouteUrl
////// new { controller = "AUConsignor", action = "ProductDetails" },
////// //new { seoName = @"."},
////// new[] { "Nop.Web.Controllers" });
//new { productId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+" },
// "Product/ProductDetails/{productid}/{SeName}",
//routes.MapLocalizedRoute("ChangeCurrency",
// "changecurrency/{customercurrency}",
// new { controller = "Common", action = "SetCurrency" },
// new { customercurrency = @"\d+" },
// new[] { "Nop.Web.Controllers" });
// var route = routes.MapRoute("SaleCategory", "AUConsignor/Category/{seoId}/{saleId}",
// new { controller = "AUConsignor", action = "Category" }, //What controller and action to use -->notice 'area="Admin"' is added new { id = @"\d+" },
// new { seoId = @".", saleId = @"\d+" },
// new[] { "Nop.Web.Controllers" }
//);
// routes.Remove(route);
// routes.Insert(0, route);
//public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints, string[] namespaces);
// //Route Name URL that will be controlled
//???
//NULL for now
// var route = routes.MapRoute("Plugin.Misc.AUConsignor.ManageConsignors", "Admin/AUConsignor/ManageConsignors",
// new { controller = "AUConsignor", action = "ManageConsignors" }, //What controller and action to use -->notice 'area="Admin"' is added
// new[] { "Nop.Plugin.Misc.AUConsignor.Controllers" }
//);
// routes.Remove(route);
// routes.Insert(0, route);
// route = null;
// Uncommented to avoid "routing-the-current-request-for-action-is-ambiguous"
var route = routes.MapRoute("Plugin.Misc.AUConsignor.EditCustomer", "AUConsignorAdmin/Edit/{id}",
new { controller = "AUConsignorAdmin", action = "Edit", area = "Admin" }, //What controller and action to use -->notice 'area="Admin"' is added
new { id = @"\d+" },
new[] { "Nop.Admin.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
//Override Product edit route
//var route2 = routes.MapRoute("Plugin.Misc.AUConsignor.Edit",
// "Admin/Product/Edit/{id}",
// new { controller = "AULot", action = "Edit", area = "Admin" }, //notice 'area="Admin"' is added
// new { id = @"\d+" },
// new[] { "Nop.Plugin.Misc.AUConsignor.Controllers" }
//);
//Override primary Customer edit routes - You need the promary route definition for the Master view override for some reason
route = routes.MapRoute("Plugin.Misc.AUConsignor.Customer.Edit", //this name can be anything but must be unique in the routetable
"Admin/Customer/Edit/{id}",
new { controller = "Customer", action = "Edit", area = "Admin" }, //notice 'area="Admin"' is added
new { id = @"\d+" },
new[] { "Nop.Admin.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("Plugin.Misc.AUConsignor.Customer.OrderList", //this name can be anything but must be unique in the routetable
"Admin/Customer/OrderList/{id}",
//.........这里部分代码省略.........
示例14: determineFirstDigit
/// <summary> Based on pattern of odd-even ('L' and 'G') patterns used to encoded the explicitly-encoded
/// digits in a barcode, determines the implicitly encoded first digit and adds it to the
/// result string.
///
/// </summary>
/// <param name="resultString">string to insert decoded first digit into
/// </param>
/// <param name="lgPatternFound">int whose bits indicates the pattern of odd/even L/G patterns used to
/// encode digits
/// </param>
/// <throws> ReaderException if first digit cannot be determined </throws>
private static void determineFirstDigit(System.Text.StringBuilder resultString, int lgPatternFound)
{
for (int d = 0; d < 10; d++)
{
if (lgPatternFound == FIRST_DIGIT_ENCODINGS[d])
{
// resultString.Insert(0, (char) ('0' + d)); // commented by .net follower (http://dotnetfollower.com)
resultString.Insert(0, new char[] { (char)('0' + d) } ); // added by .net follower (http://dotnetfollower.com)
return ;
}
}
throw ReaderException.Instance;
}
示例15: WriteFunction
/// <summary>
/// Writes generic function based on Instructions.
///
/// The other WriteFunction() can figure out the return type automatically, so
/// it is preferred over this more verbose version.
/// </summary>
/// <param name="S">Specification of algebra.</param>
/// <param name="cgd">Results go into cgd.m_defSB, and so on</param>
/// <param name="F">Function specification.</param>
/// <param name="inline">When true, the code is inlined.</param>
/// <param name="staticFunc">Static function?</param>
/// <param name="returnType">The type to return (String, can also be e.g. <c>"code"</c>.</param>
/// <param name="functionName">Name of generated function.</param>
/// <param name="returnArgument">For use with the 'C' language, an extra argument can be used to return results.</param>
/// <param name="arguments">Arguments of function (any `return argument' used for the C language is automatically generated).</param>
/// <param name="instructions">List of GA-instructions which make up the function.</param>
/// <param name="comment">Comment to go into generated code (used for decl only).</param>
/// <param name="writeDecl">When false, no declaration is written</param>
public static void WriteFunction(
Specification S, G25.CG.Shared.CGdata cgd, G25.fgs F,
bool inline, bool staticFunc, string returnType, string functionName,
FuncArgInfo returnArgument, FuncArgInfo[] arguments,
System.Collections.Generic.List<Instruction> instructions, Comment comment, bool writeDecl)
{
// where the definition goes:
StringBuilder defSB = (inline) ? cgd.m_inlineDefSB : cgd.m_defSB;
// declaration:
if (writeDecl)
{
if (comment != null) comment.Write(cgd.m_declSB, S, 0);
bool inlineDecl = false; // never put inline keywords in declaration
WriteDeclaration(cgd.m_declSB, S, cgd, inlineDecl, staticFunc, returnType, functionName, returnArgument, arguments);
cgd.m_declSB.AppendLine(";");
}
if (S.OutputCSharpOrJava()) comment.Write(defSB, S, 0);
WriteDeclaration(defSB, S, cgd, inline, staticFunc, returnType, functionName, returnArgument, arguments);
// open function
defSB.AppendLine("");
defSB.AppendLine("{");
// add extra instruction for reporting usage of SMVs
if (S.m_reportUsage)
instructions.Insert(0, ReportUsage.GetReportInstruction(S, F, arguments));
if (returnArgument != null)
{
int nbTabs = 1;
instructions.Add(new VerbatimCodeInstruction(nbTabs, "return " + returnArgument.Name + ";"));
}
// write all instructions
foreach (Instruction I in instructions)
{
I.Write(defSB, S, cgd);
}
// close function
defSB.AppendLine("}");
}