예제 #1
0
        public ActionResult Setting(UserInfo user)
        {
            user = (UserInfo)Session["LoginUser"];
            if (user == null)
            {
                return(RedirectToAction("Login", "Users"));
            }
            string path = Session["tempPath"].ToString();
            string src  = Session["tempSrc"].ToString();
            int    x    = Convert.ToInt32(Request["x"]);
            int    y    = Convert.ToInt32(Request["y"]);
            int    w    = Convert.ToInt32(Request["w"]);
            int    h    = Convert.ToInt32(Request["h"]);
            string file = user.UserName + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(src);

            if (SaveImage(path + "\\" + src, path + "\\" + file, w, h, x, y))
            {
                user.HeadImg = "/portrait/" + file;
                JavaDLL dll = new JavaDLL();
                if (dll.updateUser(user))
                {
                    Session["LoginUser"] = user;
                }
                FileInfo s = new FileInfo(path + "\\" + src);
                if (s.Exists)
                {
                    s.Delete();
                }
                ViewData.Add("headimage", user.HeadImg);
            }
            Session.Remove("tempPath");
            Session.Remove("tempSrc");
            return(RedirectToAction("Setting", "Users"));
        }
예제 #2
0
        public ActionResult c(int id, int?p)
        {
            int            pageindex = p ?? 1;
            int            pagesize  = 20;
            int            total     = 0;
            JavaDLL        dll       = new JavaDLL();
            DataSet        userds    = dll.getAllUser();
            ArticleEx      mod       = new ArticleEx();
            Article        art       = dll.getArticleNotRead(id);
            List <Comment> comments  = dll.getComments(id, pagesize, pageindex, out total);
            //linq级联查询
            var comment = from u in userds.Tables[0].AsEnumerable()
                          join c in comments on u["name"].ToString() equals c.uid
                          orderby c.cdate descending
                          select new Comment {
                id = c.id, aid = c.aid, sid = u["name"].ToString(), uid = u["nickname"].ToString(), comment = Convert.ToBoolean(u["valid"]) ? c.comment : "<span>用户被屏蔽,内容自动删除</span>", cdate = c.cdate, device = c.device, head = u["head"].Equals(DBNull.Value) ? "/images/head.jpg" : u["head"].ToString()
            };

            comments = comment.ToList <Comment>();
            PagedList <Comment> page = comments.AsQueryable().ToPagedList(pageindex, pagesize);

            page.TotalItemCount   = total;
            page.CurrentPageIndex = pageindex;
            mod.id       = id;
            mod.category = art.category;
            mod.title    = art.title;
            mod.comments = page;
            return(View(mod));
        }
예제 #3
0
        protected void linkClear_Click(object sender, EventArgs e)
        {
            JavaDLL dll = new JavaDLL();

            dll.clearKnowledge();
            getData();
        }
예제 #4
0
        public void getData()
        {
            JavaDLL dll = new JavaDLL();

            gvFeed.DataSource = dll.getFeedback();
            gvFeed.DataBind();
        }
예제 #5
0
        //public string init()
        //{
        //    if (Request.QueryString["action"] !=  null)
        //    {
        //        if (Request.QueryString["action"].Equals("edit") && Request.QueryString["id"] != null)
        //            return getData());
        //    }
        //    return "";
        //}

        private void getData(int id)
        {
            JavaDLL bll = new JavaDLL();

            ddlCategory.DataSource     = bll.getCategory();
            ddlCategory.DataTextField  = "catename";
            ddlCategory.DataValueField = "id";
            ddlCategory.DataBind();
            DataSet ds  = bll.getArticle(id, false);
            DataRow row = ds.Tables[0].Rows[0];

            ddlCategory.SelectedValue = row["category"].ToString();
            txtTitle.Text             = row["title"].ToString();
            labTitle.Text            += " - " + row["title"].ToString();
            content        = row["artical"].ToString();
            labRemark.Text = "首次创建:" + row["cuser"] + "(" + Convert.ToDateTime(row["cdate"]).ToString("yyyy-MM-dd HH:mm:ss") + ")";
            if (!row["euser"].Equals(DBNull.Value))
            {
                labRemark.Text += ",上次修改:" + row["euser"] + "(" + Convert.ToDateTime(row["edate"]).ToString("yyyy-MM-dd HH:mm:ss") + ")";
            }
            UserInfo info = (UserInfo)Session["LoginUser"];

            if (row["cuser"].ToString().Equals(info.UserName) || info.Role == UserInfo.ROLE_ADMIN)
            {
                btnSave.Enabled = true;
            }
        }
예제 #6
0
        public ActionResult Video()
        {
            JavaDLL            dll   = new JavaDLL();
            List <Model.Video> video = dll.getAllVideos();

            return(View(video));
        }
