private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); HPS.BLL.SaloonBLL.BLLSaloon_TKeys SaloonKey = new HPS.BLL.SaloonBLL.BLLSaloon_TKeys(); try { if (this.SaloonGridView.SelectedRows.Count > 0) { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } } SaloonKey.SaloonID_int = (Int32)SaloonGridView.SelectedRows[0].Cells["colSaloonID_int"].Value; SaloonFactory.Delete(SaloonKey); if ((DataTable)this.SaloonGridView.DataSource != null) { DataRow[] dr = ((DataTable)this.SaloonGridView.DataSource).Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + "=" + SaloonKey.SaloonID_int.ToString() + ""); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.SaloonGridView.DataSource).AcceptChanges(); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void FillCombo() { try { HPS.BLL.BillBLL.BLLBill_TFactory BillID_intFactory = new HPS.BLL.BillBLL.BLLBill_TFactory(); DataTable BillID_intDataTable = new DataTable(); BillID_intFactory.GetAll(ref BillID_intDataTable); this.BillID_intComboBox.DisplayMember = HPS.BLL.BillBLL.BLLBill_T.Bill_TField.BillType_nvc.ToString(); this.BillID_intComboBox.ValueMember = HPS.BLL.BillBLL.BLLBill_T.Bill_TField.BillID_int.ToString(); this.BillID_intComboBox.DataSource = BillID_intDataTable; this.BillID_intComboBox.SelectedIndex = -1; HPS.BLL.SaloonBLL.BLLSaloon_TFactory Saloon_TFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); DataTable Saloon_TDataTable = new DataTable(); Saloon_TFactory.GetAll(ref Saloon_TDataTable); this.SaloonID_intComboBox.DisplayMember = HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.Saloon_nvc.ToString(); this.SaloonID_intComboBox.ValueMember = HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString(); this.SaloonID_intComboBox.DataSource = Saloon_TDataTable; this.SaloonID_intComboBox.SelectedIndex = -1; } catch (Exception ex) { throw ex; } }
protected override void ShowForm() { HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); HPS.BLL.SaloonBLL.BLLSaloon_T SaloonEntity = SaloonFactory.GetBy((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key); this.FillListBox(); if (SaloonEntity == null) { throw new Exceptions.SaloonNotFound(); } Saloon_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(SaloonEntity.Saloon_nvc, TypeCode.String).ToString(); TurnDistinictAfterCredit_intNumericTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(SaloonEntity.TurnDistinictAfterCredit_int, TypeCode.Int32).ToString(); TurnNumberInLadeAnnouncement_intNumericTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(SaloonEntity.TurnNumberInLadeAnnouncement_int, TypeCode.Int32).ToString(); HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeList = LaderTypeFactory.GetAllBy(HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.SaloonID_int, SaloonEntity.SaloonID_int); if (LaderTypeList != null && LaderTypeList.Count > 0) { for (int i = 0; i < lstLaderTypeCheckBox.Items.Count; i++) { if (LaderTypeList.FindAll(c => c.LaderTypeID_int == (((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.Items[i]).LaderTypeID_int)).Count > 0) { this.lstLaderTypeCheckBox.SetItemChecked(i, true); } else { this.lstLaderTypeCheckBox.SetItemChecked(i, false); } } } }
protected override void Delete() { HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } SaloonFactory.BeginProc(); SaloonFactory.Delete((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key); SaloonFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + " = " + ((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key).SaloonID_int.ToString() + ""); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } catch (Exception ex) { SaloonFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); try { HPS.BLL.SaloonBLL.BLLSaloon_T SaloonEntity = new HPS.BLL.SaloonBLL.BLLSaloon_T(); SaloonEntity.SaloonID_int = ((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key).SaloonID_int; SaloonEntity.Saloon_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Saloon_nvcTextBox.Text, TypeCode.String).ToString(); SaloonEntity.TurnDistinictAfterCredit_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnDistinictAfterCredit_intNumericTextBox.NumericText, TypeCode.Int32); SaloonEntity.TurnNumberInLadeAnnouncement_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNumberInLadeAnnouncement_intNumericTextBox.NumericText, TypeCode.Int32); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { SaloonFactory.BeginProc(); SaloonFactory.Update(SaloonEntity, (HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key); HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys LaderTypeKey = new HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys(); foreach (HPS.BLL.LaderTypeBLL.BLLLaderType_T item in LaderTypeFactory.GetAllBy(BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.SaloonID_int, SaloonEntity.SaloonID_int)) { item.SaloonID_int = null; LaderTypeKey.LaderTypeID_int = item.LaderTypeID_int; LaderTypeFactory.Update(item, LaderTypeKey); } foreach (HPS.BLL.LaderTypeBLL.BLLLaderType_T item in lstLaderTypeCheckBox.CheckedItems) { item.SaloonID_int = SaloonEntity.SaloonID_int; LaderTypeKey.LaderTypeID_int = item.LaderTypeID_int; LaderTypeFactory.Update(item, LaderTypeKey); } //for (int i = 0; i < lstLaderTypeCheckBox.CheckedItems.Count; i++) //{ // ((HPS.BLL.LaderTypeBLL.BLLLaderType_T)this.lstLaderTypeCheckBox.CheckedItems[i]).SaloonID_int = SaloonEntity.SaloonID_int; // LaderTypeKey.LaderTypeID_int = ((HPS.BLL.LaderTypeBLL.BLLLaderType_T)this.lstLaderTypeCheckBox.CheckedItems[i]).LaderTypeID_int; // LaderTypeFactory.Update(((HPS.BLL.LaderTypeBLL.BLLLaderType_T)this.lstLaderTypeCheckBox.CheckedItems[i]), LaderTypeKey); //} SaloonFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + " = " + ((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key).SaloonID_int.ToString() + ""); if (dr.Length > 0) { dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.SaloonID_int, TypeCode.Int32); dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.Saloon_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.Saloon_nvc, TypeCode.String); dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnDistinictAfterCredit_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnDistinictAfterCredit_int, TypeCode.Int32); dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnNumberInLadeAnnouncement_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnNumberInLadeAnnouncement_int, TypeCode.Int32); } DataTable.AcceptChanges(); } } } catch (Exception ex) { SaloonFactory.RollBackProc(); throw ex; } }
private void LoadSaloon() { try { HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); DataTable SaloonDataTable = new DataTable(); SaloonFactory.GetAll(ref SaloonDataTable); this.SaloonGridView.DataSource = SaloonDataTable; } catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
protected override void Insert() { HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory(); try { HPS.BLL.SaloonBLL.BLLSaloon_T SaloonEntity = new HPS.BLL.SaloonBLL.BLLSaloon_T(); SaloonEntity.Saloon_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Saloon_nvcTextBox.Text, TypeCode.String).ToString(); SaloonEntity.TurnDistinictAfterCredit_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnDistinictAfterCredit_intNumericTextBox.NumericText, TypeCode.Int32); SaloonEntity.TurnNumberInLadeAnnouncement_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNumberInLadeAnnouncement_intNumericTextBox.NumericText, TypeCode.Int32); SaloonFactory.BeginProc(); SaloonFactory.Insert(SaloonEntity); HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys LaderTypeKey = new HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys(); for (int i = 0; i < lstLaderTypeCheckBox.CheckedItems.Count; i++) { ((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.CheckedItems[i]).SaloonID_int = SaloonEntity.SaloonID_int; LaderTypeKey.LaderTypeID_int = ((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.CheckedItems[i]).LaderTypeID_int; LaderTypeFactory.Update(((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.CheckedItems[i]), LaderTypeKey); } SaloonFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.SaloonID_int, TypeCode.Int32); dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.Saloon_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.Saloon_nvc, TypeCode.String); dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnDistinictAfterCredit_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnDistinictAfterCredit_int, TypeCode.Int32); dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnNumberInLadeAnnouncement_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnNumberInLadeAnnouncement_int, TypeCode.Int32); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { SaloonFactory.RollBackProc(); throw ex; } }