public void gvBind() { if (txtName.Text == string.Empty) { if (Session["Pop"].ToString().Trim() == "版主") { HyperLink1.Visible = false; host.HostName = Session["Name"].ToString(); module.ModuleID = HostManager.FindHostByHostName(host).ModuleID; gvInfo.DataSource = ModuleManager.getModuleByIDName(module); gvInfo.DataKeyNames = new string[] { "版块编号" }; gvInfo.DataBind(); return; } if (Session["Pop"].ToString().Trim() == "管理员") { gvInfo.DataSource = ModuleManager.getAllModule(); gvInfo.DataKeyNames = new string[] { "版块编号" }; gvInfo.DataBind(); return; } } else { if (Session["Pop"].ToString().Trim() == "管理员") { module.ModuleName = txtName.Text; gvInfo.DataSource = ModuleManager.getModuleByIDName(module); gvInfo.DataKeyNames = new string[] { "版块编号" }; gvInfo.DataBind(); return; } } }
public void gvBind() { if (txtName.Text == string.Empty) { List <Host> listOfHost = HostManager.getAllHost(); gvHostInfo.DataSource = listOfHost; gvHostInfo.DataBind(); for (int i = 0; i < listOfHost.Count; i++) { module.ModuleID = listOfHost[i].ModuleID.ToString(); gvHostInfo.Rows[i].Cells[1].Text = ModuleManager.FindModuleByID(module).ModuleName; gvHostInfo.Rows[i].Cells[3].Text = listOfHost[i].Birthday.ToLongDateString(); } } else { host.HostName = txtName.Text; host = HostManager.FindHostByHostName(host); gvHostInfo.DataSource = host; gvHostInfo.DataBind(); module.ModuleID = host.ModuleID; gvHostInfo.Rows[0].Cells[1].Text = ModuleManager.FindModuleByID(module).ModuleName; gvHostInfo.Rows[0].Cells[3].Text = host.Birthday.ToLongDateString(); } }
public string getPhoto(string str) { string strPhoto = ""; revert.RevertID = str; revert = RevertManager.FindRevertByRevertID(revert); string strPop = revert.Pop.Trim(); if (strPop == "用户") { user.UserName = revert.RevertPeople; user = UserManager.findUserByUserName(user); strPhoto = user.Photo; } if (strPop == "版主") { host.HostName = revert.RevertPeople; host = HostManager.FindHostByHostName(host); strPhoto = host.Photo; } if (strPop == "管理员") { strPhoto = "../Images/Admin.jpg"; } return(strPhoto); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlMName.DataSource = ModuleManager.getAllModule(); ddlMName.DataTextField = "ModuleName"; ddlMName.DataBind(); } string strName = ""; if (Session["Name"] == null) { strName = "匿名"; labName.Text = strName; labEmail.Text = "无"; labQQ.Text = "无"; labIndex.Text = "无"; imgPhoto.ImageUrl = "../Images/Visiter.jpg"; } else { strName = Session["Name"].ToString(); if (Session["Pop"].ToString() == "用户") { user.UserName = strName; user = UserManager.findUserByUserName(user); labName.Text = strName; labEmail.Text = user.Email; labQQ.Text = user.QQ.ToString(); labIndex.Text = user.Index; imgPhoto.ImageUrl = user.Photo; return; } if (Session["Pop"].ToString() == "版主") { host.HostName = strName; host = HostManager.FindHostByHostName(host); labName.Text = strName; labEmail.Text = host.Email; labQQ.Text = host.QQ.ToString(); labIndex.Text = host.Index; imgPhoto.ImageUrl = host.Photo; return; } if (Session["Pop"].ToString() == "管理员") { labName.Text = strName; labEmail.Text = "无"; labQQ.Text = "无"; labIndex.Text = "无"; imgPhoto.ImageUrl = "../Images/Admin.jpg"; return; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["Name"] == null) { Response.Redirect("../Common/LimitPop.aspx"); } else { card.CardID = Page.Request.QueryString["CardID"].ToString(); labCName.Text = CardManager.FindCardByCardID(card).CardName; string strName = Session["Name"].ToString(); if (Session["Pop"].ToString() == "用户") { user.UserName = strName; user = UserManager.findUserByUserName(user); labName.Text = strName; labEmail.Text = user.Email; labQQ.Text = user.QQ.ToString(); labIndex.Text = user.Index; imgPhoto.ImageUrl = user.Photo; return; } if (Session["Pop"].ToString() == "版主") { host.HostName = strName; host = HostManager.FindHostByHostName(host); labName.Text = strName; labEmail.Text = host.Email; labQQ.Text = host.QQ.ToString(); labIndex.Text = host.Index; imgPhoto.ImageUrl = host.Photo; return; } if (Session["Pop"].ToString() == "管理员") { labName.Text = strName; labEmail.Text = "无"; labQQ.Text = "无"; labIndex.Text = "无"; imgPhoto.ImageUrl = "../Images/Admin.jpg"; return; } } } }
protected void btnTest_Click(object sender, EventArgs e) { if (txtName.Text == string.Empty) { Response.Write("<script language=javascript>alert('版主名不能为空!')</script>"); } else { host.HostName = txtName.Text; host = HostManager.FindHostByHostName(host); if (host.HostName != null) { Response.Write("<script language=javascript>alert('该版主已经存在!')</script>"); txtName.Text = string.Empty; txtName.Focus(); } else { Response.Write("<script language=javascript>alert('您可以添加该版主!')</script>"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (txtName.Text == string.Empty) { Response.Write("<script language=javascript>alert('版主名不能为空!')</script>"); } else { host.HostName = txtName.Text; host = HostManager.FindHostByHostName(host); if (host.HostName != null) { Response.Write("<script language=javascript>alert('该版主已经存在!')</script>"); txtName.Text = string.Empty; txtName.Focus(); } else { try { module.ModuleName = ddlModule.SelectedValue; host.ModuleID = ModuleManager.findModuleByName(module).ModuleID; } catch { Response.Write("<script language=javascript>alert('请先填写版块信息!')</script>"); return; } host.HostPwd = txtPwd.Text; host.TName = txtTName.Text; if (ddlSex.SelectedIndex == 0) { host.Sex = true; } if (ddlSex.SelectedIndex == 1) { host.Sex = false; } host.Birthday = DateTime.Parse(txtBirthday.Text); host.Tel = txtTel.Text; host.Mobile = txtMobile.Text; try { host.QQ = Int32.Parse(txtQQ.Text); } catch { txtQQ.Text = string.Empty; Response.Write("<script language=javascript>alert('QQ号码输入错误!')</script>"); return; } images.PhotoID = ddlPhoto.SelectedValue; host.Photo = ImageManager.findImageByPhotoID(images).Photo; host.Email = txtEmail.Text; host.FAddress = txtHAddress.Text; host.RAddress = txtRAddress.Text; host.Index = txtIndex.Text; HostManager.addHost(host); Response.Write("<script language=javascript>alert('版主添加成功!')</script>"); txtName.Text = txtPwd.Text = txtSPwd.Text = txtTName.Text = txtBirthday.Text = txtTel.Text = txtMobile.Text = txtQQ.Text = txtEmail.Text = txtHAddress.Text = txtRAddress.Text = txtIndex.Text = string.Empty; } } }
protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (!IsPostBack) { ddlPhoto.DataSource = ImageManager.getAllPhoto(); ddlPhoto.DataTextField = "PhotoID"; ddlPhoto.DataBind(); if (Session["Pop"].ToString() == "用户") { user.UserName = Session["Name"].ToString(); user = UserManager.findUserByUserName(user); txtName.Text = user.UserName; txtPwd.Text = user.UserPwd; txtTName.Text = user.TName; if (user.Sex.ToString() == "True") { ddlSex.SelectedIndex = 0; } if (user.Sex.ToString() == "False") { ddlSex.SelectedIndex = 1; } txtBirthday.Text = user.Birthday.ToShortDateString(); txtTel.Text = user.Tel; txtMobile.Text = user.Mobile; txtQQ.Text = user.QQ.ToString(); imgPhoto.ImageUrl = user.Photo; txtEmail.Text = user.Email; txtHAddress.Text = user.FAddress; txtRAddress.Text = user.RAddress; txtIndex.Text = user.Index; return; } if (Session["Pop"].ToString() == "版主") { host.HostName = Session["Name"].ToString(); host = HostManager.FindHostByHostName(host); txtName.Text = host.HostName; txtPwd.Text = host.HostPwd; txtTName.Text = host.TName; if (host.Sex.ToString() == "True") { ddlSex.SelectedIndex = 0; } if (host.Sex.ToString() == "False") { ddlSex.SelectedIndex = 1; } txtBirthday.Text = host.Birthday.ToShortDateString(); txtTel.Text = host.Tel; txtMobile.Text = host.Mobile; txtQQ.Text = host.QQ.ToString(); imgPhoto.ImageUrl = host.Photo; txtEmail.Text = host.Email; txtHAddress.Text = host.FAddress; txtRAddress.Text = host.RAddress; txtIndex.Text = host.Index; return; } } }