public job_category Insert(job_category id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_JOB_CATEGORY", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@job_category_name", id.job_category_name);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_JOB_CATEGORY", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@job_category_name", id.job_category_name);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.job_cat_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
        public job_category Insert(job_category id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_JOB_CATEGORY", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@job_category_name", id.job_category_name);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_JOB_CATEGORY", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@job_category_name", id.job_category_name);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.job_cat_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
        public Boolean Update(job_category id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_JOB_CATEGORY", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@job_cat_id", id.job_cat_id);
                cmd.Parameters.AddWithValue("@job_category_name", id.job_category_name);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
        public job_category Select(int id)
        {
            job_category  job_category     = new job_category();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_JOB_CATEGORY", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@job_cat_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        job_category.job_cat_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        job_category.job_cat_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        job_category.job_category_name = rdr.GetString(1);
                    }
                    else
                    {
                        job_category.job_category_name = " ";
                    }
                }
                else
                {
                    job_category.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                job_category.SetColumnDefaults();
                return(job_category);
            }
            finally
            {
                con.Close();
            }
            return(job_category);
        }
 public job_category Select(int id)
 {
     job_category job_category = new job_category();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_JOB_CATEGORY", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@job_cat_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             job_category.job_cat_id = rdr.GetInt32(0);
         }
         else
         {
             job_category.job_cat_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             job_category.job_category_name = rdr.GetString(1);
         }
         else
         {
             job_category.job_category_name = " ";
         }
         }
         else
         {
             job_category.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     job_category.SetColumnDefaults();
     return job_category;
     }
     finally
     {
     con.Close();
     }
     return job_category;
 }
 public Boolean Update(job_category id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_JOB_CATEGORY", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@job_cat_id", id.job_cat_id);
     cmd.Parameters.AddWithValue("@job_category_name", id.job_category_name);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }