예제 #1
0
        public async Task <IActionResult> GetProjectNumberWithDataA6(string ProjectNumber)
        {
            ModelMenuA6ProjectNumberData e = await _IDocMenuAService.GetProjectNumberWithDataA6Async(ProjectNumber);

            if (e != null)
            {
                return(Ok(e));
            }
            else
            {
                return(BadRequest());
            }
        }
예제 #2
0
        public async Task <ModelMenuA6ProjectNumberData> GetProjectNumberWithDataA6Async(string project_number)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(ConnectionString))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand("sp_getdata_for_a6", conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.Add("@project_number", SqlDbType.VarChar, 50).Value = project_number;

                        SqlDataReader reader = await cmd.ExecuteReaderAsync();

                        if (reader.HasRows)
                        {
                            ModelMenuA6ProjectNumberData e = new ModelMenuA6ProjectNumberData();
                            while (await reader.ReadAsync())
                            {
                                e.projectname1    = reader[1].ToString();
                                e.projectname2    = reader[2].ToString();
                                e.projectheadname = reader[3].ToString();
                                e.facultyname     = reader[4].ToString();
                                e.positionname    = reader[5].ToString();
                                e.certificatetype = reader[6].ToString();
                                e.dateofapproval  = reader[7].ToString();
                            }
                            return(e);
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(null);
        }