Ejemplo n.º 1
0
        public static Route GetRouteByID_Route(int routeid)
        {
            Route route = new Route();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetRouteByID");
            dbconn.AddParameterToList("routeid", SqlDbType.Int, routeid);

            dbconn.SetSqlParameters();

            if (dbconn.ExecuteStoredProcedureDataTable().Rows.Count == 1)
            {
                foreach (DataRow routeDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
                {
                    object dropofftime     = ValueValidater.ReturnValue(routeDR["DropOffTime"]);
                    object dropofflocation = ValueValidater.ReturnValue(routeDR["DropOffLocation"]);

                    if (dropofftime != null && dropofflocation != null)
                    {
                        route = new Route(routeid, routeDR["PickupTime"].ToString(), routeDR["PickUpLocation"].ToString(),
                                          (Status)routeDR["StatusID"], dropofftime.ToString(), dropofflocation.ToString());
                    }
                    else
                    {
                        route = new Route(routeid, routeDR["PickupTime"].ToString(), routeDR["PickUpLocation"].ToString(),
                                          (Status)routeDR["StatusID"], null, null);
                    }
                }
            }

            return(route);
        }
Ejemplo n.º 2
0
        public static Driver GetDriverByID_Driver(int driverID)
        {
            Driver newDriver = new Driver();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetDriverByID");
            dbconn.AddParameterToList("DriverID", SqlDbType.Int, driverID);
            dbconn.SetSqlParameters();

            if (dbconn.ExecuteStoredProcedureDataTable().Rows.Count == 1)
            {
                foreach (DataRow driverDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
                {
                    object dropofftime     = ValueValidater.ReturnValue(driverDR["DropOffTime"]);
                    object dropofflocation = ValueValidater.ReturnValue(driverDR["DropOffLocation"]);

                    if (dropofftime != null && dropofflocation != null)
                    {
                        newDriver = new Driver(driverID, driverDR["FirstName"].ToString(),
                                               driverDR["LastName"].ToString(), driverDR["BadgeNumber"].ToString(),
                                               driverDR["StartDate"].ToString(), driverDR["EndDate"].ToString());
                    }
                    else
                    {
                        newDriver = new Driver(driverID, driverDR["FirstName"].ToString(),
                                               driverDR["LastName"].ToString(), driverDR["BadgeNumber"].ToString(),
                                               driverDR["StartDate"].ToString(), driverDR["EndDate"].ToString());
                    }
                }
            }

            return(newDriver);
        }
Ejemplo n.º 3
0
        public static string DeleteDriverByID_String(int driverid)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("DeleteDriver");
            dbconn.AddParameterToList("DriverID", SqlDbType.Int, driverid);

            dbconn.SetSqlParameters();
            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 4
0
        public static string CreateContract_String(Contract contract)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertContract");
            dbconn.AddParameterToList("contractname", SqlDbType.Text, contract.ContractName);
            dbconn.AddParameterToList("statename", SqlDbType.Text, contract.StateName);

            dbconn.SetSqlParameters();
            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 5
0
        public static string CreateLocation_String(Location location)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertLocation");
            dbconn.AddParameterToList("LocationName", SqlDbType.Text, location.LocationName);
            dbconn.AddParameterToList("Address", SqlDbType.Text, location.Address);

            dbconn.SetSqlParameters();
            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 6
0
        public static string CreateRoutePickUp_String(string pickuplocationname)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertRoutePickUp");
            dbconn.AddParameterToList("pickuptime", SqlDbType.DateTime, DateTime.Now);
            dbconn.AddParameterToList("pickuplocationname", SqlDbType.Text, pickuplocationname);

            dbconn.SetSqlParameters();
            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 7
0
        public static string CreateSignee_String(Signee signee)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertSignee");
            dbconn.AddParameterToList("FirstName", SqlDbType.Text, signee.FirstName);
            dbconn.AddParameterToList("LastName", SqlDbType.Text, signee.LastName);

            dbconn.SetSqlParameters();

            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 8
0
        public static string CreateRouteDropOff_String(int routeid, string dropofflocationname)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertRouteDropOff");

            dbconn.AddParameterToList("dropofftime", SqlDbType.DateTime, DateTime.Now);
            dbconn.AddParameterToList("dropofflocationname", SqlDbType.Text, dropofflocationname);
            dbconn.AddParameterToList("routeid", SqlDbType.Int, routeid);

            dbconn.SetSqlParameters();
            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 9
0
        public static string CreateDriver_String(Driver driver)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertDriver");
            dbconn.AddParameterToList("FirstName", SqlDbType.Text, driver.FirstName);
            dbconn.AddParameterToList("LastName", SqlDbType.Text, driver.LastName);
            dbconn.AddParameterToList("StartDate", SqlDbType.Date, driver.StartDate);
            dbconn.AddParameterToList("EndDate", SqlDbType.Date, driver.EndDate);
            dbconn.AddParameterToList("BadgeNumber", SqlDbType.Text, driver.BadgeNumber);

            dbconn.SetSqlParameters();
            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 10
0
        public static string UpdateRoute_String(Route route)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("UpdateRoute");

            dbconn.AddParameterToList("routeid", SqlDbType.Int, route.ID);
            dbconn.AddParameterToList("pickuptime", SqlDbType.DateTime, Convert.ToDateTime(route.PickUpTime));
            dbconn.AddParameterToList("dropofftime", SqlDbType.DateTime, Convert.ToDateTime(route.DropOffTime));
            dbconn.AddParameterToList("pickuplocation", SqlDbType.Text, route.PickUpLocation.LocationName);
            dbconn.AddParameterToList("dropofflocation", SqlDbType.Text, route.DropOffLocation.LocationName);
            dbconn.AddParameterToList("status", SqlDbType.Int, (int)route.Status);

            dbconn.SetSqlParameters();

            return(dbconn.ExecuteStoredProcedureString());
        }
Ejemplo n.º 11
0
        public static Signee GetSigneeByID_Signee(int signeeID)
        {
            Signee newSignee = new Signee();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetSigneeByID");
            dbconn.AddParameterToList("SigneeID", SqlDbType.Int, signeeID);
            dbconn.SetSqlParameters();

            foreach (DataRow signeeDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                newSignee = new Signee(signeeID, signeeDR["FirstName"].ToString(),
                                       signeeDR["LastName"].ToString());
            }

            return(newSignee);
        }
Ejemplo n.º 12
0
        public static Contract GetContractByID_Contract(int contractID)
        {
            Contract newContract = new Contract();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetContractByID");
            dbconn.AddParameterToList("ContractID", SqlDbType.Int, contractID);
            dbconn.SetSqlParameters();

            foreach (DataRow contractDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                newContract = new Contract(contractID, contractDR["ContractName"].ToString(),
                                           contractDR["StateName"].ToString());
            }

            return(newContract);
        }
Ejemplo n.º 13
0
        public static Location GetLocationByID_Location(int locationID)
        {
            Location newLocation = new Location();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetLocationByID");
            dbconn.AddParameterToList("LocationID", SqlDbType.Int, locationID);
            dbconn.SetSqlParameters();

            foreach (DataRow locationDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                newLocation = new Location(locationID, locationDR["LocationName"].ToString(),
                                           locationDR["Address"].ToString());
            }

            return(newLocation);
        }
Ejemplo n.º 14
0
        public static Location UpdateLocation_Location(Location location)
        {
            Location updatedLocation = new Location();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("UpdateLocation");

            dbconn.AddParameterToList("locationid", SqlDbType.Int, location.ID);
            dbconn.AddParameterToList("locationname", SqlDbType.Text, location.LocationName);
            dbconn.AddParameterToList("address", SqlDbType.Text, location.Address);

            dbconn.SetSqlParameters();

            foreach (DataRow locationDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                updatedLocation = new Location((int)locationDR["LocationID"], locationDR["LocationName"].ToString(),
                                               locationDR["Address"].ToString());
            }

            return(updatedLocation);
        }
Ejemplo n.º 15
0
        public static List <Route> GetRoutesByContractID_ListRoute(int contractid)
        {
            List <Route> RouteList = new List <Route>();
            Route        newRoute  = new Route();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetRoutesByContract");

            dbconn.AddParameterToList("contractid", SqlDbType.Int, contractid);
            dbconn.SetSqlParameters();

            foreach (DataRow routeDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                newRoute = new Route((int)routeDR["RouteID"], routeDR["PickupTime"].ToString(),
                                     routeDR["PickupLocation"].ToString(), (Status)routeDR["StatusID"]
                                     , routeDR["DropOffTime"].ToString(), routeDR["DropoffLocation"].ToString());

                RouteList.Add(newRoute);
            }

            return(RouteList);
        }