예제 #1
0
        public void Update(HPS.BLL.InfractionBLL.BLLInfraction_T businessObject, HPS.BLL.InfractionBLL.BLLInfraction_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.InfractionID_int == businessObjectKey.InfractionID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueInfractionID_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);
            }
        }
예제 #2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.InfractionBLL.BLLInfraction_TFactory InfractionFactory = new HPS.BLL.InfractionBLL.BLLInfraction_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.InfractionBLL.BLLInfraction_TFactory Infraction_TFactory = new HPS.BLL.InfractionBLL.BLLInfraction_TFactory();
                HPS.BLL.InfractionBLL.BLLInfraction_TKeys    InfractionKey       = new HPS.BLL.InfractionBLL.BLLInfraction_TKeys();

                InfractionKey.InfractionID_int = (Int32)InfractionGridView.CurrentRow.Cells["colInfractionID_int"].Value;
                InfractionFactory.Delete(InfractionKey);

                DataRow[] dr = ((DataTable)this.InfractionGridView.DataSource).Select(HPS.BLL.InfractionBLL.BLLInfraction_T.Infraction_TField.InfractionID_int.ToString() + "='" + InfractionKey.InfractionID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.InfractionGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
예제 #3
0
 public void GetBy(HPS.BLL.InfractionBLL.BLLInfraction_TKeys keys, ref System.Data.DataTable dataTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
예제 #4
0
 public HPS.BLL.InfractionBLL.BLLInfraction_T GetBy(HPS.BLL.InfractionBLL.BLLInfraction_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
예제 #5
0
 public void Delete(HPS.BLL.InfractionBLL.BLLInfraction_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
예제 #6
0
 private void EditButton_Click(object sender, EventArgs e)
 {
     try
     {
         HPS.BLL.InfractionBLL.BLLInfraction_TKeys InfractionKey = new HPS.BLL.InfractionBLL.BLLInfraction_TKeys();
         InfractionKey.InfractionID_int = (Int32)this.InfractionGridView.CurrentRow.Cells["colInfractionID_int"].Value;
         HPS.BLL.InfractionBLL.BLLInfraction_TFactory InfractionFactory = new HPS.BLL.InfractionBLL.BLLInfraction_TFactory();
         HPS.BLL.InfractionBLL.BLLInfraction_T        InfractionEntity  = InfractionFactory.GetBy(InfractionKey);
         if (!string.IsNullOrEmpty(InfractionEntity.RegisterUserName_nvc) && !string.IsNullOrEmpty(InfractionEntity.RegisterDate_nvc))
         {
             registered = true;
         }
         InfractionEntityForm Infraction = new InfractionEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.InfractionGridView.DataSource, InfractionKey, registered);
         Infraction.ShowDialog();
     }
     catch (Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }