Ejemplo n.º 1
0
 public void SetUp()
 {
     loginPage = new LoginPage(driver);
     loginPage.Load();
     landingPage     = new LandingPage(driver, loginPage);
     headerComponent = new HeaderComponent(driver);
 }
Ejemplo n.º 2
0
        public List <TableComponent> GetTableReportAutoRow(int IdBaoCao, AccountCookie accountCookie)
        {
            tongcuclamnghiepEntities tongcuclamnghiep = new tongcuclamnghiepEntities();
            List <TableComponent>    tableComponents  = new List <TableComponent>();
            var _Unit        = tongcuclamnghiep.m_unit.Where(a => a.account_id == accountCookie.Id && a.status == true).FirstOrDefault();
            var _Precious    = tongcuclamnghiep.m_precious.Where(a => a.status == false).FirstOrDefault();
            var _ReportTable = tongcuclamnghiep.m_reporttable.Where(a => a.status == true && a.autorow == true && a.id == IdBaoCao).FirstOrDefault();

            if (!(_Unit == null || _Precious == null || _ReportTable == null))
            {
                var  _UnitReport = tongcuclamnghiep.m_unit_precious.Where(a => a.precious_id == _Precious.id && a.unit_id == _Unit.id).FirstOrDefault();
                bool CheckView   = true;
                if (_UnitReport == null)
                {
                    CheckView = false;
                }
                else
                {
                    if (_UnitReport.completedate != null)
                    {
                        CheckView = false;
                    }
                }
                if (CheckView == true)
                {
                    tongcuclamnghiep.m_unit_datereport_autorows.Where(a => a.reporttable_id == IdBaoCao && a.unit_precious_id == _UnitReport.id).GroupBy(a => a.orderrow).ToList().ForEach(a =>
                    {
                        TableComponent tableComponent           = new TableComponent();
                        tableComponent.RowId                    = a.Key.Value;
                        List <HeaderComponent> headerComponents = new List <HeaderComponent>();
                        _ReportTable.m_header.OrderBy(b => b.level).OrderBy(b => b.order).ToList().ForEach(b =>
                        {
                            var datahead = a.Where(c => c.header_id == b.id).FirstOrDefault();
                            if (datahead != null)
                            {
                                HeaderComponent headerComponent = new HeaderComponent();
                                headerComponent.Id          = datahead.id;
                                headerComponent.OrderHeader = b.order.Value;
                                headerComponent.TextAlign   = b.valuetextalign;
                                headerComponent.TextBold    = b.is_valuebold.Value;
                                headerComponent.TextUpper   = b.is_valueupper.Value;
                                headerComponent.TextValue   = datahead.datatext;
                                headerComponent.HeaderId    = b.id;
                                headerComponents.Add(headerComponent);
                            }
                        });
                        tableComponent.headers = headerComponents;
                        tableComponents.Add(tableComponent);
                    });
                }
            }
            return(tableComponents);
        }
