Beispiel #1
0
        public ActionResult Register(String username, String password, String realname, String email, String phone, String gender, String wx)
        {
            DboUtils db   = new DboUtils();
            String   sql0 = "select * from user_info where username='******'";
            DataSet  ds   = db.query(sql0);

            String errorMessage = "";

            if (ds.Tables[0].Rows.Count > 0)
            {
                errorMessage = "用户名已经被注册!!!";
                return(Redirect("/Register/Index?" + errorMessage));
            }
            else
            {
                String sql = "INSERT INTO user_info(realname, username, pwd, email, sex, wx, phonenum) VALUES('"
                             + realname + "','" + username + "','" + password + "','" + email + "','" + gender + "','" + wx + "','" + phone + "')";

                DboUtils db1 = new DboUtils();

                int i = db1.insert(sql);

                if (i > 0)
                {
                    return(Redirect("/Login/Index"));
                }
                else
                {
                    errorMessage = "用户名已经被注册!!!";
                    return(Redirect("/Register/Index?" + errorMessage));
                }
            }
        }
Beispiel #2
0
        public string UpdateInfo(Guid id, String position, String info, String img_s, String img_b, String video)
        {
            DboUtils db = new DboUtils();
            String   s  = Request.Form["orgLookup.id"];


            Guid up_item = Guid.Parse(s);

            String sql = "update top_info set position='" + position + "',up_item='" +
                         up_item + "',info='" + info + "',img_s='" + img_s + "',img_b='" + img_b + "',video='" + video +
                         "'where id='" + id + "'";
            int x = db.update(sql);

            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 200, navTabId = up_item, callbackType = "closeCurrent", forwardUrl = "" });
                return(json);
            }
            else
            {
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 300, navTabId = up_item, callbackType = "", forwardUrl = "" });
                return(json);
            }
        }
Beispiel #3
0
        public string DeleteFromInfo(Guid id)
        {
            DboUtils db = new DboUtils();

            List <Entity.Info> list = new List <Entity.Info>();

            list = getInfoListById(id);

            Guid up_item = list[0].up_item;


            String sql = "delete from top_info where id='" + id + "'";
            int    x   = db.delete(sql);

            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 200, navTabId = up_item, callbackType = "", forwardUrl = "" });
                return(json);
            }
            else
            {
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 300, navTabId = up_item, callbackType = "", forwardUrl = "" });
                return(json);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 根据二级列表元素的ID
        /// 查找其上级元素的ID
        /// 然后找出一级元素下的所有的二级元素
        /// </summary>
        /// <param name="sonId"></param>
        /// <returns></returns>
        private List <Entity.Son> getSonList(Guid sonId)
        {
            DboUtils db   = new DboUtils();
            String   sql1 = "select up_item from top_sub where id='" + sonId + "'";
            DataSet  ds1  = db.query(sql1);

            if (ds1.Tables[0].Rows.Count > 0)
            {
                Guid parentId = (Guid)ds1.Tables[0].Rows[0]["up_item"];

                String            sql  = "select * from top_sub where up_item='" + parentId + "' order by position";
                DataSet           ds   = db.query(sql);
                List <Entity.Son> list = new List <Entity.Son>();
                foreach (DataRow mDr in ds.Tables[0].Rows)
                {
                    Entity.Son son = new Entity.Son()
                    {
                        id       = (Guid)mDr["id"],
                        title    = mDr["title"].ToString(),
                        up_item  = (Guid)mDr["up_item"],
                        position = (int)mDr["position"],
                        pageType = mDr["pagetype"].ToString()
                    };
                    list.Add(son);
                }
                return(list);
            }
            else
            {
                return(new List <Entity.Son>());
            }
        }
Beispiel #5
0
        private List <Entity.Nav> getList()
        {
            DboUtils db  = new DboUtils();
            String   sql = "select top_sum.id ,top_sum.position,top_sum.title,top_sum.nov_type,top_sub.id sonid,top_sub.position sonposition,up_item,createtime,top_sub.title sontitle,top_sub.pagetype from top_sum left join top_sub on top_sum.id = top_sub.up_item order by top_sum.position,top_sub.position";
            DataSet  ds  = db.query(sql);

            List <Entity.Nav> list = new List <Entity.Nav>();

            foreach (DataRow mDr in ds.Tables[0].Rows)
            {
                Guid id = (Guid)mDr["id"];
                if (list.Where(t => t.id == id).Count() == 0)
                {
                    Entity.Nav nav = new Entity.Nav();
                    nav.id       = id;
                    nav.title    = mDr["title"].ToString();
                    nav.position = (int)mDr["position"];
                    nav.novType  = (Boolean)mDr["nov_type"];
                    nav.sonList  = new List <Entity.Son>();
                    list.Add(nav);
                    if (nav.novType)
                    {
                        AddSon(nav, mDr);
                    }
                }
                else
                {
                    var nav = list.Where(t => t.id == id).FirstOrDefault();
                    AddSon(nav, mDr);
                }
            }
            return(list);
        }
