protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtname.Text) || string.IsNullOrWhiteSpace(txtpsw.Text) || cblAdminType.SelectedItem==null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "alert('信息填写不完善')", true); } else { Model.ScenicAdminType sat = 0; foreach (ListItem item in cblAdminType.Items) { if (item.Selected) { Model.ScenicAdminType admintype = (Model.ScenicAdminType)Enum.Parse(typeof(Model.ScenicAdminType), item.Text); sat = sat | admintype; } } int scid = Master.Scenic.Id; ScenicAdmin sa = new ScenicAdmin(); sa.AdminType = ScenicAdminType.景区资料员; sa.Scenic = bllScenic.GetScenicById(scid); sa.AdminType = sat; sa.RealName = txtRealName.Text.Trim(); new BLL.BLLMembership().CreateUser(txtRealName.Text.Trim(), "", "", "", txtname.Text, txtpsw.Text, ""); TourMembership tour = new BLL.BLLMembership().GetMember(txtname.Text); sa.Membership = tour; sa.IsDisabled = false; bllscenicadmin.SaveOrUpdate(sa); Page.ClientScript.RegisterStartupScript(this.GetType(), "btnOk", "alert('添加成功')", true); Response.Redirect("/WorkerList.aspx"); } }
protected void rptScenicAdmin_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "make") { int scid = int.Parse(e.CommandArgument.ToString()); ScenicAdmin sa = new ScenicAdmin(); sa.AdminType = ScenicAdminType.景区资料员 | ScenicAdminType.检票员 | ScenicAdminType.景区财务; sa.Scenic = bllScenic.GetScenicById(scid); if (!string.IsNullOrEmpty(sa.Scenic.SeoName)) { string loginname = new MakeAccount().automakeaccount(sa.Scenic.SeoName); new BLL.BLLMembership().CreateUser("", "", "", "", loginname, "123456",""); TourMembership tour = new BLL.BLLMembership().GetMember(loginname); sa.Membership = tour; bllscenicadmin.SaveOrUpdate(sa); } } if (e.CommandName == "reset") { int scid = int.Parse(e.CommandArgument.ToString()); ScenicAdmin sa = bllscenicadmin.GetScenicAdminByScidandtype(scid, 7); sa.Membership.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5"); bllscenicadmin.SaveOrUpdate(sa); } BindUsers(); }
public void SaveOrUpdate(ScenicAdmin sa) { using (var x=session.Transaction) { x.Begin(); session.SaveOrUpdate(sa); x.Commit(); } }
private void ValidPermission() { user = new BLLMembership().GetScenicAdmin((Guid)tourmembership.GetUser(scenicManagerLogin.UserName, true).ProviderUserKey); if (user == null) { lblMessage.Text = "用户名或密码错误"; } else { Scenic scenic = user.Scenic; Response.Redirect("/y/CheckTicket.aspx"); } }
public void CreateUpdateScenicAdmin(Guid memid, int scenicid) { Model.ScenicAdmin sa = GetScenicAdmin(memid); if (sa == null) { sa = new ScenicAdmin(); sa.Membership = GetMemberById(memid); } Model.Scenic sc = new BLL.BLLScenic().GetScenicById(scenicid); sa.Scenic = sc; dal.UpdateScenicAdmin(sa); string[] names = { sa.Membership.Name }; trp.AddUsersToRoles(names, roles); }
private void ValidPermission() { user = new BLLMembership().GetScenicAdmin((Guid)tourmembership.GetUser(Login1.UserName, true).ProviderUserKey); if (user == null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "alert('用户名或密码错误')", true); } else { Scenic scenic = user.Scenic; if (!string.IsNullOrEmpty(scenic.Position)) { HttpCookie httpcookie = new HttpCookie("unitposition", scenic.Position); Response.Cookies.Add(httpcookie); } else { HttpCookie httpcookie = new HttpCookie("unitposition", "120.159033,30.28376"); Response.Cookies.Add(httpcookie); } Response.Cookies.Add(new HttpCookie("idcard", "")); Response.Redirect("/"); } }
public void SaveOrUpdate(ScenicAdmin sa) { Iscenicadmin.SaveOrUpdate(sa); }