protected override void Insert() { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { HPS.BLL.PortPlacesBLL.BLLPortPlaces_T PortPlacesEntity = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_T(); PortPlacesEntity.PortPlaces_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlaces_nvcTextBox.Text, TypeCode.String).ToString(); PortPlacesEntity.Active_bit = Active_bitCheckBox.Checked; PortPlacesFactory.BeginProc(); PortPlacesFactory.Insert(PortPlacesEntity); PortPlacesFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.PortPlacesID_int, TypeCode.Int32); dr[HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.PortPlaces_nvc, TypeCode.String); dr[HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.Active_bit, TypeCode.Boolean); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { PortPlacesFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { HPS.BLL.PortPlacesBLL.BLLPortPlaces_T PortPlacesEntity = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_T(); PortPlacesEntity.PortPlaces_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlaces_nvcTextBox.Text, TypeCode.String).ToString(); PortPlacesEntity.Active_bit = Active_bitCheckBox.Checked; if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { PortPlacesFactory.BeginProc(); PortPlacesFactory.Update(PortPlacesEntity, (HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key); PortPlacesFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + ((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key).PortPlacesID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.PortPlaces_nvc, TypeCode.String); dr[0][HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(PortPlacesEntity.Active_bit, TypeCode.Boolean); } DataTable.AcceptChanges(); } } } catch (Exception ex) { PortPlacesFactory.RollBackProc(); throw ex; } }
public void Insert(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_PortPlaces_T_Add]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter PortPlacesID_int = new SqlParameter(); PortPlacesID_int.ParameterName = "@PortPlacesID_int"; PortPlacesID_int.SqlDbType = SqlDbType.Int; PortPlacesID_int.Direction = ParameterDirection.Output; PortPlacesID_int.IsNullable = false; PortPlacesID_int.Value = businessObject.PortPlacesID_int; this.Command.Parameters.Add(PortPlacesID_int); SqlParameter PortPlaces_nvc = new SqlParameter(); PortPlaces_nvc.ParameterName = "@PortPlaces_nvc"; PortPlaces_nvc.SqlDbType = SqlDbType.NVarChar; PortPlaces_nvc.Direction = ParameterDirection.Input; PortPlaces_nvc.IsNullable = false; PortPlaces_nvc.Value = businessObject.PortPlaces_nvc; this.Command.Parameters.Add(PortPlaces_nvc); SqlParameter Active_bit = new SqlParameter(); Active_bit.ParameterName = "@Active_bit"; Active_bit.SqlDbType = SqlDbType.Bit; Active_bit.Direction = ParameterDirection.Input; Active_bit.IsNullable = false; Active_bit.Value = businessObject.Active_bit; this.Command.Parameters.Add(Active_bit); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); businessObject.PortPlacesID_int = (Int32?)(this.Command.Parameters["@PortPlacesID_int"].Value); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public HPS.BLL.PortPlacesBLL.BLLPortPlaces_T SelectByPrimaryKey(HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_PortPlaces_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try { this.Command.Parameters.Clear(); SqlParameter PortPlacesID_int = new SqlParameter(); PortPlacesID_int.ParameterName = "@PortPlacesID_int"; PortPlacesID_int.SqlDbType = SqlDbType.Int; PortPlacesID_int.Direction = ParameterDirection.Input; PortPlacesID_int.IsNullable = false; PortPlacesID_int.Value = businessObjectKey.PortPlacesID_int; this.Command.Parameters.Add(PortPlacesID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_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.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_T PortPlacesEntity = PortPlacesFactory.GetBy((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key); if (PortPlacesEntity == null) { throw new HPS.Exceptions.PortPlacesNotFound(); } PortPlaces_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlacesEntity.PortPlaces_nvc, TypeCode.String).ToString(); Active_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlacesEntity.Active_bit, TypeCode.Boolean); }
public List <HPS.BLL.PortPlacesBLL.BLLPortPlaces_T> PopulateObjectsFromReader(IDataReader dataReader) { List <HPS.BLL.PortPlacesBLL.BLLPortPlaces_T> list = new List <HPS.BLL.PortPlacesBLL.BLLPortPlaces_T>(); while (dataReader.Read()) { HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_T(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); }
public void Insert(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject) { try { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "PortPlacesID_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); } }
public void Update(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject, HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys businessObjectKey) { try { HPS.BLL.PortPlacesBLL.BLLPortPlaces_T tmpPortPlace = this.GetBy(businessObjectKey); List <string> Except = new List <string>(); if (businessObject.PortPlacesID_int == businessObjectKey.PortPlacesID_int) { Except.Add("UniquePortPlacesID_int"); } if (businessObject.PortPlaces_nvc == tmpPortPlace.PortPlaces_nvc) { Except.Add("UniquePortPlaces_nvc"); } if (Except.Count > 0) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, Except.ToArray()) == false) { throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString()); } } else { if (businessObject.IsValid() == false) { throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString()); } } _dataObject.Update(businessObject, businessObjectKey); } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void PopulateBusinessObjectFromReader(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject, IDataReader dataReader) { businessObject.PortPlacesID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString())); businessObject.PortPlaces_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlaces_nvc.ToString())); businessObject.Active_bit = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.Active_bit.ToString())); }