Exemplo n.º 1
0
        public void ShouldBuildClientScriptStringForDashboardToPrintPageWithQueryString()
        {
            //Arrange
            Mock<IDashboardView> mockDashboardView = new Mock<IDashboardView>();
            mockDashboardView.SetupProperty(e => e.DashBoardViewType, Globals.Dashboard.ViewType.JobSummaryView);
            WebUtil util = new WebUtil();
            string queryStringValue = util.BuildQueryStringToPrintCallLogViewInDashBoardView(mockDashboardView.Object);

            //Act
            string script = util.BuildNewWindowClientScript("/DashboardPrint.aspx", queryStringValue,"",800,600,true,true,true);

            //Assert
            Assert.AreEqual("javascript: var newWindow = window.open('/DashboardPrint.aspx?ViewPoint=2','','width=800,height=600,scrollbars=1,resizable=yes');return false;", script);
        }
 /// <summary>
 /// Filter Project Calendar Data and Fills the view
 /// </summary>
 public void FindProjectCalendar()
 {
     try
     {
         IList<ProjectCalendarVO> listProjectCalendar = _model.ListAllProjectCalendar(_view.CalendarDateRange, _view.DivisionFilter, _view.EquipmentTypeFilter, _view.EquipmentFilter, _view.EmployeeFilter, _view.CustomerFilter, _view.JobFilter, _view.JobActionFilter);
         _view.ShowHidePanelNowRow(listProjectCalendar.Count.Equals(0));
         _viewModel.CreateDynamicCalendar(listProjectCalendar);
         string queryString = BuildQueryString();
         WebUtil util = new WebUtil();
         string script = util.BuildNewWindowClientScript("/ProjectCalendarPrint.aspx", BuildQueryString(), "", 1100, 600, true, true, true);
         _view.SetPrintButtonClientClick = script;
         //lnkButton.OnClientClick = string.Format("window.open('/ProcessDPI.aspx?DpiID={0}&ParentFieldId={1}', '', 'width=1100, height=600, scrollbars=1, resizable=yes');return false", value, btnFilter.UniqueID);
     }
     catch (Exception ex)
     {
         Logger.Write(string.Format("An error has ocurred while trying to filter Project Calendar!\n{0}\n{1}", ex.Message, ex.StackTrace));
         _view.DisplayMessage("An error ocurred while trying to filter Project Calendar.", false);
     }
 }
 public void ConfigurePrintButtonScript()
 {
     try
     {
         WebUtil util = new WebUtil();
         string script = string.Empty;
         if (this.DashBoardViewType == Globals.Dashboard.ViewType.JobCallLogView)
             script = util.BuildNewWindowClientScript("/DashboardPrint.aspx", util.BuildQueryStringToPrintCallLogViewInDashBoardView(this), string.Empty, 800, 600, true, true, true);
         else if (this.DashBoardViewType == Globals.Dashboard.ViewType.JobSummaryView)
             script = util.BuildNewWindowClientScript("/DashboardPrint.aspx", util.BuildQueryStringToPrintJobSummaryInDashBoardView(this), string.Empty, 800, 600, true, true, true);
         btnPrint.OnClientClick = script;
     }
     catch (Exception)
     {
         DisplayMessage("Error while generating Print Button Script", false);
     }
 }
        /// <summary>
        /// Search for a Job based on Number/Internal Tracking
        /// </summary>
        public void QuickSearch()
        {
            try
            {
                CS_Job job = null;
                using (_jobModel = new JobModel())
                {
                    if (!string.IsNullOrEmpty(_view.QuickSearchJobValue))
                        job = _jobModel.GetJobByNumber(_view.QuickSearchJobValue);
                }

                if (job != null)
                {
                    _view.QuickSearchJobId = job.ID;

                    WebUtil util = new WebUtil();
                    string querystring = util.BuildQueryStringToQuickSearch(_view);

                    string script = util.BuildNewWindowClientScript("/JobRecord.aspx", querystring, string.Empty, 870, 600, true, true, false);
                    _view.QuickSearchQueryString = script;
                }
                else
                {
                    _view.DisplayMessage("Job Not Found!", false);
                }
            }
            catch (Exception)
            {
                _view.DisplayMessage("There is an error searching the Job", false);
            }
        }
Exemplo n.º 5
0
        public void ShouldBuildScriptForQuickSearch()
        {
            //Arrange
            string queryString = "?JobId=1";
            WebUtil util = new WebUtil();

            //Act
            string script = util.BuildNewWindowClientScript("/JobRecord.aspx", queryString, string.Empty, 870, 600, true, true, false);

            //Assert
            Assert.AreEqual("javascript: var newWindow = window.open('/JobRecord.aspx?JobId=1','','width=870,height=600,scrollbars=1,resizable=yes');", script);
        }
Exemplo n.º 6
0
        public void ShouldBuildScriptForQuickReferenceWhenPassingQueryString()
        {
            //Arrange
            WebUtil util = new WebUtil();
            string queryString = "?JobId=8";

            //Act
            string script = util.BuildNewWindowClientScript("/JobRecord.aspx", queryString,"",870,600,true,true,false);

            //Assert
            Assert.AreEqual("javascript: var newWindow = window.open('/JobRecord.aspx?JobId=8','','width=870,height=600,scrollbars=1,resizable=yes');", script);
        }