/// <summary> /// 添加角色对应的用户 /// 创建 2015-4-17 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveClose_Click(object sender, EventArgs e) { SyncSelectedRowIndexArrayToHiddenField(); string str = ""; // 排除已经属于本角色的用户 int roleID = 0; if (Request.QueryString[requestStr].IsNum()) { roleID = Int32.Parse(Request.QueryString[requestStr]); T_ROLES T_ROLES = new T_ROLES(); var queryrole = new DapperExQuery <T_ROLES>().AndWhere(n => n.ID, OperationMethod.Equal, roleID); T_ROLES = T_ROLES_BLL.GetEntity(queryrole); var r_code = T_ROLES.R_CODE; // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames) List <int> userids = FineUITable.GetSelectedDataKeyIDs(Grid1); foreach (int userID in userids) { var queryAdmin = new DapperExQuery <T_ADMIN>().AndWhere(n => n.ID, OperationMethod.Equal, userID); T_ADMIN T_ADMIN = new Model.T_ADMIN(); T_ADMIN = T_ADMIN_BLL.GetEntity(queryAdmin); T_ADMIN_ROLES T_ADMIN_ROLES = new T_ADMIN_ROLES(); T_ADMIN_ROLES.R_CODE = r_code; T_ADMIN_ROLES.A_CODE = T_ADMIN.A_CODE; T_ADMIN_ROLES.CREATE_TIME = DateTime.Parse("2015-10-9"); T_ADMIN_ROLES.CREATE_USER = ""; T_ADMIN_ROLES.CREATE_USER_NAME = ""; if (T_ADMIN_ROLES_BLL.Add(T_ADMIN_ROLES)) { str = "添加成功!"; } else { str = "添加失败!"; } } //DB.SaveChanges(); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); Alert.Show("str"); } }
/// <summary> /// 添加角色对应的用户 /// 创建 2015-4-17 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveClose_Click(object sender, EventArgs e) { SyncSelectedRowIndexArrayToHiddenField(); string str = ""; // 排除已经属于本角色的用户 int roleID = 0; if (Request.QueryString[requestStr].IsNum()) { roleID = Int32.Parse(Request.QueryString[requestStr]); T_ROLES T_ROLES = new T_ROLES(); var queryrole = new DapperExQuery<T_ROLES>().AndWhere(n => n.ID, OperationMethod.Equal, roleID); T_ROLES = T_ROLES_BLL.GetEntity(queryrole); var r_code = T_ROLES.R_CODE; // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames) List<int> userids = FineUITable.GetSelectedDataKeyIDs(Grid1); foreach (int userID in userids) { var queryAdmin = new DapperExQuery<T_ADMIN>().AndWhere(n => n.ID, OperationMethod.Equal, userID); T_ADMIN T_ADMIN = new Model.T_ADMIN(); T_ADMIN = T_ADMIN_BLL.GetEntity(queryAdmin); T_ADMIN_ROLES T_ADMIN_ROLES = new T_ADMIN_ROLES(); T_ADMIN_ROLES.R_CODE = r_code; T_ADMIN_ROLES.A_CODE = T_ADMIN.A_CODE; T_ADMIN_ROLES.CREATE_TIME = DateTime.Parse("2015-10-9"); T_ADMIN_ROLES.CREATE_USER = ""; T_ADMIN_ROLES.CREATE_USER_NAME = ""; if (T_ADMIN_ROLES_BLL.Add(T_ADMIN_ROLES)) { str = "添加成功!"; } else { str = "添加失败!"; } } //DB.SaveChanges(); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); Alert.Show("str"); } }