public void ProcessRequest(HttpContext context) { Account user = (Account)context.Session["sid"]; Student = LabDB.StudentInfo.SingleOrDefault(d => d.AccountId == user.Id); PackageBookInfo bookInfo = new PackageBookInfo { StudentInfo=Student, PackageArrangeId = Convert.ToInt32(context.Request.QueryString["arrangeid"].Trim()), BookTime = DateTime.Now, UserAgent = context.Request.UserAgent.ToString(), }; context.Response.ContentType = "text/plain"; try { if (LabDB.PackageBookInfo.FirstOrDefault(d => d.PackageArrangeId == bookInfo.PackageArrangeId && d.StudentId == bookInfo.StudentId) != null) { throw (new Exception("已经预约!不能再次预约!")); } LabDB.PackageBookInfo.InsertOnSubmit(bookInfo); LabDB.SubmitChanges(); context.Response.Write("1"); } catch (Exception ex) { context.Response.Write("预约失败!请联系管理员!" ); } }
partial void DeletePackageBookInfo(PackageBookInfo instance);
partial void UpdatePackageBookInfo(PackageBookInfo instance);
partial void InsertPackageBookInfo(PackageBookInfo instance);
private void detach_PackageBookInfo(PackageBookInfo entity) { this.SendPropertyChanging(); entity.StudentInfo = null; }
private void detach_PackageBookInfo(PackageBookInfo entity) { this.SendPropertyChanging(); entity.PackageArrange = null; }