using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
/// <summary>
/// Summary description for SQLAccess
/// </summary>
public class SQLAccess
{
public SQLAccess()
{
//
// TODO: Add constructor logic here
//
}
public static DataTable GetTransportationFormsByDate(DateTime startDate, DateTime endDate)
{
DbCommand comm = GenericDataAccess.CreateCommand();
comm.CommandText = "GetTransportationFormsByDate";
DbParameter param = comm.CreateParameter();
param.ParameterName = "@StartDate";
param.Value = startDate;
param.DbType = DbType.DateTime;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@EndDate";
param.Value = endDate;
param.DbType = DbType.DateTime;
comm.Parameters.Add(param);
return GenericDataAccess.ExecuteSelectCommand(comm);
}
public static string GetUniqueID()
{
DbCommand comm = GenericDataAccess.CreateCommand();
comm.CommandText = "GetUniqueID";
DataTable results = GenericDataAccess.ExecuteSelectCommand(comm);
string rstring = results.Rows[0]["UniqueID"].ToString();
return rstring;
}
public static void InsertTransportationOrderForm(string residentName, string floorRoom, string appointmentDate, string drdept,
string suite, string address, string appointmentTime, string requestedBy, string pickupTime, string transportType, string requestNumber, string provideWheelchair, string stretcherReason)
{
DbCommand comm = GenericDataAccess.CreateCommand();
comm.CommandText = "InsertTransportationOrderForm";
DbParameter param = comm.CreateParameter();
param.ParameterName = "@ResidentName";
param.Value = residentName;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@Floor_Room";
param.Value = floorRoom;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@AppointmentDate";
param.Value = appointmentDate;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@DR_Dept";
param.Value = drdept;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@Suite";
param.Value = suite;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@Address";
param.Value = address;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@AppointmentTime";
param.Value = appointmentTime;
param.DbType = DbType.String;
comm.Parameters.Add(param);
/*
param = comm.CreateParameter();
param.ParameterName = "@Transporter";
param.Value = transporter;
param.DbType = DbType.String;
comm.Parameters.Add(param);
*/
param = comm.CreateParameter();
param.ParameterName = "@RequestedBy";
param.Value = requestedBy;
param.DbType = DbType.String;
comm.Parameters.Add(param);
/*
param = comm.CreateParameter();
param.ParameterName = "@ArrangedBy";
param.Value = arrangedBy;
param.DbType = DbType.String;
comm.Parameters.Add(param);
*/
param = comm.CreateParameter();
param.ParameterName = "@PickupTime";
param.Value = pickupTime;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@TransportType";
param.Value = transportType;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@StretcherReason";
param.Value = stretcherReason;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@ProvideWheelChair";
param.Value = provideWheelchair;
param.DbType = DbType.String;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@RequestNumber";
param.Value = requestNumber;
param.DbType = DbType.String;
comm.Parameters.Add(param);
GenericDataAccess.ExecuteNonQuery(comm);
}
public static DataTable GetTransportationOrderForm(string requestNumber)
{
DbCommand comm = GenericDataAccess.CreateCommand();
comm.CommandText = "GetTransportationOrderForm";
DbParameter param = comm.CreateParameter();
param.ParameterName = "@RequestNumber";
param.Value = requestNumber;
param.DbType = DbType.String;
comm.Parameters.Add(param);
return GenericDataAccess.ExecuteSelectCommand(comm);
}
/*/
* CREATE PROCEDURE InsertTransportationOrderForm
-- Add the parameters for the stored procedure here
@ResidentName NVARCHAR(50),
@Floor_Room NVARCHAR(50),
@AppointmentDate DATETIME,
@DR_Dept NVARCHAR(50),
@Suite NVARCHAR(50),
@Address NVARCHAR(50),
@AppointmentTime NVARCHAR(50),
@Transporter NVARCHAR(50),
@RequestedBy NVARCHAR(50),
@ArrangedBy NVARCHAR(50),
@PickupTime NVARCHAR(50),
@TransportType NVARCHAR(50)
*/
}