コード例 #1
0
        public Boolean Update(relative id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_RELATIVE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@relative_id", id.relative_id);
                cmd.Parameters.AddWithValue("@case_id", id.case_id);
                cmd.Parameters.AddWithValue("@client_id", id.client_id);
                cmd.Parameters.AddWithValue("@address_id", id.address_id);
                cmd.Parameters.AddWithValue("@relative_help_memo", id.relative_help_memo);
                cmd.Parameters.AddWithValue("@will_help", id.will_help);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
コード例 #2
0
        public relative Insert(relative id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_RELATIVE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@case_id", id.case_id);
                cmd.Parameters.AddWithValue("@client_id", id.client_id);
                cmd.Parameters.AddWithValue("@address_id", id.address_id);
                cmd.Parameters.AddWithValue("@relative_help_memo", id.relative_help_memo);
                cmd.Parameters.AddWithValue("@will_help", id.will_help);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_RELATIVE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@case_id", id.case_id);
                cmd.Parameters.AddWithValue("@client_id", id.client_id);
                cmd.Parameters.AddWithValue("@address_id", id.address_id);
                cmd.Parameters.AddWithValue("@relative_help_memo", id.relative_help_memo);
                cmd.Parameters.AddWithValue("@will_help", id.will_help);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.relative_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
コード例 #3
0
 public relative Insert(relative id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_RELATIVE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@case_id", id.case_id);
     cmd.Parameters.AddWithValue("@client_id", id.client_id);
     cmd.Parameters.AddWithValue("@address_id", id.address_id);
     cmd.Parameters.AddWithValue("@relative_help_memo", id.relative_help_memo);
     cmd.Parameters.AddWithValue("@will_help", id.will_help);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_RELATIVE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@case_id", id.case_id);
     cmd.Parameters.AddWithValue("@client_id", id.client_id);
     cmd.Parameters.AddWithValue("@address_id", id.address_id);
     cmd.Parameters.AddWithValue("@relative_help_memo", id.relative_help_memo);
     cmd.Parameters.AddWithValue("@will_help", id.will_help);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.relative_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
コード例 #4
0
 public Boolean Update(relative id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_RELATIVE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@relative_id", id.relative_id);
     cmd.Parameters.AddWithValue("@case_id", id.case_id);
     cmd.Parameters.AddWithValue("@client_id", id.client_id);
     cmd.Parameters.AddWithValue("@address_id", id.address_id);
     cmd.Parameters.AddWithValue("@relative_help_memo", id.relative_help_memo);
     cmd.Parameters.AddWithValue("@will_help", id.will_help);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }
コード例 #5
0
 public relative Select(int id)
 {
     relative relative = new relative();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_RELATIVE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@relative_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             relative.relative_id = rdr.GetInt32(0);
         }
         else
         {
             relative.relative_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             relative.case_id = rdr.GetInt32(1);
         }
         else
         {
             relative.case_id = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             relative.client_id = rdr.GetInt32(2);
         }
         else
         {
             relative.client_id = 0;
         }
         if (!rdr.IsDBNull(3))
         {
             relative.address_id = rdr.GetInt32(3);
         }
         else
         {
             relative.address_id = 0;
         }
         if (!rdr.IsDBNull(4))
         {
             relative.relative_help_memo = rdr.GetString(4);
         }
         else
         {
             relative.relative_help_memo = " ";
         }
         if (!rdr.IsDBNull(5))
         {
             relative.will_help = rdr.GetString(5);
         }
         else
         {
             relative.will_help = " ";
         }
         }
         else
         {
             relative.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     relative.SetColumnDefaults();
     return relative;
     }
     finally
     {
     con.Close();
     }
     return relative;
 }
コード例 #6
0
        public relative Select(int id)
        {
            relative      relative         = new relative();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_RELATIVE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@relative_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        relative.relative_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        relative.relative_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        relative.case_id = rdr.GetInt32(1);
                    }
                    else
                    {
                        relative.case_id = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        relative.client_id = rdr.GetInt32(2);
                    }
                    else
                    {
                        relative.client_id = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        relative.address_id = rdr.GetInt32(3);
                    }
                    else
                    {
                        relative.address_id = 0;
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        relative.relative_help_memo = rdr.GetString(4);
                    }
                    else
                    {
                        relative.relative_help_memo = " ";
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        relative.will_help = rdr.GetString(5);
                    }
                    else
                    {
                        relative.will_help = " ";
                    }
                }
                else
                {
                    relative.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                relative.SetColumnDefaults();
                return(relative);
            }
            finally
            {
                con.Close();
            }
            return(relative);
        }