コード例 #1
0
        public void Update(HPS.BLL.ComputerBLL.BLLComputer_T businessObject, HPS.BLL.ComputerBLL.BLLComputer_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.ComputerBLL.BLLComputer_T tmpComputer = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.ComputerID_int == businessObjectKey.ComputerID_int)
                {
                    Except.Add("UniqueComputerID_int");
                }
                if (businessObject.MacAddress_nvc == tmpComputer.MacAddress_nvc)
                {
                    Except.Add("UniqueMacAddress_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);
            }
        }
コード例 #2
0
        public void Insert(HPS.BLL.ComputerBLL.BLLComputer_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "ComputerID_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);
            }
        }