public void ShowTest()
        {
            var client   = DataMother.CreateClientAndUsers();
            var user     = client.Users.First();
            var afUpdate = new UpdateLogEntity(user);
            var supplier = DataMother.CreateSupplier();
            var document = new FullDocument {
                Supplier = supplier, ClientCode = client.Id
            };
            var line = document.NewLine(new DocumentLine {
                Product = "TestCertificateRequestLogProduct"
            });

            var nuSert = new CertificateRequestLog {
                Line   = line,
                Update = afUpdate
            };

            Save(afUpdate, supplier, document, nuSert);

            Open("Main/Stat");
            Css("#StatisticsTD a").Click();
            AssertText("Статистика по сертификатам");
            var otherRegion = session.QueryOver <Region>().List().Last();

            Css("#filter_Region_Id").SelectByValue(otherRegion.Id.ToString());
            Click("Показать");
            Assert.That(browser.Text, !Is.StringContaining("TestCertificateRequestLogProduct"));
            Css("#filter_Region_Id").SelectByValue(client.MaskRegion.ToString());
            Click("Показать");
            AssertText("TestCertificateRequestLogProduct");
        }
示例#2
0
        public void CertificateDetailsFileTest()
        {
            Client             client            = null;
            Supplier           supplier          = null;
            DocumentReceiveLog documentLogEntity = null;
            Document           document          = null;
            UpdateLogEntity    updateEntity      = null;

            Create_loaded_document_logs(out client, out supplier, out documentLogEntity, out document, out updateEntity);
            var sert = new CertificateRequestLog {
                Line   = document.Lines[0],
                Update = updateEntity
            };

            Save(sert);

            Open("Main/Stat");
            Css("#StatisticsTD a").Click();
            AssertText("Статистика по сертификатам");
            Thread.Sleep(2000);
            AssertText(supplier.Name);
            browser.Link("ShowDocumentDetailsLink" + documentLogEntity.Id).Click();
            Thread.Sleep(1000);
            AssertText("Код товара");
            AssertText("Наименование");
            AssertText("Производитель");
            AssertText("Страна");
            AssertText("Количество");
            AssertText("Срок годности");

            Thread.Sleep(2000);
            AssertText(document.Lines[0].Producer);
            AssertText(document.Lines[0].Country);
        }
示例#3
0
        public void View_loaded_documents_details_from_client_update_history()
        {
            Client             client            = null;
            Supplier           supplier          = null;
            DocumentReceiveLog documentLogEntity = null;
            Document           document          = null;
            UpdateLogEntity    updateEntity      = null;

            Create_loaded_document_logs(out client, out supplier, out documentLogEntity, out document, out updateEntity);

            Open(client);
            Click("История обновлений");
            OpenedWindow(String.Format("История обновлений клиента {0}", client.Name));
            Assert.IsTrue(browser.Link(Find.ByText("Загрузка документов на сервер")).Exists);
            browser.Link("ShowUpdateDetailsLink" + updateEntity.Id).Click();
            Thread.Sleep(2000);

            AssertText("Дата загрузки");
            AssertText("Тип документа");
            AssertText("Дата разбора");
            AssertText("Имя файла");
            AssertText("Статус");
            AssertText("Разобран");
            AssertText(supplier.Name);

            browser.Link("ShowDocumentDetailsLink" + documentLogEntity.Id).Click();
            Check_document_view(document);
        }
示例#4
0
        public void View_loaded_documents_details_from_user_update_history()
        {
            Client             client            = null;
            Supplier           supplier          = null;
            DocumentReceiveLog documentLogEntity = null;
            Document           document          = null;
            UpdateLogEntity    updateEntity      = null;

            Create_loaded_document_logs(out client, out supplier, out documentLogEntity, out document, out updateEntity);

            var user = client.Users[0];

            Open(user);
            Click("История обновлений");
            OpenedWindow(String.Format("История обновлений пользователя {0}", user.Login));
            browser.Link("ShowUpdateDetailsLink" + updateEntity.Id).Click();

            Thread.Sleep(2000);
            AssertText("Дата загрузки");
            AssertText("Тип документа");
            AssertText("Дата разбора");
            AssertText("Имя файла");
            AssertText("Статус");
            AssertText("Разобран");
            AssertText(supplier.Name);

            browser.Link("ShowDocumentDetailsLink" + documentLogEntity.Id).Click();
            Check_document_view(document);
        }
