随笔分类 - 一句话代码
摘要:$("#total" + billcode).text(data.Total.toFixed(2));直接使用:toFixed(2)
阅读全文
摘要:方法一:使用DateTime.Compare 方法public static int Compare( DateTime t1, DateTime t2)t1早于t2:小于零t1与t2相同:零t1晚于t2:大于零示例:DateTime ctime = Convert.ToDateTime("2013-07-14 04:00:00.000");DateTime today = DateTime.Now;DateTime.Compare(today,ctime)>0DateTime now = DateTime.Now;var policypro = _db.Policy
阅读全文
摘要:var policystore = _db.PolicyStores.SingleOrDefault(p => System.Data.Objects.EntityFunctions.DiffDays(p.CreateDate, ordercreatedate)==0);
阅读全文
摘要:foreach (var item in orderdetails) { var billdetails = new BillDetail(){BillCode = billoflading.BillCode,StockId = item.StockId,PCS = item.PCS,CreateDate = DateTime.Now}; _db.BillDetails.Add(billdetails); } _db.SaveChanges();
阅读全文
摘要:@Html.ActionLink("公告信息", "notice", "article", null, new { @class = ViewData["getclass"]!="notice"?"":"currclass" })@Html.ActionLink("历史查询", "index", "home", new { hd = DateTime.Today.ToString("yy
阅读全文
摘要:<add name="ProwebEntities" connectionString ="Data Source=.;Integrated Security=true;Initial Catalog=Saienyitai;User ID=sa;Password=sa;MultipleActiveResultSets=true" providerName ="System.Data.SqlClient"/>注意在连接字符串里一定要添加:Integrated Security=true;这样就可以自动删除SQL数据库里的表并
阅读全文
摘要:登录之前判断Cookies是否存在,并判断登录错误次数if (Request.Cookies["loginnum"] != null) { if (Request.Cookies["loginnum"].Value == "3") return Content("<script language='javascript' type='text/javascript'>alert('已经发生 3 次错误!请30分钟再重新查询,谢谢!');history.go(-1);
阅读全文
摘要:1、创建Cookies有两种方法:Response.Cookies["userName"].Value = "patrick";Response.Cookies["userName"].Expires = DateTime.Now.AddDays(1);HttpCookie aCookie = new HttpCookie("lastVisit");aCookie.Value = DateTime.Now.ToString();aCookie.Expires = DateTime.Now.AddDays(1);Re
阅读全文
摘要:$(function () { $("#btn").click(function () { var usercode = $("#UserCode").val(); var verifycode = $("#Verifycode").val(); if ($.trim(usercode) == "" || $.trim(verifycode) == "") { alert(" 您的[客户号]或者[验证码]必须填写!"); return false;...
阅读全文
摘要:@{Html.RenderAction("GenreMenu", "Store");}@{Html.RenderPartial("HistoryList", Model);}
阅读全文
摘要:var lambda=_db.Accounts.Join(_db.AccSubTypes,ac=>ac.Invoice,ast=>ast.Astid,(ac,ast)=>new {ac,ast}) .Join(_db.AccSubTypes,bc=>bc.ac.Schedule,bst=>bst.Astid,(bc,bst)=>new{bc,bst}) .Join(_db.AccSubType...
阅读全文
摘要:return Content("");返回并刷新页面:return Content("");context.Response.ClearContent();context.Response.Write("");
阅读全文
摘要:TimeSpan表示一个时间段实例,两个时间的差就是一个TimeSpan实例。1、TimeSpan.Minutes——其他时间都一样,比较分钟的差,同样的还有:Hours,Second2、TimeSpan.TotalDays——两个时间段相差的日数,同样的还有:TotalHours,TotalMinutes,TotalSecondsstring time1 = "2013-6-6 8:10:00";string time2 = "2013-6-7 18:20:10";DateTime t1 = DateTime.Parse(time1);DateTime
阅读全文
摘要:从客户端(content="...safasasf<scrip>")中检测到有潜在危险的 Request.Form 值。 [Column(TypeName="ntext")] [MaxLength] [UIHint("Kindeditor")] [Required(ErrorMessage = "内容不能为空")] [AllowHtml] public string Content { get; set; }在Model里添加[AllowHtml]即可以避免此问题注意引用:using System.We
阅读全文
摘要:@(i==1 ? "checked='checked'" :" ")
阅读全文
摘要:首先加载如下代码:<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script> @Ajax.Actio
阅读全文
摘要:<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
阅读全文
摘要:在Entities:DbContext里添加如下代码: protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<Account>().HasRequired(b => b.User).WithMany(a => a.Accounts).WillCascadeOnDelete(true); base.OnModelCreating(modelBuilder); }这里Account是从表...
阅读全文
摘要:如题,不然会出现:错误是:该字符串未被识别为有效的布尔值。的错误提示。因为使用:@Html.CheckBoxFor会生成两个隐藏的input他们的值就是false
阅读全文
摘要:Html.BeginForm("actionName","controllerName",FormMethod.POST,new{@class="className"})
阅读全文