Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = Convert.ToInt32(context.Request["id"]);

            BLL.blogs   bll_blog   = new BLL.blogs();
            Model.blogs model_blog = bll_blog.GetModel(id);
            //阅读排行榜
            List <Model.blogs> list_blog = bll_blog.GetModelList("Blog_delete = 0 and Blog_is = 1 order by Blog_read desc LIMIT 4");

            //评论
            BLL.tell          bll_tell  = new BLL.tell();
            List <Model.tell> list_tell = bll_tell.GetModelList("Tell_blogid=" + id + "");

            BLL.user bll_user = new BLL.user();
            for (int i = 0; i < list_tell.Count; i++)
            {
                Model.user model_user = bll_user.GetModel((int)list_tell[i].Tell_userid);
                list_tell[i].Tell_name = model_user.User_name;
            }


            Model.showblog model_show = new Model.showblog()
            {
                Show_blog = model_blog,
                Show_list = list_blog,
                Show_tell = list_tell
            };
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string is_show = js.Serialize(model_show);

            context.Response.Write(is_show);
        }
Esempio n. 2
0
        private void update_user(HttpContext context)
        {
            string openid = DTRequest.GetString("openid");
            string name   = DTRequest.GetString("name");
            int    sex    = DTRequest.GetInt("sex", 0);
            string phone  = DTRequest.GetString("phone");
            string email  = DTRequest.GetString("email");

            Model.user model = new BLL.user().GetModel(openid);
            model.nickname = name;
            model.sex      = sex;
            model.phone    = phone;
            model.email    = email;
            if (new BLL.user().Update(model))
            {
                if ((model.nickname != "" && model.sex != 0 && model.phone != "" && model.email != "") && new BLL.amount().GetCount("type=3 and user_id=" + model.id) == 0)
                {
                    Model.amount amount = new Model.amount()
                    {
                        user_id = model.id,
                        type    = 3,
                        Amount  = 1.88M,
                        remark  = "填写完整个人信息",
                        time    = DateTime.Now
                    };
                    new BLL.amount().Add(amount);
                    new BLL.user().UpdateField(model.id, "amount=amount+" + amount.Amount);
                }
                context.Response.Write("{\"status\":1,\"msg\":\"修改成功!\"}");
            }
            else
            {
                context.Response.Write("{\"status\":0,\"msg\":\"修改失败!\"}");
            }
        }
Esempio n. 3
0
 private bool DoEdit(int _id)
 {
     try
     {
         BLL.user   bll   = new BLL.user();
         Model.user model = bll.GetModel(_id);
         model.nickname   = txtName.Text;
         model.status     = Convert.ToInt32(rblStatus.SelectedValue);
         model.sex        = Convert.ToInt32(rblSex.SelectedValue);
         model.point      = Convert.ToInt32(txtPoint.Text);
         model.parent_id  = Convert.ToInt32(txtParent.Text);
         model.phone      = txtPhone.Text;
         model.email      = txtEmail.Text;
         model.login_time = Convert.ToDateTime(txtLoginTime.Text);
         model.reg_time   = Convert.ToDateTime(txtRegTime.Text);
         if (bll.Update(model))
         {
             AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改产品经理信息"); //记录日志
             return(true);
         }
     }
     catch
     {
         return(false);
     }
     return(false);
 }
        // GET: student/PersonalCenter
        public ActionResult Index()
        {
            var result = new ChangePWD();

            result.Success = false;
            try
            {
                string oldPWD = Request.QueryString["oldPWD"];
                string newPWD = Request.QueryString["newPWD"];
                int    userID = Common.User.GetUserID(Session["Username"].ToString());
                //判断旧密码
                if (Common.Auth.CheckPwd(oldPWD, Common.User.GetUserName(userID)))
                {
                    //更新密码
                    var    bll   = new BLL.user();
                    var    model = bll.GetModel(p => p.id == userID);
                    string pwd   = Common.Auth.Encrypt(newPWD);
                    model.pwd = pwd;
                    bll.Update(model, new[] { "id", "pwd" });
                    result.Success = true;
                }
            }
            catch (Exception)
            {
                return(View());
            }

            return(View(result));
        }
