//提交注册 protected void BtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { M_UserInfo info = new M_UserInfo(); info.UserName = this.TxtUserName.Text; info.UserPwd = this.TxtPassword.Text; info.Question = this.TxtQuestion.Text; info.Answer = this.TxtAnswer.Text; info.Email = this.TxtEmail.Text; info.CheckNum = DataSecurity.RandomNum(10); info.UserFace = ""; info.FaceHeight = 16; info.FaceWidth = 16; info.GroupID = 0; info.LastLoginIP = HttpContext.Current.Request.UserHostAddress; info.LastLockTime = DateTime.Now; info.LastLoginTimes = DateTime.Now; info.LastPwdChangeTime = DateTime.Now; info.LoginTimes = 1; info.PrivacySetting = 0; info.RegTime = DateTime.Now; info.Sign = ""; info.Status = 4; info.UserPwd = StringHelper.MD5(info.UserPwd); info.Answer = StringHelper.MD5(info.Answer); buser.Add(info); buser.SetLoginState(info); base.Response.Redirect("Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { buser.CheckIsLogin(); this.LblSiteName.Text = SiteConfig.SiteInfo.SiteName; string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); if (string.IsNullOrEmpty(base.Request.QueryString["NodeID"])) { this.NodeID = 0; } else { this.NodeID = DataConverter.CLng(base.Request.QueryString["NodeID"]); } RepNodeBind(); } }
public void InitPage() { int wid = 0; M_ProjectWork mprojectwork = new M_ProjectWork(); B_ProjectWork bprojectwork = new B_ProjectWork(); if (Request.QueryString["wid"] != null) { wid = DataConverter.CLng(Request.QueryString["wid"].Trim()); mprojectwork = bprojectwork.SelectWorkByWID(wid); this.m_pid = mprojectwork.ProjectID; LblProIntro.Text = mprojectwork.WorkName.ToString(); LblProName.Text = bpro.GetProjectByid(Convert.ToInt32(mprojectwork.ProjectID)).ProjectName.ToString(); } if (this.m_uid > 0) { muser = buser.SeachByID(this.m_uid); if (muser.UserName != null) TxtUserName.Text = muser.UserName.ToString(); else TxtUserName.Text="佚名"; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { buser.CheckIsLogin(); string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); if (string.IsNullOrEmpty(base.Request.QueryString["InfoID"])) { function.WriteErrMsg("没有指定要添加到收藏夹的内容ID!"); } else { int InfoID = DataConverter.CLng(base.Request.QueryString["InfoID"]); M_Favorite fav = new M_Favorite(); fav.FavoriteID = 0; fav.InfoID = InfoID; fav.Owner = this.UserInfo.UserID; fav.AddDate = DateTime.Now; this.bfav.AddFavorite(fav); function.WriteSuccessMsg("该内容成功添加到你的收藏夹了!<br/> 10秒后该页自动关闭...也可手工【<a href=\"javascript:window.close();\">关闭</a>】"); } } }
private void SetStatus(M_UserInfo info) { this.LitUserName.Text = info.UserName; this.LitLoginTime.Text = "登录次数:" + info.LoginTimes + "次"; this.LitLoginDate.Text = "最近登录:" + info.LastLoginTimes.ToString(); this.LitMessage.Text = "未读信息:" + B_Message.UserMessCount(info.UserName); this.PnlLoginStatus.Visible = true; this.PnlLogin.Visible = false; this.PnlLoginMessage.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { buser.CheckIsLogin(); this.LblSiteName.Text = SiteConfig.SiteInfo.SiteName; string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); if (string.IsNullOrEmpty(base.Request.QueryString["NodeID"])) { this.NodeID = 0; } else { this.NodeID = DataConverter.CLng(base.Request.QueryString["NodeID"]); } this.flag = base.Request.QueryString["type"]; if (this.NodeID != 0) { M_Node nod = this.bNode.GetNode(this.NodeID); this.lblNodeName.Text = nod.NodeName; string ModeIDList = nod.ContentModel; string[] ModelID = ModeIDList.Split(','); string AddContentlink = ""; for (int i = 0; i < ModelID.Length; i++) { AddContentlink = AddContentlink + "<a href=\"AddContent.aspx?ModelID=" + ModelID[i] + "&NodeID=" + this.NodeID + "\">" + this.bmode.GetModelById(DataConverter.CLng(ModelID[i])).ModelName + "</a> | "; } this.lblAddContent.Text = AddContentlink; } else { this.lblNodeName.Text = "全部节点"; this.lblAddContent.Text = ""; } RepNodeBind(); } }
/// <summary> /// 绑定数据到GridView /// </summary> private void RepNodeBind() { string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); this.NodeID = DataConverter.CLng(this.ViewState["NodeID"]); this.KeyWord = this.ViewState["KeyWord"].ToString(); this.Egv.DataSource = this.bfav.GetMyFavorite(this.UserInfo.UserID, this.NodeID, this.KeyWord); this.Egv.DataKeyNames = new string[] { "FavoriteID" }; this.Egv.DataBind(); }
//获取会员所有信息 public bool Add(M_UserInfo userInfo) { return userMethod.Add(userInfo); }
public override SqlParameter[] GetParameters() { M_UserInfo model = this; EmptyDeal(); SqlParameter[] sp = GetSP(); model.HoneyName = SafeStr(model.HoneyName); model.TrueName = SafeStr(model.TrueName); sp[0].Value = model.UserID; sp[1].Value = model.UserName; sp[2].Value = model.UserPwd; sp[3].Value = model.GroupID; sp[4].Value = model.Email; sp[5].Value = model.Question; sp[6].Value = model.Answer; sp[7].Value = model.RegTime; sp[8].Value = model.LoginTimes; sp[9].Value = model.LastLoginTimes; sp[10].Value = model.LastLoginIP; sp[11].Value = model.LastPwdChangeTime; sp[12].Value = model.LastLockTime; sp[13].Value = model.Status; sp[14].Value = model.CheckNum; sp[15].Value = model.UserExp; sp[16].Value = model.boffExp; sp[17].Value = model.ConsumeExp; sp[18].Value = model.Purse; sp[19].Value = model.DeadLine; sp[20].Value = model.UserPoint; sp[21].Value = model.JoinTime; sp[22].Value = model.DummyPurse; sp[23].Value = model.TrueName; sp[24].Value = model.SiteID; sp[25].Value = model.Remark; sp[26].Value = model.CompanyName; sp[27].Value = model.CompanyDescribe; sp[28].Value = model.IsConfirm; sp[29].Value = model.VIP; sp[30].Value = model.salt; sp[31].Value = model.RegisterIP; sp[32].Value = model.CerificateDeadLine; sp[33].Value = model.PageID; sp[34].Value = model.SiteRebateBalance; sp[35].Value = model.UserCreit; sp[36].Value = model.RoomID; sp[37].Value = model.ParentUserID; sp[38].Value = model.IsCloud; sp[39].Value = model.SilverCoin; sp[40].Value = model.PayPassWord; sp[41].Value = model.seturl; sp[42].Value = model.GuestScore; sp[43].Value = model.StructureID; sp[44].Value = model.UserRole; sp[45].Value = model.WorkNum; sp[46].Value = model.MailSize; sp[47].Value = model.LastActiveTime; sp[48].Value = model.ZnPassword; sp[49].Value = model.HoneyName; sp[50].Value = model.State; return(sp); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { this.ModelID = DataConverter.CLng(this.HdnModel.Value); this.NodeID = DataConverter.CLng(this.HdnNode.Value); DataTable dt = this.bfield.GetModelFieldList(this.ModelID).Tables[0]; DataTable table = new DataTable(); table.Columns.Add(new DataColumn("FieldName", typeof(string))); table.Columns.Add(new DataColumn("FieldType", typeof(string))); table.Columns.Add(new DataColumn("FieldValue", typeof(string))); foreach (DataRow dr in dt.Rows) { if (DataConverter.CBool(dr["IsNotNull"].ToString())) { if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + dr["FieldName"].ToString()])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "不能为空!"); } } if (dr["FieldType"].ToString() == "FileType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { DataRow row2 = table.NewRow(); row2[0] = sizefield; row2[1] = "FileSize"; row2[2] = this.Page.Request.Form["txt_" + sizefield]; table.Rows.Add(row2); } } if (dr["FieldType"].ToString() == "MultiPicType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + sizefield])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!"); } DataRow row1 = table.NewRow(); row1[0] = sizefield; row1[1] = "ThumbField"; row1[2] = this.Page.Request.Form["txt_" + sizefield]; table.Rows.Add(row1); } } DataRow row = table.NewRow(); row[0] = dr["FieldName"].ToString(); row[1] = dr["FieldType"].ToString(); row[2] = this.Page.Request.Form["txt_" + dr["FieldName"].ToString()]; table.Rows.Add(row); } string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); M_CommonData CData = new M_CommonData(); CData.NodeID = this.NodeID; CData.ModelID = this.ModelID; CData.TableName = this.bmode.GetModelById(this.ModelID).TableName; CData.Title = this.txtTitle.Text; CData.Inputer = this.UserInfo.UserName; CData.EliteLevel = 0; CData.Status = 0; CData.InfoID = ""; CData.SpecialID = ""; int newID = this.bll.AddContent(table, CData); //添加到专题 //string specialid = this.HdnSpec.Value; //if (!string.IsNullOrEmpty(specialid)) //{ // string[] arr = specialid.Split(new char[] { ',' }); // M_SpecInfo info = new M_SpecInfo(); // info.InfoID = newID; // for (int i = 0; i < arr.Length; i++) // { // info.SpecialID = DataConverter.CLng(arr[i]); // this.bspec.Add(info); // } //} Response.Redirect("MyContent.aspx?NodeID=" + this.NodeID); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { buser.CheckIsLogin(); string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); if (string.IsNullOrEmpty(base.Request.QueryString["ModelID"])) { function.WriteErrMsg("没有指定要添加内容的模型ID!"); } else { this.ModelID = DataConverter.CLng(base.Request.QueryString["ModelID"]); } if (string.IsNullOrEmpty(base.Request.QueryString["NodeID"])) { function.WriteErrMsg("没有指定要添加内容的栏目节点ID!"); } else { this.NodeID = DataConverter.CLng(base.Request.QueryString["NodeID"]); } this.Label1.Text = "向" + this.bnode.GetNode(this.NodeID).NodeName + "节点添加" + this.bmode.GetModelById(this.ModelID).ModelName; this.Label2.Text = this.bnode.GetNode(this.NodeID).NodeName; this.HdnModel.Value = this.ModelID.ToString(); this.HdnNode.Value = this.NodeID.ToString(); this.ModelHtml.Text = this.bfield.GetInputHtmlUser(this.ModelID, this.NodeID); } }
/// <summary> /// 增加会员 /// </summary> /// <param name="UserInfo"></param> /// <returns></returns> public bool Add(M_UserInfo UserInfo) { string strSql = "PR_User_AddUpdate"; SqlParameter[] parameter = GetParameters(UserInfo); return SqlHelper.ExecuteProc(strSql, parameter); }
/// <summary> /// 从Sqldatareader读取会员信息 /// </summary> /// <param name="reader"></param> /// <returns></returns> private M_UserInfo GetUserInfoFromReader(SqlDataReader reader) { M_UserInfo info = new M_UserInfo(); info.UserID = DataConverter.CLng(reader["UserID"].ToString()); info.UserName = reader["UserName"].ToString(); info.UserPwd = reader["UserPwd"].ToString(); info.Email = reader["Email"].ToString(); info.Question = reader["Question"].ToString(); info.Answer = reader["Answer"].ToString(); info.UserFace = reader["UserFace"].ToString(); info.FaceHeight = DataConverter.CLng(reader["FaceHeight"].ToString()); info.FaceWidth = DataConverter.CLng(reader["FaceWidth"].ToString()); info.RegTime = DataConverter.CDate(reader["RegTime"].ToString()); info.Sign = reader["Sign"].ToString(); info.PrivacySetting = DataConverter.CLng(reader["PrivacySetting"]); info.GroupID = DataConverter.CLng(reader["GroupID"].ToString()); info.LastLockTime = DataConverter.CDate(reader["LastLockTime"].ToString()); info.LastLoginIP = reader["LastLoginIP"].ToString(); info.LastLoginTimes = DataConverter.CDate(reader["LastLoginTime"].ToString()); info.LastPwdChangeTime = DataConverter.CDate(reader["LastPwdChangeTime"].ToString()); info.LoginTimes = DataConverter.CLng(reader["LoginTimes"].ToString()); info.Status = DataConverter.CLng(reader["Status"].ToString()); info.CheckNum = reader["CheckNum"].ToString(); reader.Close(); return info; }
/// <summary> /// 传参 /// </summary> /// <param name="userInfo"></param> /// <returns></returns> private SqlParameter[] GetParameters(M_UserInfo userInfo) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@UserName", SqlDbType.NVarChar, 20), new SqlParameter("@UserPwd", SqlDbType.NVarChar, 255), new SqlParameter("@Email", SqlDbType.NVarChar, 255), new SqlParameter("@Question", SqlDbType.NVarChar, 255), new SqlParameter("@Answer", SqlDbType.NVarChar, 255), new SqlParameter("@UserFace", SqlDbType.NVarChar, 255), new SqlParameter("@FaceHeight", SqlDbType.Int), new SqlParameter("@FaceWidth", SqlDbType.Int), new SqlParameter("@RegTime", SqlDbType.DateTime), new SqlParameter("@Sign", SqlDbType.NText), new SqlParameter("@PrivacySetting", SqlDbType.Int), new SqlParameter("@LoginTimes", SqlDbType.Int), new SqlParameter("@LastLoginTime", SqlDbType.DateTime), new SqlParameter("@LastLoginIP", SqlDbType.NVarChar, 50), new SqlParameter("@LastPwdChangeTime", SqlDbType.DateTime), new SqlParameter("@LastLockTime", SqlDbType.DateTime), new SqlParameter("@CheckNum", SqlDbType.NVarChar,50), new SqlParameter("@Status", SqlDbType.Int) }; parameter[0].Value = userInfo.UserID; parameter[1].Value = userInfo.UserName; parameter[2].Value = userInfo.UserPwd; parameter[3].Value = userInfo.Email; parameter[4].Value = userInfo.Question; parameter[5].Value = userInfo.Answer; parameter[6].Value = userInfo.UserFace; parameter[7].Value = userInfo.FaceHeight; parameter[8].Value = userInfo.FaceWidth; parameter[9].Value = userInfo.RegTime; parameter[10].Value = userInfo.Sign; parameter[11].Value = userInfo.PrivacySetting; parameter[12].Value = userInfo.LoginTimes; parameter[13].Value = userInfo.LastLoginTimes; parameter[14].Value = userInfo.LastLoginIP; parameter[15].Value = userInfo.LastPwdChangeTime; parameter[16].Value = userInfo.LastLockTime; parameter[17].Value = userInfo.CheckNum; parameter[18].Value = userInfo.Status; return parameter; }
protected void NextButtonStep5_Click(object sender, EventArgs e) { B_User buser = new B_User(); string message=string.Empty; string strHostIP = ""; IPHostEntry oIPHost = Dns.GetHostEntry(Environment.MachineName); if (oIPHost.AddressList.Length > 0) strHostIP = oIPHost.AddressList[0].ToString(); string adminname = TxtAdminName.Text.ToString(); string strtitle =TxtSiteTitle.Text.ToString(); string Code = TxtSiteManageCode.Text; string pwd = TxtAdminPassword.Text.ToString();//管理员密码 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Server.MapPath("../Config/Site.config")); XmlElement xmldocSelect = (XmlElement)xmlDoc.DocumentElement.SelectSingleNode("SiteInfo"); XmlElement xe2 = (XmlElement)xmldocSelect.SelectSingleNode("SiteTitle"); xe2.InnerText=strtitle; XmlNode xe3 = (XmlElement)xmldocSelect.SelectSingleNode("SiteUrl");//.ChildNodes xe3.InnerText = TxtSiteUrl.Text.ToString(); XmlElement xmldocSelect2 = (XmlElement)xmlDoc.DocumentElement.SelectSingleNode("SiteOption"); XmlElement xe5 = (XmlElement)xmldocSelect2.SelectSingleNode("SiteManageCode"); xe5.InnerText = Code; xmlDoc.Save(Server.MapPath("../Config/Site.config")); //WebConfigurationManager.AppSettings["Installed"]="true"; XmlDocument xmlDoc2 = new XmlDocument(); xmlDoc2.Load(Server.MapPath("../Config/AppSettings.config")); XmlNodeList amde = xmlDoc2.SelectSingleNode("appSettings").ChildNodes; foreach (XmlNode xn in amde) { XmlElement xe = (XmlElement)xn; if (xe.GetAttribute("key").ToString() == "Installed") xe.SetAttribute("value", "true"); } xmlDoc2.Save(Server.MapPath("../Config/AppSettings.config")); if (Install.Add("admin", pwd)) { M_UserInfo muser = new M_UserInfo(); muser.UserName = "******"; muser.UserPwd = StringHelper.MD5(pwd); muser.RegTime = DateTime.Now; muser.LastLockTime = DateTime.MaxValue; muser.LastLoginTimes = DateTime.Now; muser.LastPwdChangeTime = DateTime.MaxValue; muser.Email = TxtEmail.Text; muser.Question ="admin"; muser.Answer = StringHelper.MD5(pwd); muser.GroupID = 0; muser.UserFace = ""; muser.Sign = ""; muser.LastLoginIP = strHostIP; muser.CheckNum = new Random().ToString(); buser.Add(muser); message="<script language=javascript> alert('安装完成!');</script>"; } else { message="<script language=javascript> alert('安装配置失败!请检查后重新操作!');</script>"; } if (!this.IsStartupScriptRegistered("message")) { Page.RegisterStartupScript("message", message); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { buser.CheckIsLogin(); string uname = HttpContext.Current.Request.Cookies["UserState"]["LoginName"]; this.UserInfo = buser.GetUserByName(uname); if (string.IsNullOrEmpty(base.Request.QueryString["GeneralID"])) { function.WriteErrMsg("没有指定要修改的内容ID!"); } else { this.GeneralID = DataConverter.CLng(base.Request.QueryString["GeneralID"]); } M_CommonData Cdata = this.bll.GetCommonData(this.GeneralID); if (uname != Cdata.Inputer) { function.WriteErrMsg("不能编辑不属于自己输入的内容!"); } this.NodeID = Cdata.NodeID; this.ModelID = Cdata.ModelID; this.lblNodeName.Text = this.bnode.GetNode(this.NodeID).NodeName; string ModelName = this.bmode.GetModelById(this.ModelID).ModelName; this.Label1.Text = "修改" + ModelName; this.lblAddContent.Text = ModelName; this.Label2.Text = this.lblNodeName.Text; this.txtTitle.Text = Cdata.Title; this.HdnItem.Value = this.GeneralID.ToString(); DataTable dtContent = this.bll.GetContent(this.GeneralID); this.ModelHtml.Text = this.bfield.GetUpdateHtmlUser(this.ModelID, NodeID, dtContent); } }
/// <summary> /// 设定登录状态 /// </summary> /// <param name="model"></param> public void SetLoginState(M_UserInfo model) { HttpContext.Current.Response.Cookies["UserState"]["UserID"] = model.UserID.ToString(); HttpContext.Current.Response.Cookies["UserState"]["LoginName"] = model.UserName; HttpContext.Current.Response.Cookies["UserState"]["Password"] = model.UserPwd; }
public M_AJAXUser(M_UserInfo mu) { Copy(mu); }
//跟新会员信息 public bool UpDateUser(M_UserInfo userInfo) { return userMethod.UpDate(userInfo); }