protected void Page_Load(object sender, EventArgs e) { Cultural.BLL.Member staffService = new Cultural.BLL.Member(); string loginuser = this.Request["u"].Trim(); string password = this.Request["p"].Trim(); String where = " LoginID='{0}' and Password='******'"; where = string.Format(where, loginuser, password); DataSet StaffData = staffService.GetList(where); if (StaffData != null && StaffData.Tables[0].Rows.Count > 0) { Cultural.Model.Member staff = new Cultural.Model.Member(); Session.Add("MemberID", StaffData.Tables[0].Rows[0]["MemberID"].ToString().Trim()); Session.Add("LoginID", StaffData.Tables[0].Rows[0]["LoginID"].ToString().Trim()); Session.Add("MembName", StaffData.Tables[0].Rows[0]["MembName"].ToString().Trim()); Session.Add("Status", StaffData.Tables[0].Rows[0]["Status"].ToString().Trim()); Response.Redirect("Main.aspx"); } else { //this.Response.Write("用户名或密码错误!登陆失败"); Response.Redirect("login.aspx?fg=0"); } }
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"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request["MemName"]; Cultural.BLL.Member bll = new Cultural.BLL.Member(); if (name.Trim().Length < 3 || name.Trim().Length > 20 || bll.GetList(string.Format(" LoginID = '{0}' ", name)).Tables[0].Rows.Count > 0) { context.Response.Write("Exist"); } else { context.Response.Write("None"); } }
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 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"); } }
protected void btnSave_Click(object sender, EventArgs e) { Cultural.BLL.Member bll = new Cultural.BLL.Member(); string strErr = ""; if (this.txtStaffName.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (this.txtLoginID.Text.Trim().Length == 0) { strErr += "注册名不能为空!\\n"; } if (this.txtPassword.Text.Trim().Length == 0) { strErr += "密码不能为空!\\n"; } if (this.txtPassConfirm.Text.Trim().Length == 0) { strErr += "必须确认密码!\\n"; } if (this.txtPassConfirm.Text.Trim() != this.txtPassword.Text.Trim()) { strErr += "两次密码不同!\\n"; } if (bll.GetList(string.Format(" LoginID = '{0}' ", txtLoginID.Text.Trim())).Tables[0].Rows.Count > 0) { strErr += "登录名已被使用!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string LoginID = this.txtLoginID.Text; string Password = this.txtPassword.Text; string StaffName = this.txtStaffName.Text; string Gender = ddlGender.SelectedItem.Text.Trim(); string Phone = this.txtPhone.Text; string Email = this.txtEmail.Text; string Address = this.txtAddress.Text; string Job = this.txtJob.Text; string 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.GetMaxId() - 1; } else { departID = depart.DepartID; } Cultural.Model.Member member = new Cultural.Model.Member(); member.LoginID = LoginID; member.Password = Password; member.MembName = StaffName; member.Gender = Gender; member.Phone = Phone; member.Email = Email; member.Address = Address; member.JobName = Job; member.DepartID = departID; member.RegTime = string.Format("{0}-{1}-{2}", DateTime.Now.Year, DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0')); member.Status = "6"; member.PhotoURL = ""; member.Resume = resume; bll.Add(member); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "注册成功,请等待管理员审核!", "../login.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")); } }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtStaffName.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string LoginID = this.txtLoginID.Text; string Password = this.txtPassword.Text; string StaffName = this.txtStaffName.Text; string Gender = ddlGender.SelectedItem.Text.Trim(); string Phone = this.txtPhone.Text; string Email = this.txtEmail.Text; string Address = this.txtAddress.Text; string Job = this.txtJob.Text; string 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.GetMaxId() - 1; } else { departID = depart.DepartID; } string Roles = ddlType.SelectedItem.Value.Trim(); Cultural.Model.Member member = new Cultural.Model.Member(); member.LoginID = LoginID; member.Password = Password; member.MembName = StaffName; member.Gender = Gender; member.Phone = Phone; member.Email = Email; member.Address = Address; member.JobName = Job; member.DepartID = departID; member.RegTime = string.Format("{0}-{1}-{2}", DateTime.Now.Year, DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0')); member.Status = Roles; member.PhotoURL = string.Format("{0}-{1}.jpg", member.RegTime, member.MembName); member.Resume = resume; Cultural.BLL.Member bll = new Cultural.BLL.Member(); bll.Add(member); int id = bll.GetMaxId() - 1; if (id != null) { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "ShowSingle.aspx?id=" + id.ToString()); } }