public void AddRoleMenu(RoleUserInfo roleUserInfo) { string sql = "insert into S_UserRole(RoleId,UserId)values(@RoleId,@UserId)"; List<SqlParameter> lstParamter = new List<SqlParameter>(); SqlParameter paramter = new SqlParameter("@RoleId", roleUserInfo.RoleId); lstParamter.Add(paramter); paramter = new SqlParameter("@UserId", roleUserInfo.UserId); lstParamter.Add(paramter); SQLHelp.ExecuteNonQuery(sql, lstParamter); }
private RoleUserInfo ConvertToModel(DataRow dr) { RoleUserInfo roleUserInfo = new RoleUserInfo(); if (dr != null) { if (dr["RoleId"] is DBNull == false) { int roleId = 0; int.TryParse(dr["RoleId"].ToString(), out roleId); roleUserInfo.RoleId = roleId; } if (dr["UserId"] is DBNull == false) { int userId = 0; int.TryParse(dr["UserId"].ToString(), out userId); roleUserInfo.UserId = userId; } } return roleUserInfo; }
public void AddRoleUser(RoleUserInfo roleUserInfo) { RoleUserDal dal = new RoleUserDal(); dal.AddRoleMenu(roleUserInfo); }
private void GetSelectUserId(GridView gv, List<RoleUserInfo> roleUserList) { foreach (GridViewRow row in gv.Rows) { CheckBox cb = (CheckBox)row.FindControl("cbSelectUser"); if (cb != null && cb.Checked == true && cb.ToolTip != "") { RoleUserInfo roleUserInfo = new RoleUserInfo(); roleUserInfo.UserId = Convert.ToInt32(cb.ToolTip); roleUserInfo.RoleId = RoleId; roleUserList.Add(roleUserInfo); } } }