//public executeReuslt InsertResponseLog(string payRes) //{ // dbConnector objConn = new dbConnector(); // SqlConnection Conn = objConn.GetConnection; // Conn.Open(); // int result = 0; // executeReuslt r = new executeReuslt(); // try // { // if (Conn.State != System.Data.ConnectionState.Open) // Conn.Open(); // SqlCommand objCommand = new SqlCommand("INSERT_LOG_WEB", Conn); // if (string.IsNullOrEmpty(payRes) == false) // { // objCommand.CommandType = CommandType.StoredProcedure; // objCommand.Parameters.AddWithValue("@payRes", payRes); // result = Convert.ToInt32(objCommand.ExecuteScalar()); // } // if (result > 0) // { // r.memberId = ""; // r.refId = ""; // r.result = result; // return r; // } // else // { // r.memberId = "Error"; // r.refId = "Error"; // r.result = 0; // return r; // } // } // catch (Exception ex) // { // r.memberId = "Error"; // r.refId = "Error"; // r.result = 0; // return r; // } // finally // { // if (Conn != null) // { // if (Conn.State == ConnectionState.Open) // { // Conn.Close(); // Conn.Dispose(); // } // } // } //} public Trip AssignPassengerToTrip(string passengerId) { dbConnector objConn = new dbConnector(); SqlConnection Conn = objConn.GetConnection; Conn.Open(); Trip item = new Trip(); try { if (Conn.State != System.Data.ConnectionState.Open) { Conn.Open(); } SqlCommand objCommand = new SqlCommand("[CodeCamp].[Assign_PassengerToTrip]", Conn); objCommand.CommandType = CommandType.StoredProcedure; objCommand.Parameters.AddWithValue("@PassengerId", Convert.ToInt32(passengerId)); objCommand.Parameters.Add("@DriverId", SqlDbType.Int); objCommand.Parameters["@DriverId"].Direction = ParameterDirection.Output; objCommand.Parameters.Add("@PickupGate", SqlDbType.Int); objCommand.Parameters["@PickupGate"].Direction = ParameterDirection.Output; SqlDataReader _Reader = objCommand.ExecuteReader(); while (_Reader.Read()) { item.PassengerId = Convert.ToInt32(_Reader["PassengerId"]); item.DriverId = Convert.ToInt32(_Reader["DriverId"]); item.PickupGate = Convert.ToInt32(_Reader["PickupGate"]); item.CompanyId = Convert.ToInt32(_Reader["CompanyId"]); item.DriverName = _Reader["DriverName"].ToString(); item.DriverQID = _Reader["QID"].ToString(); item.PlateNum = _Reader["PlateNum"].ToString(); } return(item); } catch (Exception ex) { item.DriverId = -3; item.PickupGate = 0; return(item); } finally { if (Conn != null) { if (Conn.State == ConnectionState.Open) { Conn.Close(); Conn.Dispose(); } } } }
public List <TaxiProvider> ReadTaxiProvidersList() { List <TaxiProvider> tpList = new List <TaxiProvider>(); dbConnector objConn = new dbConnector(); SqlConnection Conn = objConn.GetConnection; Conn.Open(); try { if (Conn.State != System.Data.ConnectionState.Open) { Conn.Open(); } SqlCommand objCommand = new SqlCommand("[qpu].[Read_TaxiProviders]", Conn); objCommand.CommandType = CommandType.StoredProcedure; SqlDataReader _Reader = objCommand.ExecuteReader(); while (_Reader.Read()) { TaxiProvider tp = new TaxiProvider(); tp.Id = Convert.ToInt32(_Reader["Id"]); tp.Name = _Reader["Name"].ToString(); tp.Quote = Convert.ToInt32(_Reader["Quote"]); tpList.Add(tp); } return(tpList); } catch (Exception ex) { throw ex; } finally { if (Conn != null) { if (Conn.State == ConnectionState.Open) { Conn.Close(); Conn.Dispose(); } } } }
public int ReadPassengerCount() { int needRideCount = -1; dbConnector objConn = new dbConnector(); SqlConnection Conn = objConn.GetConnection; Conn.Open(); try { if (Conn.State != System.Data.ConnectionState.Open) { Conn.Open(); } SqlCommand objCommand = new SqlCommand("[CodeCamp].Read_PassengerCount", Conn); objCommand.CommandType = CommandType.StoredProcedure; SqlDataReader _Reader = objCommand.ExecuteReader(); while (_Reader.Read()) { needRideCount = Convert.ToInt32(_Reader["needRideCount"]); } return(needRideCount); } catch (Exception ex) { throw ex; } finally { if (Conn != null) { if (Conn.State == ConnectionState.Open) { Conn.Close(); Conn.Dispose(); } } } }
public executeReuslt GenerateFlightInfoDb(string userName) { dbConnector objConn = new dbConnector(); SqlConnection Conn = objConn.GetConnection; Conn.Open(); int result = 0; executeReuslt r = new executeReuslt(); r.result = 0; r.addedCount = "-1"; try { if (Conn.State != System.Data.ConnectionState.Open) { Conn.Open(); } SqlCommand objCommand = new SqlCommand("[CodeCamp].[GENERATE_FLIGHTINFO]", Conn); objCommand.CommandType = CommandType.StoredProcedure; objCommand.Parameters.Add("@AddedCount", SqlDbType.Int); objCommand.Parameters["@AddedCount"].Direction = ParameterDirection.Output; result = Convert.ToInt32(objCommand.ExecuteScalar()); if (result > 0) { r.addedCount = objCommand.Parameters["@AddedCount"].Value.ToString(); r.result = result; return(r); } else { r.addedCount = "-2"; r.result = 0; return(r); } } catch (Exception ex) { r.addedCount = "-3"; r.result = 0; return(r); } finally { if (Conn != null) { if (Conn.State == ConnectionState.Open) { Conn.Close(); Conn.Dispose(); } } } }