Beispiel #6
0
        // GET: Insert
        public ActionResult Index()
        {
            DboUtils db = new DboUtils();

            int[] array = new int[10];
            for (int i = 1; i < 10; i++)
            {
                String sql = "INSERT INTO top_info(title, up_item, position, info, img_s, img_b, video) values('俏江南公告-" + i + "','C81B33D6-BA93-4761-B740-988D20589643','" + i + "','','/image/notice" + i + ".jpg' , '' , '')";
                //String sql = "insert into user_info(username,pwd)values('1','')";
                array[i - 1] = db.insert(sql);
            }

            ViewBag.array = array;
            return(View());
        }
Beispiel #7
0
        public ActionResult ModifyNav(int id)
        {
            DboUtils db  = new DboUtils();
            String   sql = "select * from Nav where id = '" + id + "'";
            DataSet  ds  = db.query(sql);
            DataRow  dr  = ds.Tables[0].Rows[0];
            nav      nav = new nav()
            {
                id   = (int)dr["id"],
                name = dr["name"].ToString(),
                href = dr["href"].ToString()
            };

            ViewBag.g = nav;
            return(View());
        }
Beispiel #8
0
        // GET: Admin
        public ActionResult Login(String username, String password)
        {
            String sql = "select * from admin where username='******'and pwd='" + password + "'";

            DboUtils db = new DboUtils();
            DataSet  ds = db.query(sql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(Redirect("/Modify/Index"));
            }
            else
            {
                ViewBag.errorMessage = "用户名或密码错误";
                return(View());
            }
        }
Beispiel #9
0
        public String ConfirmAddNav(int id, String name, String href)
        {
            DboUtils db      = new DboUtils();
            String   sql     = "INSERT INTO nav(id,name,href) VALUES('" + id + "','" + name + "','" + href + "')";
            int      x       = db.insert(sql);
            string   message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                return(message);
            }
            else
            {
                return(message);
            }
        }
Beispiel #10
0
        public String ConfirmModifyNav(int id, String name, String href)
        {
            DboUtils db      = new DboUtils();
            String   sql     = "update nav set name='" + name + "',href='" + href + "'where id='" + id + "'";
            int      x       = db.update(sql);
            string   message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                return(message);
            }
            else
            {
                return(message);
            }
        }
Beispiel #11
0
        public ActionResult GetAdminList()
        {
            DboUtils db  = new DboUtils();
            String   sql = "select * from admin";
            DataSet  ds  = db.query(sql);

            List <Entity.Admin> list = new List <Entity.Admin>();

            foreach (DataRow mDr in ds.Tables[0].Rows)
            {
                Entity.Admin ad = new Entity.Admin();
                ad.username = mDr["username"].ToString();
                ad.pwd      = mDr["pwd"].ToString();
                list.Add(ad);
            }
            ViewBag.adminList = list;
            return(View());
        }
Beispiel #12
0
        private List <LvDu.Entity.Admin> getAdminListByName(String username)
        {
            DboUtils            db   = new DboUtils();
            String              sql  = "select * from admin where username='******'";
            DataSet             ds   = db.query(sql);
            List <Entity.Admin> list = new List <Entity.Admin>();

            foreach (DataRow mDr in ds.Tables[0].Rows)
            {
                Entity.Admin ad = new Entity.Admin()
                {
                    username = mDr["username"].ToString(),
                    pwd      = mDr["pwd"].ToString()
                };
                list.Add(ad);
            }
            return(list);
        }
Beispiel #13
0
        public String ConfirmModify(Guid id, String name, double price, String image, String info)
        {
            DboUtils db = new DboUtils();

            String sql     = "update good set name='" + name + "',price='" + price + "',img='" + image + "',info='" + info + "'where id='" + id + "'";
            int    x       = db.update(sql);
            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                return(message);
            }
            else
            {
                return(message);
            }
        }
Beispiel #14
0
        public ActionResult Modify(Guid id)
        {
            DboUtils db  = new DboUtils();
            String   sql = "select * from good where id = '" + id + "'";
            DataSet  ds  = db.query(sql);
            DataRow  dr  = ds.Tables[0].Rows[0];
            good     g   = new good()
            {
                id     = (Guid)dr["id"],
                img    = dr["img"].ToString(),
                info   = dr["info"].ToString(),
                price  = (double)dr["price"],
                upitem = (int)dr["upitem"],
                name   = dr["name"].ToString()
            };

            ViewBag.g = g;
            return(View());
        }
