public Driver GetDriver(Guid id) { Driver driver = new Driver(); SqlService sql = new SqlService(_sqlConnection); sql.AddParameter("@pDriverKey", System.Data.SqlDbType.UniqueIdentifier, id); using (SqlDataReader reader = sql.ExecuteSPReader("ICMS_spGetDriver")) { if (reader.HasRows) { while (reader.Read()) { driver.Id = id; // reader.SafeGetGuid(reader.GetOrdinal("DriverKey")).Value; driver.DriverName = reader.SafeGetString(reader.GetOrdinal("DriverName")); driver.DriverMobileNo = reader.SafeGetString(reader.GetOrdinal("DriverMobile")); driver.AssignedTT = reader.SafeGetString(reader.GetOrdinal("AssignedTT")); } } } return driver; }
private void CreateUpdateDriver(Driver driver) { // MMD_spUpdateDriver] //@pDriverKey as uniqueidentifier = NULL, //@pTTKey as uniqueidentifier = NULL, //@pTTNo as varchar(20), //@pDriverName as varchar(250), //@pDriverMobile as bigint SqlService sql = new SqlService(_sqlConnection); if (driver.Id != null) sql.AddParameter("@pDriverKey", System.Data.SqlDbType.UniqueIdentifier, driver.Id); sql.AddParameter("@pTTNo", System.Data.SqlDbType.VarChar, driver.AssignedTT); sql.AddParameter("@pDriverName", System.Data.SqlDbType.VarChar, driver.DriverName); sql.AddParameter("@pDriverMobile", System.Data.SqlDbType.VarChar, driver.DriverMobileNo); sql.ExecuteSP("MMD_spUpdateDriver"); }
public void UpdateDriver(Driver driver) { CreateUpdateDriver(driver); }