Пример #1
0
        public void Insert(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "TrafficTypeID_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);
            }
        }
Пример #2
0
        public void Update(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T businessObject, HPS.BLL.TrafficTypeBLL.BLLTrafficType_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.TrafficTypeBLL.BLLTrafficType_T tmpTrafficType = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.TrafficTypeID_int == businessObjectKey.TrafficTypeID_int)
                {
                    Except.Add("UniqueTrafficTypeID_int");
                }
                if (businessObject.TrafficType_nvc == tmpTrafficType.TrafficType_nvc)
                {
                    Except.Add("UniqueTrafficType_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);
            }
        }