public async Task <ModelMenuC22Data> GetRegisterUserDataC22Async(string register_id) { string register_id_ = Encoding.UTF8.GetString(Convert.FromBase64String(register_id)); string sql = "SELECT A.register_id, A.first_name, A.full_name, A.work_phone, A.mobile, B.name_thai as position_name " + "FROM RegisterUser A INNER JOIN MST_Character B ON A.position = B.id " + "WHERE register_id='" + register_id_ + "'"; using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { SqlDataReader reader = await command.ExecuteReaderAsync(); if (reader.HasRows) { ModelMenuC22Data e = new ModelMenuC22Data(); while (await reader.ReadAsync()) { e.registerid = reader["register_id"].ToString(); e.fullname = reader["first_name"].ToString() + " " + reader["full_name"].ToString(); e.positionname = reader["position_name"].ToString(); e.ListProjectNumber = await GetAllProjectLabAsync(register_id, "C22,C34"); } return(e); } } conn.Close(); } return(null); }
public async Task <ModelMenuC22Data> GetProjectNumberWithDataC22Async(string project_number) { string sql = "SELECT project_number, project_name_thai, project_name_eng " + "FROM Doc_Process WHERE project_number='" + project_number + "'"; using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { SqlDataReader reader = await command.ExecuteReaderAsync(); if (reader.HasRows) { ModelMenuC22Data e = new ModelMenuC22Data(); while (await reader.ReadAsync()) { e.labtypename = reader["project_name_thai"].ToString(); e.facultyname = reader["project_name_eng"].ToString(); } return(e); } } conn.Close(); } return(null); }
public async Task <IActionResult> GetRegisterUserDataC22(string RegisterId) { ModelMenuC22Data e = await _IDocMenuCService.GetRegisterUserDataC22Async(RegisterId); if (e != null) { return(Ok(e)); } else { return(BadRequest()); } }
public async Task <IActionResult> GetProjectNumberWithDataC22(string ProjectNumber) { ModelMenuC22Data e = await _IDocMenuCService.GetProjectNumberWithDataC22Async(ProjectNumber); if (e != null) { return(Ok(e)); } else { return(BadRequest()); } }