protected override void Delete() { HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { CompanyFactory.BeginProc(); CompanyFactory.Delete((HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key); CompanyFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString() + "='" + ((HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key).CompanyID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { CompanyFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); try { HPS.BLL.CompanyBLL.BLLCompany_T CompanyEntity = new HPS.BLL.CompanyBLL.BLLCompany_T(); CompanyEntity.CompanyCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyCode_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Company_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Company_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.DirectorName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorName_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.DirectorMobile_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorMobile_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Phone_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Phone_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Fax_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Fax_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Email_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Email_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.WebAddress_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(WebAddress_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Active_bit = Active_bitCheckBox.Checked; CompanyEntity.InfractionGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32); CompanyEntity.Address_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Address_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.CityID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.Int32); CompanyEntity.CityCode_nvc = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CityEntity.CityCode_nvc, TypeCode.String)); CompanyEntity.GroupID_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGroupComboBox.SelectedValue, TypeCode.Int32); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { CompanyFactory.BeginProc(); CompanyFactory.Update(CompanyEntity, (HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key); CompanyFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString() + "='" + ((HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key).CompanyID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CompanyCode_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Company_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorName_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorMobile_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorMobile_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Phone_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Phone_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Fax_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Fax_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Email_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Email_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.WebAddress_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.WebAddress_nvc, TypeCode.String); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Active_bit, TypeCode.Boolean); dr[0]["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Address_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Address_nvc, TypeCode.String); dr[0]["CityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CityID_intComboBox); dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CityCode_nvc, TypeCode.String); dr[0]["GroupName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyGroupComboBox); } DataTable.AcceptChanges(); } } } catch (Exception ex) { CompanyFactory.RollBackProc(); throw ex; } }
protected override void Insert() { HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory(); try { HPS.BLL.CompanyBLL.BLLCompany_T CompanyEntity = new HPS.BLL.CompanyBLL.BLLCompany_T(); CompanyEntity.CompanyCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyCode_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Company_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Company_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.DirectorName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorName_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.DirectorMobile_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorMobile_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Phone_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Phone_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Fax_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Fax_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Email_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Email_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.WebAddress_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(WebAddress_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.Active_bit = Active_bitCheckBox.Checked; CompanyEntity.InfractionGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32); CompanyEntity.Address_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Address_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.CityID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.Int32); CompanyEntity.CityCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CityCode_nvcTextBox.Text, TypeCode.String).ToString(); CompanyEntity.GroupID_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGroupComboBox.SelectedValue, TypeCode.Int32); CompanyFactory.BeginProc(); CompanyFactory.Insert(CompanyEntity); CompanyFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CompanyID_int, TypeCode.Int32); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CompanyCode_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Company_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorName_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorMobile_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorMobile_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Phone_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Phone_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Fax_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Fax_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Email_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Email_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.WebAddress_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.WebAddress_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Active_bit, TypeCode.Boolean); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.InfractionGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.InfractionGroupID_int, TypeCode.Int32); dr["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Address_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Address_nvc, TypeCode.String); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CityID_int, TypeCode.Int32); dr["CityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CityID_intComboBox); dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CityCode_nvc, TypeCode.String); dr["GroupName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyGroupComboBox); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { CompanyFactory.RollBackProc(); throw ex; } }