public Boolean Update(disaster_project_resource id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_DISASTER_PROJECT_RESOURCE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@disaster_project_resource_id", id.disaster_project_resource_id);
                cmd.Parameters.AddWithValue("@person_hours_id", id.person_hours_id);
                cmd.Parameters.AddWithValue("@person_total_hours", id.person_total_hours);
                cmd.Parameters.AddWithValue("@person_total_cost", id.person_total_cost);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
 public disaster_project_resource Insert_disaster_project_resource_select(int ID)
 {
     disaster_project_resource          = disaster_project_resource.Select(ID);
     Insert_person_hours_id_txt.Text    = Convert.ToString(disaster_project_resource.person_hours_id);
     Insert_person_total_hours_txt.Text = Convert.ToString(disaster_project_resource.person_total_hours);
     Insert_person_total_cost_txt.Text  = Convert.ToString(disaster_project_resource.person_total_cost);
     return(disaster_project_resource);
 }
 public disaster_project_resource Delete_disaster_project_resource_select(int ID)
 {
     disaster_project_resource = disaster_project_resource.Select(ID);
     Delete_disaster_project_resource_id_txt_lbl.Text = Convert.ToString(disaster_project_resource.disaster_project_resource_id);
     Delete_person_hours_id_txt_lbl.Text = Convert.ToString(disaster_project_resource.person_hours_id);
     Delete_person_total_hours_txt_lbl.Text = Convert.ToString(disaster_project_resource.person_total_hours);
     Delete_person_total_cost_txt_lbl.Text = Convert.ToString(disaster_project_resource.person_total_cost);
     return disaster_project_resource;
 }
 public disaster_project_resource disaster_project_resource_insert()
 {
     disaster_project_resource.person_hours_id = Convert.ToInt32(Insert_person_hours_id_txt.Text);
     disaster_project_resource.person_total_hours = Convert.ToDecimal(Insert_person_total_hours_txt.Text);
     disaster_project_resource.person_total_cost = Convert.ToDecimal(Insert_person_total_cost_txt.Text);
     disaster_project_resource = disaster_project_resource.Insert(disaster_project_resource);
     Insert_disaster_project_resource_GridView.DataBind();
     Update_disaster_project_resource_GridView.DataBind();
     Delete_disaster_project_resource_GridView.DataBind();
     return disaster_project_resource;
 }
 public disaster_project_resource disaster_project_resource_insert()
 {
     disaster_project_resource.person_hours_id    = Convert.ToInt32(Insert_person_hours_id_txt.Text);
     disaster_project_resource.person_total_hours = Convert.ToDecimal(Insert_person_total_hours_txt.Text);
     disaster_project_resource.person_total_cost  = Convert.ToDecimal(Insert_person_total_cost_txt.Text);
     disaster_project_resource = disaster_project_resource.Insert(disaster_project_resource);
     Insert_disaster_project_resource_GridView.DataBind();
     Update_disaster_project_resource_GridView.DataBind();
     Delete_disaster_project_resource_GridView.DataBind();
     return(disaster_project_resource);
 }
        public disaster_project_resource Insert(disaster_project_resource id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_DISASTER_PROJECT_RESOURCE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@person_hours_id", id.person_hours_id);
                cmd.Parameters.AddWithValue("@person_total_hours", id.person_total_hours);
                cmd.Parameters.AddWithValue("@person_total_cost", id.person_total_cost);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_DISASTER_PROJECT_RESOURCE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@person_hours_id", id.person_hours_id);
                cmd.Parameters.AddWithValue("@person_total_hours", id.person_total_hours);
                cmd.Parameters.AddWithValue("@person_total_cost", id.person_total_cost);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.disaster_project_resource_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
 public disaster_project_resource Insert(disaster_project_resource id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_DISASTER_PROJECT_RESOURCE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@person_hours_id", id.person_hours_id);
     cmd.Parameters.AddWithValue("@person_total_hours", id.person_total_hours);
     cmd.Parameters.AddWithValue("@person_total_cost", id.person_total_cost);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_DISASTER_PROJECT_RESOURCE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@person_hours_id", id.person_hours_id);
     cmd.Parameters.AddWithValue("@person_total_hours", id.person_total_hours);
     cmd.Parameters.AddWithValue("@person_total_cost", id.person_total_cost);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.disaster_project_resource_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Update Tab Methods
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     disaster_project_resource = Update_disaster_project_resource_select(Convert.ToInt32(Update_disaster_project_resource_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     disaster_project_resource = disaster_project_resource_update(Convert.ToInt32(Update_disaster_project_resource_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     disaster_project_resource = disaster_project_resource_insert();
 }
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Update Tab Methods
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     disaster_project_resource = Update_disaster_project_resource_select(Convert.ToInt32(Update_disaster_project_resource_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     disaster_project_resource = disaster_project_resource_insert();
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     disaster_project_resource = disaster_project_resource_update(Convert.ToInt32(Update_disaster_project_resource_GridView.SelectedValue));
 }
        public disaster_project_resource Select(int id)
        {
            disaster_project_resource disaster_project_resource = new disaster_project_resource();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_DISASTER_PROJECT_RESOURCE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@disaster_project_resource_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        disaster_project_resource.disaster_project_resource_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        disaster_project_resource.disaster_project_resource_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        disaster_project_resource.person_hours_id = rdr.GetInt32(1);
                    }
                    else
                    {
                        disaster_project_resource.person_hours_id = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        disaster_project_resource.person_total_hours = rdr.GetDecimal(2);
                    }
                    else
                    {
                        disaster_project_resource.person_total_hours = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        disaster_project_resource.person_total_cost = rdr.GetDecimal(3);
                    }
                    else
                    {
                        disaster_project_resource.person_total_cost = 0;
                    }
                }
                else
                {
                    disaster_project_resource.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                disaster_project_resource.SetColumnDefaults();
                return(disaster_project_resource);
            }
            finally
            {
                con.Close();
            }
            return(disaster_project_resource);
        }
 public Boolean Update(disaster_project_resource id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_DISASTER_PROJECT_RESOURCE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@disaster_project_resource_id", id.disaster_project_resource_id);
     cmd.Parameters.AddWithValue("@person_hours_id", id.person_hours_id);
     cmd.Parameters.AddWithValue("@person_total_hours", id.person_total_hours);
     cmd.Parameters.AddWithValue("@person_total_cost", id.person_total_cost);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }
 public disaster_project_resource Select(int id)
 {
     disaster_project_resource disaster_project_resource = new disaster_project_resource();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_DISASTER_PROJECT_RESOURCE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@disaster_project_resource_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             disaster_project_resource.disaster_project_resource_id = rdr.GetInt32(0);
         }
         else
         {
             disaster_project_resource.disaster_project_resource_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             disaster_project_resource.person_hours_id = rdr.GetInt32(1);
         }
         else
         {
             disaster_project_resource.person_hours_id = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             disaster_project_resource.person_total_hours = rdr.GetDecimal(2);
         }
         else
         {
             disaster_project_resource.person_total_hours = 0;
         }
         if (!rdr.IsDBNull(3))
         {
             disaster_project_resource.person_total_cost = rdr.GetDecimal(3);
         }
         else
         {
             disaster_project_resource.person_total_cost = 0;
         }
         }
         else
         {
             disaster_project_resource.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     disaster_project_resource.SetColumnDefaults();
     return disaster_project_resource;
     }
     finally
     {
     con.Close();
     }
     return disaster_project_resource;
 }