protected override void Edit() { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); try { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T DestinationAddressEntity = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T(); DestinationAddressEntity.DestinationAddress_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DestinationAddress_nvcTextBox.Text, TypeCode.String).ToString(); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { DestinationAddressFactory.BeginProc(); DestinationAddressFactory.Update(DestinationAddressEntity, (HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys)Key); DestinationAddressFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddressID_int.ToString() + "='" + ((HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys)Key).DestinationAddressID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddress_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DestinationAddressEntity.DestinationAddress_nvc, TypeCode.String); } DataTable.AcceptChanges(); } } } catch (Exception ex) { DestinationAddressFactory.RollBackProc(); throw ex; } }
protected override void Insert() { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); try { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T DestinationAddressEntity = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T(); DestinationAddressEntity.DestinationAddress_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DestinationAddress_nvcTextBox.Text, TypeCode.String).ToString(); DestinationAddressFactory.BeginProc(); DestinationAddressFactory.Insert(DestinationAddressEntity); DestinationAddressFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddressID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DestinationAddressEntity.DestinationAddressID_int, TypeCode.Int32); dr[HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddress_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DestinationAddressEntity.DestinationAddress_nvc, TypeCode.String); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { DestinationAddressFactory.RollBackProc(); throw ex; } }
protected override void Delete() { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { DestinationAddressFactory.BeginProc(); DestinationAddressFactory.Delete((HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys)Key); DestinationAddressFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddressID_int.ToString() + "='" + ((HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys)Key).DestinationAddressID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { DestinationAddressFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddress_TFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys DestinationAddressKey = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys(); DestinationAddressKey.DestinationAddressID_int = (Int32)DestinationAddressGridView.CurrentRow.Cells["colDestinationAddressID_int"].Value; DestinationAddressFactory.Delete(DestinationAddressKey); DataRow[] dr = ((DataTable)this.DestinationAddressGridView.DataSource).Select(HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T.DestinationAddress_TField.DestinationAddressID_int.ToString() + "='" + DestinationAddressKey.DestinationAddressID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.DestinationAddressGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
protected override void ShowForm() { this.FillCombo(); HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_T DestinationAddressEntity = DestinationAddressFactory.GetBy((HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TKeys)Key); if (DestinationAddressEntity == null) { throw new HPS.Exceptions.DestinationAddressNotFound(); } DestinationAddress_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DestinationAddressEntity.DestinationAddress_nvc, TypeCode.String)); }
private void LoadDestinationAddress() { try { HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory DestinationAddressFactory = new HPS.BLL.DestinationAddressBLL.BLLDestinationAddress_TFactory(); DataTable DestinationAddressDataTable = new DataTable(); DestinationAddressFactory.GetAll(ref DestinationAddressDataTable); this.DestinationAddressGridView.DataSource = DestinationAddressDataTable; } catch (System.Exception ex) { throw ex; } }