Esempio n. 5
0
        public static string GetUserName(int id)
        {
            var bll  = new BLL.user();
            var name = bll.GetModel(p => p.id == id).name;

            return(name);
        }
Esempio n. 6
0
        public static int GetUserID(string username)
        {
            var bll = new BLL.user();
            var id  = bll.GetModel(p => p.name == username).id;

            return(id);
        }
Esempio n. 7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string user    = context.Request["username"];
            string pattern = @"^\d*$";

            if (Regex.IsMatch(user, pattern))
            {
                int phone  = 0;
                int userid = Convert.ToInt32(user);
                if (int.TryParse(context.Request["phone"], out phone))
                {
                    phone = Convert.ToInt32(context.Request["phone"]);
                    string pwd  = context.Request["pwd"];
                    string cpwd = context.Request["cpwd"];
                    if (pwd == cpwd)
                    {
                        Model.user model_user = new Model.user()
                        {
                            User_id    = userid,
                            User_pwd   = pwd,
                            User_phone = phone,
                            User_name  = userid.ToString(),
                            User_img   = "../images/m_01.jpg",
                            User_qq    = 0
                        };
                        BLL.user bll_user = new BLL.user();
                        if (!bll_user.Exists(userid))
                        {
                            if (bll_user.Add(model_user))
                            {
                                context.Session["USER"] = model_user;
                                HttpCookie cookie_id = new HttpCookie("userid");
                                cookie_id.Expires = DateTime.Now.AddDays(1);
                                cookie_id.Value   = userid.ToString();
                                context.Response.AppendCookie(cookie_id);
                                HttpCookie cookie_pwd = new HttpCookie("userpwd");
                                cookie_pwd.Expires = DateTime.Now.AddDays(1);
                                cookie_pwd.Value   = pwd.ToString();
                                context.Response.AppendCookie(cookie_pwd);
                                context.Response.Write(1);
                            }
                        }
                        else
                        {
                            context.Response.Write("用户名已存在");
                        }
                    }
                    else
                    {
                        context.Response.Write("密码输入有错误");
                    }
                }
                else
                {
                    context.Response.Write("手机号输入有误");
                }
            }
        }
Esempio n. 8
0
 public void AddTest()
 {
     BLL.user   usrbll = new BLL.user();
     Model.user usr    = new Model.user();
     usr.feature_data    = new byte[512];
     usr.face_image_path = "1.jpg";
     usrbll.Add(usr);
 }
Esempio n. 9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int userid = 0;

            #region 没有cookie
            if (int.TryParse(context.Request["username"], out userid))
            {
                #region 账号格式正确
                userid = Convert.ToInt32(context.Request["username"]);
                BLL.user   bll_user   = new BLL.user();
                Model.user model_user = bll_user.GetModel(userid);
                if (model_user != null)
                {
                    string pwd = context.Request["password"];
                    if (model_user.User_pwd == pwd)
                    {
                        #region 密码正确
                        context.Session["USER"] = model_user;
                        string loginkeeping = context.Request["loginkeeping"];
                        if (loginkeeping != null)
                        {
                            #region 记住我
                            HttpCookie cookie_id = new HttpCookie("userid");
                            cookie_id.Expires = DateTime.Now.AddDays(1);
                            cookie_id.Value   = userid.ToString();
                            context.Response.AppendCookie(cookie_id);
                            HttpCookie cookie_pwd = new HttpCookie("userpwd");
                            cookie_pwd.Expires = DateTime.Now.AddDays(1);
                            cookie_pwd.Value   = pwd.ToString();
                            context.Response.AppendCookie(cookie_pwd);
                            context.Response.Write(1);
                            #endregion
                        }
                        #endregion
                    }
                    else
                    {
                        context.Response.Write("密码输入错误");
                    }
                }
                else
                {
                    if (context.Request.Cookies["userid"] != null && context.Request.Cookies["userpwd"] != null)
                    {
                        int        id           = Convert.ToInt32(context.Request.Cookies["userid"].Value);
                        BLL.user   bll_userid   = new BLL.user();
                        Model.user model_userid = bll_userid.GetModel(userid);
                        context.Session["USER"] = model_user;
                        object a = context.Session["USER"].ToString();
                        context.Response.Write(1);
                    }
                    context.Response.Write("账号格式错误");
                }
                #endregion
            }
            #endregion }
        }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["ht_id"] == null && Request.Cookies["ht_pwd"] == null)
     {
         Response.Redirect("login.html");
     }
     else
     {
         BLL.user bll_user = new BLL.user();
         list_user = bll_user.GetModelList("");
     }
 }
Esempio n. 11
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //博客类别
            string session_user = null;

            //if (context.Session["USER"] != null){
            //    session_user = context.Session["USER"].ToString();
            //}
            BLL.blog_type          bll_type  = new BLL.blog_type();
            List <Model.blog_type> list_type = bll_type.GetModelList("");

            //热门博客
            BLL.blogs          bll_blogs     = new BLL.blogs();
            List <Model.blogs> list_hotblogs = bll_blogs.GetModelList(" Blog_delete = 0 and Blog_is = 1 order by Blog_read  desc");

            Model.blogs moblogs = list_hotblogs[0];
            //图片分享
            BLL.img          bll_img  = new BLL.img();
            List <Model.img> list_img = bll_img.GetModelList("Img_is=1");

            //评论
            BLL.tell          bll_tell  = new BLL.tell();
            BLL.user          bll_user  = new BLL.user();
            List <Model.tell> list_tell = bll_tell.GetModelList(" Tell_id>0 order by Tell_blogid  LIMIT 3");

            for (int i = 0; i < list_tell.Count; i++)
            {
                Model.user model_user = bll_user.GetModel((int)list_tell[i].Tell_userid);
                list_tell[i].Tell_img  = model_user.User_img;
                list_tell[i].Tell_name = model_user.User_name;
            }
            //推荐博客

            List <Model.blogs> list_tuiblogs = new List <Model.blogs> {
                list_hotblogs[1], list_hotblogs[2], list_hotblogs[3]
            };

            Model.Main main = new Model.Main()
            {
                Main_type     = list_type,
                Main_hotblogs = moblogs,
                Main_tuiblogs = list_tuiblogs,
                Main_tell     = list_tell,
                Main_img      = list_img,
                name          = session_user
            };
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string json = js.Serialize(main);

            context.Response.Write(json);
        }
Esempio n. 12
0
        private void get_pm_model(HttpContext context)
        {
            int       id = DTRequest.GetInt("id", 0);
            DataTable dt = new BLL.user_pm().GetList(0, "user_id=" + id, "").Tables[0];

            dt.Columns.Add("start", typeof(float));
            dt.Columns.Add("call", typeof(int));
            DataTable t = new BLL.user().DoSql("select avg(value) as start,count(1) as call from fg_assess");

            dt.Rows[0]["start"] = t.Rows[0]["start"] == DBNull.Value ? 0 : t.Rows[0]["start"];
            dt.Rows[0]["call"]  = t.Rows[0]["call"];
            context.Response.Write(JsonHelper.DataTableToJSON(dt).TrimStart('[').TrimEnd(']'));
        }
Esempio n. 13
0
        /// <summary>
        /// 判断密码是否正确
        /// </summary>
        /// <param name="enPwd">用户输入的密码</param>
        /// <param name="username">用户名</param>
        /// <returns></returns>
        public static bool CheckPwd(string pwd, string username)
        {
            bool result = false;

            BLL.user bll  = new BLL.user();
            var      user = bll.GetModel(p => p.name == username);

            if (user.pwd == Encrypt(pwd))
            {
                result = true;
            }
            return(result);
        }