Ejemplo n.º 3
0
        public List <TableReport> GetDataReport(AccountCookie accountCookie)
        {
            List <TableReport>       tableReports     = new List <TableReport>();
            tongcuclamnghiepEntities tongcuclamnghiep = new tongcuclamnghiepEntities();
            var _Unit     = tongcuclamnghiep.m_unit.Where(a => a.status == true && a.account_id == accountCookie.Id).FirstOrDefault();
            var _Precious = tongcuclamnghiep.m_precious.Where(a => a.status == false).FirstOrDefault();

            if (_Precious != null && _Unit != null)
            {
                bool CheckView     = true;
                var  _UnitPrecious = tongcuclamnghiep.m_unit_precious.Where(a => a.unit_id == _Unit.id && a.precious_id == _Precious.id).FirstOrDefault();
                if (_UnitPrecious != null)
                {
                    if (_UnitPrecious.completedate != null)
                    {
                        CheckView = false;
                    }
                }
                if (CheckView == true)
                {
                    int Precious_Id_Before = 0;
                    int UnitPrecious_Id    = 0;
                    if (tongcuclamnghiep.m_precious.Any(a => a.status == false && a.id != _Precious.id))
                    {
                        Precious_Id_Before = tongcuclamnghiep.m_precious.Where(a => a.status == true && a.id != _Precious.id).OrderByDescending(a => a.completedate).Select(a => a.id).FirstOrDefault();
                    }
                    if (_UnitPrecious != null)
                    {
                        UnitPrecious_Id = tongcuclamnghiep.m_unit_precious.Where(a => a.unit_id == _Unit.id && a.precious_id == Precious_Id_Before).Select(a => a.id).FirstOrDefault();
                    }
                    tongcuclamnghiep.m_reporttable.Where(a => a.status == true).OrderBy(a => a.order).ToList().ForEach(a =>
                    {
                        TableReport tableReport        = new TableReport();
                        tableReport.IdBaoCao           = a.id;
                        tableReport.Title              = a.title;
                        tableReport.Order              = a.order.Value;
                        tableReport.AutoRow            = a.autorow.Value;
                        List <HeaderComponent> headers = new List <HeaderComponent>();
                        tongcuclamnghiep.m_header.Where(b => a.status == true && b.reporttable_id == a.id).OrderBy(b => b.order).ToList().ForEach(b =>
                        {
                            HeaderComponent header = new HeaderComponent();
                            header.Id           = b.id;
                            header.Title        = b.headername;
                            header.RowSpan      = b.rowspan.Value;
                            header.ColSpan      = b.colspan.Value;
                            header.HeaderId     = b.header_id;
                            header.Level        = b.level;
                            header.Is_No        = b.is_no;
                            header.Is_Component = b.is_component;
                            header.OrderHeader  = b.order.Value;
                            headers.Add(header);
                        });
                        tableReport.headers = headers.OrderBy(b => b.Level).ThenBy(b => b.OrderHeader).ToList();
                        List <TableComponent> tableComponents = new List <TableComponent>();
                        a.m_component.Where(b => b.status == true).GroupBy(b => b.orderrow).ToList().ForEach(b =>
                        {
                            TableComponent tableComponent           = new TableComponent();
                            tableComponent.RowId                    = b.Key.Value;
                            List <HeaderComponent> headerComponents = new List <HeaderComponent>();
                            tableReport.headers.ForEach(c => {
                                var _CPM = tongcuclamnghiep.m_component.Where(d => d.header_id == c.Id && d.orderrow == b.Key).FirstOrDefault();
                                if (_CPM != null)
                                {
                                    HeaderComponent header = new HeaderComponent();
                                    header.Id          = _CPM.id;
                                    header.OrderHeader = c.OrderHeader;
                                    header.HeaderId    = _CPM.header_id;
                                    header.TextAlign   = _CPM.m_header.valuetextalign;
                                    header.TextBold    = _CPM.m_header.is_valuebold.Value;
                                    header.TextUpper   = _CPM.m_header.is_valueupper.Value;
                                    header.TextValue   = _CPM.componentname;
                                    header.Title       = _CPM.m_header.headername;
                                    header.TypeValue   = _CPM.typevalue.Value;
                                    header.Is_No       = _CPM.m_header.is_no;
                                    if (_UnitPrecious == null)
                                    {
                                        header.Save = false;
                                        if (Precious_Id_Before > 0 && UnitPrecious_Id > 0)
                                        {
                                            var _dataUnitReportBefore = tongcuclamnghiep.m_unit_datareport.Where(d => d.component_id == _CPM.id && d.unit_precious_id == UnitPrecious_Id).FirstOrDefault();
                                            if (_dataUnitReportBefore == null)
                                            {
                                                header.TextUnit = "";
                                            }
                                            else
                                            {
                                                header.TextUnit = _dataUnitReportBefore.data_text;
                                            }
                                        }
                                        else
                                        {
                                            header.TextUnit = "";
                                        }
                                    }
                                    else
                                    {
                                        var _dataUnitReport = _CPM.m_unit_datareport.Where(d => d.unit_precious_id == _UnitPrecious.id).FirstOrDefault();
                                        if (_dataUnitReport == null)
                                        {
                                            header.Save = false;
                                            if (Precious_Id_Before > 0 && UnitPrecious_Id > 0)
                                            {
                                                var _dataUnitReportBefore = tongcuclamnghiep.m_unit_datareport.Where(d => d.component_id == _CPM.id && d.unit_precious_id == UnitPrecious_Id).FirstOrDefault();
                                                if (_dataUnitReportBefore == null)
                                                {
                                                    header.TextUnit = "";
                                                }
                                                else
                                                {
                                                    header.TextUnit = _dataUnitReportBefore.data_text;
                                                }
                                            }
                                            else
                                            {
                                                header.TextUnit = "";
                                            }
                                        }
                                        else
                                        {
                                            header.Save     = true;
                                            header.TextUnit = _dataUnitReport.data_text;
                                        }
                                    }

                                    header.Is_Component = _CPM.m_header.is_component;
                                    headerComponents.Add(header);
                                }
                            });
                            tableComponent.headers = headerComponents;

                            tableComponents.Add(tableComponent);
                        });
                        tableReport.tableComponents = tableComponents;

                        tableReports.Add(tableReport);
                    });
                }
            }
            return(tableReports);
        }
Ejemplo n.º 4
0
 public LandingPage(IWebDriver driver, LoginPage loginPage) : base(driver)
 {
     this.loginPage = loginPage;
     InitializeElements();
     header = new HeaderComponent(driver);
 }
Ejemplo n.º 5
0
        public void CheckTheCart()
        {
            CartComponent cartComponent = new HeaderComponent(driver).ClickOnCartButton();

            Assert.AreEqual(notebooksPage.GetItemTitle(), cartComponent.GetProductTitleText());
        }
Ejemplo n.º 6
0
 internal DomainBasePage(SeleniumInteractions interactions) : base(interactions)
 {
     Header = new HeaderComponent(interactions);
 }