Пример #1
0
        public void Update(HPS.BLL.TrafficBLL.BLLTraffic_T businessObject, HPS.BLL.TrafficBLL.BLLTraffic_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                ExceptList.AddRange(new string[] { "UniqueTrafficID_bint", "DriverInfractionRule" });
                ExceptList.AddRange(new string[] { "UniqueDriverMobileNumber_nvc", "UniqueNationalCode_int", "InsertDriverDuplicateNumberRule" });
                ExceptList.AddRange(new string[] { "DuplicateTurnNumberInUpdateRule", "DuplicateTurnNumberInUpdateRule" });
                HPS.BLL.TrafficBLL.BLLTraffic_T trafficEntity = new BLLTraffic_T();

                if (businessObject.TrafficTypeID_int == 3)
                {
                    ExceptList.Add("System_nvc");
                }
                if (businessObject.TrafficID_bint == businessObjectKey.TrafficID_bint)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.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);
            }
        }