示例#5
0
        public void View_loaded_documents_details_from_user_document_history()
        {
            Client             client            = null;
            Supplier           supplier          = null;
            DocumentReceiveLog documentLogEntity = null;
            Document           document          = null;
            UpdateLogEntity    updateEntity      = null;

            Create_loaded_document_logs(out client, out supplier, out documentLogEntity, out document, out updateEntity);

            Open(client);
            Click("История документов");
            OpenedWindow("История документов");
            AssertText(supplier.Name);
            browser.Link("ShowDocumentDetailsLink" + documentLogEntity.Id).Click();
            Thread.Sleep(1000);
            AssertText("Код товара");
            AssertText("Наименование");
            AssertText("Производитель");
            AssertText("Страна");
            AssertText("Количество");
            AssertText("Срок годности");

            Check_document_view(document);
        }
        public static UpdateLogEntity CreateTestUpdateLogEntity(Client client)
        {
            var updateEntity = new UpdateLogEntity(client.Users[0])
            {
                AppVersion = 1000,
                Addition   = "Test update",
                UpdateType = UpdateType.LoadingDocuments,
            };

            return(updateEntity);
        }
示例#7
0
        public void Show_update_reject_for_supplier_user()
        {
            var user = DataMother.CreateSupplierUser();

            updateLog = new UpdateLogEntity(user)
            {
                UpdateType = UpdateType.AccessError,
            };
            Save(updateLog);
            Open("Logs/UpdateLog?regionMask={0}&updateType={1}", 18446744073709551615ul, UpdateType.AccessError);
            AssertText(user.Login);
        }
示例#8
0
        public void View_loaded_documents_details_unparsed_document_documents()
        {
            Client             client            = null;
            Supplier           supplier          = null;
            DocumentReceiveLog documentLogEntity = null;
            UpdateLogEntity    updateEntity      = null;

            Create_loaded_document_logs_unparsed_document(out client, out supplier, out documentLogEntity, out updateEntity);
            Open("Users/{0}/edit", client.Users[0].Id);
            ClickLink("История документов");
            OpenedWindow("История документов");
            AssertText(supplier.Name);
            AssertText(documentLogEntity.FileName);
            Assert.IsFalse(browser.Link("ShowDocumentDetailsLink" + documentLogEntity.Id).Exists);
        }
示例#9
0
        public void Setup()
        {
            client    = DataMother.CreateTestClientWithAddressAndUser();
            user      = client.Users.First();
            updateLog = new UpdateLogEntity(user)
            {
                AppVersion = 1000,
                Addition   = "Test update",
                Commit     = true,
            };
            Save(updateLog);

            Open("Logs/UpdateLog?userId={0}", user.Id);
            AssertText("История обновлений");
        }
示例#10
0
        public void View_loaded_documents_details_unparsed_document_updates()
        {
            Client             client            = null;
            Supplier           supplier          = null;
            DocumentReceiveLog documentLogEntity = null;
            UpdateLogEntity    updateEntity      = null;

            Create_loaded_document_logs_unparsed_document(out client, out supplier, out documentLogEntity, out updateEntity);
            var user = client.Users[0];

            Open(user);
            Click(@"История обновлений");
            OpenedWindow(String.Format("История обновлений пользователя {0}", user.Login));
            Assert.IsTrue(browser.Link(Find.ByText("Загрузка документов на сервер")).Exists);
            browser.Link("ShowUpdateDetailsLink" + updateEntity.Id).Click();
            Thread.Sleep(2000);
            AssertText("Не разобран");
        }
        public void View_update_logs()
        {
            var user           = testClient.Users.First();
            var updateLogEnity = new UpdateLogEntity(user)
            {
                AppVersion = 833,
                ResultSize = 1 * 1024 * 1024,
                Commit     = true,
            };

            Save(updateLogEnity);
            FlushAndCommit();

            browser.Link(l => l.Text == "История обновлений").Click();
            using (var openedWindow = IE.AttachTo <IE>(Find.ByTitle(String.Format("История обновлений")))) {
                Assert.That(openedWindow.Text, Is.StringContaining("История обновлений"));
                Assert.That(openedWindow.Text, Is.StringContaining(user.GetLoginOrName()));
                Assert.That(openedWindow.Text, Is.StringContaining("833"));
            }
        }
示例#12
0
        public void Load_updates_by_filter()
        {
            var user1 = DataMother.CreateTestClientWithUser().Users[0];
            var user2 = DataMother.CreateTestClientWithUser(session.Load <Region>(16ul)).Users[0];

            Flush();
            var update1 = new UpdateLogEntity(user1);

            Save(update1);
            var update2 = new UpdateLogEntity(user2);

            Save(update2);

            var filter = new UpdateFilter();

            filter.RegionMask = 16;
            filter.BeginDate  = DateTime.Today.AddDays(-1);
            filter.EndDate    = DateTime.Today;
            filter.UpdateType = UpdateType.Accumulative;
            var results = filter.Find(session);

            Assert.That(results.Count, Is.GreaterThan(0));
            Assert.That(results.Any(r => r.Id == update1.Id), Is.False, "нашли запись обновления в воронеже, {0}", update1.Id);
            Assert.That(results.Any(r => r.Id == update2.Id), Is.True, "не нашли запись обновления в челябинске, {0} {1}", update2.Id, results.Implode(r => r.Id));
            filter.UpdateType = UpdateType.AccessError;
            Save(new UpdateLogEntity(user2)
            {
                UpdateType  = UpdateType.AutoOrder,
                RequestTime = DateTime.Now.AddHours(1),
                Commit      = true
            });
            Save(new UpdateLogEntity(user2)
            {
                UpdateType = UpdateType.AccessError,
            });
            results = filter.Find(session);
            Assert.IsTrue(results.Any(r => r.OkUpdate));
        }
        private void BuildAttachments()
        {
            var attachment = new Attachment {
                Filename  = "test",
                Extension = ".txt",
                Size      = 100,
                Mail      = mail
            };

            mail.Attachments.Add(attachment);

            attachment = new Attachment {
                Filename  = "test",
                Extension = ".dbf",
                Size      = 10 * 1000,
                Mail      = mail
            };
            var updateLog = new UpdateLogEntity(user);

            attachment.SendLogs.Add(new AttachmentSendLog(user, attachment, updateLog));
            mail.Attachments.Add(attachment);

            session.Save(updateLog);
        }
