protected void New_Click(object sender, EventArgs e) { string uid = TextBox3.Text; string pwd = TextBox2.Text; string pri = inputState1.Items[inputState1.SelectedIndex].Text; Admin a = new Admin(); a.Id = uid; a.Password = pwd; if (pri == "普通用户") { a.Privilege = 0; } else if (pri == "超级管理员") { a.Privilege = 1; } if (AdminBLL.Add(a)) { Response.Redirect("/WebReturn/UserNew_Return.aspx"); } else { Response.Write("<script>alert('添加失败,该用户已存在');history.back();</script>"); } }
protected void Zhuce_Click(object sender, EventArgs e) { Student stu = new Student(); if (!HeFaXingJianCe()) { HeFa.Text = "该ID非法"; return; } setInFor(stu); Admin a = new Admin(); a.Id = Xuehao.Text; a.Password = "******"; a.Privilege = 0; AdminBLL.Add(a); bool bo = StudentBLL.Add(stu); SystemLog sl = new SystemLog(System.Environment.UserName, "AddStudent", "successed", Page.Request.UserHostAddress); BLLSaveLog.AddSL(sl); if (stu.Main) { YiChang.Text = "赋值成功"; } else { YiChang.Text = bo.ToString(); } //YiChang.Text = bo.ToString(); Response.Redirect("StuInforShow.aspx?id=" + stu.Id); }
protected void New_Click(object sender, EventArgs e) { Student stu = new Student(); if (!HeFaXingJianCe()) { HeFa.Text = " 该学号已存在!"; } setInFor(stu); Admin a = new Admin(); a.Id = Xuehao.Text; a.Password = "******"; a.Privilege = 0; AdminBLL.Add(a); bool bo = StudentBLL.Add(stu); if (stu.Main) { Jianche.Text = "录入成功"; } else { Jianche.Text = bo.ToString(); } }
public ActionResult Register(AdminLogIn adminLogin) { var isSave = _adminBll.Add(adminLogin); if (isSave) { return(RedirectToAction("Login")); } return(View()); }
protected void SubmitButton_Click(object sender, EventArgs e) { AdminInfo admin = new AdminInfo(); admin.Id = RequestHelper.GetQueryString <int>("ID"); if (admin.Id > 0) { admin = AdminBLL.Read(admin.Id); } admin.Name = Name.Text; var _admin = AdminBLL.Read(admin.Name); if ((admin.Id > 0 && _admin.Id != admin.Id) || (admin.Id <= 0 && _admin.Id > 0)) { ScriptHelper.Alert("管理员名已存在,请重新输入"); } else { admin.Email = Email.Text; if (!AdminBLL.UniqueEmail(admin.Email, admin.Id)) { ScriptHelper.Alert("邮箱已存在,请重新输入"); } else { admin.GroupId = Convert.ToInt32(GroupID.Text); admin.Password = StringHelper.Password(Password.Text, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); admin.LastLoginDate = RequestHelper.DateNow; admin.LastLoginIP = ClientHelper.IP; admin.IsCreate = 0; admin.NoteBook = NoteBook.Text; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (admin.Id == int.MinValue) { CheckAdminPower("AddAdmin", PowerCheckType.Single); admin.Status = (int)BoolType.True; admin.FindDate = DateTime.Now; int id = AdminBLL.Add(admin); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Admin"), id); } else { CheckAdminPower("UpdateAdmin", PowerCheckType.Single); admin.Status = Convert.ToInt32(Status.Text); AdminBLL.Update(admin); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Admin"), admin.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); } } }
protected void Button1_Click(object sender, EventArgs e) { string uid = TextBox1.Text; string pwd = TextBox2.Text; int pri = 0; Admin a = new Admin(); a.Id = uid; a.Password = pwd; a.Privilege = pri; if (AdminBLL.Add(a)) { SystemLog sl = new SystemLog(System.Environment.UserName, "AddAdmin", "successed", Page.Request.UserHostAddress); BLLSaveLog.AddSL(sl); Response.Redirect("AdminList.aspx"); } else { SystemLog sl = new SystemLog(System.Environment.UserName, "AddAdmin", "failed", Page.Request.UserHostAddress); BLLSaveLog.AddSL(sl); Response.Write("<script>alert('添加错误');history.back();</script>"); } }