protected void Bind() { Model.Admin admin1 = new Model.Admin(); BLL.AdminManager admin2 = new BLL.AdminManager(); GridView1.DataSource = admin2.GetList(); GridView1.DataBind(); }
protected void GetLoginName() { BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["NadminID"].ToString()); LabelUser.Text = admin1.adminName; }
protected void Btn_Register_Click(object sender, EventArgs e) { Model.Admin admin = new Model.Admin(); admin.adminName = txbUserName.Text; admin.adminPassword = txbPassword1.Text; admin.department = txbDepartment.Text; admin.job = txbJob.Text; admin.permission = "0"; BLL.AdminManager admin1 = new BLL.AdminManager(); bool bo = admin1.Add(admin); if (bo == true) { string str = "adminname='" + txbUserName.Text.Trim() + "'"; DataSet ds = admin1.GetList(str); Session["NadminID"] = ds.Tables[0].Rows[0]["adminID"].ToString(); Session["NadminName"] = txbUserName.Text.Trim(); Response.Redirect("~/N_Admin/Apply_Permission.aspx"); } else { Response.Write("<script language=javascript>alert('申请失败!请重试')"); } }
protected void UpdateFeedback(object sender, EventArgs e) { Model.Distribution distribution = new Model.Distribution(); BLL.DistributionManager manager = new DistributionManager(); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["SadminID"].ToString()); string handlers = DropDownList_Distribution.SelectedItem.Text; Model.Feedback feedback = new Model.Feedback(); BLL.FeedbackManager Fmanager = new FeedbackManager(); feedback.feedbackID = Convert.ToInt32(Labeltest.Text.Trim()); feedback.handler = handlers; string Str1 = "handler='" + handlers + "'"; string Str2 = "feedbackID='" + Labeltest.Text.Trim() + "'"; bool bo2 = Fmanager.UpdateHandler(Str1, Str2); if (bo2 == true) { Response.Write("<script language=javascript>alert('修改成功!')</script>"); BindY(); BindN(); } }
protected void Btn_Solve_Click(object sender, EventArgs e) { string state = "1"; string idList = GetSelIDList(); if (idList.Trim().Length == 0) { return; } BLL.DistributionManager manager = new BLL.DistributionManager(); manager.UpdateList(state, idList); Response.Write("<script language=javascript>alert('标记成功!')</script>"); NewBind(); HisBind(); Model.Feedback feedback = new Model.Feedback(); BLL.FeedbackManager Fmanager = new FeedbackManager(); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["GadminID"].ToString()); int ID = Convert.ToInt32(admin1.adminID); string Str1 = "solutionState='" + state + "'"; string Str2 = "adminID='" + ID + "' and state = '" + state + "'"; Fmanager.UpdateSolution(Str1, Str2); }
protected void BntReply_Click(object sender, EventArgs e) { Model.Reply reply = new Model.Reply(); BLL.ReplyManager replyManager = new ReplyManager(); Model.Reply reply1 = new Model.Reply(); BLL.ReplyManager replyManager1 = new ReplyManager(); string str = "replyID='" + Labeltest.Text + "'"; string id = replyManager1.GetUserID(str); string str1 = "replyID='" + Labeltest.Text + "'"; string replyFB = replyManager1.GetFBID(str); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["SadminID"].ToString()); int s = Convert.ToInt32(admin1.adminID); reply.feedbackID = Convert.ToInt32(replyFB); reply.text = txtReply.Text; reply.replierID = s; reply.receiverID = Convert.ToInt32(id); bool bo = replyManager.Add(reply); if (bo == true) { Response.Write("<script language=javascript>alert('回复成功!')</script>"); } else { Response.Write("<script language=javascript>alert('回复失败!请重试')"); } }
protected void Btn_Distribution_Click(object sender, EventArgs e) { Model.Distribution distribution = new Model.Distribution(); BLL.DistributionManager manager = new DistributionManager(); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["SadminID"].ToString()); int s = Convert.ToInt32(admin1.adminID); distribution.feedbackID = Convert.ToInt32(Labeltest.Text); distribution.description = txtDistribution.Text.Trim(); distribution.adminID = Convert.ToInt32(DropDownList_Distribution.SelectedValue.ToString()); distribution.assignerID = s; distribution.state = "待处理"; bool bo = manager.Add(distribution); if (bo == true) { Response.Write("<script language=javascript>alert('分配成功!')</script>"); txtDistribution.Text = ""; DropDownList_Distribution.SelectedIndex = 0; UpdateFeedback(sender, e); BindY(); BindN(); } else { Response.Write("<script language=javascript>alert('分配失败!请重试')"); } }
protected void BntReply_Click(object sender, EventArgs e) { Model.Reply reply = new Model.Reply(); BLL.ReplyManager replyManager = new ReplyManager(); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["SadminID"].ToString()); int s = Convert.ToInt32(admin1.adminID); reply.feedbackID = Convert.ToInt32(Labeltest.Text); reply.text = txtReply.Text; reply.replierID = s; reply.remark = "1"; reply.receiverID = Convert.ToInt32(LabelName.Text.Trim()); bool bo = replyManager.Add(reply); if (bo == true) { Response.Write("<script language=javascript>alert('回复成功!')</script>"); txtReply.Text = ""; } else { Response.Write("<script language=javascript>alert('回复失败!请重试')"); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Model.Admin admin1 = new Model.Admin(); BLL.AdminManager admin2 = new BLL.AdminManager(); int adminID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelID") as Label).Text); bool bo = admin2.Delete(adminID); if (bo == true) { Bind(); } }
protected void GetMessage() { BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["NadminID"].ToString()); LabelUser.Text = admin1.adminName; txtID.Text = Convert.ToString(admin1.adminID); txtName.Text = admin1.adminName; txtDepartment.Text = admin1.department; txtJob.Text = admin1.job; }
protected void NewBind() { Model.Distribution distribution = new Model.Distribution(); BLL.DistributionManager manager = new BLL.DistributionManager(); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["GadminID"].ToString()); int ID = Convert.ToInt32(admin1.adminID); string Str = " adminID='" + ID + "'and state != '" + "1" + "'"; GridView1.DataSource = manager.GetList(Str); GridView1.DataBind(); }
protected void ReplyNumber() { Model.Reply reply1 = new Model.Reply(); BLL.ReplyManager replyManager1 = new ReplyManager(); BLL.AdminManager adminManager = new BLL.AdminManager(); Model.Admin admin = adminManager.GetModel1(Session["SadminID"].ToString()); int s = Convert.ToInt32(admin.adminID); string str = "0"; int id = s; replyManager1.UpdateState(str, s); LabelApply.Text = "0"; LabelApply.Visible = false; }
protected void Bind() { BLL.AdminManager adminManager = new BLL.AdminManager(); Model.Admin admin = adminManager.GetModel1(Session["SadminID"].ToString()); int ID = Convert.ToInt32(admin.adminID); Model.Reply reply = new Model.Reply(); BLL.ReplyManager replyManager = new BLL.ReplyManager(); string Str = " receiverID='" + ID + "'"; GridView1.DataSource = replyManager.GetFBList(Str); GridView1.DataBind(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Model.Admin admin1 = new Model.Admin(); BLL.AdminManager admin2 = new BLL.AdminManager(); admin1.ID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("Label1") as Label).Text); admin1.adminName = (GridView1.Rows[e.RowIndex].FindControl("TextBox1") as TextBox).Text.ToString(); admin1.department = (GridView1.Rows[e.RowIndex].FindControl("TextBox2") as TextBox).Text.ToString(); bool bo = admin2.Update(admin1); GridView1.EditIndex = -1; Bind(); }
protected void Btn_Register_Click(object sender, EventArgs e) { Model.Apply_Message apply_Message = new Model.Apply_Message(); apply_Message.name = txbUserName.Text; apply_Message.department = txbDepartment.Text; apply_Message.job = txbJob.Text; apply_Message.permission = DropDownListPermission.SelectedItem.Text; apply_Message.isRead = "0"; Model.Admin admin = new Model.Admin(); admin.adminName = txbUserName.Text; admin.adminPassword = txbPassword1.Text; admin.department = txbDepartment.Text; admin.job = txbJob.Text; admin.permission = DropDownListPermission.SelectedItem.Text; BLL.AdminManager admin1 = new BLL.AdminManager(); bool bo1 = admin1.Add(admin); BLL.Apply_MessageManager apply_Message1 = new BLL.Apply_MessageManager(); bool bo = apply_Message1.Add(apply_Message); if ((bo == true) && (bo1 == true)) { Response.Write("<script language=javascript>alert('申请成功!请耐心等待管理员同意')</script>"); } else { Response.Write("<script language=javascript>alert('申请失败!请重试')"); } //Model.Users users = new Model.Users(); //users.userName = txbUserName.Text; //users.password = txbPassword1.Text; //users.gender = DropDownList1.SelectedItem.Text; //string date = DropDownListYear.SelectedItem.Text.Trim().ToString() + "/" + DropDownListMonth.SelectedItem.Text.Trim().ToString() + "/" + DropDownListDay.SelectedItem.Text.Trim().ToString(); //DateTime time = Convert.ToDateTime(date); //users.birthDate = time; //BLL.UsersManager users1 = new UsersManager(); //bool bo = users1.Add(users); //if (bo == true) //{ // Response.Redirect("~/Default.aspx"); //} //else //{ // Response.Write("<script language=javascript>alert('注册失败!')"); //} }
/// <summary> /// 登录 /// </summary> /// <param name="context"></param> private void Login(HttpContext context) { BLL.AdminManager bll = new BLL.AdminManager(); string userName = context.Request["txtName"]; string userPwd = context.Request["txtPwd"]; Model.Admin admin = null; string msg = string.Empty; if (bll.Login(userName, userPwd, out msg, out admin)) { context.Session["admin"] = admin; } context.Response.Write(msg); }
protected void ReplyNumber() { Model.Reply reply = new Model.Reply(); BLL.ReplyManager replyManager = new ReplyManager(); BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["SadminID"].ToString()); int s = Convert.ToInt32(admin1.adminID); string str = "remark='" + "1" + "'and receiverID='" + s + "'"; int number = replyManager.GetRecordCount(str); if (number > 0) { LabelMessage.Visible = true; LabelMessage.Text = Convert.ToString(number); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //Model.Question question1 = new Model.Question(); //BLL.QuestionManager question2 = new BLL.QuestionManager(); //question1.questionID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelquestionID") as Label).Text); //question1.question = (GridView1.Rows[e.RowIndex].FindControl("txbQuestion") as TextBox).Text.ToString(); //question1.solution = (GridView1.Rows[e.RowIndex].FindControl("txbSolution") as TextBox).Text.ToString(); //bool bo = question2.Update(question1); //GridView1.EditIndex = -1; //Bind(); Model.Admin admin1 = new Model.Admin(); BLL.AdminManager admin2 = new BLL.AdminManager(); admin1.ID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelID") as Label).Text); // admin1.permission = (GridView1.DataKeys[e.RowIndex].Values[3].ToString()); admin1.permission = (GridView1.Rows[e.RowIndex].FindControl("txbpermission") as TextBox).Text.ToString(); bool bo = admin2.Update(admin1); GridView1.EditIndex = -1; Bind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Model.Admin admin1 = new Model.Admin(); BLL.AdminManager admin2 = new BLL.AdminManager(); int adminID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("Label1") as Label).Text); bool bo = admin2.Delete(adminID); if (bo == true) { Bind(); } // Model.Users users = new Model.Users(); //BLL.UsersManager users1 = new UsersManager(); //bool bo = users1.Add(users); //if (bo == true) //{ // Response.Redirect("~/Default.aspx"); //} }
protected void Btn_Login_Click(object sender, EventArgs e) { BLL.AdminManager adminManager = new BLL.AdminManager(); string Str1 = "adminname='" + txbUserName.Text.Trim() + "'and adminpassword='******'and permission='" + 1 + "'"; DataSet ds1 = adminManager.GetList(Str1); string Str2 = "adminname='" + txbUserName.Text.Trim() + "'and adminpassword='******'and permission='" + 2 + "'"; DataSet ds2 = adminManager.GetList(Str2); string Str0 = "adminname='" + txbUserName.Text.Trim() + "'and adminpassword='******'and permission='" + 0 + "'"; DataSet ds0 = adminManager.GetList(Str0); if (ds1.Tables[0].Rows.Count > 0) { Session["SadminName"] = txbUserName.Text.Trim(); Session["SadminID"] = ds1.Tables[0].Rows[0]["adminID"].ToString(); Response.Redirect("~/S_Admin_List/List.aspx"); return; } else if (ds2.Tables[0].Rows.Count > 0) { Session["GadminName"] = txbUserName.Text.Trim(); Session["GadminID"] = ds2.Tables[0].Rows[0]["adminID"].ToString(); Response.Redirect("~/G_Admin_List/G_List.aspx"); return; } else if (ds0.Tables[0].Rows.Count > 0) { Session["NadminName"] = txbUserName.Text.Trim(); Session["NadminID"] = ds0.Tables[0].Rows[0]["adminID"].ToString(); Response.Redirect("~/N_Admin/Apply_Permission.aspx"); return; } else { Response.Write("<script language=javascript>alert('用户名不存在或密码错误!');location.href='AdminLogin.aspx'</script>"); Response.End(); } }
protected void Button_submit_Click(object sender, EventArgs e) { //string AdminName = txbUserName.Text.Trim(); //string AdminPassword =txbPassword.Text; //BLL.AdminManager adminManager = new BLL.AdminManager(); //Model.Admin admin = adminManager.Exists(AdminName,ID); //BLL.AdminManager blladminManager = new BLL.AdminManager(); //string strWhere = "adminname'" + txbUserName.Text.Trim() + "'and adminpassword='******'"; //DataSet da = blladminManager.GetList(strWhere); //if (da.Tables[0].Rows.Count > 0) //{ // Session["adminname"] = txbUserName.Text.Trim(); // Session["adminpassword"] = da.Tables[0].Rows[0]["id"].ToString(); ; // Response.Redirect("~/Default.aspx"); // return; //} //else //{ // Response.Write("<script language=javascript>alert('用户名不存在或密码错误!');location.href='Login.aspx'</script>"); // Response.End(); //} BLL.AdminManager adminManager = new BLL.AdminManager(); string Str = "adminname'" + txbUserName.Text.Trim() + "'and adminpassword='******'"; DataSet ds = adminManager.GetList(Str); if (ds.Tables[0].Rows.Count > 0) { Session["adminname"] = txbUserName.Text.Trim(); Session["adminpassword"] = ds.Tables[0].Rows[0]["id"].ToString(); Response.Redirect("~/Default.aspx"); return; } else { Response.Write("<script language=javascript>alert('用户名不存在或密码错误!');location.href='Login.aspx'</script>"); Response.End(); } }
protected void btn_Dealwith_Click(object sender, EventArgs e) { string solution = "1"; string idList = GetSelIDList(); if (idList.Trim().Length == 0) { return; } BLL.AdminManager adminManager1 = new BLL.AdminManager(); Model.Admin admin1 = adminManager1.GetModel1(Session["SadminID"].ToString()); string name = Convert.ToString(admin1.adminName); Model.Feedback feedback = new Model.Feedback(); BLL.FeedbackManager Fmanager = new FeedbackManager(); string Str1 = "solutionState='" + solution + "' , handler = '" + name + "'"; string Str2 = "feedbackID in(" + idList + ")"; Fmanager.UpdateSolution(Str1, Str2); Response.Write("<script language=javascript>alert('已标记为已处理!')</script>"); BindY(); BindN(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; BLL.AdminManager bll = new BLL.AdminManager(); string action = context.Request["action"]; // 获取分页 if (action == "get") { int pageIndex, pageSize; try { pageIndex = Convert.ToInt32(context.Request["pageIndex"]); pageSize = Convert.ToInt32(context.Request["pageSize"]); } catch { return; } pageIndex = pageIndex < 1 ? 1 : pageIndex; pageSize = pageSize <= 0 || pageSize > 10 ? 10 : pageSize; int pageCount = (int)Math.Ceiling((double)bll.GetModelCount() / (double)pageSize); List <Model.Admin> list = bll.GetPageList(pageIndex, pageSize); object obj = new { pageIndex, pageSize, pageCount, data = list, }; JavaScriptSerializer js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(obj)); } //获得一个 else if (action == "getById") { int id = 0; if (!int.TryParse(context.Request["id"], out id)) { context.Response.Write("error:非法的ID"); return; } var admin = bll.GetModel(id); if (admin == null) { context.Response.Write("no:该用户不存在"); return; } JavaScriptSerializer js = new JavaScriptSerializer(); context.Response.Write("ok:" + js.Serialize(admin)); } // 删除 else if (action == "delete") { int id = 0; if (!int.TryParse(context.Request["id"], out id)) { context.Response.Write("error:非法的ID"); return; } if (bll.Delete(id)) { context.Response.Write("ok:删除成功"); } else { context.Response.Write("no:删除失败"); } } // 修改 else if (action == "edit") { int id = 0; string adminName = context.Request["adminName"]; string pwd = context.Request["pwd"]; if (!int.TryParse(context.Request["id"], out id)) { context.Response.Write("error:非法的ID"); return; } Model.Admin admin = bll.GetModel(id); if (admin == null) { context.Response.Write("no:该用户不存在"); return; } admin.AdminName = adminName; if (!string.IsNullOrWhiteSpace(pwd)) { admin.Pwd = pwd; } if (bll.Update(admin)) { context.Response.Write("ok:修改成功"); } else { context.Response.Write("no:修改失败"); } } // 添加 else if (action == "add") { Model.Admin admin = new Model.Admin { AdminName = context.Request["adminName"], Pwd = context.Request["pwd"] }; if (bll.Add(admin)) { context.Response.Write("ok:添加成功"); } else { context.Response.Write("no:添加失败"); } } else { context.Response.Write("error:非法的action"); } }