public void BinInfo(int id) { Cultural.Model.Member member = new Cultural.Model.Member(); Cultural.BLL.Member bll = new Cultural.BLL.Member(); Cultural.BLL.Department dbll = new Cultural.BLL.Department(); Cultural.Model.Department dmodel = new Cultural.Model.Department(); member = bll.GetModel(id); if (member != null) { if (member.DepartID != 0 && member.DepartID != null) { dmodel = dbll.GetModel(int.Parse(member.DepartID.ToString())); } txtLoginID.Text = member.LoginID; txtPassword.Text = member.Password; txtStaffName.Text = member.MembName; ddlGender.SelectedIndex = ddlGender.Items.IndexOf(ddlGender.Items.FindByText(member.Gender)); txtPhone.Text = member.Phone; txtEmail.Text = member.Email; txtAddress.Text = member.Address; txtJob.Text = member.JobName; txtDepartID.Text = dmodel == null ? "" : dmodel.DepartName; txtResume.Text = member.Resume; ddlType.SelectedIndex = int.Parse(member.Status == "" ? "0" : member.Status == null ? "0" : member.Status); lblRegtime.Text = member.RegTime.ToString(); Photo.ImageUrl = CommonFun.URLConverToServer("../../Image/Photo/" + member.PhotoURL); } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "出错!请重试!", "../Main.aspx"); } }
protected void btnSave_Click(object sender, EventArgs e) { Cultural.Model.Member member = new Cultural.Model.Member(); Cultural.BLL.Member bll = new Cultural.BLL.Member(); try { member = bll.GetModel(int.Parse(id.Trim())); if (member != null) { member.Gender = ddlGender.SelectedItem.Text.Trim(); member.Phone = this.txtPhone.Text; member.Email = this.txtEmail.Text; member.Address = this.txtAddress.Text; member.JobName = this.txtJob.Text; member.Resume = this.txtResume.Text.Trim(); Cultural.BLL.Department dbll = new Cultural.BLL.Department(); Cultural.Model.Department depart = new Cultural.Model.Department(); List <Cultural.Model.Department> departList = dbll.GetModelList(string.Format(" DepartName = '{0}'", txtDepartID.Text.Trim())); depart = departList.Count > 0 ? departList[0] : null; int departID = 0; if (depart == null) { depart = new Cultural.Model.Department(); depart.DepartName = txtDepartID.Text.Trim(); dbll.Add(depart); departID = dbll.GetModelList(string.Format(" DepartName like '%{0}%'", txtDepartID.Text.Trim()))[0].DepartID; } else { departID = depart.DepartID; } member.DepartID = departID; member.Status = ddlType.SelectedValue; if (hidFilePath.Value != "") { member.PhotoURL = hidFilePath.Value; } bll.Update(member); Maticsoft.Common.MessageBox.Show(this.Page, "保存成功!"); BinInfo(int.Parse(id)); } } catch { Maticsoft.Common.MessageBox.Show(this.Page, "保存失败,请重试!"); } }
protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "MemDelete") { Cultural.Model.Member mem = new Cultural.Model.Member(); mem = bll.GetModel(int.Parse(e.CommandArgument.ToString())); if (Session[Common.Session_MemStatus].ToString() != "5" && mem.Status == "5") { CommonFun.Show(this.Page, "您无权删除超级管理员!"); } else { mem.Status = "7"; bll.Update(mem); BindData(); } } }
protected void btnConfirm_Click(object sender, EventArgs e) { if (Session[Common.Session_MemID] != null && Session[Common.Session_MemID].ToString() != "") { Cultural.Model.Member member = new Cultural.Model.Member(); Cultural.BLL.Member memBLL = new Cultural.BLL.Member(); member = memBLL.GetModel(Convert.ToInt32(Session[Common.Session_MemID])); if (member != null) { if (member.Password == txtOldPW.Text.Trim()) { if (txtNewPW.Text.Trim() == txtPWRe.Text.Trim()) { if (txtNewPW.Text.Trim().Length >= 3 && txtNewPW.Text.Trim().Length <= 20) { member.Password = txtNewPW.Text.Trim(); try { memBLL.Update(member); Maticsoft.Common.MessageBox.Show(this.Page, "修改成功!"); } catch { Maticsoft.Common.MessageBox.Show(this.Page, "网络出错!请重试!"); } } else { Maticsoft.Common.MessageBox.Show(this.Page, "密码长度必须为3-20位!请重试!"); } } else { Maticsoft.Common.MessageBox.Show(this.Page, "两次新密码不同!请重试!"); } } else { Maticsoft.Common.MessageBox.Show(this.Page, "旧密码错误!请重试!"); } } } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; if (id != null & id != "") { Cultural.Model.Member member = new Cultural.Model.Member(); Cultural.BLL.Member bll = new Cultural.BLL.Member(); Cultural.BLL.Department dbll = new Cultural.BLL.Department(); Cultural.Model.Department dmodel = new Cultural.Model.Department(); if (member.DepartID != 0 && member.DepartID != null) { dmodel = dbll.GetModel(int.Parse(member.DepartID.ToString())); } member = bll.GetModel(int.Parse(id.Trim())); if (member != null) { txtLoginID.Text = member.LoginID; txtPassword.Text = member.Password; txtStaffName.Text = member.MembName; lblGender.Text = member.Gender; txtPhone.Text = member.Phone; txtEmail.Text = member.Email; txtAddress.Text = member.Address; txtJob.Text = member.JobName; txtDepartID.Text = dmodel == null ? "" : dmodel.DepartName; txtResume.Text = member.Resume; ddlType.SelectedIndex = int.Parse(member.Status == "" ? "0" : member.Status == null ? "0" : member.Status); lblRegtime.Text = member.RegTime.ToString(); Photo.ImageUrl = "../../Image/Photo/" + member.PhotoURL; } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "出错!请重试!", "../Main.aspx"); } } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "出错!请重试!", "../Main.aspx"); } }
public void ProcessRequest(HttpContext context) { Cultural.BLL.Information infoBLL = new Cultural.BLL.Information(); context.Response.ContentType = "text/plain"; string paraFID = context.Request["FID"]; //读取参数PageSize if (paraFID != null && paraFID.Trim() == "NL") //列表界面 { int paraIndex = context.Request["Index"] == null ? 1 : int.Parse(context.Request["Index"]); //读取参数PageSize int paraSize = context.Request["PageSize"] == null ? 10 : int.Parse(context.Request["PageSize"]); //读取参数PageSize string paraBoardID = context.Request["BoardID"] == null ? "0" : context.Request["BoardID"].ToString(); //读取参数 NewsInfo newsInfo = new NewsInfo(); newsInfo.Info = infoBLL.DataTableToList(infoBLL.GetListByPage(string.Format(" BoardID={0} and Status!='0' ", paraBoardID), " Weight desc,PubTime desc ", (paraIndex - 1) * paraSize, paraIndex * paraSize).Tables[0]); newsInfo.TotalNum = infoBLL.GetRecordCount(string.Format(" BoardID={0} and Status!='0' ", paraBoardID)); newsInfo.BoardID = paraBoardID; for (int i = 0; i < newsInfo.Info.Count; i++) { newsInfo.Info[i].Content = newsInfo.Info[i].Content == null ? "" : Maticsoft.Common.CommonFun.ClearHtml(newsInfo.Info[i].Content).Length > 230 ? Maticsoft.Common.CommonFun.ClearHtml(newsInfo.Info[i].Content).Substring(0, 229) + "…" :CommonFun.ClearHtml(newsInfo.Info[i].Content); } context.Response.Write(JsonHelper.Serialize(newsInfo)); } else if (paraFID != null && paraFID.Trim() == "ND") //详细界面 { int paraID = context.Request["InfoID"] == null ? 1 : int.Parse(context.Request["InfoID"]); //读取参数PageSize if (paraID != null && paraID.ToString().Trim() != "") { Cultural.Model.Information info = new Cultural.Model.Information(); info = infoBLL.GetModel(paraID); NewsInfo newsInfo = new NewsInfo(); newsInfo.Info = new List <Cultural.Model.Information>(); if (info != null) { newsInfo.Info.Add(info); //阅读次数更新 info.ReadNum += 1; infoBLL.Update(info); Cultural.BLL.Member memBll = new Cultural.BLL.Member(); newsInfo.Author = memBll.GetModel(int.Parse(info.Author.ToString().Trim())).MembName; Cultural.BLL.Board boardBll = new Cultural.BLL.Board(); Cultural.Model.Board board = new Cultural.Model.Board(); board = boardBll.GetModel(int.Parse(info.BoardID.ToString())); if (board != null && board.ParentID == 0) { newsInfo.BoardID = board.BoardID.ToString(); newsInfo.BoardName = board.BoardName; newsInfo.BName = ""; } else if (board != null && board.ParentID != 0) { Cultural.Model.Board board2 = new Cultural.Model.Board(); board2 = boardBll.GetModel(int.Parse(board.ParentID.ToString())); if (board2 != null) { newsInfo.BoardID = board2.BoardID.ToString(); newsInfo.BoardName = board2.BoardName; newsInfo.BName = board.BoardName; } else { newsInfo.BoardID = board.BoardID.ToString(); newsInfo.BoardName = board.BoardName; newsInfo.BName = ""; } } else { newsInfo.BoardID = board.BoardID.ToString(); newsInfo.BoardName = board.BoardName; newsInfo.BName = ""; } } context.Response.Write(JsonHelper.Serialize(newsInfo)); } else { context.Response.Write(JsonHelper.Serialize("error")); } } else if (paraFID != null && paraFID.Trim() == "CND") //中心概括界面 邹瑶修改20140225 { int paraID = context.Request["InfoID"] == null ? 1 : int.Parse(context.Request["InfoID"]); //读取参数PageSize NewsInfo newsInfo = new NewsInfo(); if (paraID != null && paraID.ToString().Trim() != "") { newsInfo.Info = infoBLL.GetModelList(string.Format(" BoardID ={0} and Status!='0' order by Weight desc,PubTime desc ", paraID)); } context.Response.Write(JsonHelper.Serialize(newsInfo)); } else { context.Response.Write(JsonHelper.Serialize("error")); } }