public async Task <ModelMenuF2Edit> GetUserEditPermissionF2Async(string UserGroup, string MenuCode) { string sql = "SELECT * FROM [dbo].[SYS_Permission] WHERE user_group_code='" + UserGroup + "' AND menu_page_code='" + MenuCode + "'"; using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { SqlDataReader reader = await command.ExecuteReaderAsync(); if (reader.HasRows) { ModelMenuF2Edit item = new ModelMenuF2Edit(); while (await reader.ReadAsync()) { item.pmview = Convert.ToBoolean(reader["pm_view"]); item.pminsert = Convert.ToBoolean(reader["pm_insert"]); item.pmupdate = Convert.ToBoolean(reader["pm_update"]); item.pmprint = Convert.ToBoolean(reader["pm_print"]); item.pmalldata = Convert.ToBoolean(reader["pm_all_data"]); } return(item); } } conn.Close(); } return(null); }
public async Task <IActionResult> UpdatePermissionGroup(ModelMenuF2Edit model) { ModelResponseMessageUpdateUserRegister e = await _IDocMenuFService.UpdatePermissionGroupAsync(model); if (e != null) { return(Ok(e)); } else { return(BadRequest()); } }
public async Task <IActionResult> GetUserEditPermissionF2(string UserGroup, string MenuCode) { ModelMenuF2Edit e = await _IDocMenuFService.GetUserEditPermissionF2Async(UserGroup, MenuCode); if (e != null) { return(Ok(e)); } else { return(BadRequest()); } }
public async Task<IActionResult> UpdatePermissionGroup(ModelMenuF2Edit model) { var requestUri = $"{_WebApiModel.BaseURL}/{"PrivateDocMenuF"}/{"UpdatePermissionGroup"}"; string authHeader = HttpContext.Request?.Headers["Authorization"]; if (authHeader != null && authHeader.StartsWith("Bearer")) { BearerToken = authHeader.Substring("Bearer ".Length).Trim(); } var response = await HttpRequestFactory.Post(requestUri, BearerToken, model); switch (response.StatusCode) { case HttpStatusCode.Unauthorized: return Unauthorized(response.ContentAsString()); case HttpStatusCode.BadRequest: return BadRequest(response.ContentAsString()); case HttpStatusCode.OK: return Ok(response.ContentAsString()); default: return StatusCode(500); } }
public async Task <ModelResponseMessageUpdateUserRegister> UpdatePermissionGroupAsync(ModelMenuF2Edit model) { ModelResponseMessageUpdateUserRegister resp = new ModelResponseMessageUpdateUserRegister(); using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("sp_permission_group", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserGroupCode", SqlDbType.VarChar, 100).Value = model.usergroup; cmd.Parameters.Add("@MenuPageCode", SqlDbType.VarChar, 100).Value = model.menupagecode; cmd.Parameters.Add("@PmView", SqlDbType.Bit).Value = Convert.ToBoolean(model.pmview); cmd.Parameters.Add("@PmInsert", SqlDbType.Bit).Value = Convert.ToBoolean(model.pminsert); cmd.Parameters.Add("@PmUpdate", SqlDbType.Bit).Value = Convert.ToBoolean(model.pmupdate); cmd.Parameters.Add("@PmPrint", SqlDbType.Bit).Value = Convert.ToBoolean(model.pmprint); cmd.Parameters.Add("@PmAllData", SqlDbType.Bit).Value = Convert.ToBoolean(model.pmalldata); SqlParameter rStatus = cmd.Parameters.Add("@rStatus", SqlDbType.Int); rStatus.Direction = ParameterDirection.Output; SqlParameter rMessage = cmd.Parameters.Add("@rMessage", SqlDbType.NVarChar, 500); rMessage.Direction = ParameterDirection.Output; await cmd.ExecuteNonQueryAsync(); if ((int)cmd.Parameters["@rStatus"].Value > 0) { resp.Status = true; } else { resp.Message = (string)cmd.Parameters["@rMessage"].Value; } } conn.Close(); } return(resp); }
public async Task <ModelResponseMessageUpdateUserRegister> UpdatePermissionGroupAsync(ModelMenuF2Edit model) { return(await _IDocMenuF2Repository.UpdatePermissionGroupAsync(model)); }