public ActionResult Order() { EntitieFinal entitieFinal = new EntitieFinal(); string demand = Request["dem"]; ViewData["demand"] = demand; if (Request.Cookies["loginState"] == null) { return(RedirectToAction("Login", "Login")); } var userName = Request.Cookies["loginState"].Value; if (userName == null) { return(RedirectToAction("Login", "Login")); } var user = entitieFinal.CUSTOMERs.Single(p => p.CUSTOMER_NAME == userName); try { ALL_PHOTO aLL_PHOTO = new ALL_PHOTO(); aLL_PHOTO.PHOTO_ADDRESS = (string)TempData["PhotoID"]; aLL_PHOTO.PHOTO_REQUIREMENT = demand; aLL_PHOTO.PHOTO_SIZE = 42; aLL_PHOTO.PHOTO_STATUS = 0; entitieFinal.ALL_PHOTO.Add(aLL_PHOTO); entitieFinal.SaveChanges(); CONTRACT_PHOTO_INFO contract = new CONTRACT_PHOTO_INFO(); contract.CONTRACT_USER_ID = user.CUSTOMER_ID; contract.CONTRACT_PHOTO_ID = entitieFinal.ALL_PHOTO.Single(p => p.PHOTO_ADDRESS == aLL_PHOTO.PHOTO_ADDRESS).PHOTO_ID; contract.CONTRACT_PHOTOREPAIRER_ID = 1; contract.CONTRACT_START_DATE = new DateTime(); contract.CONTRACT_END_DATE = new DateTime(); contract.CONTRACT_PAYMENT = 80; contract.CONTRACT_STATUS = 0; entitieFinal.CONTRACT_PHOTO_INFO.Add(contract); entitieFinal.SaveChanges(); } catch (Exception e) { Console.WriteLine(e.Message); } return(View()); }
public ActionResult EquDelete(string orderID) { ViewData["front"] = "1"; var ID = long.Parse(orderID); EntitieFinal entitie = new EntitieFinal(); var order = entitie.ORDER_EQUIPMENT_INFO.Single(temp => temp.ORDER_ID == ID); entitie.ORDER_EQUIPMENT_INFO.Remove(order); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); }
public ActionResult UserDelete(string userID) { ViewData["front"] = "4"; var ID = long.Parse(userID); EntitieFinal entitie = new EntitieFinal(); var user = entitie.CUSTOMERs.Single(temp => temp.CUSTOMER_ID == ID); entitie.CUSTOMERs.Remove(user); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); }
public ActionResult EmpDelete(string empID) { ViewData["front"] = "3"; var ID = long.Parse(empID); EntitieFinal entitie = new EntitieFinal(); var emp = entitie.EMPLOYEEs.Single(temp => temp.EMPLOYEE_ID == ID); entitie.EMPLOYEEs.Remove(emp); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); }
public ActionResult PicDelete(string picID) { ViewData["front"] = "2"; var ID = long.Parse(picID); EntitieFinal entitie = new EntitieFinal(); var pic = entitie.CONTRACT_PHOTO_INFO.Single(temp => temp.CONTRACT_PHOTO_ID == ID); entitie.CONTRACT_PHOTO_INFO.Remove(pic); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); }
public ActionResult EqptBuy() { if (Request.Cookies["loginState"] == null) { return(RedirectToAction("../Login/Login")); } EntitieFinal entitieFinal = new EntitieFinal(); var address = Request.Form["Item1.ORDER_ADDRESS_DETAIL"]; var startDate = Request.Form["Item1.ORDER_START_DATE"]; var endDate = Request.Form["Item1.ORDER_END_DATE"]; int id = Int32.Parse(TempData["curData"].ToString()); if (address == "" || startDate == "" || endDate == "") { Response.Write("<script>alert('订单错误!')</script>"); var s = id.ToString(); return(RedirectToAction("EqptBuyPage", new { equID = s })); } ORDER_EQUIPMENT_INFO order = new ORDER_EQUIPMENT_INFO(); order.ORDER_ADDRESS_DETAIL = address; order.ORDER_END_DATE = Convert.ToDateTime(endDate); order.ORDER_START_DATE = Convert.ToDateTime(startDate); string name = Request.Cookies["loginState"].Value; order.ORDER_EQUIPMENT_ID = id; order.ORDER_STATUS = 1; var user_id = (from temp in entitieFinal.CUSTOMERs where temp.CUSTOMER_NAME == name select temp.CUSTOMER_ID).ToList().First(); order.ORDER_USER_ID = user_id; var payment = (from temp in entitieFinal.EQUIPMENT_INFO where temp.EQUIPMENT_ID == id select temp.EQUIPMENT_RENT).ToList().First(); order.ORDER_PAYMENT = payment; entitieFinal.ORDER_EQUIPMENT_INFO.Add(order); entitieFinal.SaveChanges(); Response.Write("<script>alert('购买成功')</script>"); return(View("../Home/Index")); }
public ActionResult ChangePwd() { if (Request.Cookies["loginState"].Value == null || !GetUserInfo()) { return(RedirectToAction("../Home/Index")); } string inputPwd = Request["oldPwd"]; var userName = Request.Cookies["loginState"].Value; EntitieFinal entitie = new EntitieFinal(); var userList = (from temp in entitie.ALL_LOGIN_INFO where temp.USER_LOGIN_NAME == userName select temp).ToList(); if (userList.Count() <= 0) { return(RedirectToAction("UserInfo")); } var user = userList.First(); var userPassword = user.USER_PASSWORD;; if (userPassword != inputPwd) { ViewData["PWD"] = "密码输入错误"; } else if (string.IsNullOrEmpty(Request["newPwd"])) { ViewData["EMP"] = "请输入新的密码"; } else if (Request["newPwd"] != Request["confirmPwd"]) { ViewData["NOT"] = "两次输入密码不一致"; } else { ViewData["NOT"] = null; ViewData["EMP"] = null; ViewData["PWD"] = null; ALL_LOGIN_INFO loginInfo = entitie.ALL_LOGIN_INFO.Single(p => p.USER_LOGIN_NAME == userName); loginInfo.USER_PASSWORD = Request["newPwd"]; entitie.SaveChanges(); } return(View("UserInfo")); }
public ActionResult EquAddOrSearch(string op) { ViewData["front"] = "1"; EntitieFinal entitie = new EntitieFinal(); if (op == "add") { var order = new ORDER_EQUIPMENT_INFO(); order.ORDER_USER_ID = long.Parse(Request["USER"]); order.ORDER_EQUIPMENT_ID = long.Parse(Request["EQUID"]); order.ORDER_START_DATE = Convert.ToDateTime(Request["START"]); order.ORDER_END_DATE = Convert.ToDateTime(Request["END"]); order.ORDER_PAYMENT = Convert.ToDecimal(Request["PAY"]); order.ORDER_ADDRESS_DETAIL = "嘉定"; order.ORDER_STATUS = 1; entitie.ORDER_EQUIPMENT_INFO.Add(order); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); } else { var orderList = from order in entitie.ORDER_EQUIPMENT_INFO select order; if (!string.IsNullOrEmpty(Request["ORDERID"])) { var p = long.Parse(Request["ORDERID"]); orderList = from order in orderList where order.ORDER_ID == p select order; } if (!string.IsNullOrEmpty(Request["USER"])) { var p = long.Parse(Request["USER"]); orderList = from order in orderList where order.ORDER_USER_ID == p select order; } if (!string.IsNullOrEmpty(Request["EQUID"])) { var p = long.Parse(Request["EQUID"]); orderList = from order in orderList where order.ORDER_EQUIPMENT_ID == p select order; } if (!string.IsNullOrEmpty(Request["START"])) { var p = Convert.ToDateTime(Request["START"]); orderList = from order in orderList where order.ORDER_START_DATE == p select order; } if (!string.IsNullOrEmpty(Request["END"])) { var p = Convert.ToDateTime(Request["END"]); orderList = from order in orderList where order.ORDER_END_DATE == p select order; } if (!string.IsNullOrEmpty(Request["PAY"])) { var p = Convert.ToDecimal(Request["PAY"]); orderList = from order in orderList where order.ORDER_PAYMENT == p select order; } GetData(); ViewData["EQU"] = orderList.ToList(); } return(View("AdminView")); }
public ActionResult UserAddOrSearch(string op) { ViewData["front"] = "4"; EntitieFinal entitie = new EntitieFinal(); if (op == "add") { var user = new CUSTOMER(); user.CUSTOMER_ID = long.Parse(Request["ID"]); user.CUSTOMER_NAME = Request["NAME"]; user.CUSTOMER_SEX = 0; if (Request["SEX"] == "女") { user.CUSTOMER_SEX = 1; } user.CUSTOMER_ADDRESS_ID = Int32.Parse(Request["ADDRESS"]); user.CUSTOMER_EMAIL = Request["EMAIL"]; user.CUSTOMER_IS_ASSOCIATE = 1; entitie.CUSTOMERs.Add(user); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); } else { var userList = from user in entitie.CUSTOMERs select user; if (!string.IsNullOrEmpty(Request["ID"])) { var p = long.Parse(Request["ID"]); userList = from user in userList where user.CUSTOMER_ID == p select user; } if (!string.IsNullOrEmpty(Request["NAME"])) { var p = Request["NAME"]; userList = from user in userList where user.CUSTOMER_NAME == p select user; } if (!string.IsNullOrEmpty(Request["SEX"])) { long p = 0; if (Request["SEX"] == "女") { p = 1; } userList = from user in userList where user.CUSTOMER_SEX == p select user; } if (!string.IsNullOrEmpty(Request["ADDRESS"])) { var p = long.Parse(Request["ADDRESS"]); userList = from user in userList where user.CUSTOMER_ADDRESS_ID == p select user; } if (!string.IsNullOrEmpty(Request["EMAIL"])) { var p = Request["DEP"]; userList = from user in userList where user.CUSTOMER_EMAIL == p select user; } GetData(); ViewData["USER"] = userList.ToList(); } return(View("AdminView")); }
public ActionResult EmpAddOrSearch(string op) { ViewData["front"] = "3"; EntitieFinal entitie = new EntitieFinal(); if (op == "add") { var emp = new EMPLOYEE(); emp.EMPLOYEE_ID = long.Parse(Request["ID"]); emp.EMPLOYEE_NAME = Request["NAME"]; emp.EMPLOYEE_SEX = 0; if (Request["NAME"] == "女") { emp.EMPLOYEE_SEX = 1; } emp.EMPLOYEE_EMAIL = Request["EMAIL"]; emp.EMPLOYEE_DEPART_NAME = Request["DEP"]; emp.EMPLOYEE_TITLE = Request["TIT"]; emp.EMPLOYEE_SALARY = 0; emp.EMPLOYEE_ADDRESS_ID = 1; emp.EMPLOYEE_ENTRY_TIME = new DateTime(2000, 1, 1); entitie.EMPLOYEEs.Add(emp); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); } else { var empList = from emp in entitie.EMPLOYEEs select emp; if (!string.IsNullOrEmpty(Request["ID"])) { var p = long.Parse(Request["ID"]); empList = from emp in empList where emp.EMPLOYEE_ID == p select emp; } if (!string.IsNullOrEmpty(Request["NAME"])) { var p = Request["NAME"]; empList = from emp in empList where emp.EMPLOYEE_NAME == p select emp; } if (!string.IsNullOrEmpty(Request["SEX"])) { long p = 0; if (Request["SEX"] == "女") { p = 1; } empList = from emp in empList where emp.EMPLOYEE_SEX == p select emp; } if (!string.IsNullOrEmpty(Request["EMAIL"])) { var p = Request["EMAIL"]; empList = from emp in empList where emp.EMPLOYEE_EMAIL == p select emp; } if (!string.IsNullOrEmpty(Request["DEP"])) { var p = Request["DEP"]; empList = from emp in empList where emp.EMPLOYEE_DEPART_NAME == p select emp; } if (!string.IsNullOrEmpty(Request["TIT"])) { var p = Request["TIT"]; empList = from emp in empList where emp.EMPLOYEE_TITLE == p select emp; } GetData(); ViewData["EMP"] = empList.ToList(); } return(View("AdminView")); }
public ActionResult PicAddOrSearch(string op) { ViewData["front"] = "2"; EntitieFinal entitie = new EntitieFinal(); if (op == "add") { var pic = new CONTRACT_PHOTO_INFO(); pic.CONTRACT_PHOTO_ID = long.Parse(Request["PICID"]); pic.CONTRACT_USER_ID = long.Parse(Request["USER"]); pic.CONTRACT_PHOTOREPAIRER_ID = long.Parse(Request["REP"]); pic.CONTRACT_START_DATE = Convert.ToDateTime(Request["START"]); pic.CONTRACT_END_DATE = Convert.ToDateTime(Request["END"]); pic.CONTRACT_PAYMENT = long.Parse(Request["PAY"]); pic.CONTRACT_STATUS = 0; entitie.CONTRACT_PHOTO_INFO.Add(pic); entitie.SaveChanges(); GetData(); return(RedirectToAction("AdminView")); } else { var picList = from pic in entitie.CONTRACT_PHOTO_INFO select pic; if (!string.IsNullOrEmpty(Request["PICID"])) { var p = long.Parse(Request["PICID"]); picList = from pic in picList where pic.CONTRACT_PHOTO_ID == p select pic; } if (!string.IsNullOrEmpty(Request["USER"])) { var p = long.Parse(Request["USER"]); picList = from pic in picList where pic.CONTRACT_USER_ID == p select pic; } if (!string.IsNullOrEmpty(Request["REP"])) { var p = long.Parse(Request["REP"]); picList = from pic in picList where pic.CONTRACT_PHOTOREPAIRER_ID == p select pic; } if (!string.IsNullOrEmpty(Request["START"])) { var p = Convert.ToDateTime(Request["START"]); picList = from pic in picList where pic.CONTRACT_START_DATE == p select pic; } if (!string.IsNullOrEmpty(Request["END"])) { var p = Convert.ToDateTime(Request["END"]); picList = from pic in picList where pic.CONTRACT_END_DATE == p select pic; } if (!string.IsNullOrEmpty(Request["PAY"])) { var p = Convert.ToDecimal(Request["PAY"]); picList = from order in picList where order.CONTRACT_PAYMENT == p select order; } GetData(); ViewData["PIC"] = picList.ToList(); } return(View("AdminView")); }