Exemplo n.º 1
0
        public void Insert(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueInfractionTypeID_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);
            }
        }
Exemplo n.º 2
0
        public void Update(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T businessObject, HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.InfractionTypeBLL.BLLInfractionType_T tmpInfractionType = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.InfractionTypeID_int == businessObjectKey.InfractionTypeID_int)
                {
                    Except.Add("UniqueInfractionTypeID_int");
                }
                if (businessObject.InfractionGroupID_int == tmpInfractionType.InfractionGroupID_int)
                {
                    Except.Add("UniqueInfractionGroupID_int");
                }
                //if (businessObject.InfractionType_nvc == tmpInfractionType.InfractionType_nvc)
                //    Except.Add("UniqueInfractionType_nvc");
                if (Except.Count > 0)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, Except.ToArray()) == 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);
            }
        }