public demobilization Insert(demobilization id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_DEMOBILIZATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_DEMOBILIZATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.demo_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
 public demobilization Insert(demobilization id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_DEMOBILIZATION", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_DEMOBILIZATION", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.demo_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
        public demobilization Select(int id)
        {
            demobilization demobilization   = new demobilization();
            string         ConnectionString = IDManager.connection();
            SqlConnection  con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_DEMOBILIZATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@demo_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        demobilization.demo_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        demobilization.demo_id = 0;
                    }
                }
                else
                {
                    demobilization.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                demobilization.SetColumnDefaults();
                return(demobilization);
            }
            finally
            {
                con.Close();
            }
            return(demobilization);
        }
 public demobilization Select(int id)
 {
     demobilization demobilization = new demobilization();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_DEMOBILIZATION", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@demo_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             demobilization.demo_id = rdr.GetInt32(0);
         }
         else
         {
             demobilization.demo_id = 0;
         }
         }
         else
         {
             demobilization.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     demobilization.SetColumnDefaults();
     return demobilization;
     }
     finally
     {
     con.Close();
     }
     return demobilization;
 }