Esempio n. 14
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page             = DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            DataTable dt = new BLL.user().GetList(pageSize, this.page, _strWhere, _orderby, out this.totalCount).Tables[0];

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("user_list.aspx", "keywords={0}&page={1}",
                                              this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Esempio n. 15
0
        public ActionResult Login()
        {
            BLL.user          userBll   = new BLL.user();
            string            LoginName = Request["userName"];
            string            pwd       = Request["pwd"];
            string            sql       = "loginName='" + LoginName + "' and PWD='" + pwd + "' and validFlag='1' ";
            List <Model.user> userlist  = userBll.GetModelList(sql);

            if (userlist.Count > 0)
            {
                ViewData["ID"] = userlist[0].ID;
                return(View("./Index"));
            }
            return(View());
        }
Esempio n. 16
0
 //删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.user bll = new BLL.user();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             bll.Delete(id);
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除产品分类数据"); //记录日志
     JscriptMsg("删除数据成功!", Utils.CombUrlTxt("user_list.aspx", "", ""));
 }
Esempio n. 17
0
        public BaseController()
        {
#if DEBUG
            ViewBag.Username = "******";
#endif
            //初始化页面数据,通过ViewBag传递给view
            //获取用户id
            BLL.user user      = new BLL.user();
            string   name      = ViewBag.Username;
            var      userModel = user.GetModel(p => p.name == name);
            //验证用户权限
            if (!new BLL.clubManager().Exist(p => p.userID == userModel.id))
            {
                //返回用户登录界面
                Response.Redirect("/manager/Login/Login");
            }

            ViewBag.Clubs = new BLL.ClubBLL().GetRecordCount();
            //获取我管理的所有社团的活动申请结果
            var clubList = new BLL.clubManager().GetModels(p => p.userID == userModel.id);
            //获取这些社团的活动信息
            var list = new List <Model.clubactivity>();
            foreach (var item in clubList)
            {
                var act = new BLL.clubActivity().GetModels(p => p.clubID == item.cludID & p.state != 0 & p.state != 3);
                foreach (var j in act)
                {
                    list.Add(j);
                }
            }
            //页面申请结果数量
            ViewBag.Result = list.Count;
            //页面入社申请结果数量
            var newMember      = new BLL.newMember();
            int newMemberCount = 0;
            foreach (var item in clubList)
            {
                var act = new BLL.clubActivity().GetModels(p => p.clubID == item.cludID & p.state != 0 & p.state != 3);
                newMemberCount += newMember.GetRecordCount(p => p.state == 0 & p.clubID == item.cludID);
            }
            ViewBag.NewMember = newMemberCount;
        }
