Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string cmd = null;
     string msgid = null;
     cmd = Request["cmd"];
     lbtnUrl.Text = Request.Cookies["url"].Value;
     string url = lbtnUrl.Text;
     switch (cmd)
     {
         case "quit":
             {
                 lblMsg.Text = "退出成功,正在返回之前的页面……";
                 Session.Clear();
             }
             break;
         case "login":
             {
                 urm.userName = Request["uid"];
                 urm.userPass = Request["pwd"];
                 lblMsg.Text = checkLogin(urm);
             }
             break;
         case "upload":
             {
                 msgid = Request["msgid"];
                 if (msgid == "1")
                 {
                     lblMsg.Text = "视频上传失败,失败原因:视频截图发生错误!";
                 }
                 else if (msgid == "2")
                 {
                     lblMsg.Text = "视频上传失败,失败原因:视频格式转化发生错误!";
                 }
                 else if (msgid == "3")
                 {
                     lblMsg.Text = "视频上传成功,恭喜您获得10个网站积分!";
                     userInfo = userBLL.getUInfo(Request.QueryString["uid"]);
                     Session["userInfo"] = userInfo;
                 }
                 else
                 {
                     lblMsg.Text = "视频上传失败,失败原因:系统发生未知错误";
                 }
             }
             break;
         default: lblMsg.Text = "系统出现错误";
             break;
     }
     string JSCode = " <script>setTimeout('Load();', 5000);function Load() {window.location.href ='" + url + "';}</script>";
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", JSCode);
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["userInfo"]!=null)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$('#UserLogined').show();</script>");
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$('#lTop').show();$('#lBot').show();</script>");
         uinfo = Session["userInfo"] as UInfoModel;
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$('#UserLogined').hide();</script>");
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$('#lTop').hide();$('#lBot').hide();</script>");
     }
 }
Пример #3
0
 /// <summary>
 /// 用户积分增加
 /// </summary>
 /// <param name="uInfo">积分实体</param>
 /// <returns></returns>
 public bool addSumMark(UInfoModel uInfo)
 {
     bool flag = false;
     string cmdText = "update userInfo set SumMark = SumMark+@sumMark where userName = @userName";
     SqlParameter[] paras = new SqlParameter[] {
         new SqlParameter("@userName", uInfo.userName ),
         new SqlParameter("@sumMark",uInfo.sumMark)
     };
     int res = sqlhelper.ExecuteNonQuery(cmdText, paras, CommandType.Text);
     if (res > 0)
     {
         flag = true;
     }
     return flag;
 }
Пример #4
0
 private string checkLogin(URegModel urM)
 {
     string msg = null;
     if (userBLL.login(urM))
     {
         if (userBLL.getUReg(urM.userName)._Lock == "0")
         {
             userInfo = userBLL.getUInfo(urM.userName);
             Session["userInfo"] = userInfo;
             msg = "登录成功,正在返回登录前的页面,请稍后……";
         }
         else
         {
             msg = "您已经成功登陆,但您的账户已经被锁定,如有疑问,请联系网站管理员!";
         }
     }
     else
     {
         msg = "登录失败!用户名或者密码错误";
     }
     return msg;
 }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         this.btnChangeExtension.Enabled = false;
     }
     if (Session["userInfo"] == null)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请您先登录!');location='indexPage.aspx' </script>");
     }
     else
     {
         uinfo = Session["userInfo"] as UInfoModel;
         Url.Value = Request.Url.AbsoluteUri;
         Response.Cookies.Add(Url);
     }
 }