示例#14
0
 private bool IsDataTransferUpdate()
 {
     return(UpdateType != null &&
            UpdateLogEntity.IsDataTransferUpdateType(UpdateType.Value));
 }
示例#15
0
 public bool IsDataTransferUpdateType()
 {
     return(UpdateLogEntity.IsDataTransferUpdateType(UpdateType));
 }
        private User AnalysisOfWorkDrugstoresDataPrepare()
        {
            //orders.ordershead
            //orders.orderslist
            var supplier = DataMother.CreateSupplier();
            var client   = DataMother.CreateTestClientWithAddressAndUser();

            client.Settings.ServiceClient   = false;
            client.Settings.InvisibleOnFirm = DrugstoreType.Standart;
            client.Status = ClientStatus.On;
            var user = client.Users[0];

            user.AvaliableAddresses.Add(client.Addresses[0]);

            var _order = new ClientOrder(user, supplier.Prices[0]);

            var product = new Product(session.Load <Catalog>(DataMother.CreateCatelogProduct()));
            var line    = new OrderLine(_order, product, 100, 1);

            session.Save(supplier);
            session.Save(_order);
            session.Save(product);
            session.Save(line);
            Flush();

            //AutoOrderCntFirst
            var updateLog = new UpdateLogEntity(user)
            {
                AppVersion  = 1000,
                Addition    = "Test update",
                Commit      = true,
                UpdateType  = UpdateType.AutoOrder,
                RequestTime = SystemTime.Now()
            };

            session.Save(updateLog);
            updateLog = new UpdateLogEntity(user)
            {
                AppVersion  = 1000,
                Addition    = "Test update",
                Commit      = true,
                UpdateType  = UpdateType.Accumulative,
                RequestTime = SystemTime.Now()
            };
            session.Save(updateLog);

            // AutoOrderCntNetFirst
            var log = new RequestLog(user)
            {
                Version      = "1.11",
                IsCompleted  = true,
                IsFaulted    = false,
                UpdateType   = "BatchController",
                CreatedOn    = SystemTime.Now(),
                RequestToken = Guid.NewGuid().ToString()
            };

            session.Save(log);

            // AutoOrderCntNetFirst
            log = new RequestLog(user)
            {
                Version      = "1.11",
                IsCompleted  = true,
                IsFaulted    = false,
                UpdateType   = "MainController",
                CreatedOn    = SystemTime.Now(),
                RequestToken = Guid.NewGuid().ToString()
            };
            session.Save(log);
            Flush();
            return(user);
        }
示例#17
0
        private void Create_loaded_document_logs_unparsed_document(out Client client, out Supplier supplier,
                                                                   out DocumentReceiveLog documentLogEntity, out UpdateLogEntity updateLogEntity)
        {
            client   = DataMother.CreateTestClientWithAddressAndUser();
            supplier = DataMother.CreateSupplier();
            Save(supplier);
            documentLogEntity = DataMother.CreateTestDocumentLog(supplier, client);
            updateLogEntity   = DataMother.CreateTestUpdateLogEntity(client);

            session.SaveOrUpdate(updateLogEntity);
            documentLogEntity.SendUpdateLogEntity = updateLogEntity;
            Save(documentLogEntity);
        }
示例#18
0
 private void Create_loaded_document_logs(out Client client, out Supplier supplier, out DocumentReceiveLog documentLogEntity,
                                          out Document document, out UpdateLogEntity updateLogEntity)
 {
     Create_loaded_document_logs_unparsed_document(out client, out supplier, out documentLogEntity, out updateLogEntity);
     document = DataMother.CreateTestDocument(supplier, client, documentLogEntity);
 }
示例#19
0
 public AttachmentSendLog(User user, Attachment attachment, UpdateLogEntity update)
 {
     User       = user;
     Attachment = attachment;
     Update     = update;
 }