/// <summary> /// Performs one "update" database command in a transactional context. /// * The method uses a transaction object already created and does not close the connection. /// * Must have "MultipleActiveResultSets=True" on connection string. /// </summary> /// <param name="OrdersInfo">Object to update.</param> /// <param name="transaction">Inform "DBTransaction".</param> /// <param name="errorMessage">Error message if exception is throwed.</param> public virtual void UpdateOne(OrdersInfo parOrdersInfo, DbTransaction transaction, out string errorMessage) { errorMessage = string.Empty; //If is trying to insert FKValue without the ID but has the unique description, //the system will try to get the class with the ID and populate it. if ((parOrdersInfo.CustomerID == null) && (parOrdersInfo.FK0_CompanyName != null)) { CustomersInfo fkClass = Get_CustomerIDID_FKCustomers(parOrdersInfo, transaction); parOrdersInfo.CustomerID = fkClass.CustomerID; } if ((parOrdersInfo.EmployeeID == null) && (parOrdersInfo.FK1_LastName != null)) { EmployeesInfo fkClass = Get_EmployeeIDID_FKEmployees(parOrdersInfo, transaction); parOrdersInfo.EmployeeID = fkClass.EmployeeID; } if ((parOrdersInfo.ShipVia == null) && (parOrdersInfo.FK2_CompanyName != null)) { ShippersInfo fkClass = Get_ShipViaID_FKShippers(parOrdersInfo, transaction); parOrdersInfo.ShipVia = fkClass.ShipperID; } OrdersDAO.UpdateOne(parOrdersInfo, transaction, out errorMessage); //By default, the caller of this method will do the commit. //motor.Commit(); //motor.CloseConnection(); }
/// <summary> /// Insert one register in database. /// </summary> /// <param name="parEmployeesInfo">Item to delete</param> /// <param name="transaction">Transaction context</param> /// <param name="errorMessage">Error message</param> public virtual void InsertOne(EmployeesInfo parEmployeesInfo, DbTransaction transaction, out string errorMessage) { errorMessage = null; try { motor.CommandText = GetInsertCommand(); ///Warning: performance issues with this automation. See method description for details. List <DbParameter> paramList = ParameterBuilder.GetParametersForInsert(typeof(EmployeesInfo), parEmployeesInfo, motor.Command); motor.ClearCommandParameters(); motor.AddCommandParameters(paramList); motor.AddTransaction(transaction); if (GetIdentity == true) { parEmployeesInfo.EmployeeID = motor.ExecuteScalar(); } else { motor.ExecuteNonQuery(); } } catch (Exception ex) { errorMessage = ex.Message; } }
/// <summary> /// Delete registers based on class values informed. MinValues and nulls are skipped. /// </summary> /// <param name="parEmployeesInfo">Item to delete</param> /// <param name="transaction">Transaction context</param> /// <param name="errorMessage">Error message</param> public virtual void Delete(EmployeesInfo parEmployeesInfo, DbTransaction transaction, out string errorMessage) { errorMessage = null; try { string whereClausule = string.Empty; var pks = GetPrimaryKey(); List <string> primaryKeys = new List <string>(); foreach (var item in pks) { primaryKeys.Add(item.Key); } List <DbParameter> paramList = ParameterBuilder.GetParametersForDelete(primaryKeys, typeof(EmployeesInfo), parEmployeesInfo, motor.Command, out whereClausule); motor.CommandText = GetDeleteCommand() + " " + whereClausule; motor.ClearCommandParameters(); motor.AddCommandParameters(paramList); motor.AddTransaction(transaction); motor.ExecuteNonQuery(); } catch (Exception ex) { errorMessage = ex.Message; } }
/// <summary> /// Get one register using only ID as key. /// </summary> /// <returns></returns> public virtual EmployeesInfo GetValueByID(int EmployeeID) { //ToDo: set multiple PK filter motor.ClearCommandParameters(); motor.CommandText = GetSelectCommand() + GetWherePrimaryKey(); List <DbParameter> paramList = new List <DbParameter>(); DbParameter paramEmployeeID = motor.Command.CreateParameter(); paramEmployeeID.ParameterName = "@param_EmployeeID"; paramEmployeeID.Value = EmployeeID; paramList.Add(paramEmployeeID); motor.AddCommandParameters(paramList); EmployeesInfo InfoValue = new EmployeesInfo(); DbDataReader dbReader = motor.ExecuteReader(); ClassFiller classFiller = new ClassFiller(typeof(EmployeesInfo), dbReader); using (dbReader) { if (dbReader.Read()) { InfoValue = new EmployeesInfo(); classFiller.Fill(InfoValue); } else { return(null); } } return(InfoValue); }
/// <summary> /// Delete registers based on ID informed. Other values are skipped. /// </summary> /// <param name="parEmployeesInfo">Item to delete</param> /// <param name="errorMessage">Error message</param> public virtual void DeleteByID(EmployeesInfo parEmployeesInfo, out string errorMessage) { EmployeesInfo newParam = new EmployeesInfo(); newParam.EmployeeID = parEmployeesInfo.EmployeeID; this.Delete(newParam, out errorMessage); }
public async Task <IActionResult> EditEmployee(Guid Id, [FromForm] Employees employee, [FromForm] EmployeesInfo empInfo, IFormFile fileImage) { try { var existEmployee = await _employeeData.GetEmployee(Id); if (existEmployee != null) { employee.Id = existEmployee.Id; employee.Password = BC.HashPassword(employee.Password); //Change name Image var image = _uploadFile.UploadImage(_hostEnvironment, "Assets/ProfileImage/", fileImage).Result; if (image != null) { var path = Path.Combine(_hostEnvironment.ContentRootPath, "Assets/ProfileImage/", existEmployee.ProfileImage); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } employee.ProfileImage = image; } return(Ok(await _employeeData.EditEmployee(employee, empInfo))); } return(NotFound(new { message = $"Not found Employee with Id: {Id}" })); } catch (Exception ex) { return(BadRequest(new { message = ex.InnerException.Message })); } }
public async Task <Employees> EditEmployee(Employees employee, EmployeesInfo empInfo) { var existEmployee = await _employeeContext.Employees.FindAsync(employee.Id); if (existEmployee != null) { existEmployee.Username = employee.Username; existEmployee.Password = employee.Password; existEmployee.IdRole = employee.IdRole; //Update Image Profile if (employee.ProfileImage != null) { existEmployee.ProfileImage = employee.ProfileImage; } //EmployeesInfo existEmployee.EmployeesInfo.Fullname = empInfo.Fullname; existEmployee.EmployeesInfo.Birthday = empInfo.Birthday; existEmployee.EmployeesInfo.Address = empInfo.Address; existEmployee.EmployeesInfo.PhoneNumber = empInfo.PhoneNumber; _employeeContext.Employees.Update(existEmployee); await _employeeContext.SaveChangesAsync(); //Don't show password existEmployee.Password = null; } return(existEmployee); }
/// <summary> /// Performs one "select * from MyTable where [InformedProperties]". MinValues and nulls are skipped from filter. /// </summary> /// <param name="filter">EmployeesInfo</param> /// <returns>List of found records.</returns> public virtual List <EmployeesInfo> GetSome(EmployeesInfo filter) { List <EmployeesInfo> AllInfoList = new List <EmployeesInfo>(); string filterWhere = string.Empty; List <DbParameter> paramList = null; GenerateWhere(filter, out filterWhere, out paramList); motor.ClearCommandParameters(); motor.AddCommandParameters(paramList); motor.CommandText = GetSelectCommand() + " " + filterWhere; DbDataReader dbReader = motor.ExecuteReader(); ClassFiller classFiller = new ClassFiller(typeof(EmployeesInfo), dbReader); using (dbReader) { while (dbReader.Read()) { EmployeesInfo EmployeesInfo = new EmployeesInfo(); ///Warning: performance issues with this automation. See method description for details. classFiller.Fill(EmployeesInfo); AllInfoList.Add(EmployeesInfo); } } return(AllInfoList); }
/// <summary> /// Delete registers based on class values informed. MinValues and nulls are skipped. /// Must have "MultipleActiveResultSets=True" on connection string. /// </summary> /// <param name="parEmployeesInfo">Item to delete</param> /// <param name="transaction">Transaction context</param> /// <param name="errorMessage">Error message</param> public virtual void Delete(EmployeesInfo parEmployeesInfo, DbTransaction transaction, out string errorMessage) { errorMessage = string.Empty; EmployeesDAO.Delete(parEmployeesInfo, transaction, out errorMessage); //By default, the caller of this method will do the commit. //motor.Commit(); //motor.CloseConnection(); }
public void DeleteData(ModelNotifiedForEmployees modelNotifiedForEmployees, out string error) { EmployeesBsn bsn = new EmployeesBsn(wpfConfig); EmployeesInfo dbItem = new EmployeesInfo(); Cloner.CopyAllTo(typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees, typeof(EmployeesInfo), dbItem); bsn.DeleteByID(dbItem, out error); }
/// <summary> /// Performs one "update" database command. /// Will commit the transaction and close the connection. Use for independent delete. /// </summary> /// <param name="EmployeesInfo">Object to update.</param> /// <param name="errorMessage">Error message if exception is throwed</param> public virtual void UpdateOne(EmployeesInfo parEmployeesInfo, out string errorMessage) { errorMessage = string.Empty; DbTransaction transaction = motor.BeginTransaction(); this.UpdateOne(parEmployeesInfo, transaction, out errorMessage); motor.Commit(); motor.CloseConnection(); }
public void AddData(ModelNotifiedForEmployees modelNotifiedForEmployees, out string error) { EmployeesBsn bsn = new EmployeesBsn(wpfConfig); EmployeesInfo dbItem = new EmployeesInfo(); Cloner.CopyAllTo(typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees, typeof(EmployeesInfo), dbItem); bsn.InsertOne(dbItem, out error); modelNotifiedForEmployees.NewItem = false; Cloner.CopyAllTo(typeof(EmployeesInfo), dbItem, typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees); }
public ModelNotifiedForEmployees GetEmployeesByID(int EmployeeID, out string error) { error = null; EmployeesBsn bsn = new EmployeesBsn(wpfConfig); EmployeesInfo dbItem = bsn.GetValueByID(EmployeeID); ModelNotifiedForEmployees item = new ModelNotifiedForEmployees(); Cloner.CopyAllTo(typeof(EmployeesInfo), dbItem, typeof(ModelNotifiedForEmployees), item); return(item); }
/// <summary> /// Delete registers based on class ID informed in transactional context. Other values are skipped. /// Must have "MultipleActiveResultSets=True" on connection string. /// </summary> /// <param name="parEmployeesInfo">Item to delete</param> /// <param name="transaction">Transaction context</param> /// <param name="errorMessage">Error message</param> public virtual void DeleteByID(EmployeesInfo parEmployeesInfo, DbTransaction transaction, out string errorMessage) { EmployeesInfo newParam = new EmployeesInfo(); newParam.EmployeeID = parEmployeesInfo.EmployeeID; this.Delete(newParam, transaction, out errorMessage); //By default, the caller of this method will do the commit. //motor.Commit(); //motor.CloseConnection(); }
/// <summary> /// Retrieves the data using only the primary key ID. Ex.: "Select * from MyTable where id=1" /// </summary> /// <returns>The class filled if found.</returns> public virtual EmployeesInfo GetValueByID(int EmployeeID) { motor.OpenConnection(); EmployeesInfo value = EmployeesDAO.GetValueByID(EmployeeID); if (this.closeConnectionWhenFinish) { motor.CloseConnection(); } return(value); }
/// <summary> /// Perform one "select" command to database. Filter the data using "filter" class. /// </summary> /// <param name="filter">Class to use as filter</param> /// <returns>List with filtered data</returns> public virtual List <EmployeesInfo> GetSome(EmployeesInfo filter) { motor.OpenConnection(); List <EmployeesInfo> list = EmployeesDAO.GetSome(filter); if (this.closeConnectionWhenFinish) { motor.CloseConnection(); } return(list); }
public async Task <Employees> AddEmployee(Employees employee, EmployeesInfo empInfo) { employee.Id = Guid.NewGuid(); await _employeeContext.Employees.AddAsync(employee); empInfo.IdEmployee = employee.Id; await _employeeContext.EmployeesInfo.AddAsync(empInfo); await _employeeContext.SaveChangesAsync(); return(employee); }
public void SaveData(ModelNotifiedForEmployees modelNotifiedForEmployees, out string error) { EmployeesBsn bsn = new EmployeesBsn(wpfConfig); EmployeesInfo dbItem = new EmployeesInfo(); Cloner.CopyAllTo(typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees, typeof(EmployeesInfo), dbItem); //Saving NxN data fro: EmployeeTerritories SaveNxNComboFor_EmployeeTerritories(modelNotifiedForEmployees, out error); bsn.UpdateOne(dbItem, out error); }
public async Task <string> RecognizePerson([FromForm] IFormFile file) { if (file is null || EmployeesInfo.IsTrained == false) { return(string.Empty); } try { return(await EmployeesInfo.IdentifyFacesAsync(file)); } catch (Exception e) { Console.WriteLine(e); return(string.Empty); } }
/// <summary> /// Performs one "update" database command in a transactional context. /// * The method uses a transaction object already created and does not close the connection. /// * Must have "MultipleActiveResultSets=True" on connection string. /// </summary> /// <param name="EmployeesInfo">Object to update.</param> /// <param name="transaction">Inform "DBTransaction".</param> /// <param name="errorMessage">Error message if exception is throwed.</param> public virtual void UpdateOne(EmployeesInfo parEmployeesInfo, DbTransaction transaction, out string errorMessage) { errorMessage = string.Empty; //If is trying to insert FKValue without the ID but has the unique description, //the system will try to get the class with the ID and populate it. if ((parEmployeesInfo.ReportsTo == null) && (parEmployeesInfo.FK0_FirstName != null)) { EmployeesInfo fkClass = Get_ReportsToID_FKEmployees(parEmployeesInfo, transaction); parEmployeesInfo.ReportsTo = fkClass.EmployeeID; } EmployeesDAO.UpdateOne(parEmployeesInfo, transaction, out errorMessage); //By default, the caller of this method will do the commit. //motor.Commit(); //motor.CloseConnection(); }
/// <summary> /// Performs a "update [FildList] set [FieldList] where id = @id". Must have the ID informed. /// </summary> /// <param name="parEmployeesInfo">Item to update</param> /// <param name="transaction">Transaction context</param> /// <param name="errorMessage">Error message</param> public virtual void UpdateOne(EmployeesInfo parEmployeesInfo, DbTransaction transaction, out string errorMessage) { errorMessage = null; try { motor.CommandText = GetUpdateCommand(); ///Warning: performance issues with this automation. See method description for details. List <DbParameter> paramList = ParameterBuilder.GetParametersForUpdate(typeof(EmployeesInfo), parEmployeesInfo, motor.Command); motor.ClearCommandParameters(); motor.AddCommandParameters(paramList); motor.AddTransaction(transaction); motor.ExecuteNonQuery(); } catch (Exception ex) { errorMessage = ex.Message; } }
/// <summary> /// Use parameters to apply simple filters /// </summary> /// <param name="filterExpression"></param> /// <returns></returns> public virtual List <EmployeesInfo> GetAll(List <DataFilterExpressionDB> filterExpression) { List <EmployeesInfo> AllInfoList = new List <EmployeesInfo>(); motor.ClearCommandParameters(); motor.CommandText = GetSelectCommand() + " where 1=1 "; List <DbParameter> paramList = new List <DbParameter>(); string where = ""; foreach (DataFilterExpressionDB filter in filterExpression) { DbParameter param = motor.Command.CreateParameter(); param.ParameterName = "@param_" + filter.FieldName; param.Value = filter.Filter; param.DbType = HelperDBType.GetDBType(typeof(EmployeesInfo), filter.FieldName); if (filter.FilterType == DataFilterExpressionDB._FilterType.Equal) { param.Value = filter.Filter; where += string.Format(" and Employees.{0} = {1}", filter.FieldName, param.ParameterName); } else { param.Value = "%" + filter.Filter + "%"; where += string.Format(" and Employees.{0} like {1}", filter.FieldName, param.ParameterName); } paramList.Add(param); } motor.CommandText += where; motor.AddCommandParameters(paramList); DbDataReader dbReader = motor.ExecuteReader(); ClassFiller classFiller = new ClassFiller(typeof(EmployeesInfo), dbReader); using (dbReader) { while (dbReader.Read()) { EmployeesInfo classInfo = new EmployeesInfo(); classFiller.Fill(classInfo); AllInfoList.Add(classInfo); } } return(AllInfoList); }
protected void listChiTiet_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e) { string s = e.Parameters.ToString(); List <EmployeesInfo> lsEmp = new List <EmployeesInfo>(); foreach (string sItem in s.Split(',')) { if (string.IsNullOrEmpty(sItem)) { continue; } int id = Convert.ToInt32(sItem); employees = objEmployees.GetEmployees(id); lsEmp.Add(employees); } listChiTiet.DataSource = lsEmp; listChiTiet.DataBind(); }
/// <summary> /// Performs one "Select * from MyTable". Use wisely. /// </summary> /// <returns>List of found records.</returns> public virtual List <EmployeesInfo> GetAll() { List <EmployeesInfo> AllInfoList = new List <EmployeesInfo>(); motor.CommandText = GetSelectCommand(); DbDataReader dbReader = motor.ExecuteReader(); ClassFiller classFiller = new ClassFiller(typeof(EmployeesInfo), dbReader); using (dbReader) { while (dbReader.Read()) { EmployeesInfo classInfo = new EmployeesInfo(); classFiller.Fill(classInfo); AllInfoList.Add(classInfo); } } return(AllInfoList); }
/// <summary> /// Same as get all but filter the result set /// </summary> /// <param name="numberOfRowsToSkip">Skip first X rows</param> /// <param name="numberOfRows">Like "TOP" in sql server</param> /// <returns></returns> public List <EmployeesInfo> GetAll(int numberOfRowsToSkip, int numberOfRows) { List <EmployeesInfo> AllInfoList = new List <EmployeesInfo>(); motor.CommandText = base.GetFilteredRowNumAndSkipQuery("AttributeLists", "id", numberOfRowsToSkip, numberOfRows); DbDataReader dbReader = motor.ExecuteReader(); ClassFiller classFiller = new ClassFiller(typeof(EmployeesInfo), dbReader); using (dbReader) { while (dbReader.Read()) { EmployeesInfo classInfo = new EmployeesInfo(); classFiller.Fill(classInfo); AllInfoList.Add(classInfo); } } return(AllInfoList); }
/// <summary> /// Delete registers based on class values informed. MinValues and nulls are skipped. /// </summary> /// <param name="parEmployeesInfo">Item to delete</param> /// <param name="errorMessage">Error message</param> public virtual void Delete(EmployeesInfo parEmployeesInfo, out string errorMessage) { errorMessage = string.Empty; //1) Start the transaction context. DbTransaction transaction = motor.BeginTransaction(); //2) Call the overload of this method, which call the DAO but does not commit. this.Delete(parEmployeesInfo, transaction, out errorMessage); //3) Commit the transaction. motor.Commit(); //4) Close the conection (if configured to do so). if (this.closeConnectionWhenFinish) { motor.CloseConnection(); } }
public async Task <IActionResult> AddEmployee([FromForm] Employees employee, [FromForm] EmployeesInfo empInfo, IFormFile fileImage) { try { var image = _uploadFile.UploadImage(_hostEnvironment, "Assets/ProfileImage/", fileImage).Result; if (image != null) { employee.ProfileImage = image; employee.Password = BC.HashPassword(employee.Password); await _employeeData.AddEmployee(employee, empInfo); return(Created(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + HttpContext.Request.Path + "/" + employee.Id, employee)); } return(BadRequest(new { message = "fileImage require .png .jpg .jpge" })); } catch (Exception ex) { return(BadRequest(new { message = ex.InnerException.Message })); } }
/// <summary> /// Perform a search to find the class "EmployeesInfo" using as key the field "Employees". /// </summary> /// <param name="parEmployeesInfo">Main class that contains the aggregation.</param> /// <returns>Foreing key attched class.</returns> public virtual EmployeesInfo Get_ReportsToID_FKEmployees(EmployeesInfo parEmployeesInfo, DbTransaction transaction) { EmployeesInfo filter = new EmployeesInfo(); filter.FirstName = parEmployeesInfo.FK0_FirstName; EmployeesBsn myClass = new EmployeesBsn(false, this.motor); List <EmployeesInfo> list = myClass.GetSome(filter); if (list.Count == 0) { //This error occurs when try to search for the ID in one table, but it does not find the value. //Ex.: Select id,SomeField from myTable where SomeField='myValue') If no data return, this error will trigger. throw new Exception(string.Format("Can not define ID for parEmployeesInfo.", parEmployeesInfo.FK0_FirstName)); /* [Hint] The code below do one insert in the table "Employees" informing only the "EmployeeID" field. * [Warning] The code may crash if other fields are necessary. * [Instructions] Comment the exception above. Uncomment the code below. */ //string errorMsg = string.Empty; //myClass.InsertOne(filter, transaction, out errorMsg); //if (errorMsg != string.Empty) //{ //throw new Exception(errorMsg); //} //else //{ //return filter; //} } if (list.Count > 1) { //This error occurs when try to search for the ID in one table, but it return more then one value. //Ex.: Select id,SomeField from myTable where SomeField='myValue') If more then one line return, this error will trigger. throw new Exception(string.Format("Can not define ID for parEmployeesInfo. Theres more then one ID value for this field. ", parEmployeesInfo.FK0_FirstName)); } else { //Return the only one class found. return(list[0]); } }
public void TryUpdate(UpdateEmployeesView viewToUpdate, out RestExceptionError error) { error = null; EmployeesInfo dbViewToInclude = new EmployeesInfo(); try { Cloner.CopyAllTo(typeof(UpdateEmployeesView), viewToUpdate, typeof(EmployeesInfo), dbViewToInclude); } catch (Exception ex) { error = new RestExceptionError(); error.InternalMessage = "Internal Error parsing data for (Employees.TryUpdate/Parsing)"; error.ExceptionMessage = ex.Message; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ex.StackTrace; } try { EmployeesBsn bsn = new EmployeesBsn(restConfig); string dbError = null; bsn.UpdateOne(dbViewToInclude, out dbError); if (dbError != null) { error = new RestExceptionError(); error.InternalMessage = "Internal Error Save data for [Employees.TryUpdate]"; error.ExceptionMessage = dbError; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ""; } } catch (Exception ex) { error = new RestExceptionError(); error.InternalMessage = "Internal Error Update data for [Employees.TryUpdate]"; error.ExceptionMessage = ex.Message; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ex.StackTrace; } }
/// <summary> /// Performs one "insert into" database command in a transactional context. /// * The method uses a transaction object already created and does not close the connection. /// * Must have "MultipleActiveResultSets=True" on connection string. /// </summary> /// <param name="EmployeeTerritoriesInfo">Object to insert.</param> /// <param name="transaction">Inform "DBTransaction".</param> /// <param name="errorMessage">Error message if exception is throwed.</param> public virtual void InsertOne(EmployeeTerritoriesInfo parEmployeeTerritoriesInfo, DbTransaction transaction, out string errorMessage) { errorMessage = string.Empty; //If is trying to insert FKValue without the ID but has the unique description, //the system will try to get the class with the ID and populate it. if ((parEmployeeTerritoriesInfo.EmployeeID == Int32.MinValue) && (parEmployeeTerritoriesInfo.FK0_LastName != null)) { EmployeesInfo fkClass = Get_EmployeeIDID_FKEmployees(parEmployeeTerritoriesInfo, transaction); parEmployeeTerritoriesInfo.EmployeeID = fkClass.EmployeeID; } if ((parEmployeeTerritoriesInfo.TerritoryID == string.Empty) && (parEmployeeTerritoriesInfo.FK1_TerritoryDescription != null)) { TerritoriesInfo fkClass = Get_TerritoryIDID_FKTerritories(parEmployeeTerritoriesInfo, transaction); parEmployeeTerritoriesInfo.TerritoryID = fkClass.TerritoryID; } EmployeeTerritoriesDAO.InsertOne(parEmployeeTerritoriesInfo, transaction, out errorMessage); //By default, the caller of this method will do the commit. //motor.Commit(); //motor.CloseConnection(); }