예제 #1
0
        public bool GetUserInfo()
        {
            var          userName = Request.Cookies["loginState"].Value;
            EntitieFinal entitie  = new EntitieFinal();
            var          userList = (from temp in entitie.CUSTOMERs
                                     where temp.CUSTOMER_NAME == userName
                                     select temp).ToList();

            if (userList.Count() <= 0)
            {
                return(false);
            }
            var user        = userList.First();
            var userID      = user.CUSTOMER_ID;
            var equContract = (from temp in entitie.ORDER_EQUIPMENT_INFO
                               where temp.ORDER_USER_ID == userID
                               orderby temp.ORDER_ID ascending
                               select temp).ToList();
            var picContract = (from temp in entitie.CONTRACT_PHOTO_INFO
                               select temp).ToList();
            var userInfo = (from temp in entitie.CUSTOMERs
                            select temp).ToList();
            var address = (from temp in entitie.ALL_ADDRESS
                           where temp.ADDRESS_ID == user.CUSTOMER_ADDRESS_ID
                           select temp).ToList().First();
            string fullAddress = address.COUNTRY + "" + address.CITY + "" + address.DISTRICT + "" + address.DETAIL_ADDRESS;

            ViewData["ORDER"]    = equContract;
            ViewData["PICORDER"] = picContract;
            ViewData["ACCOUNT"]  = userInfo;
            ViewData["USER"]     = userList.First();
            ViewData["ADDRESS"]  = fullAddress;
            return(true);
        }
예제 #2
0
        public ActionResult EmpManage()
        {
            EntitieFinal entitie = new EntitieFinal();
            var          picList = (from pic in entitie.CONTRACT_PHOTO_INFO
                                    select pic).ToList();

            ViewData["PIC"] = picList;

            return(View());
        }
예제 #3
0
        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"));
        }
예제 #4
0
        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"));
        }
예제 #5
0
        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"));
        }
예제 #6
0
        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"));
        }
예제 #7
0
        public ActionResult EqptPage(string typeIndex)
        {
            EntitieFinal entitie = new EntitieFinal();
            var          equList = (from temp in entitie.EQUIPMENT_INFO
                                    select temp).ToList();
            var cam = (from temp in entitie.EQUIPMENT_INFO
                       where temp.EQUIPMENT_CATEGORY == "摄像机"
                       orderby temp.EQUIPMENT_ID ascending
                       select temp).ToList();

            ViewData["CAM"] = cam;
            var dir = (from temp in entitie.EQUIPMENT_INFO
                       where temp.EQUIPMENT_CATEGORY == "单反相机"
                       orderby temp.EQUIPMENT_ID ascending
                       select temp).ToList();

            ViewData["DIR"] = dir;
            var head = (from temp in entitie.EQUIPMENT_INFO
                        where temp.EQUIPMENT_CATEGORY == "镜头"
                        orderby temp.EQUIPMENT_ID ascending
                        select temp).ToList();

            ViewData["HEAD"] = head;
            var fly = (from temp in entitie.EQUIPMENT_INFO
                       where temp.EQUIPMENT_CATEGORY == "航拍飞机"
                       orderby temp.EQUIPMENT_ID ascending
                       select temp).ToList();

            ViewData["FLY"] = fly;
            var tri = (from temp in entitie.EQUIPMENT_INFO
                       where temp.EQUIPMENT_CATEGORY == "三脚架"
                       orderby temp.EQUIPMENT_ID ascending
                       select temp).ToList();

            ViewData["TRI"] = tri;
            var pai = (from temp in entitie.EQUIPMENT_INFO
                       where temp.EQUIPMENT_CATEGORY == "拍立得"
                       orderby temp.EQUIPMENT_ID ascending
                       select temp).ToList();

            ViewData["PAI"] = pai;
            var other = (from temp in entitie.EQUIPMENT_INFO
                         where temp.EQUIPMENT_CATEGORY == "其他"
                         orderby temp.EQUIPMENT_ID ascending
                         select temp).ToList();

            ViewData["OTHER"] = other;
            return(View());
        }
예제 #8
0
        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());
        }
예제 #9
0
        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"));
        }
예제 #10
0
        public ActionResult EqptBuyPage(string equID)
        {
            TempData["curData"] = equID;
            ViewData["EQTID"]   = equID;
            int          ID      = Convert.ToInt32(equID);
            EntitieFinal entitie = new EntitieFinal();
            var          equList = (from temp in entitie.EQUIPMENT_INFO
                                    where temp.EQUIPMENT_ID == (long)ID
                                    select temp).ToList();

            if (equList.Count() > 0)
            {
                var equ = equList.First();
                ViewData["DETAIL"] = equ.EQUIPMENT_DETAIL;
                ViewData["RENT"]   = equ.EQUIPMENT_RENT;
            }
            return(View());
        }
예제 #11
0
        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"));
        }
예제 #12
0
        public void GetData()
        {
            EntitieFinal entitie = new EntitieFinal();
            var          equList = (from equ in entitie.ORDER_EQUIPMENT_INFO
                                    select equ).ToList();

            ViewData["EQU"] = equList;
            var picList = (from pic in entitie.CONTRACT_PHOTO_INFO
                           select pic).ToList();

            ViewData["PIC"] = picList;
            var userList = (from user in entitie.CUSTOMERs
                            select user).ToList();

            ViewData["USER"] = userList;
            var empList = (from emp in entitie.EMPLOYEEs
                           select emp).ToList();

            ViewData["EMP"] = empList;
        }
예제 #13
0
        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"));
        }
예제 #14
0
        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"));
        }
예제 #15
0
        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"));
        }
예제 #16
0
        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"));
        }