Beispiel #15
0
        public String ConfirmAddGood(String name, int upitem, double price, String img, String info)
        {
            Console.WriteLine(name + "---" + upitem + "---" + price + "---" + img + "---" + info);

            DboUtils db      = new DboUtils();
            String   sql     = "INSERT INTO good(name,price,img,info,upitem) VALUES('" + name + "','" + price + "','" + img + "','" + info + "','" + upitem + "')";
            int      x       = db.insert(sql);
            string   message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                return(message);
            }
            else
            {
                return(message);
            }
        }
Beispiel #16
0
        public ActionResult getNav()
        {
            DboUtils   dbo     = new DboUtils();
            String     sql     = "select * from nav ORDER by id";
            DataSet    ds      = dbo.query(sql);
            List <nav> navList = new List <nav>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                nav nav = new nav()
                {
                    id   = (int)dr["id"],
                    name = dr["name"].ToString(),
                    href = dr["href"].ToString()
                };
                navList.Add(nav);
            }
            return(Json(navList));
        }
Beispiel #17
0
        public String deleteGood(Guid id)
        {
            DboUtils db = new DboUtils();

            String sql = "delete from good where id='" + id + "'";

            int    x       = db.delete(sql);
            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                return(message);
            }
            else
            {
                return(message);
            }
        }
Beispiel #18
0
        public String UpdateAdmin(String username, String pwd_confirm)
        {
            String   nav = "admin2";
            DboUtils db  = new DboUtils();
            String   sql = "update admin set pwd='" + pwd_confirm + "'";
            int      x   = db.update(sql);

            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 200, navTabId = nav, callbackType = "closeCurrent", forwardUrl = "" });
                return(json);
            }
            else
            {
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 300, navTabId = username, callbackType = "", forwardUrl = "" });
                return(json);
            }
        }
Beispiel #19
0
        public String DeleteFromAdmin(String username)
        {
            String   nav = "GoodsClassTree";
            DboUtils db  = new DboUtils();
            String   sql = "delete from admin where username='******'";
            int      x   = db.delete(sql);

            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 200, navTabId = nav, callbackType = "", forwardUrl = "" });
                return(json);
            }
            else
            {
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 300, navTabId = username, callbackType = "", forwardUrl = "" });
                return(json);
            }
        }
Beispiel #20
0
        public ActionResult getGood()
        {
            DboUtils    dbo     = new DboUtils();
            String      sql     = "select * from good  ORDER by upitem";
            DataSet     ds      = dbo.query(sql);
            List <good> navList = new List <good>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                good info = new good()
                {
                    id     = (Guid)dr["id"],
                    img    = dr["img"].ToString(),
                    info   = dr["info"].ToString(),
                    price  = (double)dr["price"],
                    upitem = (int)dr["upitem"],
                    name   = dr["name"].ToString()
                };
                navList.Add(info);
            }
            return(Json(navList));
        }
Beispiel #21
0
        public String InsertIntoInfo(String title, String position, String info, String img_s, String img_b, String video)
        {
            DboUtils db      = new DboUtils();
            String   s       = Request.Form["orgLookup.id"];
            Guid     up_item = Guid.Parse(s);

            String sql = "INSERT INTO top_info(title, up_item, position, info, img_s, img_b, video)"
                         + " VALUES('" + title + "','" + up_item + "','" + position + "','" + info + "','" + img_s + "','" + img_b + "','" + video + "')";
            int    x       = db.delete(sql);
            string message = "操作失败";

            if (x > 0)
            {
                message = "操作成功";
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 200, navTabId = up_item, callbackType = "c", forwardUrl = "" });
                return(json);
            }
            else
            {
                string json = JsonConvert.SerializeObject(new { message = message, statusCode = 300, navTabId = up_item, callbackType = "", forwardUrl = "" });
                return(json);
            }
        }
Beispiel #22
0
        private List <Entity.Info> getInfo(Guid id)
        {
            DboUtils           db   = new DboUtils();
            String             sql  = "select * from top_info where id='" + id + "'";
            DataSet            ds   = db.query(sql);
            List <Entity.Info> list = new List <Entity.Info>();

            foreach (DataRow mDr in ds.Tables[0].Rows)
            {
                Entity.Info son = new Entity.Info()
                {
                    id       = (Guid)mDr["id"],
                    title    = mDr["title"].ToString(),
                    up_item  = (Guid)mDr["up_item"],
                    position = (int)mDr["position"],
                    info     = mDr["info"].ToString(),
                    img_b    = mDr["img_b"].ToString(),
                    img_s    = mDr["img_s"].ToString(),
                    video    = mDr["video"].ToString()
                };
                list.Add(son);
            }
            return(list);
        }