protected override void Edit() { HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory CarSystemFactory = new HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory(); try { HPS.BLL.CarSystemBLL.BLLCarSystem_T CarSystemEntity = new HPS.BLL.CarSystemBLL.BLLCarSystem_T(); CarSystemEntity.CarSystem_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CarSystem_nvcTextBox.Text, TypeCode.String).ToString(); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { CarSystemFactory.BeginProc(); CarSystemFactory.Update(CarSystemEntity, (HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys)Key); CarSystemFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystemID_int.ToString() + "='" + ((HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys)Key).CarSystemID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystem_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CarSystemEntity.CarSystem_nvc, TypeCode.String); } DataTable.AcceptChanges(); } } } catch (Exception ex) { CarSystemFactory.RollBackProc(); throw ex; } }
protected override void Insert() { HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory CarSystemFactory = new HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory(); try { HPS.BLL.CarSystemBLL.BLLCarSystem_T CarSystemEntity = new HPS.BLL.CarSystemBLL.BLLCarSystem_T(); CarSystemEntity.CarSystem_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CarSystem_nvcTextBox.Text, TypeCode.String).ToString(); CarSystemFactory.BeginProc(); CarSystemFactory.Insert(CarSystemEntity); CarSystemFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystemID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CarSystemEntity.CarSystemID_int, TypeCode.Int32); dr[HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystem_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CarSystemEntity.CarSystem_nvc, TypeCode.String); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { CarSystemFactory.RollBackProc(); throw ex; } }
public void Insert(HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_CarSystem_T_Add]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter CarSystemID_int = new SqlParameter(); CarSystemID_int.ParameterName = "@CarSystemID_int"; CarSystemID_int.SqlDbType = SqlDbType.Int; CarSystemID_int.Direction = ParameterDirection.Output; CarSystemID_int.IsNullable = false; CarSystemID_int.Value = businessObject.CarSystemID_int; this.Command.Parameters.Add(CarSystemID_int); SqlParameter CarSystem_nvc = new SqlParameter(); CarSystem_nvc.ParameterName = "@CarSystem_nvc"; CarSystem_nvc.SqlDbType = SqlDbType.NVarChar; CarSystem_nvc.Direction = ParameterDirection.Input; CarSystem_nvc.IsNullable = true; if (String.IsNullOrEmpty(businessObject.CarSystem_nvc)) { CarSystem_nvc.Value = DBNull.Value; } else { CarSystem_nvc.Value = businessObject.CarSystem_nvc; } this.Command.Parameters.Add(CarSystem_nvc); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); businessObject.CarSystemID_int = (Int32)(this.Command.Parameters["@CarSystemID_int"].Value); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public HPS.BLL.CarSystemBLL.BLLCarSystem_T SelectByPrimaryKey(HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_CarSystem_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter CarSystemID_int = new SqlParameter(); CarSystemID_int.ParameterName = "@CarSystemID_int"; CarSystemID_int.SqlDbType = SqlDbType.Int; CarSystemID_int.Direction = ParameterDirection.Input; CarSystemID_int.IsNullable = false; CarSystemID_int.Value = businessObjectKey.CarSystemID_int; this.Command.Parameters.Add(CarSystemID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject = new HPS.BLL.CarSystemBLL.BLLCarSystem_T(); if (dataReader.Read()) { PopulateBusinessObjectFromReader(businessObject, dataReader); } else { businessObject = null; } if (dataReader.IsClosed == false) { dataReader.Close(); } if (ControlConnection) { this.Commit(); } return(businessObject); } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
protected override void ShowForm() { this.FillCombo(); HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory CarSystemFactory = new HPS.BLL.CarSystemBLL.BLLCarSystem_TFactory(); HPS.BLL.CarSystemBLL.BLLCarSystem_T CarSystemEntity = CarSystemFactory.GetBy((HPS.BLL.CarSystemBLL.BLLCarSystem_TKeys)Key); if (CarSystemEntity == null) { throw new HPS.Exceptions.CarSystemNotFound(); } CarSystem_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CarSystemEntity.CarSystem_nvc, TypeCode.String)); }
public List <HPS.BLL.CarSystemBLL.BLLCarSystem_T> PopulateObjectsFromReader(IDataReader dataReader) { List <HPS.BLL.CarSystemBLL.BLLCarSystem_T> list = new List <HPS.BLL.CarSystemBLL.BLLCarSystem_T>(); while (dataReader.Read()) { HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject = new HPS.BLL.CarSystemBLL.BLLCarSystem_T(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); }
public void PopulateBusinessObjectFromReader(HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject, IDataReader dataReader) { businessObject.CarSystemID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystemID_int.ToString())); if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystem_nvc.ToString())) == false) { businessObject.CarSystem_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CarSystemBLL.BLLCarSystem_T.CarSystem_TField.CarSystem_nvc.ToString())); } else { businessObject.CarSystem_nvc = String.Empty; } }
public void Insert(HPS.BLL.CarSystemBLL.BLLCarSystem_T businessObject) { try{ if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueCarSystemID_int") == false) { throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString()); } _dataObject.Insert(businessObject); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }