コード例 #1
0
        public static IBusinessOperation CreateBusinessOperationObject(string profile, string name)
        {
            if (!classMaps.ContainsKey(name))
            {
                throw new ArgumentNullException(String.Format("Operation not found [{0}]", name));
            }

            PluginEntry entry = classMaps[name];

            Assembly           asm = Assembly.Load(entry.Asm.GetName());
            IBusinessOperation obj = (IBusinessOperation)asm.CreateInstance(entry.Fqdn);

            ContextGroup grp = GetContextGroup(profile);

            obj.SetNoSqlContext(grp.NoSqlContext);
            obj.SetStorageContext(grp.StorageContext);
            obj.SetSmtpContext(grp.SmtpContext);
            obj.SetDatabaseContext(grp.DatabaseContext);

            if (loggerFactory != null)
            {
                Type    t      = obj.GetType();
                ILogger logger = loggerFactory.CreateLogger(t);
                obj.SetLogger(logger);
            }

            return(obj);
        }
コード例 #2
0
 public override void Execute(IBusinessOperation businessOperation)
 {
     if (businessOperation is CompleteMaintenanceOrder completeMaintenanceOrder)
     {
         ExecuteInternal(completeMaintenanceOrder);
     }
     else
     {
         throw new ArgumentException("Неверный тип бизнес-операции!");
     }
 }
 public void UnknownOperationNameWithProfileTest(string name)
 {
     try
     {
         IBusinessOperation opt = FactoryBusinessOperation.CreateBusinessOperationObject("DEFAULT", name);
         Assert.True(false, "Exception shoud be throw for unknow API!!!");
     }
     catch (Exception e)
     {
         Assert.True(true, e.Message);
     }
 }
 public override void Execute(IBusinessOperation businessOperation)
 {
     using (var objectSpace = BusinessOperationManager.Instance.Application.CreateObjectSpace())
     {
         var         bo                 = (AssetCreateServiceJournalItemOperation)businessOperation;
         var         newOperation       = objectSpace.CreateObject <ОперацияЖР>();
         ЖурналРабот serviceJournalItem = null;
         if (bo.ServiceJournalItem == null)
         {
             bo.Process.NextStep("Создание операции", 0, 4, "Для операции не задан журнал работ", Xafari.ManagedOperations.TraceMessageTypes.Error);
         }
         else
         {
             serviceJournalItem = objectSpace.GetObject(bo.ServiceJournalItem);
             serviceJournalItem.Операции.Add(newOperation);
             bo.Process.NextStep("Операция успешно создана");
             objectSpace.CommitChanges();
             bo.ResultObject = newOperation;
         }
     }
 }
コード例 #5
0
        public override void Execute(IBusinessOperation businessOperation)
        {
            var bo      = (ExternalDocumentCompleteOperation)businessOperation;
            var insdate = bo.Date;

            using (var objectSpace = BusinessOperationManager.Instance.Application.CreateObjectSpace())
            {
                var operations = 0;
                foreach (var rawOper in bo.Operations)
                {
                    var oper = objectSpace.GetObject(rawOper); // Операция в текущем ObjectSpace.
                    if (oper.DateEnd == DateTime.MinValue)
                    {
                        oper.DateEnd = insdate;
                        operations++;
                    }
                }
                if (bo.Process != null)
                {
                    bo.Process.NextStep(String.Format("Для {0} операций была проставлена дата окончания", operations));
                }
                objectSpace.CommitChanges();
            }
        }
コード例 #6
0
        public static IBusinessOperation CreateBusinessOperationObject(string name)
        {
            IBusinessOperation obj = CreateBusinessOperationObject(FactoryContextUtils.DefaultProfileName, name);

            return(obj);
        }
コード例 #7
0
 void IBusinessOperation.DoParameterizedOperation(string str, IBusinessOperation obj) => mock.DoParameterizedOperation(str, obj);
コード例 #8
0
 internal BusinessOperation(IBusinessOperation mock)
 {
     this.mock = mock;
 }
        public void RegisterBusinessOperationWithProfileTest(string profile, string name)
        {
            IBusinessOperation opt = FactoryBusinessOperation.CreateBusinessOperationObject(profile, name);

            Assert.IsInstanceOf(typeof(BusinessOperationMocked), opt, "Should get the right object instance!!!");
        }