Esempio n. 18
0
        public BaseController()
        {
#if DEBUG
            ViewBag.Username = "******";
#endif
            //初始化页面数据,通过ViewBag传递给view
            //获取用户id
            BLL.user user      = new BLL.user();
            string   name      = ViewBag.Username;
            var      userModel = user.GetModel(p => p.name == name);

            //获取所有社团数
            DushBoard model = new DushBoard();
            model.Clubs = new BLL.ClubBLL().GetRecordCount();
            //获取我加入的社团数
            model.Mine = new BLL.clubMember().GetRecordCount(p => p.userid == userModel.id);
            //获取申请中的新社团
            model.NewClubs = new BLL.newMember().GetRecordCount(p => p.userID == userModel.id & p.state == 0);

            ViewBag.Clubs    = model.Clubs;
            ViewBag.Mine     = model.Mine;
            ViewBag.NewClubs = model.NewClubs;

            //获取通知与活动个数
            ViewBag.Message  = new BLL.messageBLL().GetRecordCount(p => p.to == userModel.id & p.state == 0);
            ViewBag.Activity = new BLL.clubActivity().GetRecordCount(p => p.state == 1);
            //获取我所有加入的社团,然后查询
            int count     = 0;
            var mineClubs = new BLL.clubMember().GetModels(p => p.userid == userModel.id);
            foreach (var item in mineClubs)
            {
                count += new BLL.clubActivity().GetRecordCount(p => p.clubID == item.clubid & p.state == 1);
            }
            ViewBag.mineActivity = count;
            //获取未读申请结果个数
            ViewBag.ApplyResult = new BLL.newMember().GetRecordCount(p => p.userID == userModel.id & p.state != 0 & p.state != 3);
            //未读的创办社团消息
            ViewBag.ClubApplyResult = new BLL.newClub().GetModels(p => p.userID == userModel.id & p.state != 0 & p.state != 3).ToList().Count;
            //申请中的社团
            ViewBag.ClubApply = new BLL.newClub().GetModels(p => p.userID == userModel.id & p.state == 0).ToList().Count;
        }
