本文整理汇总了C#中Common.System类的典型用法代码示例。如果您正苦于以下问题:C# System类的具体用法?C# System怎么用?C# System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System类属于Common命名空间,在下文中一共展示了System类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConvertFrom
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v)
{
try
{
if (v is string)
{
foreach (DictionaryEntry myDE in _hash)
{
if (myDE.Value.Equals((v.ToString())))
return myDE.Key;
}
}
return base.ConvertFrom(context, culture, v);
}
catch
{
return "";
throw new Exception("a");
}
}
开发者ID:Klutzdon,项目名称:PBIMSN,代码行数:25,代码来源:ComboBoxItemTypeConvert.cs
示例2: GetTasks
public PagedDataInquiryResponse<Task> GetTasks(System.Net.Http.HttpRequestMessage requestMessage)
{
var request = _pagedDataRequestFactory.Create(requestMessage.RequestUri);
var tasks = _allTasksInquiryProcessor.GetTasks(request);
return tasks;
}
开发者ID:sanghyukp,项目名称:AngularJSWebAPI2,代码行数:7,代码来源:TasksController.cs
示例3: OnAuthorization
public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext)
{
base.OnAuthorization(actionContext);
if (!CurrentHttpContext.Authorize)
HandleUnauthorizedRequest(actionContext);
}
开发者ID:Regisfra,项目名称:Regisfra.WebApp,代码行数:7,代码来源:AppHttpAuthorizeAttribute.cs
示例4: OnModelCreating
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Dad>()
.Property(x => x.DayOfBirth).IsRequired();
}
开发者ID:chrisortman,项目名称:EfCodeFirstDemo,代码行数:7,代码来源:ValidationExample.cs
示例5: Show
/// <summary>
/// 显示消息提示对话框
/// </summary>
/// <param name="page">当前页面指针,一般为this</param>
/// <param name="msg">提示信息</param>
public static void Show(System.Web.UI.Page page, string msg)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + msg + "');</script>");
// UpdatePanel采用如下方式弹出对话框
//System.Web.UI.ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "javascript", "alert('您已经投过票!');", true);
}
开发者ID:zachary1986,项目名称:TravelAdmin,代码行数:12,代码来源:MessageBox.cs
示例6: AddStyle
/// <summary>
/// 添加CSS样式内容
/// </summary>
/// <param name="page">页面</param>
/// <param name="content">样式内容</param>
public void AddStyle(System.Web.UI.Page page, string content)
{
HtmlGenericControl styleControl = new HtmlGenericControl("style");
styleControl.Attributes.Add("type", "text/css");
styleControl.InnerHtml = content;
page.Header.Controls.Add(styleControl);
}
开发者ID:aj-hc,项目名称:ZSSY,代码行数:12,代码来源:CssHelper.cs
示例7: AddScript
/// <summary>
/// 添加JS脚本内容
/// </summary>
/// <param name="page">页面</param>
/// <param name="content">脚本内容</param>
public void AddScript(System.Web.UI.Page page, string content)
{
HtmlGenericControl scriptControl = new HtmlGenericControl("script");
scriptControl.Attributes.Add("type", "text/javascript");
scriptControl.InnerHtml = content;
page.Header.Controls.Add(scriptControl);
}
开发者ID:aj-hc,项目名称:ZSSY,代码行数:12,代码来源:CssHelper.cs
示例8: SaveXml
/// <summary>
/// 序列化
/// </summary>
/// <param name="filePath">文件路径</param>
/// <param name="obj">要序列化的实体类</param>
/// <param name="type">类型</param>
public static void SaveXml(string filePath, object obj, System.Type type)
{
//////序列化 成 XML 文件 Object -- > XML
//如果文件存在 则先删除原来文件
if (System.IO.File.Exists(filePath))
File.Delete(filePath);
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(filePath))
{
try
{
System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(type);
xs.Serialize(writer, obj);
writer.Close();
}
catch (Exception e)
{
e = e;
throw;
}
}
////////序列化 成 2进制 文件
//FileStream fs = new FileStream(filePath, FileMode.Create);
//BinaryFormatter bf = new BinaryFormatter();
//bf.Serialize(fs, obj);
}
开发者ID:alanhuang1ok,项目名称:easySocket,代码行数:32,代码来源:XMLSerialization.cs
示例9: AddRoom
//添加客房
void AddRoom(object sender,System.EventArgs e)
{
if (MainForm.LoadedUser.Privilege == 0)
{
AddRoom newAddRoom = new AddRoom();
newAddRoom.Text = "添加客房";
if (newAddRoom.ShowDialog() == DialogResult.OK)
{
if (new RoomManager().CheckRoomData(NewRoom ))
{
if (MessageBox.Show("您确定要添加该客房吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
if (new RoomManager().AddRoom(NewRoom))
{
MessageBox.Show("添加成功!", "提示");
}
else
{
MessageBox.Show("发生错误,没有添加成功!", "提示");
}
}
}
else
{
MessageBox.Show("您填写的信息有误,请重新填写!", "提示");
}
}
}
else
{
MessageBox.Show("您没有权限添加客房", "提示");
}
}
开发者ID:pangjiuzala,项目名称:oldcode,代码行数:34,代码来源:RoomInformation.cs
示例10: AddJS
/// <summary>
/// 添加JS脚本链接
/// </summary>
/// <param name="page">页面</param>
/// <param name="url">路径</param>
public void AddJS(System.Web.UI.Page page, string url)
{
HtmlGenericControl jsControl = new HtmlGenericControl("script");
jsControl.Attributes.Add("type", "text/javascript");
jsControl.Attributes.Add("src", url);
page.Header.Controls.Add(jsControl);
}
开发者ID:aj-hc,项目名称:ZSSY,代码行数:12,代码来源:CssHelper.cs
示例11: Template
public void Template(object o, System.EventArgs e)
{
Cambro.Web.Helpers.WriteAlertHeader();
Cambro.Web.Helpers.WriteAlert("Selecting xxx...", 1);
Query q = new Query();
//q.QueryCondition=???
CommentSet bs = new CommentSet(q);
for (int count = 0; count < bs.Count; count++)
{
Comment c = bs[count];
try
{
// Do work here!
c.Update();
if (count % 10 == 0)
Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);
}
catch(Exception ex)
{
Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
}
bs.Kill(count);
}
Cambro.Web.Helpers.WriteAlert("Done!", 3);
Cambro.Web.Helpers.WriteAlertFooter();
}
开发者ID:davelondon,项目名称:dontstayin,代码行数:32,代码来源:Utility.ascx.cs
示例12: ListView_ColumnClick
/// <summary>
/// 单击listview控件的列进行排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void ListView_ColumnClick(object sender, System.Windows.Forms.ColumnClickEventArgs e)
{
System.Windows.Forms.ListView lv = sender as System.Windows.Forms.ListView;
// 检查点击的列是不是现在的排序列.
if (e.Column == (lv.ListViewItemSorter as ListViewColumnSorter).SortColumn)
{
// 重新设置此列的排序方法.
if ((lv.ListViewItemSorter as ListViewColumnSorter).Order == System.Windows.Forms.SortOrder.Ascending)
{
(lv.ListViewItemSorter as ListViewColumnSorter).Order = System.Windows.Forms.SortOrder.Descending;
}
else
{
(lv.ListViewItemSorter as ListViewColumnSorter).Order = System.Windows.Forms.SortOrder.Ascending;
}
}
else
{
// 设置排序列,默认为正向排序
(lv.ListViewItemSorter as ListViewColumnSorter).SortColumn = e.Column;
(lv.ListViewItemSorter as ListViewColumnSorter).Order = System.Windows.Forms.SortOrder.Ascending;
}
// 用新的排序方法对ListView排序
((System.Windows.Forms.ListView)sender).Sort();
}
开发者ID:SaintLoong,项目名称:TDTK.MSCM,代码行数:30,代码来源:ListViewHelper.cs
示例13: ApplicationService_Closing
static void ApplicationService_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (!e.Cancel)
{
Stop();
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:WatcherManager.cs
示例14: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
Usr.KickUserIfNotLoggedIn();
if (!Usr.Current.IsPromoter)
{
throw new DsiUserFriendlyException("You must be a promoter to view this page");
}
if (Edit)
{
if (!Usr.Current.CanEdit(CurrentBanner))
throw new DsiUserFriendlyException("You can't edit this banner!");
}
if (Mode.Equals(Modes.Delete))
{
if (!Usr.Current.CanDelete(CurrentBanner))
throw new DsiUserFriendlyException("You can't delete this banner!");
}
if (Edit && Usr.Current.IsAdmin)
{
ContainerPage.Menu.Admin.AdminPanelOther.Controls.Add(new LiteralControl("<p><a href=\"http://old.dontstayin.com/login-" + Usr.Current.K + "- " + Usr.Current.LoginString + "/admin/banner?ID=" + CurrentBanner.K + "\">Edit banner (admin)</a></p>"));
}
ContainerPage.SetPageTitle("Banner administration");
if (!Page.IsPostBack)
{
if (Mode.Equals(Modes.Edit))
ChangePanel(PanelEdit);
else if (Mode.Equals(Modes.Delete))
ChangePanel(PanelDelete);
else
throw new Exception("Wrong mode");
开发者ID:davelondon,项目名称:dontstayin,代码行数:33,代码来源:.!48387!BannerOptions.ascx.cs
示例15: SendAsync
protected override async System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
if(HttpContext.Current.User.Identity.IsAuthenticated)
{
_log.Debug("Already authenticated; passing on to next handler...");
return await base.SendAsync(request, cancellationToken);
}
if(!CanHandleAuthentication(request))
{
_log.Debug("Not a basic auth request; passing on to next handler...");
return await base.SendAsync(request, cancellationToken);
}
bool isAuthenticated;
try
{
isAuthenticated = Authenticated(request);
}
catch(Exception e)
{
_log.Error("Failure in auth processing", e);
return CreateUnauthorizedResponse();
}
if(isAuthenticated)
{
var response = await base.SendAsync(request, cancellationToken);
return response.StatusCode == HttpStatusCode.Unauthorized ? CreateUnauthorizedResponse() : response;
}
return CreateUnauthorizedResponse();
}
开发者ID:sanghyukp,项目名称:AngularJSWebAPI2,代码行数:34,代码来源:BasicAuthenticationMessageHandler.cs
示例16: ShowAndRedirect
/// <summary>
/// 显示消息提示对话框,并进行页面跳转
/// </summary>
/// <param name="page">当前页面指针,一般为this</param>
/// <param name="msg">提示信息</param>
/// <param name="url">跳转的目标URL</param>
public static void ShowAndRedirect(System.Web.UI.Page page,string msg,string url)
{
//Response.Write("<script>alert('帐户审核通过!现在去为企业充值。');window.location=\"" + pageurl + "\"</script>");
page.ClientScript.RegisterStartupScript(page.GetType(), UnionID().ToString(), "<script language='javascript' defer>alert('" + msg + "');window.location=\"" + url + "\"</script>");
}
开发者ID:uwitec,项目名称:ds568,代码行数:13,代码来源:MessageBox.cs
示例17: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
for (int month = 0; month < 2; month++)
{
TableCell tc = new TableCell();
tc.VerticalAlign = VerticalAlign.Top;
System.Web.UI.WebControls.Calendar c = new System.Web.UI.WebControls.Calendar();
c.VisibleDate = DateTime.Today.AddMonths(month);
c.DayRender += new DayRenderEventHandler(DateCal_DayRender);
c.DayStyle.Width = Unit.Parse("30px");
c.DayStyle.Height = Unit.Parse("35px");
c.DayStyle.VerticalAlign = VerticalAlign.Top;
c.DayStyle.CssClass = "BannerCalendarDay";
c.DayHeaderStyle.CssClass = "BannerCalendarDayHeader";
c.OtherMonthDayStyle.CssClass = "BannerCalendarOtherMonthDay";
c.CssClass = "BannerCalendar";
c.TitleStyle.CssClass = "BannerCalendarTitle";
c.CellPadding = 0;
c.CellSpacing = 0;
c.ShowNextPrevMonth = false;
tc.Controls.Add(c);
Row.Cells.Add(tc);
}
}
开发者ID:davelondon,项目名称:dontstayin,代码行数:25,代码来源:BannerSlots.ascx.cs
示例18: noCache
public static void noCache(System.Web.UI.Page p)
{//使页面不进行缓存
p.Response.Expires = -1;
p.Response.AddHeader("pragma", "no-cache");
p.Response.AddHeader("cache-control", "no-store");
}
开发者ID:uwitec,项目名称:ds568,代码行数:7,代码来源:ClientInfo.cs
示例19: DataTable2Excel
/// <summary>
/// 导出Excel文件,转换为可读模式
/// </summary>
public static void DataTable2Excel(System.Data.DataTable dtData)
{
DataGrid dgExport = null;
HttpContext curContext = HttpContext.Current;
StringWriter strWriter = null;
HtmlTextWriter htmlWriter = null;
if (dtData != null)
{
curContext.Response.ContentType = "application/vnd.ms-excel";
curContext.Response.ContentEncoding = System.Text.Encoding.UTF8;
curContext.Response.Charset = "";
strWriter = new StringWriter();
htmlWriter = new HtmlTextWriter(strWriter);
dgExport = new DataGrid();
dgExport.DataSource = dtData.DefaultView;
dgExport.AllowPaging = false;
dgExport.DataBind();
try
{
dgExport.RenderControl(htmlWriter);
}
catch (Exception e)
{
Log4Net.LogWrite("err", e.Message);
}
curContext.Response.Write(strWriter.ToString());
curContext.Response.End();
}
}
开发者ID:wawa0210,项目名称:jgq,代码行数:33,代码来源:ExcelHelper.cs
示例20: AddMeta
/// <summary>
/// 添加Meta标签
/// </summary>
/// <param name="page">页面</param>
/// <param name="name">Meta名字</param>
/// <param name="content">Meta内容</param>
public void AddMeta(System.Web.UI.Page page, string name, string content)
{
HtmlMeta meta = new HtmlMeta();
meta.Name = name;
meta.Content = content;
page.Header.Controls.Add(meta);
}
开发者ID:aj-hc,项目名称:ZSSY,代码行数:13,代码来源:CssHelper.cs
注:本文中的Common.System类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论