示例#1
0
        /// <summary>
        /// 通过察看有没有在工单选择该route如果有则不能删除
        /// 没有则可以删除,删除也删除对应copy途程的详细的信息
        /// </summary>
        /// <param name="model2Route"></param>
        private void DeleteModelRoute(Model2Route model2Route)
        {
            if (model2Route == null)
            {
                ExceptionManager.Raise(this.GetType(), "$Error_Null_Paramter");
                //				throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(ModelFacade),String.Format(ErrorCenter.ERROR_ARGUMENT_NULL,"model2Route")));
            }
            MOFacade _moFacade = new MOFacade(this.DataProvider);

            if (_moFacade.IsModelRouteUsed(model2Route.RouteCode))
            {
                ExceptionManager.Raise(this.GetType(), "$Error_ModelRoute_Used", String.Format("[$ModelCode='{0}']", model2Route.ModelCode), null);
                //				throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(ModelFacade),string.Format(ErrorCenter.ERROR_MODELROUTEUSED,model2Route.ModelCode,model2Route.RouteCode)));
            }
            try
            {
                object[] modelOperations = GetModel2Operations(model2Route);
                for (int i = 0; i < modelOperations.Length; i++)
                {
                    this.DataProvider.Delete(modelOperations[i]);
                }
                this.DataProvider.Delete(model2Route);
            }
            catch (Exception ex)
            {
                //_log.Error(ex.Message);
                ExceptionManager.Raise(this.GetType(), "$Error_DeleteModelRoute_Failure", String.Format("[$ModelCode='{0}',$RouteCode='{1}']", model2Route.ModelCode, model2Route.RouteCode), ex);
                //				throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(ModelFacade),String.Format(ErrorCenter.ERROR_DELETEMODELROUTE,model2Route.ModelCode,model2Route.RouteCode)),ex);
            }
        }