Пример #6
0
 private void doStore(string saveName)
 {
     VideoInfoModel vim = new VideoInfoModel();
     UInfoModel uim = new UInfoModel();
     vim.userName = uinfo.userName;
     vim.videoTitle = this.txtVideoTitle.Value;
     vim.videoContent = this.txtVideoContent.Value;
     vim.videoPath = "../" + common.playFile + saveName + ".flv";
     vim.videoPicture = "../" + common.imgFile + saveName + ".jpg";
     vim.videoType = this.dropVideoType.SelectedValue.ToString();
     if (userbll.insertVideo(vim))
     {
         uim.userName = uinfo.userName;
         uim.sumMark = "10";//上传一个视频加10个积分;
         userbll.addSumMark(uim);
         string redirect = "message.aspx?cmd=upload&msgid=3&uid=" + uinfo.userName;
         Page.Response.Redirect(redirect);
     }
 }
Пример #7
0
 //增加积分
 public bool addSumMark(UInfoModel uim)
 {
     return userDAL.addSumMark(uim);
 }
Пример #8
0
 //更新用户信息
 public bool updateUserInfo(UInfoModel uInfoModel)
 {
     return userDAL.updateUserInfo(uInfoModel);
 }
Пример #9
0
 //更新用户昵称
 public bool updateNickname(UInfoModel uim)
 {
     return userDAL.updateNickname(uim);
 }
Пример #10
0
 /// <summary>
 /// 用户信息更新
 /// </summary>
 /// <param name="ui">用户信息实体参数</param>
 /// <returns>返回真或假</returns>
 public bool updateUserInfo(UInfoModel uInfo)
 {
     bool flag = false;
     string cmdText = "update userInfo set sex =@sex,img=@img,city=@city,QQ=@qq,speak=@speak where userName=@userName";
     SqlParameter[] paras = new SqlParameter[] {
         new SqlParameter ("@userName", uInfo.userName),
         new SqlParameter ("@sex",uInfo.Sex ),
         new SqlParameter ("@img",uInfo.Img),
         new SqlParameter ("@city",uInfo.City),
         new SqlParameter ("@qq",uInfo.QQ),
         new SqlParameter ("@speak",uInfo.Speak)
     };
     int res = sqlhelper.ExecuteNonQuery(cmdText, paras, CommandType.Text);
     if (res > 0)
     {
         flag = true;
     }
     return flag;
 }
Пример #11
0
 public bool updateNickname(UInfoModel uInfo)
 {
     bool flag = false;
     string cmdText = "update userInfo set nickname=@nickName where userName=@userName";
     SqlParameter[] paras = new SqlParameter[] {
         new SqlParameter ("@userName", uInfo.userName),
         new SqlParameter ("@nickName",uInfo.nickName)
     };
     int res = sqlhelper.ExecuteNonQuery(cmdText, paras, CommandType.Text);
     if (res > 0)
     {
         flag = true;
     }
     return flag;
 }
Пример #12
0
 /// <summary>
 /// 根据用户名查找用户信息
 /// </summary>
 /// <param name="userName">用户名</param>
 /// <returns></returns>
 public UInfoModel getUserInfo(string userName)
 {
     UInfoModel uInfoModel = new UInfoModel();
     DataTable dt = new DataTable();
     string cmdText = "select * from userInfo where userName = @userName";
     SqlParameter[] paras = new SqlParameter[] {
         new SqlParameter ("@userName", userName)
     };
     dt = sqlhelper.getRow(cmdText, paras, CommandType.Text);
     uInfoModel.Id = dt.Rows[0]["id"].ToString();
     uInfoModel.userName = dt.Rows[0]["userName"].ToString();
     uInfoModel.nickName = dt.Rows[0]["nickName"].ToString();
     uInfoModel.Sex = dt.Rows[0]["sex"].ToString();
     uInfoModel.Img = dt.Rows[0]["img"].ToString();
     uInfoModel.City = dt.Rows[0]["city"].ToString();
     uInfoModel.Speak = dt.Rows[0]["speak"].ToString();
     uInfoModel.sumMark = dt.Rows[0]["summark"].ToString();
     uInfoModel.sumVideo = dt.Rows[0]["sumvideo"].ToString();
     return uInfoModel;
 }