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

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_DEMOBILIZATION_LOCATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@demo_location_id", id.demo_location_id);
                cmd.Parameters.AddWithValue("@demo_id", id.demo_id);
                cmd.Parameters.AddWithValue("@location_id", id.location_id);
                cmd.Parameters.AddWithValue("@location_description", id.location_description);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 2
0
 public demobilization_location Insert_demobilization_location_select(int ID)
 {
     demobilization_location              = demobilization_location.Select(ID);
     Insert_demo_id_txt.Text              = Convert.ToString(demobilization_location.demo_id);
     Insert_location_id_txt.Text          = Convert.ToString(demobilization_location.location_id);
     Insert_location_description_txt.Text = Convert.ToString(demobilization_location.location_description);
     return(demobilization_location);
 }
Ejemplo n.º 3
0
 public demobilization_location demobilization_location_insert()
 {
     demobilization_location.demo_id              = Convert.ToInt32(Insert_demo_id_txt.Text);
     demobilization_location.location_id          = Convert.ToInt32(Insert_location_id_txt.Text);
     demobilization_location.location_description = Insert_location_description_txt.Text;
     demobilization_location = demobilization_location.Insert(demobilization_location);
     Insert_demobilization_location_GridView.DataBind();
     Update_demobilization_location_GridView.DataBind();
     Delete_demobilization_location_GridView.DataBind();
     return(demobilization_location);
 }
Ejemplo n.º 4
0
 public demobilization_location demobilization_location_update(int ID)
 {
     demobilization_location = demobilization_location.Select(ID);
     demobilization_location.demo_location_id     = Convert.ToInt32(Update_demo_location_id_txt.Text);
     demobilization_location.demo_id              = Convert.ToInt32(Update_demo_id_txt.Text);
     demobilization_location.location_id          = Convert.ToInt32(Update_location_id_txt.Text);
     demobilization_location.location_description = Update_location_description_txt.Text;
     demobilization_location.Update(demobilization_location);
     Insert_demobilization_location_GridView.DataBind();
     Update_demobilization_location_GridView.DataBind();
     Delete_demobilization_location_GridView.DataBind();
     return(demobilization_location);
 }
        public demobilization_location Insert(demobilization_location id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_DEMOBILIZATION_LOCATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@demo_id", id.demo_id);
                cmd.Parameters.AddWithValue("@location_id", id.location_id);
                cmd.Parameters.AddWithValue("@location_description", id.location_description);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_DEMOBILIZATION_LOCATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@demo_id", id.demo_id);
                cmd.Parameters.AddWithValue("@location_id", id.location_id);
                cmd.Parameters.AddWithValue("@location_description", id.location_description);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.demo_location_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
Ejemplo n.º 6
0
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Update Tab Methods
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     demobilization_location = Update_demobilization_location_select(Convert.ToInt32(Update_demobilization_location_GridView.SelectedValue));
 }
Ejemplo n.º 7
0
 protected void INSERT(object sender, EventArgs e)
 {
     demobilization_location = demobilization_location_insert();
 }
Ejemplo n.º 8
0
 protected void UPDATE(object sender, EventArgs e)
 {
     demobilization_location = demobilization_location_update(Convert.ToInt32(Update_demobilization_location_GridView.SelectedValue));
 }
        public demobilization_location Select(int id)
        {
            demobilization_location demobilization_location = new demobilization_location();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_DEMOBILIZATION_LOCATION", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@demo_location_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        demobilization_location.demo_location_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        demobilization_location.demo_location_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        demobilization_location.demo_id = rdr.GetInt32(1);
                    }
                    else
                    {
                        demobilization_location.demo_id = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        demobilization_location.location_id = rdr.GetInt32(2);
                    }
                    else
                    {
                        demobilization_location.location_id = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        demobilization_location.location_description = rdr.GetString(3);
                    }
                    else
                    {
                        demobilization_location.location_description = " ";
                    }
                }
                else
                {
                    demobilization_location.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                demobilization_location.SetColumnDefaults();
                return(demobilization_location);
            }
            finally
            {
                con.Close();
            }
            return(demobilization_location);
        }