145 lines
5.6 KiB
C#
145 lines
5.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Web;
|
|
using System.Web.SessionState;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
namespace Mtxfw.shop.bbs
|
|
{
|
|
/// <summary>
|
|
/// myShoppingCart 的摘要说明。
|
|
/// </summary>
|
|
public partial class updateuser : Mtxfw.Utility.MemberBase
|
|
{
|
|
Mtxfw.DAL.Ads daoAds = new Mtxfw.DAL.Ads();
|
|
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|
public Mtxfw.DAL.forum daoforum = new Mtxfw.DAL.forum();
|
|
public Mtxfw.DAL.bbs daobbs = new Mtxfw.DAL.bbs();
|
|
Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
|
protected int MemberId=0;
|
|
protected string AdsName01, AdsName02;
|
|
protected string indexTP01, indexTP02;
|
|
protected string indexTPLink01, indexTPLink02;
|
|
protected string strposition = "", strimg="";
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
// 在此处放置用户代码以初始化页面
|
|
|
|
System.Data.DataSet Ds_Ads = daoAds.GetCacheList("top 1", "utype=N'论坛广告' Order By AdsSort desc", "bbs_Ads2");
|
|
System.Data.DataTable Dt_Ads = Ds_Ads != null && Ds_Ads.Tables[0] != null ? Ds_Ads.Tables[0] : null;
|
|
foreach (System.Data.DataRow Dr in Dt_Ads.Rows)
|
|
{
|
|
indexTP01 = Dr["AdsPic"].ToString();
|
|
indexTPLink01 = Dr["AdsUrl"].ToString();
|
|
AdsName01 = Dr["AdsName"].ToString();
|
|
}
|
|
if (!Page.IsPostBack)
|
|
{
|
|
|
|
if (Request.UrlReferrer != null)
|
|
{
|
|
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
|
}
|
|
if (Hidd_Url.Value.Trim() == "")
|
|
{
|
|
Hidd_Url.Value = "/";
|
|
}
|
|
if (Session["MemberId"] == null)
|
|
{
|
|
Session["returnurl"] = Hidd_Url.Value;
|
|
Mtxfw.Utility.Tools.Message("您还没有登录!", "/login.aspx");
|
|
}
|
|
else
|
|
{
|
|
Page.Title = "发表帖子-" + config.webName;
|
|
Page.MetaDescription = "发表帖子-" + config.webDescription;
|
|
Page.MetaKeywords = "发表帖子-" + config.webKeywords;
|
|
strposition = "发表帖子";
|
|
Mtxfw.Model.user_info umodel = daoUser.GetModel(Card);
|
|
if (umodel != null)
|
|
{
|
|
Text_NCName.Text = umodel.NCName;
|
|
Text_MTZNLConent.Text = umodel.MTZNLConent;
|
|
Text_BBSConent.Text = umodel.BBSConent;
|
|
if (!String.IsNullOrEmpty(umodel.UserPic))
|
|
{
|
|
Image_PicTrue.Visible = true;
|
|
Image_PicTrue.ImageUrl = Mtxfw.Utility.Common.GetCoverPic(umodel.UserPic, "250x250", "cut");
|
|
Hidd_PicTrue.Value = umodel.UserPic;
|
|
}
|
|
PanelBBSConent.Visible = true;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void Btn_Update_Click(object sender, EventArgs e)
|
|
{
|
|
if (!String.IsNullOrEmpty(Text_NCName.Text))
|
|
{
|
|
|
|
string strpic = "";
|
|
if (File_PicTrue.FileContent.Length > 0)
|
|
{
|
|
Mtxfw.Utility.UploadFile upload = new Mtxfw.Utility.UploadFile(File_PicTrue.PostedFile, config.webUpPath, config.webUpType, int.Parse(config.webUpSize));
|
|
if (upload.StatrUpFile())
|
|
{
|
|
strpic = upload.UploadPath;
|
|
}
|
|
else strpic = String.Empty;
|
|
|
|
}
|
|
else strpic = Hidd_PicTrue.Value;
|
|
if (strpic == "")
|
|
{
|
|
Mtxfw.Utility.Tools.Message("您的头像不能为空!");
|
|
}
|
|
else
|
|
{
|
|
if (!Mtxfw.Utility.Common.IsAllowedExtension(Server.MapPath("/image/" + strpic)))
|
|
{
|
|
File.Delete(Server.MapPath("/image/" + strpic));
|
|
Mtxfw.Utility.Tools.Message("只能上传图片", "updateuser.aspx");
|
|
}
|
|
else
|
|
{
|
|
if (Hidd_PicTrue.Value != "")
|
|
{
|
|
if (File.Exists(Server.MapPath("/image/" + Hidd_PicTrue.Value)))
|
|
{
|
|
File.Exists(Server.MapPath("/image/" + Hidd_PicTrue.Value));
|
|
}
|
|
}
|
|
Mtxfw.Model.user_info umodel = daoUser.GetModel(Card);
|
|
if (umodel != null)
|
|
{
|
|
|
|
umodel.NCName = Text_NCName.Text;
|
|
umodel.MTZNLConent = Text_MTZNLConent.Text;
|
|
umodel.BBSConent = Text_BBSConent.Text;
|
|
umodel.UserPic = strpic;
|
|
daoUser.UpdateBBS(umodel);
|
|
Mtxfw.Utility.Tools.Message("上传成功!", "updateuser.aspx");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Mtxfw.Utility.Tools.Message("您的昵称不能为空!");
|
|
}
|
|
}
|
|
}
|
|
}
|