Пример #1
0
 public vehicle vehicle_insert()
 {
     vehicle = vehicle.Insert(vehicle);
     Insert_vehicle_GridView.DataBind();
     Update_vehicle_GridView.DataBind();
     Delete_vehicle_GridView.DataBind();
     return(vehicle);
 }
Пример #2
0
 public vehicle Insert_vehicle_select(int ID)
 {
     vehicle = vehicle.Select(ID);
     Insert_vehicle_brand_txt.Text       = Convert.ToString(vehicle.vehicle_brand);
     Insert_vehicle_model_txt.Text       = Convert.ToString(vehicle.vehicle_model);
     Insert_vehicle_year_txt.Text        = Convert.ToString(vehicle.vehicle_year);
     Insert_vehicle_description_txt.Text = Convert.ToString(vehicle.vehicle_description);
     return(vehicle);
 }
 public vehicle Insert_vehicle_select(int ID)
 {
     vehicle = vehicle.Select(ID);
     Insert_vehicle_brand_txt.Text = Convert.ToString(vehicle.vehicle_brand);
     Insert_vehicle_model_txt.Text = Convert.ToString(vehicle.vehicle_model);
     Insert_vehicle_year_txt.Text = Convert.ToString(vehicle.vehicle_year);
     Insert_vehicle_description_txt.Text = Convert.ToString(vehicle.vehicle_description);
     return vehicle;
 }
