data access(reservation)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
public class DALSky
{
public DataSet GetReservationById(int resid)
{
using (SqlConnection conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_GetReservationByRId", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@resid",resid);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet dtst = new DataSet();
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
//get reservation
public DataSet GetReseravation()
{
using (SqlConnection Conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_GetReservation", Conn);
cmd.CommandType = CommandType.StoredProcedure;
DataSet dtst = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
//set co line data
public int SetReservation(ArrayList data)
{
using (SqlConnection Conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_SetReservation", Conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@nvcAirport_Trip", data[0]);
cmd.Parameters.AddWithValue("@nvcRound_Trip", data[1]);
cmd.Parameters.AddWithValue("@nvcRide_Type", data[2]);
cmd.Parameters.AddWithValue("@inNumber_Of_Adult", data[3]);
cmd.Parameters.AddWithValue("@inNumber_Of_Children", data[4]);
cmd.Parameters.AddWithValue("@dtPickup_Date", data[5]);
cmd.Parameters.AddWithValue("@nvcFirst_Name", data[6]);
cmd.Parameters.AddWithValue("@nvcLast_Name", data[7]);
cmd.Parameters.AddWithValue("@nvcTelephoneNo", data[8]);
cmd.Parameters.AddWithValue("@nvcEmail", data[9]);
cmd.Parameters.AddWithValue("@nvcAirLine_Name", data[10]);
cmd.Parameters.AddWithValue("@dtAirLine_Time", data[11]);
cmd.Parameters.AddWithValue("@nvcAddress", data[12]);
cmd.Parameters.AddWithValue("@inTourLength", data[13]);
cmd.Parameters.AddWithValue("@dcCost", data[14]);
cmd.Parameters.AddWithValue("@nvcNo_Of_Bags", data[15]);
cmd.Parameters.AddWithValue("@nvcComments", data[16]);
cmd.Parameters.AddWithValue("@nvcReservation_No", data[17]);
cmd.Parameters.AddWithValue("@inRes_Id", data[18]);
cmd.Parameters.AddWithValue("@dtCreated_On", data[19]);
return cmd.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
}
}
//update reservation
public int UpdateReservationGrid(ArrayList data)
{
using (SqlConnection Conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_UpdateReservationGrid", Conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@resid", data[0]);
cmd.Parameters.AddWithValue("@dtPickup_Date", data[1]);
cmd.Parameters.AddWithValue("@nvcTelephoneNo", data[2]);
cmd.Parameters.AddWithValue("@nvcFirst_Name", data[3]);
cmd.Parameters.AddWithValue("@nvcLast_Name", data[4]);
cmd.Parameters.AddWithValue("@nvcReservation_No", data[5]);
cmd.Parameters.AddWithValue("@nvcEmail", data[6]);
cmd.Parameters.AddWithValue("@nvcAddress", data[7]);
cmd.Parameters.AddWithValue("@nvcProgress_State", data[8]);
//new parameters
cmd.Parameters.AddWithValue("@nvcDriver_Name", data[9]);
cmd.Parameters.AddWithValue("@dtAirLine_Time", data[10]);
cmd.Parameters.AddWithValue("@nvcAirport_Trip", data[11]);
cmd.Parameters.AddWithValue("@nvcFare_Type", data[12]);
cmd.Parameters.AddWithValue("@dcCost", data[13]);
cmd.Parameters.AddWithValue("@nvcRound_Trip", data[14]);
cmd.Parameters.AddWithValue("@nvcRide_Type", data[15]);
cmd.Parameters.AddWithValue("@nvcAirLine_Name", data[16]);
cmd.Parameters.AddWithValue("@nvcComments", data[17]);
return cmd.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
public class DALSky
{
public DataSet GetReservationById(int resid)
{
using (SqlConnection conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_GetReservationByRId", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@resid",resid);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet dtst = new DataSet();
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
//get reservation
public DataSet GetReseravation()
{
using (SqlConnection Conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_GetReservation", Conn);
cmd.CommandType = CommandType.StoredProcedure;
DataSet dtst = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
//set co line data
public int SetReservation(ArrayList data)
{
using (SqlConnection Conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_SetReservation", Conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@nvcAirport_Trip", data[0]);
cmd.Parameters.AddWithValue("@nvcRound_Trip", data[1]);
cmd.Parameters.AddWithValue("@nvcRide_Type", data[2]);
cmd.Parameters.AddWithValue("@inNumber_Of_Adult", data[3]);
cmd.Parameters.AddWithValue("@inNumber_Of_Children", data[4]);
cmd.Parameters.AddWithValue("@dtPickup_Date", data[5]);
cmd.Parameters.AddWithValue("@nvcFirst_Name", data[6]);
cmd.Parameters.AddWithValue("@nvcLast_Name", data[7]);
cmd.Parameters.AddWithValue("@nvcTelephoneNo", data[8]);
cmd.Parameters.AddWithValue("@nvcEmail", data[9]);
cmd.Parameters.AddWithValue("@nvcAirLine_Name", data[10]);
cmd.Parameters.AddWithValue("@dtAirLine_Time", data[11]);
cmd.Parameters.AddWithValue("@nvcAddress", data[12]);
cmd.Parameters.AddWithValue("@inTourLength", data[13]);
cmd.Parameters.AddWithValue("@dcCost", data[14]);
cmd.Parameters.AddWithValue("@nvcNo_Of_Bags", data[15]);
cmd.Parameters.AddWithValue("@nvcComments", data[16]);
cmd.Parameters.AddWithValue("@nvcReservation_No", data[17]);
cmd.Parameters.AddWithValue("@inRes_Id", data[18]);
cmd.Parameters.AddWithValue("@dtCreated_On", data[19]);
return cmd.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
}
}
//update reservation
public int UpdateReservationGrid(ArrayList data)
{
using (SqlConnection Conn = DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_UpdateReservationGrid", Conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@resid", data[0]);
cmd.Parameters.AddWithValue("@dtPickup_Date", data[1]);
cmd.Parameters.AddWithValue("@nvcTelephoneNo", data[2]);
cmd.Parameters.AddWithValue("@nvcFirst_Name", data[3]);
cmd.Parameters.AddWithValue("@nvcLast_Name", data[4]);
cmd.Parameters.AddWithValue("@nvcReservation_No", data[5]);
cmd.Parameters.AddWithValue("@nvcEmail", data[6]);
cmd.Parameters.AddWithValue("@nvcAddress", data[7]);
cmd.Parameters.AddWithValue("@nvcProgress_State", data[8]);
//new parameters
cmd.Parameters.AddWithValue("@nvcDriver_Name", data[9]);
cmd.Parameters.AddWithValue("@dtAirLine_Time", data[10]);
cmd.Parameters.AddWithValue("@nvcAirport_Trip", data[11]);
cmd.Parameters.AddWithValue("@nvcFare_Type", data[12]);
cmd.Parameters.AddWithValue("@dcCost", data[13]);
cmd.Parameters.AddWithValue("@nvcRound_Trip", data[14]);
cmd.Parameters.AddWithValue("@nvcRide_Type", data[15]);
cmd.Parameters.AddWithValue("@nvcAirLine_Name", data[16]);
cmd.Parameters.AddWithValue("@nvcComments", data[17]);
return cmd.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
}
}
0 comments:
Post a Comment