예제 #7
0
        public void getUser(int id)
        {
            JavaDLL  bll   = new JavaDLL();
            UserInfo info  = Session["LoginUser"] as UserInfo;
            UserInfo Users = bll.Login(id);

            Session["TmpUser"] = Users;
            if (Users != null)
            {
                txtUserName.Text        = Users.UserName;
                txtNickName.Text        = Users.NickName;
                labEmail.Text           = Users.Email;
                txtRemark.Text          = Users.Mark;
                ddlGender.SelectedValue = "" + Users.Gender;
                ddlRole.SelectedValue   = "" + Users.Role;
                chkValid.Checked        = Users.Valid;
                if (Users.UserName.Equals("admin") || info.UserName.Equals(Users.UserName))
                {
                    txtUserName.Enabled          =
                        ddlRole.Enabled          =
                            linPassword.Visible  =
                                chkValid.Enabled = false;
                }
            }
        }
예제 #8
0
        public ActionResult Login(UserInfo user)
        {
            user.UserName = Request.Form["username"];
            user.UserPass = Request.Form["password"];
            JavaDLL dll = new JavaDLL();

            user = dll.Login(Request.Form["username"]);
            if (user == null || !user.Valid)
            {
                ViewData["LoginMsg"] = "用户不存在";
                return(View(user));
            }
            if (user.Role == UserInfo.ROLE_CONF)
            {
                ViewData["LoginMsg"] = "账户已被限制使用";
                return(View(user));
            }
            string s = FormsAuthentication.HashPasswordForStoringInConfigFile(Security.MD5Encrypt(Request.Form["password"]), "MD5");

            if (s.Equals(user.UserPass))
            {
                Session["LoginUser"] = user;
                return(RedirectToAction(UserAuth.resultAction, UserAuth.recontroller));
            }
            else
            {
                ViewData["username"] = Request.Form["username"];
                ViewData["LoginMsg"] = "密码错误";
                return(View(user));
            }
        }
예제 #9
0
        protected void lnkRestore_Click(object sender, EventArgs e)
        {
            int     id  = Convert.ToInt32(((LinkButton)sender).CommandName);
            JavaDLL dll = new JavaDLL();

            dll.restoreArticle(id);
            getData();
        }
예제 #10
0
        public void getData()
        {
            JavaDLL bll = new JavaDLL();
            DataSet ds  = bll.getAllUser();

            gvUser.ShowFooter = (ds.Tables[0].Rows.Count <= gvUser.PageSize);
            gvUser.DataSource = ds;
            gvUser.DataBind();
        }
예제 #11
0
        private void getData()
        {
            JavaDLL bll = new JavaDLL();

            ddlCategory.DataSource     = bll.getCategory();
            ddlCategory.DataTextField  = "catename";
            ddlCategory.DataValueField = "id";
            ddlCategory.DataBind();
        }
예제 #12
0
        private void getData()
        {
            JavaDLL dll = new JavaDLL();

            listVideo.DataSource     = dll.getAllVideo();
            listVideo.DataTextField  = "name";
            listVideo.DataValueField = "url";
            listVideo.DataBind();
        }
예제 #13
0
        public void getData()
        {
            JavaDLL dll = new JavaDLL();
            DataSet ds  = dll.getDownloadList();

            gvList.ShowFooter = (ds.Tables[0].Rows.Count <= gvList.PageSize);
            gvList.DataSource = ds;
            gvList.DataBind();
        }
예제 #14
0
        private void getData()
        {
            JavaDLL dll = new JavaDLL();
            DataSet ds  = dll.getAllVideo();

            gvCategory.ShowFooter = (ds.Tables[0].Rows.Count <= gvCategory.PageSize);
            gvCategory.DataSource = ds;
            gvCategory.DataBind();
        }
예제 #15
0
        public void getData()
        {
            JavaDLL dll = new JavaDLL();
            DataSet ds  = dll.getMaterialList();

            gvCategory.ShowFooter = (ds.Tables[0].Rows.Count <= gvCategory.PageSize);
            gvCategory.DataSource = ds;
            gvCategory.DataBind();
        }
예제 #16
0
        public ActionResult Views(string id)
        {
            if (id.ToLower().Equals("views"))
            {
                return(RedirectToAction("article", "Java21"));
            }
            JavaDLL dll = new JavaDLL();

            Model.Article mod = dll.getArticle(Convert.ToInt32(id.Split('.')[0]));
            return(View(mod));
        }
예제 #17
0
        private void getData(int id)
        {
            JavaDLL dll = new JavaDLL();

            Model.Category cate = dll.getCategory(id);
            if (cate != null)
            {
                txtName.Text   = cate.catename;
                txtValues.Text = cate.remark;
            }
        }
예제 #18
0
        public ActionResult Article(int?p)
        {
            int     pageindex = p ?? 1;
            int     pagesize  = 10;
            int     total     = 0;
            JavaDLL dll       = new JavaDLL();
            PagedList <Model.Article> page = dll.getArticle(pagesize, pageindex, out total).AsQueryable().ToPagedList(pageindex, pagesize);

            page.TotalItemCount   = total;
            page.CurrentPageIndex = pageindex;
            return(View(page));
        }
예제 #19
0
        private void getData(int id)
        {
            JavaDLL dll = new JavaDLL();

            Model.Video cate = dll.getVideo(id);
            if (cate != null)
            {
                txtTitle.Text = cate.name;
                txtUrl.Text   = cate.url;
                txtUrl2.Text  = cate.url2;
            }
        }