/// <summary> /// Handles the RowDeleting event of the grid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param> void grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string username = (string)gridUsers.DataKeys[e.RowIndex].Value; string[] roles = Roles.GetRolesForUser(username); if (roles.Length > 0) { Roles.RemoveUserFromRoles(username, roles); } Membership.DeleteUser(username); AuthorProfile profile = AuthorProfile.GetProfile(username); if (profile != null) { profile.Delete(); profile.Save(); } if (HttpContext.Current.User.Identity.Name.Equals(username, StringComparison.OrdinalIgnoreCase)) { FormsAuthentication.SignOut(); } Response.Redirect(Request.RawUrl); }
public static JsonProfile GetProfile(string id) { if (!Utils.StringIsNullOrWhitespace(id)) { bool canEditRoles; if (!CanUserEditProfile(id, out canEditRoles)) return null; var pf = AuthorProfile.GetProfile(id); if (pf == null) { pf = new AuthorProfile(id); pf.Birthday = DateTime.Parse("01/01/1900"); pf.DisplayName = id; pf.EmailAddress = Utils.GetUserEmail(id); pf.FirstName = id; pf.Private = true; pf.Save(); } return AuthorProfile.ToJson(id); } return null; }
public static JsonProfile GetProfile(string id) { if (!Utils.StringIsNullOrWhitespace(id)) { bool canEditRoles; if (!CanUserEditProfile(id, out canEditRoles)) { return(null); } var pf = AuthorProfile.GetProfile(id); if (pf == null) { pf = new AuthorProfile(id); pf.Birthday = DateTime.Parse("01/01/1900"); pf.DisplayName = id; pf.EmailAddress = Utils.GetUserEmail(id); pf.FirstName = id; pf.Private = true; pf.Save(); } return(AuthorProfile.ToJson(id)); } return(null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Params["id"] != null) { lbID.Text = Request.Params["id"]; } ap = AuthorProfile.GetProfile(lbID.Text); //机构名称 lbTitle.Text = ap.Company; strTitle = ap.Company; strCity = ap.Address; strGSJS = ap.AboutMe; strFWGKH = ap.Description1; this.Title = ap.Company; if (Request.Cookies["OrgansViewCount_" + lbID.Text] == null) { HttpCookie MyCookie = new HttpCookie("OrgansViewCount_" + lbID.Text); DateTime now = DateTime.Now; MyCookie["IP"] = Request.UserHostAddress; MyCookie["tid"] = lbID.Text; MyCookie.Expires = now.AddHours(1); Response.Cookies.Add(MyCookie); ap.ViewCount++; ap.Save(); } } }
protected void btnok_Click(object sender, EventArgs e) { string reg_uid = Request["reg_uid"]; Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]); AuthorProfile pc = new AuthorProfile(reg_uid); pc.DisplayName = Request["reg_xingming"]; //pc.Company = Request["reg_company"]; if (Request["reg_phone2"] != string.Empty) { pc.PhoneMain = (Request["reg_phone1"].Trim() != string.Empty ? Request["reg_phone1"] + "-" : "") + Request["reg_phone2"] + (Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : ""); } pc.PhoneMobile = Request["reg_mobile"]; if (Request["reg_fax2"] != string.Empty) { pc.PhoneFax = (Request["reg_fax1"].Trim() != string.Empty ? Request["reg_fax1"] + "-" : "") + Request["reg_fax2"]; } pc.CityTown = Request["reg_shi"]; pc.MSN_QQ = Request["reg_qqmsn"]; pc.Company = Request["reg_company"]; pc.Address = Request["reg_address"]; pc.AboutMe = Request["reg_jianjie"]; pc.Description1 = Request["reg_kehu"]; Uppic(pc); pc.Save(); Roles.AddUserToRole(reg_uid, "organs"); Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=org", true); }
protected void btnok_Click(object sender, EventArgs e) { string reg_uid = Request["reg_uid"]; Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]); //reg_nicheng reg_company //reg_phone1 reg_phone2 reg_phone3 reg_mobile reg_qqmsn AuthorProfile pc = new AuthorProfile(reg_uid); pc.DisplayName = Request["reg_nicheng"]; pc.CityTown = Request["reg_shi"]; pc.Company = Request["reg_company"]; if (Request["reg_phone2"] != string.Empty) { pc.PhoneMain = Request["reg_phone1"].Trim() != string.Empty ?Request["reg_phone1"] + "-":"" + Request["reg_phone2"] + Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : ""; } pc.PhoneMobile = Request["reg_mobile"]; pc.MSN_QQ = Request["reg_qqmsn"]; pc.IsPrivate = true;//学员注册直接审核通过 pc.Save(); Roles.AddUserToRole(reg_uid, "students"); Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=std", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Params["id"] != null) { lbID.Text = Request.Params["id"]; } ap = AuthorProfile.GetProfile(lbID.Text); //机构名称 lbTitle.Text = ap.Company; strTitle = ap.Company; strCity = ap.Address; strGSJS = ap.AboutMe; strFWGKH = ap.Description1; this.Title = ap.Company; if (Request.Cookies["OrgansViewCount_" + lbID.Text] == null) { HttpCookie MyCookie = new HttpCookie("OrgansViewCount_" + lbID.Text); DateTime now = DateTime.Now; MyCookie["IP"] = Request.UserHostAddress; MyCookie["tid"] = lbID.Text; MyCookie.Expires = now.AddHours(1); Response.Cookies.Add(MyCookie); ap.ViewCount++; ap.Save(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Page.User.Identity.IsAuthenticated) { Response.Redirect(Utils.AbsoluteWebRoot + "login.aspx?Err=" + Server.HtmlEncode("未登录") + "&rUrl=" + Server.UrlPathEncode(Request.RawUrl)); } else { Res rs = Res.GetRes(new Guid(Request.Params["id"])); byte[] buff = rs.CurrentPostFileBuffer; outPutFile(buff, rs.FileName); //积分增减 AuthorProfile apSource = AuthorProfile.GetProfile(rs.Author); apSource.Points = (Convert.ToInt32(apSource.Points) + rs.Points).ToString(); apSource.Save(); AuthorProfile apDown = AuthorProfile.GetProfile(this.User.Identity.Name); apSource.Points = (Convert.ToInt32(apSource.Points) - rs.Points).ToString(); apSource.Save(); } } }
protected void Page_Load(object sender, EventArgs e) { lbID.Text = Request.Params["uid"]; tch = AuthorProfile.GetProfile(lbID.Text); this.Title = tch.DisplayName; if (Request.Cookies["tchViewCount_" + lbID.Text] == null) { HttpCookie MyCookie = new HttpCookie("tchViewCount_" + lbID.Text); DateTime now = DateTime.Now; MyCookie["IP"] = Request.UserHostAddress; MyCookie["tid"] = lbID.Text; MyCookie.Expires = now.AddHours(1); Response.Cookies.Add(MyCookie); tch.ViewCount++; tch.Save(); } }
protected void Page_Load(object sender, EventArgs e) { lbID.Text = Request.Params["uid"]; tch = AuthorProfile.GetProfile(lbID.Text); this.Title = tch.DisplayName; if (Request.Cookies["tchViewCount_" + lbID.Text] == null) { HttpCookie MyCookie = new HttpCookie("tchViewCount_" + lbID.Text); DateTime now = DateTime.Now; MyCookie["IP"] = Request.UserHostAddress; MyCookie["tid"] = lbID.Text; MyCookie.Expires = now.AddHours(1); Response.Cookies.Add(MyCookie); tch.ViewCount++; tch.Save(); } }
protected void btnok_Click(object sender, EventArgs e) { string reg_uid = Request["reg_uid"]; Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]); AuthorProfile pc = new AuthorProfile(reg_uid); pc.DisplayName = Request["reg_xingming"]; pc.CityTown = Request["reg_shi"]; //pc.Company = Request["reg_company"]; if (Request["reg_phone2"] != string.Empty) { pc.PhoneMain = (Request["reg_phone1"].Trim() != string.Empty ? Request["reg_phone1"] + "-" : "") + Request["reg_phone2"] + (Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : ""); } pc.PhoneMobile = Request["reg_mobile"]; pc.MSN_QQ = Request["reg_qqmsn"]; pc.Pay = Request["reg_pay"]; pc.AboutMe = Request["reg_jianjie"]; pc.Description1 = Request["reg_kehu"]; pc.Description2 = Request["reg_zhujiang"]; string fields = string.Empty; for (int i = 0; i < Field.Fields.Count; i++) { if (Request["reg_lingyu:" + i] != null) { Field fld = Field.Fields[i]; fields += fld.Id + "|"; } } pc.Fields = fields.TrimEnd('|'); Uppic(pc); pc.Save(); Roles.AddUserToRole(reg_uid, "teachers"); Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=tch", true); }
protected void btnok_Click(object sender, EventArgs e) { string reg_uid = Request["reg_uid"]; Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]); //reg_nicheng reg_company //reg_phone1 reg_phone2 reg_phone3 reg_mobile reg_qqmsn AuthorProfile pc = new AuthorProfile(reg_uid); pc.DisplayName = Request["reg_nicheng"]; pc.CityTown = Request["reg_shi"]; pc.Company = Request["reg_company"]; if (Request["reg_phone2"]!=string.Empty) { pc.PhoneMain = Request["reg_phone1"].Trim() != string.Empty ?Request["reg_phone1"] + "-":"" + Request["reg_phone2"] + Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : ""; } pc.PhoneMobile = Request["reg_mobile"]; pc.MSN_QQ = Request["reg_qqmsn"]; pc.IsPrivate = true;//学员注册直接审核通过 pc.Save(); Roles.AddUserToRole(reg_uid, "students"); Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=std", true); }
protected void btnok_Click(object sender, EventArgs e) { string reg_uid = Request["reg_uid"]; Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]); AuthorProfile pc = new AuthorProfile(reg_uid); pc.DisplayName = Request["reg_xingming"]; pc.CityTown = Request["reg_shi"]; //pc.Company = Request["reg_company"]; if (Request["reg_phone2"] != string.Empty) { pc.PhoneMain = (Request["reg_phone1"].Trim() != string.Empty ? Request["reg_phone1"] + "-" : "") + Request["reg_phone2"] + (Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : ""); } pc.PhoneMobile = Request["reg_mobile"]; pc.MSN_QQ = Request["reg_qqmsn"]; pc.Pay = Request["reg_pay"]; pc.AboutMe = Request["reg_jianjie"]; pc.Description1 = Request["reg_kehu"]; pc.Description2 = Request["reg_zhujiang"]; string fields = string.Empty; for (int i = 0; i < Field.Fields.Count; i++) { if (Request["reg_lingyu:" + i]!=null) { Field fld = Field.Fields[i]; fields += fld.Id + "|"; } } pc.Fields = fields.TrimEnd('|'); Uppic(pc); pc.Save(); Roles.AddUserToRole(reg_uid, "teachers"); Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=tch", true); }
static Profile GetProfile(string id) { if (!Utils.StringIsNullOrWhitespace(id)) { var pf = AuthorProfile.GetProfile(id); if (pf == null) { pf = new AuthorProfile(id); pf.Birthday = DateTime.Parse("01/01/1900"); pf.DisplayName = id; pf.EmailAddress = Utils.GetUserEmail(id); pf.FirstName = id; pf.Private = true; pf.Save(); } return(new Profile { AboutMe = string.IsNullOrEmpty(pf.AboutMe) ? "" : pf.AboutMe, Birthday = pf.Birthday.ToShortDateString(), CityTown = string.IsNullOrEmpty(pf.CityTown) ? "" : pf.CityTown, Country = string.IsNullOrEmpty(pf.Country) ? "" : pf.Country, DisplayName = pf.DisplayName, EmailAddress = pf.EmailAddress, PhoneFax = string.IsNullOrEmpty(pf.PhoneFax) ? "" : pf.PhoneFax, FirstName = string.IsNullOrEmpty(pf.FirstName) ? "" : pf.FirstName, Private = pf.Private, LastName = string.IsNullOrEmpty(pf.LastName) ? "" : pf.LastName, MiddleName = string.IsNullOrEmpty(pf.MiddleName) ? "" : pf.MiddleName, PhoneMobile = string.IsNullOrEmpty(pf.PhoneMobile) ? "" : pf.PhoneMobile, PhoneMain = string.IsNullOrEmpty(pf.PhoneMain) ? "" : pf.PhoneMain, PhotoUrl = string.IsNullOrEmpty(pf.PhotoUrl) ? "" : pf.PhotoUrl.Replace("\"", ""), RegionState = string.IsNullOrEmpty(pf.RegionState) ? "" : pf.RegionState }); } return(null); }
protected void btnok_Click(object sender, EventArgs e) { string reg_uid = Request["reg_uid"]; Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]); AuthorProfile pc = new AuthorProfile(reg_uid); pc.DisplayName = Request["reg_xingming"]; //pc.Company = Request["reg_company"]; if (Request["reg_phone2"] != string.Empty) { pc.PhoneMain = (Request["reg_phone1"].Trim() != string.Empty ? Request["reg_phone1"] + "-" : "") + Request["reg_phone2"] + (Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : ""); } pc.PhoneMobile = Request["reg_mobile"]; if (Request["reg_fax2"] != string.Empty) { pc.PhoneFax = (Request["reg_fax1"].Trim() != string.Empty ? Request["reg_fax1"] + "-" : "") + Request["reg_fax2"]; } pc.CityTown = Request["reg_shi"]; pc.MSN_QQ = Request["reg_qqmsn"]; pc.Company = Request["reg_company"]; pc.Address = Request["reg_address"]; pc.AboutMe = Request["reg_jianjie"]; pc.Description1 = Request["reg_kehu"]; Uppic(pc); pc.Save(); Roles.AddUserToRole(reg_uid, "organs"); Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=org", true); }
static Profile GetProfile(string id) { if (!Utils.StringIsNullOrWhitespace(id)) { var pf = AuthorProfile.GetProfile(id); if (pf == null) { pf = new AuthorProfile(id); pf.Birthday = DateTime.Parse("01/01/1900"); pf.DisplayName = id; pf.EmailAddress = Utils.GetUserEmail(id); pf.FirstName = id; pf.Private = true; pf.Save(); } return new Profile { AboutMe = string.IsNullOrEmpty(pf.AboutMe) ? "" : pf.AboutMe, Birthday = pf.Birthday.ToShortDateString(), CityTown = string.IsNullOrEmpty(pf.CityTown) ? "" : pf.CityTown, Country = string.IsNullOrEmpty(pf.Country) ? "" : pf.Country, DisplayName = pf.DisplayName, EmailAddress = pf.EmailAddress, PhoneFax = string.IsNullOrEmpty(pf.PhoneFax) ? "" : pf.PhoneFax, FirstName = string.IsNullOrEmpty(pf.FirstName) ? "" : pf.FirstName, Private = pf.Private, LastName = string.IsNullOrEmpty(pf.LastName) ? "" : pf.LastName, MiddleName = string.IsNullOrEmpty(pf.MiddleName) ? "" : pf.MiddleName, PhoneMobile = string.IsNullOrEmpty(pf.PhoneMobile) ? "" : pf.PhoneMobile, PhoneMain = string.IsNullOrEmpty(pf.PhoneMain) ? "" : pf.PhoneMain, PhotoUrl = string.IsNullOrEmpty(pf.PhotoUrl) ? "" : pf.PhotoUrl.Replace("\"", ""), RegionState = string.IsNullOrEmpty(pf.RegionState) ? "" : pf.RegionState }; } return null; }