Пример #4
0
 public vehicle vehicle_update(int ID)
 {
     vehicle            = vehicle.Select(ID);
     vehicle.vehicle_id = Convert.ToInt32(Update_vehicle_id_txt.Text);
     vehicle.Update(vehicle);
     Insert_vehicle_GridView.DataBind();
     Update_vehicle_GridView.DataBind();
     Delete_vehicle_GridView.DataBind();
     return(vehicle);
 }
        public Boolean Update(vehicle id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_VEHICLE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@vehicle_id", id.vehicle_id);
                cmd.Parameters.AddWithValue("@case_id", id.case_id);
                cmd.Parameters.AddWithValue("@client_id", id.client_id);
                cmd.Parameters.AddWithValue("@vehicle_make", id.vehicle_make);
                cmd.Parameters.AddWithValue("@vehicle_model", id.vehicle_model);
                cmd.Parameters.AddWithValue("@vehicle_type", id.vehicle_type);
                cmd.Parameters.AddWithValue("@vehicle_year", id.vehicle_year);
                cmd.Parameters.AddWithValue("@vehicle_desc", id.vehicle_desc);
                cmd.Parameters.AddWithValue("@vin", id.vin);
                cmd.Parameters.AddWithValue("@start_mileage", id.start_mileage);
                cmd.Parameters.AddWithValue("@first_service_date", id.first_service_date);
                cmd.Parameters.AddWithValue("@last_service_date", id.last_service_date);
                cmd.Parameters.AddWithValue("@PLATENUMBER", id.PLATENUMBER);
                cmd.Parameters.AddWithValue("@FUELTYPE", id.FUELTYPE);
                cmd.Parameters.AddWithValue("@MPH", id.MPH);
                cmd.Parameters.AddWithValue("@INSURED", id.INSURED);
                cmd.ExecuteReader();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
Пример #6
0
 protected void INSERT(object sender, EventArgs e)
 {
     vehicle = vehicle_insert();
 }
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Update Tab Methods
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     vehicle = Update_vehicle_select(Convert.ToInt32(Update_vehicle_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     vehicle = vehicle_update(Convert.ToInt32(Update_vehicle_GridView.SelectedValue));
 }
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Insert Tab Methods
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     vehicle = Insert_vehicle_select(Convert.ToInt32(Insert_vehicle_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     vehicle = vehicle_insert();
 }
Пример #11
0
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Update Tab Methods
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     vehicle = Update_vehicle_select(Convert.ToInt32(Update_vehicle_GridView.SelectedValue));
 }
        public vehicle Insert(vehicle id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_VEHICLE", 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("@vehicle_make", id.vehicle_make);
                cmd.Parameters.AddWithValue("@vehicle_model", id.vehicle_model);
                cmd.Parameters.AddWithValue("@vehicle_type", id.vehicle_type);
                cmd.Parameters.AddWithValue("@vehicle_year", id.vehicle_year);
                cmd.Parameters.AddWithValue("@vehicle_desc", id.vehicle_desc);
                cmd.Parameters.AddWithValue("@vin", id.vin);
                cmd.Parameters.AddWithValue("@start_mileage", id.start_mileage);
                cmd.Parameters.AddWithValue("@first_service_date", id.first_service_date);
                cmd.Parameters.AddWithValue("@last_service_date", id.last_service_date);
                cmd.Parameters.AddWithValue("@PLATENUMBER", id.PLATENUMBER);
                cmd.Parameters.AddWithValue("@FUELTYPE", id.FUELTYPE);
                cmd.Parameters.AddWithValue("@MPH", id.MPH);
                cmd.Parameters.AddWithValue("@INSURED", id.INSURED);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_VEHICLE", 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("@vehicle_make", id.vehicle_make);
                cmd.Parameters.AddWithValue("@vehicle_model", id.vehicle_model);
                cmd.Parameters.AddWithValue("@vehicle_type", id.vehicle_type);
                cmd.Parameters.AddWithValue("@vehicle_year", id.vehicle_year);
                cmd.Parameters.AddWithValue("@vehicle_desc", id.vehicle_desc);
                cmd.Parameters.AddWithValue("@vin", id.vin);
                cmd.Parameters.AddWithValue("@start_mileage", id.start_mileage);
                cmd.Parameters.AddWithValue("@first_service_date", id.first_service_date);
                cmd.Parameters.AddWithValue("@last_service_date", id.last_service_date);
                cmd.Parameters.AddWithValue("@PLATENUMBER", id.PLATENUMBER);
                cmd.Parameters.AddWithValue("@FUELTYPE", id.FUELTYPE);
                cmd.Parameters.AddWithValue("@MPH", id.MPH);
                cmd.Parameters.AddWithValue("@INSURED", id.INSURED);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.vehicle_id = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
 public vehicle vehicle_insert()
 {
     vehicle = vehicle.Insert(vehicle);
     Insert_vehicle_GridView.DataBind();
     Update_vehicle_GridView.DataBind();
     Delete_vehicle_GridView.DataBind();
     return vehicle;
 }
Пример #14
0
 /////////////////////////
 ////////////////////////
 ///////////////////////
 //////////////////////
 /////////////////////
 //Insert Tab Methods
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     vehicle = Insert_vehicle_select(Convert.ToInt32(Insert_vehicle_GridView.SelectedValue));
 }
Пример #15
0
 protected void UPDATE(object sender, EventArgs e)
 {
     vehicle = vehicle_update(Convert.ToInt32(Update_vehicle_GridView.SelectedValue));
 }
 public Boolean Update(vehicle id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_VEHICLE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@vehicle_id", id.vehicle_id);
     cmd.Parameters.AddWithValue("@case_id", id.case_id);
     cmd.Parameters.AddWithValue("@client_id", id.client_id);
     cmd.Parameters.AddWithValue("@vehicle_make", id.vehicle_make);
     cmd.Parameters.AddWithValue("@vehicle_model", id.vehicle_model);
     cmd.Parameters.AddWithValue("@vehicle_type", id.vehicle_type);
     cmd.Parameters.AddWithValue("@vehicle_year", id.vehicle_year);
     cmd.Parameters.AddWithValue("@vehicle_desc", id.vehicle_desc);
     cmd.Parameters.AddWithValue("@vin", id.vin);
     cmd.Parameters.AddWithValue("@start_mileage", id.start_mileage);
     cmd.Parameters.AddWithValue("@first_service_date", id.first_service_date);
     cmd.Parameters.AddWithValue("@last_service_date", id.last_service_date);
     cmd.Parameters.AddWithValue("@PLATENUMBER", id.PLATENUMBER);
     cmd.Parameters.AddWithValue("@FUELTYPE", id.FUELTYPE);
     cmd.Parameters.AddWithValue("@MPH", id.MPH);
     cmd.Parameters.AddWithValue("@INSURED", id.INSURED);
     cmd.ExecuteReader();
     con.Close();
     return true;
     }
     catch (Exception ex)
     {
     return false;
     }
     finally
     {
     con.Close();
     }
 }
 public vehicle Select(int id)
 {
     vehicle vehicle = new vehicle();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_VEHICLE", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@vehicle_id", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             vehicle.vehicle_id = rdr.GetInt32(0);
         }
         else
         {
             vehicle.vehicle_id = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             vehicle.case_id = rdr.GetInt32(1);
         }
         else
         {
             vehicle.case_id = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             vehicle.client_id = rdr.GetInt32(2);
         }
         else
         {
             vehicle.client_id = 0;
         }
         if (!rdr.IsDBNull(3))
         {
             vehicle.vehicle_make = rdr.GetString(3);
         }
         else
         {
             vehicle.vehicle_make = " ";
         }
         if (!rdr.IsDBNull(4))
         {
             vehicle.vehicle_model = rdr.GetString(4);
         }
         else
         {
             vehicle.vehicle_model = " ";
         }
         if (!rdr.IsDBNull(5))
         {
             vehicle.vehicle_type = rdr.GetString(5);
         }
         else
         {
             vehicle.vehicle_type = " ";
         }
         if (!rdr.IsDBNull(6))
         {
             vehicle.vehicle_year = rdr.GetInt32(6);
         }
         else
         {
             vehicle.vehicle_year = 0;
         }
         if (!rdr.IsDBNull(7))
         {
             vehicle.vehicle_desc = rdr.GetString(7);
         }
         else
         {
             vehicle.vehicle_desc = " ";
         }
         if (!rdr.IsDBNull(8))
         {
             vehicle.vin = rdr.GetString(8);
         }
         else
         {
             vehicle.vin = " ";
         }
         if (!rdr.IsDBNull(9))
         {
             vehicle.start_mileage = rdr.GetInt32(9);
         }
         else
         {
             vehicle.start_mileage = 0;
         }
         if (!rdr.IsDBNull(10))
         {
             vehicle.first_service_date = rdr.GetDateTime(10);
         }
         else
         {
             vehicle.first_service_date = DateTime.Now;
         }
         if (!rdr.IsDBNull(11))
         {
             vehicle.last_service_date = rdr.GetDateTime(11);
         }
         else
         {
             vehicle.last_service_date = DateTime.Now;
         }
         if (!rdr.IsDBNull(12))
         {
             vehicle.PLATENUMBER = rdr.GetString(12);
         }
         else
         {
             vehicle.PLATENUMBER = " ";
         }
         if (!rdr.IsDBNull(13))
         {
             vehicle.FUELTYPE = rdr.GetString(13);
         }
         else
         {
             vehicle.FUELTYPE = " ";
         }
         if (!rdr.IsDBNull(14))
         {
             vehicle.MPH = rdr.GetInt32(14);
         }
         else
         {
             vehicle.MPH = 0;
         }
         if (!rdr.IsDBNull(15))
         {
             vehicle.INSURED = rdr.GetString(15);
         }
         else
         {
             vehicle.INSURED = " ";
         }
         }
         else
         {
             vehicle.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     vehicle.SetColumnDefaults();
     return vehicle;
     }
     finally
     {
     con.Close();
     }
     return vehicle;
 }
 public vehicle Insert(vehicle id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_VEHICLE", 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("@vehicle_make", id.vehicle_make);
     cmd.Parameters.AddWithValue("@vehicle_model", id.vehicle_model);
     cmd.Parameters.AddWithValue("@vehicle_type", id.vehicle_type);
     cmd.Parameters.AddWithValue("@vehicle_year", id.vehicle_year);
     cmd.Parameters.AddWithValue("@vehicle_desc", id.vehicle_desc);
     cmd.Parameters.AddWithValue("@vin", id.vin);
     cmd.Parameters.AddWithValue("@start_mileage", id.start_mileage);
     cmd.Parameters.AddWithValue("@first_service_date", id.first_service_date);
     cmd.Parameters.AddWithValue("@last_service_date", id.last_service_date);
     cmd.Parameters.AddWithValue("@PLATENUMBER", id.PLATENUMBER);
     cmd.Parameters.AddWithValue("@FUELTYPE", id.FUELTYPE);
     cmd.Parameters.AddWithValue("@MPH", id.MPH);
     cmd.Parameters.AddWithValue("@INSURED", id.INSURED);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_VEHICLE", 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("@vehicle_make", id.vehicle_make);
     cmd.Parameters.AddWithValue("@vehicle_model", id.vehicle_model);
     cmd.Parameters.AddWithValue("@vehicle_type", id.vehicle_type);
     cmd.Parameters.AddWithValue("@vehicle_year", id.vehicle_year);
     cmd.Parameters.AddWithValue("@vehicle_desc", id.vehicle_desc);
     cmd.Parameters.AddWithValue("@vin", id.vin);
     cmd.Parameters.AddWithValue("@start_mileage", id.start_mileage);
     cmd.Parameters.AddWithValue("@first_service_date", id.first_service_date);
     cmd.Parameters.AddWithValue("@last_service_date", id.last_service_date);
     cmd.Parameters.AddWithValue("@PLATENUMBER", id.PLATENUMBER);
     cmd.Parameters.AddWithValue("@FUELTYPE", id.FUELTYPE);
     cmd.Parameters.AddWithValue("@MPH", id.MPH);
     cmd.Parameters.AddWithValue("@INSURED", id.INSURED);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.vehicle_id = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
 public vehicle vehicle_update(int ID)
 {
     vehicle = vehicle.Select(ID);
     vehicle.vehicle_id = Convert.ToInt32(Update_vehicle_id_txt.Text);
     vehicle.Update(vehicle);
     Insert_vehicle_GridView.DataBind();
     Update_vehicle_GridView.DataBind();
     Delete_vehicle_GridView.DataBind();
     return vehicle;
 }
        public vehicle Select(int id)
        {
            vehicle       vehicle          = new vehicle();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_VEHICLE", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@vehicle_id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        vehicle.vehicle_id = rdr.GetInt32(0);
                    }
                    else
                    {
                        vehicle.vehicle_id = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        vehicle.case_id = rdr.GetInt32(1);
                    }
                    else
                    {
                        vehicle.case_id = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        vehicle.client_id = rdr.GetInt32(2);
                    }
                    else
                    {
                        vehicle.client_id = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        vehicle.vehicle_make = rdr.GetString(3);
                    }
                    else
                    {
                        vehicle.vehicle_make = " ";
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        vehicle.vehicle_model = rdr.GetString(4);
                    }
                    else
                    {
                        vehicle.vehicle_model = " ";
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        vehicle.vehicle_type = rdr.GetString(5);
                    }
                    else
                    {
                        vehicle.vehicle_type = " ";
                    }
                    if (!rdr.IsDBNull(6))
                    {
                        vehicle.vehicle_year = rdr.GetInt32(6);
                    }
                    else
                    {
                        vehicle.vehicle_year = 0;
                    }
                    if (!rdr.IsDBNull(7))
                    {
                        vehicle.vehicle_desc = rdr.GetString(7);
                    }
                    else
                    {
                        vehicle.vehicle_desc = " ";
                    }
                    if (!rdr.IsDBNull(8))
                    {
                        vehicle.vin = rdr.GetString(8);
                    }
                    else
                    {
                        vehicle.vin = " ";
                    }
                    if (!rdr.IsDBNull(9))
                    {
                        vehicle.start_mileage = rdr.GetInt32(9);
                    }
                    else
                    {
                        vehicle.start_mileage = 0;
                    }
                    if (!rdr.IsDBNull(10))
                    {
                        vehicle.first_service_date = rdr.GetDateTime(10);
                    }
                    else
                    {
                        vehicle.first_service_date = DateTime.Now;
                    }
                    if (!rdr.IsDBNull(11))
                    {
                        vehicle.last_service_date = rdr.GetDateTime(11);
                    }
                    else
                    {
                        vehicle.last_service_date = DateTime.Now;
                    }
                    if (!rdr.IsDBNull(12))
                    {
                        vehicle.PLATENUMBER = rdr.GetString(12);
                    }
                    else
                    {
                        vehicle.PLATENUMBER = " ";
                    }
                    if (!rdr.IsDBNull(13))
                    {
                        vehicle.FUELTYPE = rdr.GetString(13);
                    }
                    else
                    {
                        vehicle.FUELTYPE = " ";
                    }
                    if (!rdr.IsDBNull(14))
                    {
                        vehicle.MPH = rdr.GetInt32(14);
                    }
                    else
                    {
                        vehicle.MPH = 0;
                    }
                    if (!rdr.IsDBNull(15))
                    {
                        vehicle.INSURED = rdr.GetString(15);
                    }
                    else
                    {
                        vehicle.INSURED = " ";
                    }
                }
                else
                {
                    vehicle.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                vehicle.SetColumnDefaults();
                return(vehicle);
            }
            finally
            {
                con.Close();
            }
            return(vehicle);
        }