Exemplo n.º 1
0
        public void CreateDealWithStageTest()
        {
            UnitOfWork uow = new UnitOfWork(Common.dataLayer);

            crmContractRegistrationForm frm = NewRegistrationFormPrepare(uow);
            IWizardSupport wiz = frm;

            dealWithStage = (crmDealWithStageVersion)wiz.Complete();

            uow.CommitChanges();
        }
Exemplo n.º 2
0
        //[Test, Description("Тестирование создания этапа")]
        public void CreateStageTest()
        {
            CreateDealWithStageTest();

            UnitOfWork uow = new UnitOfWork(Common.dataLayer);

            crmDealWithStageVersion dws = uow.GetObjectByKey <crmDealWithStageVersion>(dealWithStage.Oid);

            stage = new crmStage(uow, VersionStates.VERSION_NEW);
            dws.Stages.Add(stage);
            stage.StageType = StageType.FINANCE;

            uow.CommitChanges();
        }
Exemplo n.º 3
0
        public void CreateDealWithStageTest()
        {
            UnitOfWork uow = new UnitOfWork(Common.dataLayer);

            crmContractRegistrationForm frm = NewRegistrationFormPrepare(uow);
            IWizardSupport wiz = frm;

            dealWithStage = (crmDealWithStageVersion)wiz.Complete();

            uow.CommitChanges();

            //---------------

            //ITestControl control = adapter.CreateTestControl(TestControlType.Table, "");
            //IGridBase table = control.GetInterface<IGridBase>();
            //Assert.AreEqual(2, table.GetRowCount());

            //List<IGridColumn> columns = new List<IGridColumn>(table.Columns);
            //IGridColumn column = commandAdapter.GetColumn(control, "Full Name");

            //Assert.AreEqual("John Nilsen", table.GetCellValue(0, column));
            //Assert.AreEqual("Mary Tellitson", table.GetCellValue(1, column));

            //commandAdapter.ProcessRecord("Contact", new string[] { "Full Name" }, new string[] { "Mary Tellitson" }, "");

            //Assert.AreEqual("Mary Tellitson", commandAdapter.GetFieldValue("Full Name"));
            //Assert.AreEqual("Development Department", commandAdapter.GetFieldValue("Department"));
            //Assert.AreEqual("Manager", commandAdapter.GetFieldValue("Position"));

            //commandAdapter.DoAction("Edit", null);

            //commandAdapter.SetFieldValue("First Name", "User_1");
            //commandAdapter.SetFieldValue("Last Name", "User_2");

            //commandAdapter.SetFieldValue("Position", "Developer");

            //commandAdapter.DoAction("Save", null);

            //Assert.AreEqual("User_1 User_2", commandAdapter.GetFieldValue("Full Name"));
            //Assert.AreEqual("Developer", commandAdapter.GetFieldValue("Position"));
        }
Exemplo n.º 4
0
        public void CreateStageTest([Range(1, 1, 1)]  int counter)
        {
            CreateDealWithStageTest();

            UnitOfWork uow = new UnitOfWork(Common.dataLayer);

            crmDealWithStageVersion dws = uow.GetObjectByKey <crmDealWithStageVersion>(dealWithStage.Oid);
            UnitOfWork uow2             = uow.BeginNestedUnitOfWork();

            crmDealWithStageVersion dws2 = uow2.GetObjectByKey <crmDealWithStageVersion>(dws.Oid);

            for (int i = 0; i < counter; i++)
            {
                crmStage stage = new crmStage(uow2, VersionStates.VERSION_NEW);
                dws2.Stages.Add(stage);
                stage.StageType = StageType.FINANCE;
            }
            uow2.CommitChanges();

            uow.CommitChanges();
        }
Exemplo n.º 5
0
 private void UpdateContractDeals()
 {
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         crmUserParty cfr = os.GetObjects <crmUserParty>().FirstOrDefault(x => x.Party.Code == "2518");
         IList <TrwSaleNomenclature> sale_noms = os.GetObjects <TrwSaleNomenclature>();
         IList <crmContractDeal>     deals     = os.GetObjects <crmContractDeal>();
         foreach (crmContractDeal deal in deals)
         {
             if (deal.Current != null)
             {
                 if (deal.Current.Customer != null && deal.Current.Supplier != null)
                 {
                     if (deal.Current.Customer.CfrUserParty != null && deal.Current.Supplier.CfrUserParty == null)
                     {
                         deal.Current.Customer.CfrUserParty = null;
                         deal.Current.Supplier.CfrUserParty = cfr;
                     }
                     else if (deal.Current.Customer.CfrUserParty == null && deal.Current.Supplier.CfrUserParty != null)
                     {
                         deal.Current.Customer.CfrUserParty = cfr;
                         deal.Current.Supplier.CfrUserParty = null;
                     }
                 }
             }
             crmDealWithStage deal_ws = deal as crmDealWithStage;
             if (deal_ws != null)
             {
                 crmDealWithStageVersion deal_ws_version = deal_ws.Current as crmDealWithStageVersion;
                 if (deal_ws_version == null)
                 {
                     continue;
                 }
                 foreach (crmStage stage in deal_ws_version.StageStructure.Stages)
                 {
                     if (stage.DeliveryUnits == null)
                     {
                         continue;
                     }
                     foreach (crmDeliveryUnit unit in stage.DeliveryUnits)
                     {
                         foreach (crmDeliveryItem item in unit.DeliveryItems)
                         {
                             if (item.Nomenclature == null)
                             {
                                 continue;
                             }
                             if (item.Order == null || item.Nomenclature == null)
                             {
                                 continue;
                             }
                             TrwSaleNomenclature nom = sale_noms.FirstOrDefault(x => x.Order == item.Order && x.Nomenclature == item.Nomenclature);
                             if (nom == null)
                             {
                                 nom              = os.CreateObject <TrwSaleNomenclature>();
                                 nom.Order        = item.Order;
                                 nom.Nomenclature = item.Nomenclature;
                             }
                             nom.TrwCodeSet(nom.Order.Code + ".9" + nom.Nomenclature.Code);
                             foreach (TrwOrder trw_order in deal_ws.TrwOrders)
                             {
                                 if (trw_order.Subject == nom.Order.Subject)
                                 {
                                     trw_order.TrwSaleNomenclatures.Add(nom);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         os.CommitChanges();
     }
 }