protected override void Insert() { HPS.BLL.BoundryBLL.BLLBoundry_TFactory BoundryFactory = new HPS.BLL.BoundryBLL.BLLBoundry_TFactory(); try { HPS.BLL.BoundryBLL.BLLBoundry_T BoundryEntity = new HPS.BLL.BoundryBLL.BLLBoundry_T(); BoundryEntity.BoundryCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoundryCode_nvcTextBox.Text, TypeCode.String).ToString(); BoundryEntity.Boundry_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Boundry_nvcTextBox.Text, TypeCode.String).ToString(); BoundryFactory.BeginProc(); BoundryFactory.Insert(BoundryEntity); BoundryFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoundryEntity.BoundryID_int, TypeCode.Int32); dr[HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoundryEntity.BoundryCode_nvc, TypeCode.String); dr[HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.Boundry_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoundryEntity.Boundry_nvc, TypeCode.String); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { BoundryFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.BoundryBLL.BLLBoundry_TFactory BoundryFactory = new HPS.BLL.BoundryBLL.BLLBoundry_TFactory(); try { HPS.BLL.BoundryBLL.BLLBoundry_T BoundryEntity = new HPS.BLL.BoundryBLL.BLLBoundry_T(); BoundryEntity.BoundryCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoundryCode_nvcTextBox.Text, TypeCode.String).ToString(); BoundryEntity.Boundry_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Boundry_nvcTextBox.Text, TypeCode.String).ToString(); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { BoundryFactory.BeginProc(); BoundryFactory.Update(BoundryEntity, (HPS.BLL.BoundryBLL.BLLBoundry_TKeys)Key); BoundryFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryID_int.ToString() + "='" + ((HPS.BLL.BoundryBLL.BLLBoundry_TKeys)Key).BoundryID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoundryEntity.BoundryCode_nvc, TypeCode.String); dr[0][HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.Boundry_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoundryEntity.Boundry_nvc, TypeCode.String); } DataTable.AcceptChanges(); } } } catch (Exception ex) { BoundryFactory.RollBackProc(); throw ex; } }
public void Insert(HPS.BLL.BoundryBLL.BLLBoundry_T businessObject) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Boundry_T_Add]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter BoundryID_int = new SqlParameter(); BoundryID_int.ParameterName = "@BoundryID_int"; BoundryID_int.SqlDbType = SqlDbType.Int; BoundryID_int.Direction = ParameterDirection.Output; BoundryID_int.IsNullable = false; BoundryID_int.Value = businessObject.BoundryID_int; this.Command.Parameters.Add(BoundryID_int); SqlParameter BoundryCode_nvc = new SqlParameter(); BoundryCode_nvc.ParameterName = "@BoundryCode_nvc"; BoundryCode_nvc.SqlDbType = SqlDbType.NVarChar; BoundryCode_nvc.Direction = ParameterDirection.Input; BoundryCode_nvc.IsNullable = false; BoundryCode_nvc.Value = businessObject.BoundryCode_nvc; this.Command.Parameters.Add(BoundryCode_nvc); SqlParameter Boundry_nvc = new SqlParameter(); Boundry_nvc.ParameterName = "@Boundry_nvc"; Boundry_nvc.SqlDbType = SqlDbType.NVarChar; Boundry_nvc.Direction = ParameterDirection.Input; Boundry_nvc.IsNullable = false; Boundry_nvc.Value = businessObject.Boundry_nvc; this.Command.Parameters.Add(Boundry_nvc); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); businessObject.BoundryID_int = (Int32)(this.Command.Parameters["@BoundryID_int"].Value); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public HPS.BLL.BoundryBLL.BLLBoundry_T SelectByPrimaryKey(HPS.BLL.BoundryBLL.BLLBoundry_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_Boundry_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter BoundryID_int = new SqlParameter(); BoundryID_int.ParameterName = "@BoundryID_int"; BoundryID_int.SqlDbType = SqlDbType.Int; BoundryID_int.Direction = ParameterDirection.Input; BoundryID_int.IsNullable = false; BoundryID_int.Value = businessObjectKey.BoundryID_int; this.Command.Parameters.Add(BoundryID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.BoundryBLL.BLLBoundry_T businessObject = new HPS.BLL.BoundryBLL.BLLBoundry_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.BoundryBLL.BLLBoundry_TFactory BoundryFactory = new HPS.BLL.BoundryBLL.BLLBoundry_TFactory(); HPS.BLL.BoundryBLL.BLLBoundry_T BoundryEntity = BoundryFactory.GetBy((HPS.BLL.BoundryBLL.BLLBoundry_TKeys)Key); if (BoundryEntity == null) { throw new HPS.Exceptions.BoundryNotFound(); } BoundryCode_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(BoundryEntity.BoundryCode_nvc, TypeCode.String)); Boundry_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(BoundryEntity.Boundry_nvc, TypeCode.String)); }
public List <HPS.BLL.BoundryBLL.BLLBoundry_T> PopulateObjectsFromReader(IDataReader dataReader) { List <HPS.BLL.BoundryBLL.BLLBoundry_T> list = new List <HPS.BLL.BoundryBLL.BLLBoundry_T>(); while (dataReader.Read()) { HPS.BLL.BoundryBLL.BLLBoundry_T businessObject = new HPS.BLL.BoundryBLL.BLLBoundry_T(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); }
public void Insert(HPS.BLL.BoundryBLL.BLLBoundry_T businessObject) { try{ if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "BoundryID_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.BoundryBLL.BLLBoundry_T businessObject, HPS.BLL.BoundryBLL.BLLBoundry_TKeys businessObjectKey) { try{ if (businessObject.BoundryID_int == businessObjectKey.BoundryID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueBoundryID_int") == 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.BoundryBLL.BLLBoundry_T businessObject, IDataReader dataReader) { businessObject.BoundryID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryID_int.ToString())); businessObject.BoundryCode_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.BoundryCode_nvc.ToString())); businessObject.Boundry_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BoundryBLL.BLLBoundry_T.Boundry_TField.Boundry_nvc.ToString())); }