protected void Page_Load(object sender, EventArgs e) { Owen.Model.Model_UserInfo model = new Owen.BLL.BLL_UserInfo().IsRoles((int)Owen.Common.RolesValue.Distributor); if (model == null) { Owen.Common.JSHelper.Alert(this, "对不起,您没有权限创建/修改员工档案!", "../Center.aspx"); return; } Owen.Model.Model_Distributor mDistributor = new Owen.BLL.BLL_Distributor().GetEntity(string.Format(" Mobile = '{0}' ", model.UserName)); if (mDistributor == null) { Owen.Common.JSHelper.Alert(this, "对不起,经销商信息不存在!", "../Center.aspx"); return; } distributorID = mDistributor.DistributorID; employeesId = Owen.Common.Utils.GetQueryInt("employeesId"); action = Owen.Common.Utils.GetQueryString("action"); if (!Page.IsPostBack) { OnStart(sender, e); } }
protected void Page_Load(object sender, EventArgs e) { int userID = 0; if (HttpContext.Current.Session[Owen.Common.Constant.SESSION_ADMIN_INFO] != null) { userID = new Owen.BLL.BLL_UserInfo().GetAdminInfo().UserID; } Owen.Model.Model_UserInfo userInfo = new Owen.BLL.BLL_UserInfo().GetEntity(userID); if (userInfo != null) { //超级管理员不加此条件 if (userInfo.UserType != 1) { Owen.Common.JSHelper.Alert(this, "对不起,您没有权限创建/修改伙伴档案!", "../Center.aspx"); return; } } hidPartnersId.Value = Owen.Common.Utils.GetQueryInt("partnersId").ToString(); action = Owen.Common.Utils.GetQueryString("action"); if (!Page.IsPostBack) { OnStart(); } }
protected void Page_Load(object sender, EventArgs e) { int userID = 0; if (HttpContext.Current.Session[Owen.Common.Constant.SESSION_ADMIN_INFO] != null) { userID = new Owen.BLL.BLL_UserInfo().GetAdminInfo().UserID; } Owen.Model.Model_UserInfo userInfo = new Owen.BLL.BLL_UserInfo().GetEntity(userID); if (userInfo != null) { //超级管理员不加此条件 if (userInfo.UserType != 1) { userInfo = new Owen.BLL.BLL_UserInfo().IsRoles((int)Owen.Common.RolesValue.Manager); if (userInfo == null) { Owen.Common.JSHelper.Alert(this, "对不起,您没有权限创建/修改医院档案!", "../Center.aspx"); return; } } } hospitalId = Owen.Common.Utils.GetQueryInt("hospitalId"); action = Owen.Common.Utils.GetQueryString("action"); if (!Page.IsPostBack) { BindProvince(); BindHosType(); OnStart(sender, e); } }
/// <summary> /// 返回用户ID /// </summary> public static int UserID() { if (HttpContext.Current.Session[Owen.Common.Constant.SESSION_ADMIN_INFO] != null) { userID = new BLL_UserInfo().GetAdminInfo().UserID; } return userID; }
protected void Page_Load(object sender, EventArgs e) { Owen.Model.Model_UserInfo userInfo = null; //先判断是不是经销商员工 userInfo = new Owen.BLL.BLL_UserInfo().IsRoles((int)Owen.Common.RolesValue.Employees); //不是经销商员工 if (userInfo == null) { //再判断是不是经销商管理员 userInfo = new Owen.BLL.BLL_UserInfo().IsRoles((int)Owen.Common.RolesValue.Distributor); if (userInfo == null) { Owen.Common.JSHelper.Alert(this, "对不起,您没有权限创建/修改病历!", "../Center.aspx"); return; } Owen.Model.Model_Distributor mDistributor = new Owen.BLL.BLL_Distributor().GetEntity(string.Format(" Mobile = '{0}' ", userInfo.UserName)); if (mDistributor == null) { Owen.Common.JSHelper.Alert(this, "对不起,经销商信息不存在!", "../Center.aspx"); return; } distributorID = mDistributor.DistributorID; } else { Owen.Model.Model_Employees mEmployess = new Owen.BLL.BLL_Employees().GetEntity(string.Format(" Mobile = '{0}' ", userInfo.UserName)); if (mEmployess == null) { Owen.Common.JSHelper.Alert(this, "对不起,经销商员工信息不存在!", "../Center.aspx"); return; } employessID = mEmployess.EmployeesID; distributorID = mEmployess.DistributorID; } medicalId = Owen.Common.Utils.GetQueryInt("medicalId"); action = Owen.Common.Utils.GetQueryString("action"); if (action.Equals("add")) btnSave.Text = "立即创建"; if (action.Equals("edit")) btnSave.Text = "保存"; if (!Page.IsPostBack) { BindHospital(distributorID); OnStart(sender, e); } }
protected void Page_Load(object sender, EventArgs e) { //判断用户是否登录 if (!new Owen.BLL.BLL_UserInfo().IsAdminLogin()) { Response.Write("<script>parent.location.href='login.aspx'</script>"); Response.End(); } Owen.Model.Model_UserInfo model = new Owen.BLL.BLL_UserInfo().GetAdminInfo(); if (model != null) { userID = model.UserID; BindMenu(); } }
/// <summary> /// 绑定子菜单事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LeftMenu_ItemDataBound(object sender, RepeaterItemEventArgs e) { Model_UserInfo modelUser = new Owen.BLL.BLL_UserInfo().GetEntity(userID); if (modelUser.UserType == 1) { Model_Resource modelResource = (Model_Resource)e.Item.DataItem; string strWhere = string.Format(" Levels = 2 and ParentID ={0}", modelResource.ResourceID); IList<Model_Resource> list2 = new Owen.BLL.BLL_Resource().GetEntities(strWhere); if (list2.Count > 0) { Repeater LeftSubID = (Repeater)e.Item.FindControl("LeftMenu_Sub"); LeftSubID.DataSource = list2; LeftSubID.DataBind(); } else { e.Item.Visible = false; } } else { DataRowView dv = (DataRowView)e.Item.DataItem; DataTable table = new Owen.BLL.BLL_RolesAuthorize().QueryLinks(modelUser.UserID, 2, Convert.ToInt32(dv.Row["ResourceID"])); foreach (DataRow r in table.Rows) { System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^.*\?.+=.+$"); if (reg.IsMatch(r["Links"].ToString())) r["Links"] = r["Links"].ToString().Trim() + "&" + Owen.Common.Constant.ResourceID + "=" + r["ResourceID"].ToString(); else r["Links"] = r["Links"].ToString().Trim() + "?" + Owen.Common.Constant.ResourceID + "=" + r["ResourceID"].ToString(); } if (table.Rows.Count > 0) { Repeater LeftSubID = (Repeater)e.Item.FindControl("LeftMenu_Sub"); LeftSubID.DataSource = table; LeftSubID.DataBind(); } else { e.Item.Visible = false; } } }
/// <summary> /// 绑定主菜单 /// </summary> private void BindMenu() { Model_UserInfo modelUser = new Owen.BLL.BLL_UserInfo().GetEntity(userID); //超级用户 if (modelUser.UserType == 1) { string sqlWhere = " Levels = 1 "; IList<Model_Resource> list = new Owen.BLL.BLL_Resource().GetEntities(sqlWhere); LeftMenu.DataSource = list; LeftMenu.DataBind(); } else { DataTable table = new Owen.BLL.BLL_RolesAuthorize().QueryLinks(modelUser.UserID, 1, 0); LeftMenu.DataSource = table; LeftMenu.DataBind(); } }
/// <summary> /// 初始加载 /// </summary> private void OnStart() { Owen.Model.Model_UserInfo model = new Owen.BLL.BLL_UserInfo().GetEntity(userId); if (model == null) return; this.txtAddress.Text = model.Address; this.txtAge.Text = model.Age.ToString(); this.txtBirth.Text = model.Birth; this.txtEmail.Text = model.Email; this.txtPhone.Text = model.Phone; this.txtUserName.Text = model.UserName; this.txtZipCode.Text = model.ZipCode; SelectingRole(model); }
protected void btnSave_Click(object sender, EventArgs e) { Owen.Model.Model_UserInfo modelUserInfo = new Owen.BLL.BLL_UserInfo().GetEntity(userId); if (modelUserInfo == null) modelUserInfo = new Owen.Model.Model_UserInfo(); if (String.IsNullOrEmpty(txtUserName.Text)) { JSHelper.Alert(this, "请输入用户名!"); return; } if (!Owen.Common.Validator.IsValidPhone(txtUserName.Text)) { JSHelper.Alert(this, "请正确输入手机号码,这是识别该用户身份的唯一标识!"); return; } if ((action.Equals("add")) && new Owen.BLL.BLL_UserInfo().Exists(txtUserName.Text)) { JSHelper.Alert(this, "用户名已存在!"); return; } if ((action.Equals("edit")) && new Owen.BLL.BLL_UserInfo().Exists(txtUserName.Text, userId)) { JSHelper.Alert(this, "用户名已存在!"); return; } modelUserInfo.UserName = txtUserName.Text; int age; if (int.TryParse(txtAge.Text, out age) == false) { JSHelper.Alert(this, "请输入正确的年龄!"); return; } modelUserInfo.Age = age; modelUserInfo.Address = txtAddress.Text; modelUserInfo.Birth = txtBirth.Text; modelUserInfo.Email = txtEmail.Text; modelUserInfo.Gender = int.Parse(ddlGender.SelectedValue); modelUserInfo.Phone = txtPhone.Text; modelUserInfo.Status = 0; modelUserInfo.UserType = 0; modelUserInfo.ZipCode = txtZipCode.Text; switch (action) { case "add": modelUserInfo.Password = Owen.Common.DESEncrypt.Encrypt(txtPassword.Text); new Owen.BLL.BLL_UserInfo().Insert(modelUserInfo, cblRoles); JSHelper.Alert(this, "保存成功!", "UserList.aspx"); break; case "edit": modelUserInfo.UserID = userId; new Owen.BLL.BLL_UserInfo().Update(modelUserInfo, cblRoles); JSHelper.Alert(this, "保存成功!", "UserList.aspx"); break; } }