Esempio n. 19
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page             = DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            DataTable dt = new BLL.point().GetList(pageSize, this.page, _strWhere, _orderby, out this.totalCount).Tables[0];

            dt.Columns.Add("username", typeof(string));
            foreach (DataRow dr in dt.Rows)
            {
                string name = new BLL.user().GetModel(Convert.ToInt32(dr["user_id"])).nickname;
                dr["username"] = name;
            }
            this.rptList.DataSource = dt;
            this.rptList.DataBind();
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("point_log.aspx", "keywords={0}&page={1}",
                                              this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Esempio n. 20
0
        private void get_proUser_comment(HttpContext context)
        {
            int user_id = DTRequest.GetInt("uid", 0);
            //select * from fg_news_commend where news_id in(select id from fg_product where user_id=1) and isPN=1 order by time desc
            DataTable dt = new BLL.product().GetUserComment(user_id).Tables[0];

            string[] arr = new string[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                arr[i] = Convert.ToDateTime(dt.Rows[i]["time"].ToString()).ToString("yyyy-MM-dd HH:mm");
            }
            dt.Columns.Remove("time");
            dt.Columns.Add("time", typeof(string));

            dt.Columns.Add("phone", typeof(string));
            foreach (DataRow dr in dt.Rows)
            {
                dr["time"] = arr[dt.Rows.IndexOf(dr)];
                Model.user user = new BLL.user().GetModel(Convert.ToInt32(dr["user_id"]));
                dr["phone"] = user.phone;
            }
            context.Response.Write(JsonHelper.DataTableToJSON(dt));
        }
Esempio n. 21
0
        public BaseController()
        {
#if DEBUG
            ViewBag.Username = "******";
#endif
            //初始化页面数据,通过ViewBag传递给view
            //获取用户id
            BLL.user user      = new BLL.user();
            string   name      = ViewBag.Username;
            var      userModel = user.GetModel(p => p.name == name);
            //验证用户权限
            if (!new BLL.teacher().Exist(p => p.userID == userModel.id))
            {
                //返回用户登录界面
                Response.Redirect("/teacher/Login/Login?errorMSG=2");
            }
            //获取社团个数
            ViewBag.Clubs = new BLL.ClubBLL().GetRecordCount();
            //获取申请中的活动
            ViewBag.ActivityApply = new BLL.clubActivity().GetRecordCount(p => p.state == 0);
            //获取申请中的新社团
            ViewBag.ClubApply = new BLL.newClub().GetRecordCount(p => p.userID == userModel.id & p.state == 0);
        }
Esempio n. 22
0
        public ActionResult checkPwd()
        {
            string pwd      = Request.Params["pwd"];
            string username = Request.Params["username"];

            BLL.user bll = new BLL.user();
            try
            {
                var result = Common.Auth.CheckPwd(pwd, username);

                if (result)
                {
                    BLL.user    userBll    = new BLL.user();
                    var         model      = userBll.GetModel(p => p.name == username);
                    BLL.teacher teacherBll = new BLL.teacher();

                    var exist = teacherBll.Exist(p => p.userID == model.id);
                    if (exist)
                    {
                        Session["Username"] = username;
                        return(Redirect("/teacher/Home"));
                    }
                    else
                    {
                        return(Redirect("/teacher/Login/Login?errorMSG=2"));
                    }
                }
                else
                {
                    return(Redirect("/teacher/Login/Login?errorMSG=1"));
                }
            }
            catch (Exception)
            {
                return(Redirect("/teacher/Login/Login?errorMSG=1"));
            }
        }
Esempio n. 23
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = 0;

            //图片
            if (context.Request["page"] == "img")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.img bll_img = new BLL.img();
                if (bll_img.Delete(id) == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.user bll_user = new BLL.user();
                if (bll_user.Delete(id) == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客评论
            if (context.Request["page"] == "tell")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.tell bll_tell    = new BLL.tell();
                bool     tell_delete = bll_tell.Delete(id);
                if (tell_delete == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.blogs bll_blog    = new BLL.blogs();
                bool      blog_delete = bll_blog.Delete(id);
                if (blog_delete == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客类型
            if (context.Request["page"] == "type")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          a        = bll_type.Delete(id);
                if (a == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
        }
Esempio n. 24
0
        private void get_banner_pm(HttpContext context)
        {
            DataTable dt = new BLL.user().DoSql("select * from [dt_plugin_images] where class_id=2");

            context.Response.Write(JsonHelper.DataTableToJSON(dt));
        }
Esempio n. 25
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //图片
            if (context.Request["page"] == "img")
            {
                int    id     = Convert.ToInt32(context.Request["id"]);
                string text   = context.Request["text"];
                string img    = context.Request["img"];
                int    img_is = Convert.ToInt32(context.Request["is"]);

                Model.img model_img = new Model.img()
                {
                    Img_address = img,
                    Img_id      = id,
                    Img_is      = img_is,
                    Img_text    = text
                };
                BLL.img bll_img = new BLL.img();
                if (bll_img.Update(model_img) == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                int    id    = Convert.ToInt32(context.Request["id"]);
                string name  = context.Request["name"];
                string img   = context.Request["img"];
                int    qq    = Convert.ToInt32(context.Request["qq"]);
                int    phone = Convert.ToInt32(context.Request["phone"]);

                Model.user model_user = new Model.user()
                {
                    User_id    = id,
                    User_name  = name,
                    User_img   = img,
                    User_qq    = qq,
                    User_phone = phone,
                    User_pwd   = id.ToString()
                };
                BLL.user bll_user = new BLL.user();
                if (bll_user.Update(model_user) == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }
            //评论
            if (context.Request["page"] == "tell")
            {
                int               id        = Convert.ToInt32(context.Request["id"]);
                BLL.tell          bll_tell  = new BLL.tell();
                List <Model.tell> list_tell = bll_tell.GetModelList("Tell_blogid=" + id + "");
                BLL.user          bll_user  = new BLL.user();
                for (int i = 0; i < list_tell.Count; i++)
                {
                    Model.user model_user = bll_user.GetModel((double)list_tell[i].Tell_userid);
                    list_tell[i].Tell_username = model_user.User_name;
                }
                System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
                string a = js.Serialize(list_tell);
                context.Response.Write(a);
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                int                    id         = Convert.ToInt32(context.Request["id"]);
                string                 title      = context.Request["title"];
                string                 img        = context.Request["img"];
                int                    showis     = Convert.ToInt32(context.Request["showis"]);
                string                 time       = context.Request["time"];
                string                 typename   = context.Request["typename"];
                string                 text       = context.Request["text"];
                string                 abs        = context.Request["abs"];
                BLL.blog_type          bll_type   = new BLL.blog_type();
                List <Model.blog_type> list_type  = bll_type.GetModelList("Type_name='" + typename + "'");
                Model.blogs            model_blog = new Model.blogs()
                {
                    Blog_id       = id,
                    Blog_title    = title,
                    Blog_img      = img,
                    Blog_is       = showis,
                    Blog_time     = time,
                    Blog_typeid   = list_type[0].Type_id,
                    Blog_text     = text,
                    Blog_delete   = 0,
                    Blog_abstract = abs
                };
                BLL.blogs blogs    = new BLL.blogs();
                bool      blog_add = blogs.Update(model_blog);
                if (blog_add == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }

            //博客类型
            if (context.Request["page"] == "type")
            {
                int             id         = Convert.ToInt32(context.Request["id"]);
                string          type       = context.Request["type"];
                int             bai        = Convert.ToInt32(context.Request["bai"]);
                Model.blog_type model_type = new Model.blog_type()
                {
                    Type_id         = id,
                    Type_name       = type,
                    Type_percentage = bai
                };
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          a        = bll_type.Update(model_type);
                if (a == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }
        }
Esempio n. 26
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //图片
            if (context.Request["page"] == "img")
            {
                int       id        = Convert.ToInt32(context.Request["id"]);
                string    text      = context.Request["text"];
                string    img       = context.Request["img"];
                int       img_is    = Convert.ToInt32(context.Request["is"]);
                Model.img model_img = new Model.img()
                {
                    Img_id      = id,
                    Img_address = img,
                    Img_is      = img_is,
                    Img_text    = text
                };
                BLL.img bll_img = new BLL.img();
                if (bll_img.Add(model_img) == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                int        id         = Convert.ToInt32(context.Request["id"]);
                string     name       = context.Request["name"];
                string     img        = context.Request["img"];
                int        qq         = Convert.ToInt32(context.Request["qq"]);
                int        phone      = Convert.ToInt32(context.Request["phone"]);
                Model.user model_user = new Model.user()
                {
                    User_id    = id,
                    User_name  = name,
                    User_img   = img,
                    User_qq    = qq,
                    User_phone = phone,
                    User_pwd   = id.ToString()
                };
                BLL.user bll_user = new BLL.user();
                if (bll_user.Add(model_user) == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                int                    id         = Convert.ToInt32(context.Request["id"]);
                string                 title      = context.Request["title"];
                string                 img        = context.Request["img"];
                int                    showis     = Convert.ToInt32(context.Request["showis"]);
                string                 time       = context.Request["time"];
                string                 typename   = context.Request["typename"];
                string                 text       = context.Request["text"];
                string                 abs        = context.Request["abstract"];
                BLL.blog_type          bll_type   = new BLL.blog_type();
                List <Model.blog_type> list_type  = bll_type.GetModelList("Type_name='" + typename + "'");
                Model.blogs            model_blog = new Model.blogs()
                {
                    Blog_id       = id,
                    Blog_title    = title,
                    Blog_img      = img,
                    Blog_is       = showis,
                    Blog_time     = time,
                    Blog_typeid   = list_type[0].Type_id,
                    Blog_abstract = abs,
                    Blog_text     = text,
                    Blog_delete   = 0
                };
                BLL.blogs blogs    = new BLL.blogs();
                bool      blog_add = blogs.Add(model_blog);
                if (blog_add == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }

            //博客类型
            if (context.Request["page"] == "type")
            {
                int             id         = Convert.ToInt32(context.Request["id"]);
                string          type       = context.Request["type"];
                int             bai        = Convert.ToInt32(context.Request["bai"]);
                Model.blog_type model_type = new Model.blog_type()
                {
                    Type_id         = id,
                    Type_name       = type,
                    Type_percentage = bai
                };
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          is_type  = bll_type.Add(model_type);
                if (is_type == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }
        }