private static async Task SeedAdminUsersAsync(IServiceProvider serviceProvider) { const string adminUserEmail = "*****@*****.**"; const string roleName = "Administrator"; var userManager = serviceProvider.GetRequiredService<UserManager<AdminUser>>(); var roleManager = serviceProvider.GetRequiredService<RoleManager<AdminRole>>(); if (!await roleManager.RoleExistsAsync(roleName)) { var adminRole = new AdminRole(roleName); await roleManager.CreateAsync(adminRole); await roleManager.AddClaimAsync(adminRole, new Claim("ManageRole", "Allowed")); } var user = await userManager.FindByEmailAsync(adminUserEmail); if (user == null) { user = new AdminUser { UserName = adminUserEmail, Email = adminUserEmail }; await userManager.CreateAsync(user, "!QAZ2wsx"); await userManager.AddToRoleAsync(user, roleName); await userManager.AddClaimAsync(user, new Claim("ManageStore", "Allowed")); } }
protected void BtnLogin_Click(object sender, EventArgs e) { string username = txtName.Text.Trim().ToLower(); string password = txtPwd.Text.Trim().ToLower(); AdminUser adminUser = new AdminUser(); adminUser.UserNm = username; adminUser.UserPw = password; AdminUserBLL adminBll = new AdminUserBLL (); if (adminBll.CheckLogin(adminUser)) { if (!txtValidate.Text.ToUpper().Equals(Session["CheckCode"].ToString())) { MessageBox.ShowAndRedirect(this, "您输入的验证码有误,请重新输入!", "Login.aspx"); return; } /*设置session变量username为用户名*/ Session["username"] = username; Session["usertype"] = "S"; Response.Redirect("~/System/EnterpriseUserList.aspx"); } else { MessageBox.ShowAndRedirect(this, "您输入的用户名称或者密码有误,请重新输入!", "Login.aspx"); } }
private void BindList() { IList<AdminUserInfo> list = new AdminUser().GetList(20, 0); AdminUserInfo aInfo = new AdminUserInfo(); aInfo.Time = DateTime.Now; list.Add(aInfo); gvUserList.DataSource = list; gvUserList.DataBind(); }
public Entity.Booking[] Select_Booking(string p_Search_Content, int p_Search_Method, int p_Search_State, int p_PageSize, int p_PageIndex) { switch (p_Search_Method) { case 6: { BLL.AdminUser b_AdminUser = new AdminUser(); Entity.AdminUser o_AdminUser = b_AdminUser.Select_AdminUser(1, p_Search_Content); if (o_AdminUser != null) { p_Search_Content = o_AdminUser.AdminUser_ID.ToString(); p_Search_Method = 6; } else return null; } break; case 7: { BLL.AdminUser b_AdminUser = new AdminUser(); Entity.AdminUser o_AdminUser = b_AdminUser.Select_AdminUser(2, p_Search_Content); if (o_AdminUser != null) { p_Search_Content = o_AdminUser.AdminUser_ID.ToString(); p_Search_Method = 7; } else return null; } break; default: break; } DataTable o_DataTable = d_Booking.Select_Booking(p_Search_Content, p_Search_Method, p_Search_State, p_PageSize, p_PageIndex, ref g_TotalCount, ref g_TotalPage); if (o_DataTable == null) return null; else { Entity.Booking[] e_Booking = new Entity.Booking[o_DataTable.Rows.Count]; int i = 0; foreach (DataRow o_DataRow in o_DataTable.Rows) { e_Booking[i] = new Entity.Booking(); DateRow_Booking(o_DataRow, e_Booking[i]); i++; } return e_Booking; } }
public ActionResult UpdateDo(AdminUser User) { AdminUserBLL bll = new AdminUserBLL(); if (User.Password == null) { User.Password = bll.Get(User.ID).Password; } else { User.Password = Des.GetMD5String(User.Password); } bll.Update(User); return RedirectToAction("UserList", "AdminUser"); }
public static bool CheckLogin(AdminUser adminUser) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from ExamDB.dbo.tb_AdminUsers"); strSql.Append(" where users_name=@userName and users_password=@userPassword"); SqlParameter[] parameters = {new SqlParameter("@userName", SqlDbType.VarChar,255), new SqlParameter("@userPassword",SqlDbType.VarChar,255)}; parameters[0].Value = adminUser.UserNm ; parameters[1].Value = Encrypt(adminUser.UserPw); return DbHelperSQL.Exists(strSql.ToString(), parameters); }
private async Task LoadSharedKeyAndQrCodeUriAsync(AdminUser user) { // Load the authenticator key & QR code URI to display on the form var unformattedKey = await _userManager.GetAuthenticatorKeyAsync(user); if (string.IsNullOrEmpty(unformattedKey)) { await _userManager.ResetAuthenticatorKeyAsync(user); unformattedKey = await _userManager.GetAuthenticatorKeyAsync(user); } SharedKey = FormatKey(unformattedKey); var email = await _userManager.GetEmailAsync(user); AuthenticatorUri = GenerateQrCodeUri(email, unformattedKey); }
public static bool Login(string loginName, string pwd) { AdminUser adminUser = AdminUserRep.Login(loginName, pwd); if (adminUser == null) { return(false); } HttpContext.Current.Session["SyUserInfo"] = adminUser; HttpCookie cookie = new HttpCookie("SyUserInfo"); cookie.HttpOnly = true; cookie.Values.Add("LoginName", AesHelper.Encrypt(adminUser.UserName)); cookie.Values.Add("Password", AesHelper.Encrypt(adminUser.UserPwd)); HttpContext.Current.Response.Cookies.Add(cookie); return(true); }
public ActionResult Edit(int id, AdminUser adminUser) { try { var eUser = entityContext.adminUser.FirstOrDefault(q => q.Id == id); eUser.Name = adminUser.Name; eUser.Email = adminUser.Email; eUser.PhoneNumber = adminUser.PhoneNumber; entityContext.Entry(eUser).State = EntityState.Modified; entityContext.adminUser.AddOrUpdate(eUser); // TODO: Add update logic here entityContext.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void SendProfileRequestEmail(string username, Person person) { AdminUser user = this.userTasks.GetAdminUser(username); if (user != null && person != null) { string subject = "Notification - Profile Requested through Integrated Profiling and Conditionality System"; string body = "A user (" + username + ") has requested the following profile." + "<br /><br />Person ID: " + person.Id.ToString() + "<br />Person Name: <a href='" + APPLICATION_URL + "Profiling/Persons/Details/" + person.Id.ToString() + "'>" + person.Name + "</a>"; // do we need a new permission here? this.SendMailMessage(this.userTasks.GetUsersWithPermission(AdminPermission.CanApproveAndRejectSources), user, subject, body, true); } }
private void onLogin(object sender, RoutedEventArgs e) { AdminUser user = UserQuery.login(emailField.Text, passwordField.Password); if (user != null) { Console.WriteLine("Hello " + user.getFirstname() + " " + user.getLastname()); Main main = new Main(user); main.Show(); Close(); } else { emailField.Text = ""; passwordField.Password = ""; Console.WriteLine("Wrong username or password."); } }
public async Task <ActionResult> Index(AdminUser users) { _logger.LogInformation("查询管理员:UserName="******"AdminUser", recvUser[0].UserName); //缓存当前登录用户 HttpContext.Session.SetString("AdminUserId", recvUser[0].AdminUserId.ToString()); //缓存当前登录用户Id return(RedirectToAction("Index", "Home")); } } return(View()); //return View(await _context.AdminUser.ToListAsync()); }
public ActionResult Index(LoginVM model) { AdminUser user = rpadminuser.FirstOrDefault(x => (x.Email == model.Email || x.UserName == model.Email) && x.Password == model.Password); if (user != null) { user.LastLoginDate = DateTime.Now; rpadminuser.SaveChanges(); FormsAuthentication.SetAuthCookie(user.Email, true); string controller = user.Roles.Split(';').Contains("1") ? "AdminHome" : "AdminSale"; return(RedirectToAction("Index", controller)); } else { ViewBag.IslemDurum = EnumIslemDurum.ParolaYanlis; return(View()); } }
public async Task ResetDb() { var db = Resolve <MusicDbContext>(); await db.Database.EnsureDeletedAsync(); await db.Database.EnsureCreatedAsync(); var user = new AdminUser { Email = "*****@*****.**", }; await Persist(ops => { ops.Add(user); }); }
public ActionResult Login(AdminUser adminuser) { HospitalContext db = new HospitalContext(); var count = db.AdminUsers.Where(u => u.Username == adminuser.Username && u.Password == adminuser.Password).Count(); if (count == 0) { ViewBag.Message = "Invalid User"; return(View()); } else { FormsAuthentication.SetAuthCookie(adminuser.Username, false); return(RedirectToAction("Index", "News")); //hey josh. You just have to create a view for this now. Slide 25/36. You're doing great man! } }
public ActionResult Login([FromBody] AdminUser user) { if (ModelState.IsValid) { using (TestAmbEntity entity = new TestAmbEntity()) { var obj = entity.AdminUsers.Where(a => a.Username.Equals(user.Username) && a.Password.Equals(user.Password)); var x = obj.FirstOrDefault(); if (x != null) { Session["username"] = x.Username; Session["userid"] = x.UserId; return(RedirectToAction("Index", "DashBoard")); } } } return(View("index")); }
// GET: AdminInfoes/Delete/5 public ActionResult Delete(int?id) { if (Session["AdminLogin"].ToString() != "") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AdminUser adminInfo = db.AdminUsers.Find(id); if (adminInfo == null) { return(HttpNotFound()); } return(View(adminInfo)); } return(RedirectToAction("Login", "AdminPanel")); }
private void ChildRoleUpdate(AdminUser entity, AdminUserDto dto) { var currentRecords = entity.Roles.Select(s => s.Id).ToList(); var addedRecords = dto.Roles.Except(currentRecords).ToList(); foreach (var record in addedRecords) { entity.Roles.Add(_adminRoleRepository.Find(record)); } var deletedRecords = currentRecords.Except(dto.Roles).ToList(); foreach (var record in deletedRecords) { entity.Roles.Remove(entity.Roles.First(w => w.Id == record)); } }
public void Init() { AdminUser u = new AdminUser { //Id=1, Account = "*****@*****.**", Phone = "18780287009", RealName = "SuperAdmin", Email = String.Empty, IsUse = true }; var _u = AdminUserService.Instance.GetByAccount(u.Account); if (_u == null) { AdminUserDao.Instance.Create(u); } }
public ActionResult Create(AdminUser admin) { if (ModelState.IsValid) { var dao = new AdminDao(); long id = dao.Insert(admin); if (id > 0) { SetAlert("Thêm thành công", "success"); return(RedirectToAction("Index", "UserAdmin")); } else { ModelState.AddModelError("", "Thêm user thất bại"); } } return(View("Index")); }
private void setInfo() { if (id > 0) { using (BLLAdminUser bll = new BLLAdminUser()) { AdminUser admin = bll.GetSingle(id); if (admin != null) { txtAccount.Text = admin.Account; txtTrueName.Text = admin.TrueName; lblPwd.Text = "<span style=\"color:Red;\">*如不修改密码请留空</span> "; lblAgin.Text = "<span style=\"color:Red;\">*如不修改密码请留空</span> "; } } } }
public ActionResult Edit(string userId) { RegisterEditAdminUserViewModel model = new RegisterEditAdminUserViewModel(); AdminUser user = userManager.FindById(userId); if (user != null) { model.Id = user.Id; model.Email = user.Email; model.FirstName = user.FirstName; model.LastName = user.LastName; model.Initials = user.Initials; model.IsSuperAdmin = userManager.IsInRole(user.Id, "SuperAdminUser"); } return(View(model)); }
public ActionResult Create([Bind(Include = "Id,UserId")] AdminUser adminuser) { if (Session["type"] == null || Session["type"] == "") { Session["dv"] = "Create"; Session["dc"] = "AdminUser"; return(RedirectToAction("Login", "Users")); } if (ModelState.IsValid) { db.AdminUsers.Add(adminuser); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Userses, "Id", "Name", adminuser.UserId); return(View(adminuser)); }
public IActionResult Add(AdminUserVM model) { if (ModelState.IsValid) { AdminUser adminuser = new AdminUser(); adminuser.Name = model.Name; adminuser.Surname = model.Surname; adminuser.Email = model.EMail; adminuser.Password = model.Password; //adminuser.Roles = model.Roles; _context.AdminUsers.Add(adminuser); _context.SaveChanges(); //return RedirectToAction("Index", "AdminUser"); return(Redirect("/AdminArea/AdminUser/Index/")); } return(View()); }
// 删除 public IActionResult DeleteAdminUsers(string code) { var Aid = HttpContext.Session.GetString("Aid"); if (Aid == null) { return(RedirectToAction("Login", "Login")); } if (code == null) { return(Content("500")); } AdminUser AdminUser = _context.AdminUser.FirstOrDefault(u => u.AdminUserCode == code); _context.AdminUser.Remove(AdminUser); _context.SaveChanges(); return(Content("200")); }
public SearchableAdminViewModel( AdminUser adminUser, AdminUser loggedInAdminUser, ReturnPageQuery returnPageQuery ) { Id = adminUser.Id; Name = adminUser.SearchableName; CategoryName = adminUser.CategoryName ?? "All"; EmailAddress = adminUser.EmailAddress; IsLocked = adminUser.IsLocked; CanShowDeactivateAdminButton = UserPermissionsHelper.LoggedInAdminCanDeactivateUser(adminUser, loggedInAdminUser); Tags = FilterableTagHelper.GetCurrentTagsForAdminUser(adminUser); ReturnPageQuery = returnPageQuery; }
public ActionResult LoginAdmin(AdminUser adminUser) { if (!ModelState.IsValid) { return(View("Index")); } var istifadeci = db.AdminUsers.FirstOrDefault(x => x.Username == adminUser.Username && x.Passvords == adminUser.Passvords); if (istifadeci != null) { return(RedirectToAction("Index")); } else { ViewBag.message = "Istifadəçi adı və ya şifrə yalnışdır!"; return(View()); } }
public JsonNetResult SearchGetFacets() { // parse search term string term = Request.Params["term"]; if (!string.IsNullOrEmpty(term)) { // parse date filter inputs DateTime s, e; DateTime?start = null, end = null; if (DateTime.TryParse(Request.Params["start-date"], out s)) { start = s; } if (DateTime.TryParse(Request.Params["end-date"], out e)) { end = e; } // get path prefix string prefix = this.sourcePermissionTasks.GetSourceOwningEntityPrefixPath(Request.Params["code"]); // need user's affiliations AdminUser user = this.userTasks.GetAdminUser(User.Identity.Name); IList <string> affiliations = user.Affiliations.Select(x => x.Name).ToList(); // run search IDictionary <IDictionary <string, string>, long> facets = this.luceneTasks.SourceSearchFacets(term, prefix, start, end, 50, ((PrfPrincipal)User).HasPermission(AdminPermission.CanViewAndSearchAllSources), ((PrfPrincipal)User).HasPermission(AdminPermission.CanViewAndSearchRestrictedSources), User.Identity.Name, affiliations); return(JsonNet(facets.Select(x => new { Facets = x.Key.Select(y => new { Name = y.Key, Value = y.Value }), Count = x.Value }))); } return(JsonNet(null)); }
public async Task <ResponseResult <int> > Add_Save() { //获取参数 StreamReader streamReader = new StreamReader(Request.Body); var paramStr = streamReader.ReadToEnd(); RequestParamterHelper requestParamterHelper = new RequestParamterHelper(paramStr); AdminUser adminUser = new AdminUser(); adminUser.Name = requestParamterHelper.GetParamValue("name")[0]; var user = await _userService.GetAdminUserByNameAsync(adminUser.Name); if (user != null) { return(new ResponseResult <int>(false, -1)); } //adminUser.Password = requestParamterHelper.GetParamValue("password")[0]; var phonedic = requestParamterHelper.GetParamValue("phone"); if (phonedic != null && phonedic.Count > 0) { adminUser.Phone = phonedic[0]; } adminUser.Gender = int.Parse(requestParamterHelper.GetParamValue("gender")[0]); adminUser.UserRoles = new List <AdminUserRole>(); foreach (var it in requestParamterHelper.GetParamValue("roleId")) { var roleId = int.Parse(it); var adminUserRole = new AdminUserRole { RoleId = roleId }; adminUser.UserRoles.Add(adminUserRole); } //adminUser.Password = MD5Helper.MD5Crypto16("123456"); //123456 加密后的值 adminUser.Password = "******"; var serviceResult = await _userService.AddModelAsync(adminUser); return(new ResponseResult <int>(true, serviceResult)); }
private async Task CreateRoles(IServiceProvider serviceProvider) { //initializing custom roles var RoleManager = serviceProvider.GetRequiredService <RoleManager <IdentityRole> >(); var UserManager = serviceProvider.GetRequiredService <UserManager <AdminUser> >(); string[] roleNames = { "Admin", "Store-Manager", "Member" }; IdentityResult roleResult; foreach (var roleName in roleNames) { var roleExist = await RoleManager.RoleExistsAsync(roleName); // ensure that the role does not exist if (!roleExist) { //create the roles and seed them to the database: roleResult = await RoleManager.CreateAsync(new IdentityRole(roleName)); } } // find the user with the admin email var _user = await UserManager.FindByEmailAsync(Configuration["Email"]); // check if the user exists if (_user == null) { //Here you could create the super admin who will maintain the web app var poweruser = new AdminUser { UserName = Configuration["Admin"], Email = Configuration["Email"], }; string adminPassword = Configuration["Password"]; var createPowerUser = await UserManager.CreateAsync(poweruser, adminPassword); if (createPowerUser.Succeeded) { //here we tie the new user to the role await UserManager.AddToRoleAsync(poweruser, "Admin"); } } }
public IHttpActionResult RegisterHospital(AdminUser hospital) { string Name = hospital.Username; string Password = hospital.Password; string NewID; int temp; using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = "Data Source=DESKTOP-3SOIUD0\\SQLEXPRESS;Initial Catalog=Eclinic;Integrated Security=True;"; conn.Open(); string query1 = "EXEC Load_HospitalID"; SqlCommand LastID = new SqlCommand(query1, conn); string LID = LastID.ExecuteScalar().ToString().Replace(" ", ""); conn.Close(); conn.Open(); string checkuname = "select count(*) from AdminUser where Username = '******'"; SqlCommand com = new SqlCommand(checkuname, conn); temp = Convert.ToInt32(com.ExecuteScalar().ToString()); conn.Close(); int position = LID.IndexOf("s"); string Spart = "Hos"; string ID = LID.Substring(position + 1); int IDval = Int32.Parse(ID); int Nid = ++IDval; string Ipart = Nid.ToString(); NewID = string.Concat(Spart, Ipart); } if (temp == 0) { string query = "EXEC Add_Hospital'" + NewID + "','" + Name + "','" + Password + "'"; int result = connectionProvider.CreateSomething(query); return(Ok(result)); } else { testenigma mal = new testenigma(); mal.test1 = temp.ToString(); return(Ok(mal)); } }
public ActionResult AddNewAdmin(AdminUser admin) { try { if (admin != null && admin.Role != 0) { AdminUserManager adminManager = new AdminUserManager(); admin.CreateTime = DateTime.Now; admin.LastUpdatedTime = DateTime.Now; admin.EncryptedPassword = admin.EncryptedPassword.ToMD5(); adminManager.AddAdminUser(admin); } } catch (Exception ex) { LogService.Log("AddNewAdmin", ex.ToString()); } return RedirectToAction("Index"); }
//登陆 protected void ImageButton1_Click1(object sender, ImageClickEventArgs e) { string adminName = ConfigurationManager.AppSettings["AdminUser"].ToString(); string adminPwd = ConfigurationManager.AppSettings["AdminPwd"].ToString(); if (Session["createRandom"] != null) { if (this.txtValidate.Text == Session["createRandom"].ToString()) { if (this.txtUser.Text == adminName && this.txtPwd.Text == adminPwd) { AdminUser user = new AdminUser(); user.AdminName = adminName; user.AdminPwd = adminPwd; user.LoginDate = DateTime.Now; user.LoginIP = Request.ServerVariables["LOCAL_ADDR"]; int count = Convert.ToInt32(ConfigurationManager.AppSettings["LoginCount"].ToString()); count++; user.LoginCount = count; ConfigurationManager.AppSettings["LoginCount"] = user.LoginCount + ""; ConfigurationManager.AppSettings["LoginIP"] = user.LoginIP; ConfigurationManager.AppSettings["LoginDate"] = user.LoginDate.ToString(); Session["adminUser"] = user; this.Response.Redirect("Frame.aspx"); } else { this.ltlTip.Text = "登陆失败!"; this.txtValidate.Text = ""; ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('用户名/密码错误!');</script>"); return; } } else { this.ltlTip.Text = "登陆失败!"; this.txtValidate.Text = ""; ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('验证码输入错误!');</script>"); return; } } }
static void AbstractClassTest() { Japanese user1 = new Japanese(); Console.WriteLine(user1.Name); Console.WriteLine(user1.Id); User.GetCount(); Japanese sawao = new Japanese("Keita Sawao", "J0118386"); User.GetCount(); American bob = new American("Bob"); Console.WriteLine(bob.Id); bob.SayHi(); User.GetCount(); AdminUser tom = new AdminUser("Tom", "J0111111"); User.GetCount(); }
public void sub_level_of_hierarchy() { StoreOptions(_ => { _.Schema.For <User>() .SoftDeleted() .AddSubClass <AdminUser>() .AddSubClass <SuperUser>(); }); var user1 = new SuperUser { UserName = "******" }; var user2 = new SuperUser { UserName = "******" }; var user3 = new SuperUser { UserName = "******" }; var user4 = new SuperUser { UserName = "******" }; var user5 = new AdminUser { UserName = "******" }; using (var session = theStore.OpenSession()) { session.StoreObjects(new User[] { user1, user2, user3, user4, user5 }); session.SaveChanges(); session.DeleteWhere <SuperUser>(x => x.UserName.StartsWith("b")); session.SaveChanges(); // no where clause session.Query <SuperUser>().OrderBy(x => x.UserName).Select(x => x.UserName) .ToList().ShouldHaveTheSameElementsAs("foo", "jack"); // with a where clause session.Query <SuperUser>().Where(x => x.UserName != "jack") .ToList().Single().UserName.ShouldBe("foo"); } }
private void UpdateRecord() { int index = comboBoxUsers.SelectedIndex; AdminUser admin = adminList[index]; labelID.Text = admin.UserID; textBoxName.Text = admin.Name; textBoxSurname.Text = admin.Surname; textBoxTitle.Text = admin.Title; textBoxUserName.Text = admin.Username; textBoxPass.Text = admin.Password; textBoxPassRepeat.Text = ""; checkBoxActive.Checked = false; if (admin.Active == "1") { checkBoxActive.Checked = true; } }
public async Task<Result> Create([FromBody] AdminEmployeeCreateRequest request) { var anyName = await _repository.Query().AnyAsync(e => e.Name == request.Name || e.Tel == request.Tel); if (anyName) return Result.Fail(ResultCodes.UserExists, "用户名或手机号已存在"); var user = new AdminUser { Name = request.Name, Createat = DateTime.Now, IsAdmin = false, NickName = request.NickName, Role = request.Role, Tel = request.Tel, Pwd = request.Pwd.ToMD5Base64() }; await _repository.InsertAsync(user); return Result.Ok(); }
public static AdminUser ReadAdminUser(SqlDataReader reader) { AdminUser retval = new AdminUser(); for (int i = 0; i < reader.FieldCount; i++) { switch (reader.GetName(i)) { case "UserName": retval.Id = Helper.ToGuid(reader[i]); break; case "Password": retval.Password = Helper.ToString(reader[i]); break; case "AccessLevel": retval.AccessLevel = Helper.ToString(reader[i]); break; } } return retval; }
public bool Update(AdminUser user) { try { return dal.Update(user); } catch (Exception ex) { CommonLoger.Error(ex.ToString()); return false; } }
private void DateRow_Booking(DataRow p_DataRow, Entity.Booking p_Booking) { if (p_DataRow == null || p_Booking == null) return; p_Booking.Booking_ID = Convert.ToInt32(p_DataRow["Booking_ID"].ToString()); p_Booking.Booking_Seq = p_DataRow["Booking_Seq"].ToString(); p_Booking.Booking_Airline = p_DataRow["Booking_Airline"].ToString(); p_Booking.Booking_Contact = p_DataRow["Booking_Contact"].ToString(); p_Booking.Booking_Num = Convert.ToInt32(p_DataRow["Booking_Num"].ToString()); p_Booking.Booking_Tel = p_DataRow["Booking_Tel"].ToString(); p_Booking.Booking_Email = p_DataRow["Booking_Email"].ToString(); BLL.AdminUser b_AdminUser = new AdminUser(); p_Booking.Booking_AdminUser_ID = b_AdminUser.Select_AdminUser(Convert.ToInt32(p_DataRow["Booking_AdminUser_ID"].ToString())); if (p_DataRow["Booking_Kind"].ToString().ToLower() == "true") p_Booking.Booking_Kind = true; else p_Booking.Booking_Kind = false; p_Booking.Booking_State = Convert.ToInt32(p_DataRow["Booking_State"].ToString()); p_Booking.Booking_AddTime = DateTime.Parse(p_DataRow["Booking_AddTime"].ToString()); p_Booking.Booking_LastTime = DateTime.Parse(p_DataRow["Booking_LastTime"].ToString()); if (p_DataRow["Booking_LastTime"] != null && VerifyUtility.IsString_NotNull(p_DataRow["Booking_LastTime"].ToString())) p_Booking.Booking_ComitTime = p_DataRow["Booking_ComitTime"].ToString(); }
public static void UpdateAdminUser(AdminUser admin) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@AdminId", admin.Id), new SqlParameter("@Password", admin.Password) }; SqlHelper.ExecuteNonQuery(Helper.ConnectionString, CommandType.StoredProcedure, "app_AdminUser_Update", param); }
private void DateRow_Consumption(DataRow p_DataRow, Entity.Consumption p_Consumption) { if (p_DataRow == null || p_Consumption == null) return; p_Consumption.Consumption_ID = Convert.ToInt32(p_DataRow["Consumption_ID"].ToString()); p_Consumption.Consumption_Serial = p_DataRow["Consumption_Serial"].ToString(); p_Consumption.Consumption_Type = Convert.ToInt32(p_DataRow["Consumption_Type"].ToString()); p_Consumption.Consumption_Src = p_DataRow["Consumption_Src"].ToString(); p_Consumption.Consumption_Dest = p_DataRow["Consumption_Dest"].ToString(); p_Consumption.Consumption_Price = Convert.ToInt32(p_DataRow["Consumption_Price"].ToString()); p_Consumption.Consumption_DePrice = Convert.ToInt32(p_DataRow["Consumption_DePrice"].ToString()); p_Consumption.Consumption_Points = Convert.ToInt32(p_DataRow["Consumption_Points"].ToString()); p_Consumption.Consumption_Commission = Convert.ToInt32(p_DataRow["Consumption_Commission"].ToString()); p_Consumption.Consumption_Date = DateTime.Parse(p_DataRow["Consumption_Date"].ToString()); BLL.Member b_Member = new Member(); p_Consumption.Consumption_Org_Member_ID = b_Member.Select_Member(Convert.ToInt32(p_DataRow["Consumption_Org_Member_ID"].ToString())); p_Consumption.Consumption_Com_Member_ID = b_Member.Select_Member(Convert.ToInt32(p_DataRow["Consumption_Com_Member_ID"].ToString())); BLL.AdminUser b_AdminUser = new AdminUser(); p_Consumption.Consumption_Admin_ID = b_AdminUser.Select_AdminUser(Convert.ToInt32(p_DataRow["Consumption_Admin_ID"].ToString())); p_Consumption.Consumption_AddTime = DateTime.Parse(p_DataRow["Consumption_AddTime"].ToString()); p_Consumption.Consumption_Remark = p_DataRow["Consumption_Remark"].ToString(); }
/// <summary> /// 注册信息验证 /// </summary> /// <param name="user"></param> /// <param name="bll"></param> /// <returns></returns> private string CheckRegistInfo(AdminUser user, AdminUserBLL bll) { Regex reg; string msg = string.Empty; #region 验证用户名 if (string.IsNullOrEmpty(user.UserName)) { return "请填写用户名!"; } reg = new Regex(RegexPatton.UserNamePatton); if (!reg.Match(user.UserName).Success) { return "用户名格式不正确!"; } if (bll.UserNameIsExists(user.UserName)) { return "用户名已存在!"; } #endregion #region 验证密码 if (string.IsNullOrEmpty(user.Password)) { return "请填写密码!"; } reg = new Regex(RegexPatton.PasswordPatton); if (!reg.Match(user.Password).Success) { return "密码格式不正确!"; } if (user.Password != Request.Form["Password2"]) { return "两次输入的密码不一致!"; } #endregion #region 验证邮箱 if (string.IsNullOrEmpty(user.EMail)) { return "请填写邮箱!"; } reg = new Regex(RegexPatton.EMailPatton); if (!reg.Match(user.EMail).Success) { return "邮箱格式不正确!"; } if (bll.EmailIsExists(user.EMail)) { return "邮箱已存在!"; } #endregion #region 验证QQ if (string.IsNullOrEmpty(user.QQ)) { return "请填写QQ!"; } reg = new Regex(RegexPatton.qqPatton); if (!reg.Match(user.QQ).Success) { return "qq格式不正确!"; } if (bll.QQIsExists(user.QQ)) { return "qq已存在!"; } #endregion #region 验证收款人 if (string.IsNullOrEmpty(user.RealName)) { return "请填写收款人!"; } reg = new Regex(RegexPatton.RealNamePatton); if (!reg.Match(user.RealName).Success) { return "收款人格式不正确!"; } #endregion #region 验证手机号 if (string.IsNullOrEmpty(user.Mobile)) { return "请填写手机号!"; } reg = new Regex(RegexPatton.MobilePatton); if (!reg.Match(user.Mobile).Success) { return "手机号格式不正确!"; } if (bll.MobileIsExists(user.Mobile)) { return "手机号码已存在!"; } #endregion if (Session["vcode"] == null) { return "验证码已失效,请换一张!"; } if (Request.Form["ValidateCode"].ToUpper() != GetCode()) { return "验证码不正确!"; } return msg; }
public bool UpdateAdmin(AdminUser user) { bool canUpdate = (_adminRepository.GetById(user.Id) != null); if (canUpdate) { _adminRepository.Upsert(user); } return canUpdate; }
public AdminUser CreateAdmin(string login, string password) { var adminUser = new AdminUser(login, password); _adminRepository.Upsert(adminUser); return adminUser; }
public ActionResult Register(AdminUser user =null) { AdminUserBLL userBll = new AdminUserBLL(); ViewBag.CustomServices = userBll.GetAdminUserNameIDsByRoleType(RoleType.媒介); ViewBag.PwdPatton = RegexPatton.PasswordPatton; //以用户名有没有值来判断是请求注册页面还是提交注册数据 if (user != null && !string.IsNullOrEmpty(user.UserName)) { string msg = CheckRegistInfo(user, userBll); if (msg.Length > 0) { ViewBag.RegistInfo = user; ViewBag.Message = msg; return View(); } user.RoleType = (int)RoleType.渠道; user.Password = Des.GetMD5String(user.Password); user.CreateTime = DateTime.Now; userBll.Add(user); } else { ViewBag.RegistInfo = new AdminUser(); return View(); } return RedirectToAction("Login","Home"); }
public bool CheckLogin(AdminUser adminUser) { return AdminUserDAL.CheckLogin(adminUser); }
private void DateRow_LowFare(DataRow p_DataRow, Entity.LowFare p_LowFare) { if (p_DataRow == null || p_LowFare == null) return; p_LowFare.LowFare_ID = Convert.ToInt32(p_DataRow["LowFare_ID"].ToString()); p_LowFare.LowFare_Type = Convert.ToInt32(p_DataRow["LowFare_Type"].ToString()); BLL.LowFare_Detail b_LowFare_Detail = new LowFare_Detail(); Entity.LowFare_Detail[] e_LowFare_Detail = b_LowFare_Detail.Select_LowFare_Detail_LowFare_ID(Convert.ToInt32(p_DataRow["LowFare_Detail_ID"].ToString()), 1, 1); if (e_LowFare_Detail != null) { p_LowFare.LowFare_Detail_ID = new List<Entity.LowFare_Detail>(); foreach (Entity.LowFare_Detail o_LowFare_Detail in e_LowFare_Detail) p_LowFare.LowFare_Detail_ID.Add(o_LowFare_Detail); } p_LowFare.LowFare_Adults = Convert.ToInt32(p_DataRow["LowFare_Adults"].ToString()); p_LowFare.LowFare_Children = Convert.ToInt32(p_DataRow["LowFare_Children"].ToString()); p_LowFare.LowFare_Infants = Convert.ToInt32(p_DataRow["LowFare_Infants"].ToString()); p_LowFare.LowFare_Passengers = p_DataRow["LowFare_Passengers"].ToString(); p_LowFare.LowFare_Airline = p_DataRow["LowFare_Airline"].ToString(); p_LowFare.LowFare_Class = p_DataRow["LowFare_Class"].ToString(); BLL.Member b_Member = new Member(); p_LowFare.LowFare_Member_ID = b_Member.Select_Member(Convert.ToInt32(p_DataRow["LowFare_Member_ID"].ToString())); BLL.AdminUser b_AdminUser = new AdminUser(); p_LowFare.LowFare_AdminUser_ID = b_AdminUser.Select_AdminUser(Convert.ToInt32(p_DataRow["LowFare_AdminUser_ID"].ToString())); p_LowFare.LowFare_Status = Convert.ToInt32(p_DataRow["LowFare_Status"].ToString()); p_LowFare.LowFare_AddTime = DateTime.Parse(p_DataRow["LowFare_AddTime"].ToString()); p_LowFare.LowFare_SubmitTime = p_DataRow["LowFare_SubmitTime"].ToString(); }
public ActionResult UpdateAdmin(AdminUser admin) { try { if (admin != null && admin.AdminId != 0) { AdminUserManager adminManager = new AdminUserManager(); admin.EncryptedPassword = admin.EncryptedPassword.ToMD5(); adminManager.UpdateAdminUser(admin); } } catch (Exception ex) { LogService.Log("UpdateAdmin", ex.ToString()); } return RedirectToAction("Index"); }
public Entity.Consumption[] Select_Consumption(string p_Search_Content, int p_Search_Method, int p_Search_Year, int p_Search_Month, int p_PageSize, int p_PageIndex) { switch (p_Search_Method) { case 9: { BLL.Member b_Member = new Member(); Entity.Member o_Member = b_Member.Select_Member(1, p_Search_Content); if (o_Member != null) { p_Search_Content = o_Member.Member_ID.ToString(); p_Search_Method = 9; } else return null; } break; case 10: { BLL.Member b_Member = new Member(); Entity.Member o_Member = b_Member.Select_Member(2, p_Search_Content); if (o_Member != null) { p_Search_Content = o_Member.Member_ID.ToString(); p_Search_Method = 9; } else return null; } break; case 11: { BLL.Member b_Member = new Member(); Entity.Member o_Member = b_Member.Select_Member(1, p_Search_Content); if (o_Member != null) { p_Search_Content = o_Member.Member_ID.ToString(); p_Search_Method = 10; } else return null; } break; case 12: { BLL.Member b_Member = new Member(); Entity.Member o_Member = b_Member.Select_Member(2, p_Search_Content); if (o_Member != null) { p_Search_Content = o_Member.Member_ID.ToString(); p_Search_Method = 10; } else return null; } break; case 13: { BLL.AdminUser b_AdminUser = new AdminUser(); Entity.AdminUser o_AdminUser = b_AdminUser.Select_AdminUser(1, p_Search_Content); if (o_AdminUser != null) { p_Search_Content = o_AdminUser.AdminUser_ID.ToString(); p_Search_Method = 11; } else return null; } break; case 14: { BLL.AdminUser b_AdminUser = new AdminUser(); Entity.AdminUser o_AdminUser = b_AdminUser.Select_AdminUser(2, p_Search_Content); if (o_AdminUser != null) { p_Search_Content = o_AdminUser.AdminUser_ID.ToString(); p_Search_Method = 11; } else return null; } break; default: break; } DataTable o_DataTable = d_Consumption.Select_Consumption(p_Search_Content, p_Search_Method, p_Search_Year, p_Search_Month, p_PageSize, p_PageIndex, ref g_TotalCount, ref g_TotalPage); if (o_DataTable == null) return null; else { Entity.Consumption[] e_Consumption = new Entity.Consumption[o_DataTable.Rows.Count]; int i = 0; foreach (DataRow o_DataRow in o_DataTable.Rows) { e_Consumption[i] = new Entity.Consumption(); DateRow_Consumption(o_DataRow, e_Consumption[i]); i++; } return e_Consumption; } }