public Check_Out PrintCheck(string data) { Check_Out model = new Check_Out(); Check_In param = Newtonsoft.Json.JsonConvert.DeserializeObject <Check_In>(data); TF.RunSafty.BLL.Tab_DeliverJSPrint bllPrint = new TF.RunSafty.BLL.Tab_DeliverJSPrint(); TF.RunSafty.Model.Tab_DeliverJSPrint modelPlan = new TF.RunSafty.Model.Tab_DeliverJSPrint(); try { int bPrint = bllPrint.IsJsPrintable(param.strPlanGUID, param.strTrainmanGUID, param.dtBeginWorkTime); modelPlan.StrPlanGUID = param.strPlanGUID; modelPlan.StrSiteGUID = param.cid; modelPlan.StrTrainmanGUID = param.strTrainmanGUID; model.result = "0"; model.returnStr = "返回成功"; model.bPrint = bPrint.ToString(); } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); model.result = "1"; model.returnStr = "提交失败" + ex.Message; } return(model); }
public ActionResult Create([Bind(Include = "CheckinId,StudId,ResId,Date_In")] Check_In check_In) { var userId = User.Identity.GetUserId(); var student = db.Students.ToList().Find(x => x.Email == User.Identity.GetUserName()); if (ModelState.IsValid) { var resid = lo.getStudentRes((student.IdNumber)); if (check_In.CheckStudent(check_In.StudId) == true) { check_In.ResId = resid; check_In.UpdateCheckIn(); check_In.Date_In = DateTime.Now.Date; Bs.AddCheckIn(check_In); return(RedirectToAction("Create", "RoomStudents")); } else { ModelState.AddModelError("", "Student is already checked in"); } } if (User.IsInRole("Student")) { ViewBag.StudId = new SelectList(db.Students.Where(x => x.Email == userId), "StudId", "Name", check_In.StudId); } else { ViewBag.StudId = new SelectList(db.Students, "StudId", "Name", check_In.StudId); } ViewBag.ResId = new SelectList(db.Residences, "ResId", "ResName", check_In.ResId); return(View(check_In)); }
public ActionResult DeleteConfirmed(int id) { Check_In check_In = db.Check_In.Find(id); Bs.RemoveCheck_In(check_In); return(RedirectToAction("Index")); }
//Creates public bool AddCheckIn(Check_In check_In) { try { db.Check_In.Add(check_In); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public ActionResult Edit(Check_In check_In) { if (ModelState.IsValid) { Bs.UpdateCheckIn(check_In); return(RedirectToAction("Index")); } ViewBag.ResId = new SelectList(db.Residences, "ResId", "ResName", check_In.ResId); ViewBag.StudId = new SelectList(db.Students, "StudId", "Name", check_In.StudId); return(View(check_In)); }
//Edit public bool UpdateCheckIn(Check_In check_In) { try { db.Entry(check_In).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
protected void btncheckin_Click(object sender, EventArgs e) { Check_In ci = OneDB.Check_Ins.SingleOrDefault( x => x.check_code == codeverify.Text ); if (codeverify != null) { changestatus(); //displaystatus.Text = "Your Email have been verified, enjoy~"; } Response.Redirect("~/Home.aspx"); }
// GET: Check_In/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Check_In check_In = db.Check_In.Find(id); if (check_In == null) { return(HttpNotFound()); } return(View(check_In)); }
// GET: Check_In/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Check_In check_In = db.Check_In.Find(id); if (check_In == null) { return(HttpNotFound()); } ViewBag.ResId = new SelectList(db.Residences, "ResId", "ResName", check_In.ResId); ViewBag.StudId = new SelectList(db.Students, "StudId", "Name", check_In.StudId); return(View(check_In)); }
protected void btnPay_Click(object sender, EventArgs e) { // Customer Id string userId = ""; // Reservation Detail string type = ""; // Food Order string food_id = ""; string food_name = ""; string qty = ""; // Payment decimal totalPrice = 0; if (!string.IsNullOrEmpty(Session["Id"] as string)) { userId = Session["id"].ToString(); if (Page.IsValid) { int randomId; Random random = new Random(); bool repeatId = false; string cust_id; // Booking string bookingId = ""; int person = 0; string seatArea = ""; DateTime dt; // Booking person = int.Parse(Session["person"].ToString()); seatArea = Session["seatArea"].ToString(); dt = DateTime.Parse(Session["datetime"].ToString()); // Generate Booking Id do { randomId = random.Next(10000, 999999); bookingId = "RES" + randomId; var p = OneDB.ReservationBKs.SingleOrDefault(b => b.resID == bookingId); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var stringChars = new char[8]; for (int i = 0; i < stringChars.Length; i++) { stringChars[i] = chars[random.Next(chars.Length)]; } var finalString = new String(stringChars); cust_id = userId; ReservationBK book = new ReservationBK { resID = bookingId, resHeadCount = person, resArea = seatArea, resDate = dt, customer_ID = cust_id }; OneDB.ReservationBKs.InsertOnSubmit(book); OneDB.SubmitChanges(); // Reservation Detail string rd_id; type = Session["reserveType"].ToString(); string res_id; res_id = bookingId; // Generate Reservation Detail Id do { randomId = random.Next(10000, 999999); rd_id = "RD" + randomId; var p = OneDB.Reservation_Details.SingleOrDefault(b => b.resDetail_iD == rd_id); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var RDchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var RDstringChars = new char[8]; for (int i = 0; i < RDstringChars.Length; i++) { RDstringChars[i] = chars[random.Next(RDchars.Length)]; } var RDfinalString = new String(RDstringChars); // Insert in Reservation Detail Table Reservation_Detail resDetail = new Reservation_Detail { resDetail_iD = rd_id, resDetail_type = type, reservation_ID = res_id }; OneDB.Reservation_Details.InsertOnSubmit(resDetail); OneDB.SubmitChanges(); // Food Order food_name = Session["foodname"].ToString(); qty = Session["foodquantity"].ToString(); // Generate Reservation Id do { randomId = random.Next(10000, 999999); food_id = "FO" + randomId; var p = OneDB.Food_Orders.SingleOrDefault(b => b.foodID == food_id); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var FOchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var FOstringChars = new char[8]; for (int i = 0; i < FOstringChars.Length; i++) { FOstringChars[i] = chars[random.Next(FOchars.Length)]; } var FOfinalString = new String(FOstringChars); // Insert in Food Order Food_Order order = new Food_Order { foodID = food_id, }; OneDB.Food_Orders.InsertOnSubmit(order); OneDB.SubmitChanges(); // Food Order Detail string orderid = ""; food_name = Session["foodname"].ToString(); qty = Session["foodquantity"].ToString(); var id = food_id; // Generate Reservation Id do { randomId = random.Next(10000, 999999); orderid = "FD" + randomId; var p = OneDB.FoodOrderDetails.SingleOrDefault(b => b.OrderId == orderid); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var FDchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var FDstringChars = new char[8]; for (int i = 0; i < FDstringChars.Length; i++) { FDstringChars[i] = chars[random.Next(FDchars.Length)]; } var FDfinalString = new String(FDstringChars); // Insert in Food Order Detail FoodOrderDetail od = new FoodOrderDetail { OrderId = food_id, Id = orderid, foodName = food_name, quantity = qty }; OneDB.FoodOrderDetails.InsertOnSubmit(od); OneDB.SubmitChanges(); // Address string address_id; string firstName = txtFirst.Text; string lastName = txtLast.Text; string address = txtAddress.Text; string postcode = txtPostcode.Text; string state = txtState.Text; cust_id = userId; // Generate Reservation Id do { randomId = random.Next(10000, 999999); address_id = "ADD" + randomId; var p = OneDB.Addresses.SingleOrDefault(b => b.Id == address_id); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var ADchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var ADstringChars = new char[8]; for (int i = 0; i < ADstringChars.Length; i++) { ADstringChars[i] = chars[random.Next(ADchars.Length)]; } var ADfinalString = new String(ADstringChars); // Insert in Address Address a = new Address() { Id = address_id, FirstName = firstName, LastName = lastName, AddressLine = address, Postcode = postcode, State = state, Customer_ID = cust_id }; OneDB.Addresses.InsertOnSubmit(a); OneDB.SubmitChanges(); // Payment string pay_id; totalPrice = decimal.Parse(Session["total"].ToString()); DateTime payDate = DateTime.Now; cust_id = userId; string payFoodid = food_id; // Generate Reservation Id do { randomId = random.Next(10000, 999999); pay_id = "P" + randomId; var p = OneDB.Checkouts.SingleOrDefault(b => b.paymentID == pay_id); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var Pchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var PstringChars = new char[8]; for (int i = 0; i < PstringChars.Length; i++) { PstringChars[i] = chars[random.Next(Pchars.Length)]; } var PfinalString = new String(PstringChars); // Insert in Checkout Checkout c = new Checkout() { paymentID = pay_id, totalPrice = totalPrice, paymentDate = payDate, Customer_ID = cust_id, foodID = food_id }; OneDB.Checkouts.InsertOnSubmit(c); OneDB.SubmitChanges(); // Check In string chk_code = ""; // Generate Reservation Id randomId = random.Next(10000, 999999); chk_code = randomId.ToString(); //For random code generate var CHKchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var CHKstringChars = new char[6]; for (int i = 0; i < CHKstringChars.Length; i++) { CHKstringChars[i] = chars[random.Next(CHKchars.Length)]; } var CHKfinalString = new String(CHKstringChars); string booking = "Booking"; string status = "Pending"; // Insert in Check in Check_In chk = new Check_In { check_code = CHKfinalString, check_type = booking, check_status = status }; OneDB.Check_Ins.InsertOnSubmit(chk); OneDB.SubmitChanges(); var email = Session["email"]; // Send Email try { MailMessage mailMessage = new MailMessage(); mailMessage.To.Add(email.ToString()); mailMessage.From = new MailAddress("*****@*****.**"); mailMessage.Subject = "Verification Mail"; mailMessage.Body = "<h3>hi</h3> " + "<h2>your booking verification code are</h2> <p>" + "<h1>" + CHKfinalString + "</h1>"; mailMessage.IsBodyHtml = true; SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = "smtp.gmail.com"; smtpClient.Port = 587; smtpClient.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "cornhub666lol"); smtpClient.EnableSsl = true; smtpClient.Send(mailMessage); } catch (Exception ex) { Response.Write("Unable to send the e-mail <br/>" + ex.Message); } displayStatus.Text = "Payment Successful!"; Server.Transfer("~/Reservation/PaymentSuccessful.aspx"); } } }
public static void AddCheck_In(Check_In check_in, string account) { ChinaPay.B3B.Service.Foundation.Domain.Check_InCellection.Instance.Add(check_in.Id, check_in); saveLog(OperationType.Insert, "添加值机详细信息", check_in.Id.ToString(), account); }
protected void btnReserve_Click(object sender, EventArgs e) { string userId = ""; hfType.Value = "Reserve"; if (!string.IsNullOrEmpty(Session["Id"] as string)) { userId = Session["id"].ToString(); if (Page.IsValid) { // ReservationBK int person = int.Parse(ddl_headCount.Text); string seatArea = ddl_seatArea.Text; string datePick = txtDatepicker.Text; string timePick = txtTime.Text; int randomId; string id; string cust_id; Random random = new Random(); bool repeatId = false; // Generate Reservation Id do { randomId = random.Next(10000, 999999); id = "RES" + randomId; var p = OneDB.ReservationBKs.SingleOrDefault(b => b.resID == id); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var stringChars = new char[8]; for (int i = 0; i < stringChars.Length; i++) { stringChars[i] = chars[random.Next(chars.Length)]; } var finalString = new String(stringChars); cust_id = userId; DateTime dt = DateTime.Parse(datePick + " " + timePick); var reserveDT = OneDB.ReservationBKs.FirstOrDefault(r => r.customer_ID == cust_id && r.resDate == dt); // Check if same user have already reserve on that day, then user cannot reserve in same day again if (reserveDT == null) { //Make reserved table ReservationBK reserve = new ReservationBK { resID = id, resHeadCount = person, resArea = seatArea, resDate = dt, customer_ID = cust_id }; OneDB.ReservationBKs.InsertOnSubmit(reserve); OneDB.SubmitChanges(); // Reservation Detail string rd_id; string rd_type; string res_id; rd_type = hfType.Value; res_id = id; // Generate Reservation Detail Id do { randomId = random.Next(10000, 999999); rd_id = "RD" + randomId; var p = OneDB.Reservation_Details.SingleOrDefault(b => b.resDetail_iD == rd_id); if (p == null) { repeatId = true; } } while (repeatId == false); //For random code generate var RDchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var RDstringChars = new char[8]; for (int i = 0; i < RDstringChars.Length; i++) { RDstringChars[i] = RDchars[random.Next(RDchars.Length)]; } var RDfinalString = new String(RDstringChars); // Insert in Reservation Detail Table Reservation_Detail resDetail = new Reservation_Detail { resDetail_iD = rd_id, resDetail_type = rd_type, reservation_ID = res_id }; OneDB.Reservation_Details.InsertOnSubmit(resDetail); OneDB.SubmitChanges(); // Check In string chk_code = ""; // Generate Reservation Id randomId = random.Next(10000, 999999); chk_code = randomId.ToString(); //For random code generate var CHKchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var CHKstringChars = new char[6]; for (int i = 0; i < CHKstringChars.Length; i++) { CHKstringChars[i] = chars[random.Next(CHKchars.Length)]; } var CHKfinalString = new String(CHKstringChars); string booking = "Reserve"; string status = "Pending"; // Insert in Check in Check_In chk = new Check_In { check_code = CHKfinalString, check_type = booking, check_status = status }; OneDB.Check_Ins.InsertOnSubmit(chk); OneDB.SubmitChanges(); var email = Session["email"]; // Send Email try { MailMessage mailMessage = new MailMessage(); mailMessage.To.Add(email.ToString()); mailMessage.From = new MailAddress("*****@*****.**"); mailMessage.Subject = "Verification Mail"; mailMessage.Body = "<h3>hi</h3> " + "<h2>your booking verification code are</h2> <p>" + "<h1>" + CHKfinalString + "</h1>"; mailMessage.IsBodyHtml = true; SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = "smtp.gmail.com"; smtpClient.Port = 587; smtpClient.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "cornhub666lol"); smtpClient.EnableSsl = true; smtpClient.Send(mailMessage); } catch (Exception ex) { Response.Write("Unable to send the e-mail <br/>" + ex.Message); } displaystatus.Text = "Congratulations, you have succesfully reserved."; } else { displaystatus.Text = "You have already reserved!"; } } } else { Response.Redirect("~/Login.aspx"); } }