상속: MonoBehaviour
예제 #1
0
	// Use this for initialization
	void Start () {
		Application.runInBackground = true ;

		reporter = FindObjectOfType( typeof(Reporter)) as Reporter ;
		Debug.Log("test long text sdf asdfg asdfg sdfgsdfg sdfg sfg" 	+ 
		          "sdfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdfg " 	+ 
		          "sdfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdfg " 	+ 
		          "sdfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdfg " 	+ 
		          "sdfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdfg " 	+ 
		          "sdfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdfg ssssssssssssssssssssss" 	+ 
		          "asdf asdf asdf asdf adsf \n dfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdf" +
		          "asdf asdf asdf asdf adsf \n dfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdf"+
		          "asdf asdf asdf asdf adsf \n dfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdf"+
		          "asdf asdf asdf asdf adsf \n dfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdf"+
		          "asdf asdf asdf asdf adsf \n dfgsdfg sdfg sdf gsdfg sfdg sf gsdfg sdfg asdf");
		
		style = new GUIStyle();
		style.alignment = TextAnchor.MiddleCenter ;
		style.normal.textColor = Color.white ;
		style.wordWrap = true ;
		
		for( int i = 0 ; i < 10 ; i ++ )
		{
			Debug.Log("Test Collapsed log");
			Debug.LogWarning("Test Collapsed Warning");
			Debug.LogError("Test Collapsed Error");
		}

		rect1 = new Rect (Screen.width/2-120, Screen.height/2-225, 240, 50) ;
		rect2 = new Rect (Screen.width/2-120, Screen.height/2-175, 240, 100) ;
		rect3 = new Rect (Screen.width/2-120, Screen.height/2-50, 240, 50) ;
		rect4 = new Rect (Screen.width/2-120, Screen.height/2, 240, 50) ;
		rect5 = new Rect (Screen.width/2-120, Screen.height/2+50, 240, 50) ;
		rect6 = new Rect (Screen.width/2-120, Screen.height/2+100, 240, 50) ;
	}
예제 #2
0
파일: Form1.cs 프로젝트: rNdm74/C-
        //====================================================
        // Display
        //====================================================
        private void displayReport(Reporter reporter, List<Garden> gardenList)
        {
            listBox1.Items.Clear();

            foreach (Garden garden in gardenList)
                listBox1.Items.Add(reporter(garden));
        }
예제 #3
0
        public BaseInstaller(string targetDirectory, Reporter reporter)
        {
            this.TargetDirectory = targetDirectory;

            this.reporter = reporter;

            GitPath = FindAmbiguousExecutable(GitSubdirectory);
            MySQLPath = FindAmbiguousExecutable(MySQLSubdirectory);
        }
예제 #4
0
        public void It_detects_when_a_member_is_marked_obsolete()
        {
            var reporter = new Reporter
            {
                Assemblies =
                                   {
                                       new AssemblyInfo
                                       {
                                           Name = "MyAssembly",
                                           Version = "1",
                                           Types =
                                               {
                                                   new TypeInfo
                                                   {
                                                       Name = "MyType",
                                                       Members =
                                                           {
                                                               new MemberInfo
                                                               {
                                                                   Name = "MyMethod",
                                                                   Kind = MemberKind.Method,
                                                               }
                                                           }
                                                   }
                                               }
                                       },
                                       new AssemblyInfo
                                       {
                                           Name = "MyAssembly",
                                           Version = "2",
                                           Types =
                                               {
                                                   new TypeInfo
                                                   {
                                                       Name = "MyType",
                                                       Members =
                                                           {
                                                               new MemberInfo
                                                               {
                                                                   Name = "MyMethod",
                                                                   Kind = MemberKind.Method,
                                                                   Obsolete = true,
                                                                   ObsoleteMessage = "I'm obsolete!"
                                                               }
                                                           }
                                                   }
                                               }
                                       }
                                   }
            };

            var report = reporter.GenerateReport();

            Assert.AreEqual(MemberChangeKind.ObsoletedMember, report.Types.Single().Members.Get("MyMethod").Changes.Single().Kind);
            Assert.AreEqual("2", report.Types.Single().Members.Get("MyMethod").Changes.Single().Version);
        }
예제 #5
0
 /// <summary>
 /// Resets the Reporters to write to the current Console Out/Error.
 /// </summary>
 public static void Reset()
 {
     lock (_lock)
     {
         Output = new Reporter(AnsiConsole.GetOutput());
         Error = new Reporter(AnsiConsole.GetError());
         Verbose = IsVerbose ?
             new Reporter(AnsiConsole.GetOutput()) :
             NullReporter;
     }
 }
    void OnPreStart()
    {
        //To Do : this method is called before initializing reporter, 
        //we can for example check the resultion of our device ,then change the size of reporter
        if (reporter == null)
            reporter = gameObject.GetComponent<Reporter>();

        if (Screen.width < 1000)
            reporter.size = new Vector2(25, 25);
        else 
            reporter.size = new Vector2(25, 25);
    }
	void OnPreStart(){
		//To Do : this method is called before initializing reporter, 
		//we can for example check the resultion of our device ,then change the size of reporter
		if( reporter == null )
			reporter = gameObject.GetComponent<Reporter>();

		if( Screen.width < 1000 )
			reporter.size = new Vector2( 32 , 32 );
		else 
			reporter.size = new Vector2( 48 , 48);

		reporter.UserData = "Put user date here like his account to know which user is playing on this device";
	}
예제 #8
0
        public void SendManyReportsTest(int numberOfReports)
        {
            var reports = Enumerable.Range(1, numberOfReports).Select(index => new Report { Id = index, Name = "report_name_" + index }).ToList();

            var builder = new Mock<IReportBuilder>();
            builder.Setup(m => m.CreateReports()).Returns(reports);

            var sender = new Mock<IReportSender>();

            var reporter = new Reporter(builder.Object, sender.Object);
            reporter.SendReports();

            reports.ForEach(report => sender.Verify(rs => rs.Send(report), Times.Once()));
        }
예제 #9
0
        public void SendReportsTest()
        {
            var report = new Mock<Report>();

            var builder = new Mock<IReportBuilder>();
            builder.Setup(m => m.CreateReports()).Returns(new List<Report> { report.Object });

            var sender = new Mock<IReportSender>();

            var reporter = new Reporter(builder.Object, sender.Object);
            reporter.SendReports();

            sender.Verify(rs => rs.Send(report.Object), Times.Once());
        }
        private void StartAppAgent(ApplicationAgent AG)
        {
            AutoLogProxy.UserOperationStart("StartAgentButton_Click");
            Reporter.ToStatus(eStatusMsgKey.StartAgent, null, AG.AgentName, AG.AppName);
            if (((Agent)AG.Agent).Status == Agent.eStatus.Running)
            {
                ((Agent)AG.Agent).Close();
            }

            ((Agent)AG.Agent).ProjEnvironment = App.AutomateTabEnvironment;
            ((Agent)AG.Agent).BusinessFlow    = mContext.BusinessFlow;
            ((Agent)AG.Agent).SolutionFolder  = WorkSpace.UserProfile.Solution.Folder;
            ((Agent)AG.Agent).DSList          = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <DataSourceBase>();
            ((Agent)AG.Agent).StartDriver();
            //For ASCF, launch explorer automatically when launching Agent
            if (((Agent)AG.Agent).IsShowWindowExplorerOnStart && ((Agent)AG.Agent).Status == Agent.eStatus.Running)
            {
                WindowExplorerPage WEP = new WindowExplorerPage(AG, mContext);
                WEP.ShowAsWindow();
            }

            Reporter.HideStatusMessage();
            AutoLogProxy.UserOperationEnd();
        }
 /// <summary>
 /// This method will restore the conversion done
 /// </summary>
 public override void Cancel()
 {
     try
     {
         if (IsConversionDoneOnce)
         {
             foreach (BusinessFlowToConvert bfToConvert in ListOfBusinessFlow)
             {
                 try
                 {
                     bfToConvert.BusinessFlow.RestoreFromBackup();
                 }
                 catch (Exception ex)
                 {
                     Reporter.ToLog(eLogLevel.ERROR, "Error occurred while Restoring from backup - " + bfToConvert.BusinessFlowName + " - ", ex);
                 }
             }
         }
     }
     finally
     {
         base.Cancel();
     }
 }
예제 #12
0
        private string TakeScreenShot()
        {
            string imagePath = string.Empty;

            try
            {
                System.Drawing.Rectangle bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
                using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
                {
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
                    }
                    imagePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "ScreenShot_" + DateTime.Now.ToString("MM-dd-yyyy_HH-mm-ss") + ".jpg");
                    bitmap.Save(imagePath, ImageFormat.Jpeg);
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
            }

            return(imagePath);
        }
예제 #13
0
        protected virtual List <T> ReadFile <T, M>(string path) where T : class, new()
        {
            var fileFormat = this.ProcessFileFormatFromPath(path);

            if (fileFormat == _settings.FILE_FORMAT_JSON)
            {
                var jsonString = File.ReadAllText(path);
                var converter  = new BoxJsonConverter();
                var collection = converter.Parse <BoxCollection <T> >(jsonString);
                return(collection.Entries.ToList());
            }
            else if (fileFormat == _settings.FILE_FORMAT_CSV)
            {
                using (var fs = File.OpenText(path))
                    using (var csv = new CsvReader(fs))
                    {
                        csv.Configuration.RegisterClassMap(typeof(M));
                        try
                        {
                            return(csv.GetRecords <T>().ToList());
                        }
                        catch (CsvTypeConverterException e)
                        {
                            foreach (var value in e.Data.Values)
                            {
                                Reporter.WriteError(value.ToString());
                            }
                            throw e;
                        }
                    }
            }
            else
            {
                throw new Exception($"File format {fileFormat} is not currently supported.");
            }
        }
예제 #14
0
        private Boolean IsInstrumentationModuleLoaded(int id)
        {
            //This method will check if process modules contains instrument dll
            //if yes that means java agent is already attached to this process
            try
            {
                if (id == -1)
                {
                    return(false);
                }

                Process process = Process.GetProcessById(id);
                ProcessModuleCollection processModules = process.Modules;
                ProcessModule           module;

                int modulesCount = processModules.Count - 1;
                // we start from end, because instrument dll is always loaded after rest of the modules are already loaded
                //So we look for only last 5 modules
                int maxProcessToCheck = modulesCount - 5 > 0 ? modulesCount - 5 : 0;
                for (int i = modulesCount; i > maxProcessToCheck - 5; i--)
                {
                    module = processModules[i];

                    if (module.ModuleName.Equals("instrument.dll"))
                    {
                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Reporter.ToLog(eLogLevel.WARN, "Exception when checking IsInstrumentationModuleLoaded for process id:" + id, e);
            }

            return(false);
        }
예제 #15
0
        private void RemoveColumn(object sender, RoutedEventArgs e)
        {
            if (Reporter.ToUser(eUserMsgKey.SaveLocalChanges) == Amdocs.Ginger.Common.eUserMsgSelection.No)
            {
                return;
            }
            RemoveTableColumnPage RTCP = new RemoveTableColumnPage(mDSTableDetails.DSC.GetColumnList(mDSTableDetails.Name));

            RTCP.ShowAsWindow();

            DataSourceTableColumn dsTableColumn = RTCP.DSTableCol;

            if (dsTableColumn != null)
            {
                SaveTable();
                mDSTableDetails.DSC.RemoveColumn(mDSTableDetails.Name, dsTableColumn.Name);
                SetGridView(true);
                mColumnNames.Remove(dsTableColumn.Name);
                if (dsTableColumn.Name == "GINGER_USED")
                {
                    grdTableData.btnMarkAll.Visibility = Visibility.Collapsed;
                }
            }
        }
예제 #16
0
        private void RenameTreeFolderHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            string originalName  = mTreeView.Tree.GetSelectedTreeNodeName();
            string newFolderName = originalName;

            if (InputBoxWindow.GetInputWithValidation("Rename Folder", "New Folder Name:", ref newFolderName, System.IO.Path.GetInvalidPathChars()))
            {
                if (!String.IsNullOrEmpty(newFolderName))
                {
                    string path = Path.Combine(Path.GetDirectoryName(this.NodePath().TrimEnd('\\', '/')), newFolderName);
                    if (System.IO.Directory.Exists(path) == true && originalName.ToUpper() != newFolderName.ToUpper())
                    {
                        Reporter.ToUser(eUserMsgKey.FolderExistsWithName);
                        mTreeView.Tree.RefreshSelectedTreeNodeParent();
                        return;
                    }
                    else
                    {
                        try
                        {
                            if (RenameTreeFolder(originalName, newFolderName, path) == false)
                            {
                                Reporter.ToUser(eUserMsgKey.RenameItemError, path);
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToUser(eUserMsgKey.RenameItemError, ex.Message);
                            Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
                            return;
                        }
                    }
                }
            }
        }
예제 #17
0
        public void HiglightElement(ElementInfo ei)
        {
            if (IsWindowValid(GetCurrentWindow()))
            {
                //TODO: FIXME there is still glitch in refresh when highlighting form system menu
                UIAElementInfo WEI = (UIAElementInfo)ei;
                //First remove the last highlight if exist
                if (LastHighLightHWND != 0)
                {
                    // Remove the highlighter by asking the window to repaint
                    // Better repaint the whole window, caused some glitched when trying to repaint just the control window
                    HandlePaintWindow(GetCurrentWindow());
                    RedrawWindow((IntPtr)LastHighLightHWND, IntPtr.Zero, IntPtr.Zero, 0x0400 /*RDW_FRAME*/ | 0x0100 /*RDW_UPDATENOW*/ | 0x0001 /*RDW_INVALIDATE*/);
                }

                if (WEI.ElementObject == null)
                {
                    return;
                }

                Rect r = new Rect();
                r = GetElementBoundingRectangle(WEI.ElementObject);

                int hwnd = GetElementNativeWindowHandle(GetCurrentWindow());  // AE.Current.NativeWindowHandle;
                                                                              // hwnd = (TreeWalker.ContentViewWalker.GetParent(AE)).Current.NativeWindowHandle;
                LastHighLightHWND = hwnd;

                // If user have multiple screens, get the one where the current window is displayed, resolve issue of highlighter not working when app window on secondary monitor
                System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.FromHandle((IntPtr)hwnd);
                HighlightRect(r, scr, WEI);
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.ObjectUnavailable, "Selected Object is not available, cannot highlight the element");
            }
        }
예제 #18
0
        public bool ParseRespondToOutputParams()
        {
            if (Response != null)
            {
                mAct.AddOrUpdateReturnParamActual("Header: Status Code ", Response.StatusCode.ToString());
                Reporter.ToLog(eLogLevel.DEBUG, "Retrieve Response Status Code passed successfully");
                foreach (var Header in Response.Headers)
                {
                    string headerValues = string.Empty;
                    foreach (string val in Header.Value.ToArray())
                    {
                        headerValues = val + ",";
                    }
                    headerValues = headerValues.Remove(headerValues.Length - 1);
                    mAct.AddOrUpdateReturnParamActual("Header: " + Header.Key.ToString(), headerValues);
                }
                Reporter.ToLog(eLogLevel.DEBUG, "responseHeadersCollection passed successfully");
            }
            else
            {
                mAct.AddOrUpdateReturnParamActual("Respond", "Respond returned as null");
            }



            string prettyResponse = XMLDocExtended.PrettyXml(ResponseMessage);

            mAct.AddOrUpdateReturnParamActual("Response:", prettyResponse);

            if (!ActWebAPIBase.ParseNodesToReturnParams(mAct, ResponseMessage))
            {
                return(false);
            }

            return(true);
        }
예제 #19
0
        public static void ClassInit(TestContext context)
        {
            AutoLogProxy.Init("NonUITests");
            mBF            = new BusinessFlow();
            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF WebServices Web API";
            mBF.Active     = true;


            Platform p = new Platform();

            p.PlatformType = ePlatformType.WebServices;


            mDriver = new WebServicesDriver(mBF);
            mDriver.SaveRequestXML        = true;
            mDriver.SavedXMLDirectoryPath = "~\\Documents";


            wsAgent.DriverType = Agent.eDriverType.WebServices;
            wsAgent.Driver     = mDriver;
            ApplicationAgent mAG = new ApplicationAgent();

            mAG.Agent = wsAgent;

            mGR = new GingerRunner();
            mGR.SolutionAgents = new ObservableList <Agent>();
            mGR.SolutionAgents.Add(wsAgent);

            mGR.BusinessFlows.Add(mBF);

            Reporter.ToLog(eLogLevel.DEBUG, "Creating the GingerCoreNET WorkSpace");
            WorkSpaceEventHandler WSEH = new WorkSpaceEventHandler();

            WorkSpace.Init(WSEH);
        }
예제 #20
0
 private void RemoveXmlNode(ref string xml, string nodeName, int searchStartIndx)
 {
     try
     {
         string startNode = "<" + nodeName + ">";
         string endNode = "</" + nodeName + ">";
         int startIndx = xml.IndexOf(startNode, searchStartIndx);
         if (startIndx == -1)
             return;
         else
             RemoveXmlNode(ref xml, nodeName, startIndx + 9);//remove the more dipper node
         //remove node
         int endIndx = xml.IndexOf(endNode, startIndx+9);
         if (endIndx != -1 && endIndx > startIndx)
         {
             xml = xml.Remove(startIndx, endIndx - startIndx + 9);
         }
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}");
         return;
     }
 }
예제 #21
0
        private void Share(object sender, System.Windows.RoutedEventArgs e)
        {
            bool appsWereAdded = false;
            ObservableList <ProjEnvironment> envs = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>();

            foreach (ProjEnvironment env in envs)
            {
                if (env != ProjEnvironment)
                {
                    if (env.Applications.Where(x => x.Name == EnvApplication.Name).FirstOrDefault() == null)
                    {
                        EnvApplication app = (EnvApplication)(((RepositoryItemBase)EnvApplication).CreateCopy());
                        env.Applications.Add(app);
                        env.SaveBackup();//to mark the env as changed
                        appsWereAdded = true;
                    }
                }
            }

            if (appsWereAdded)
            {
                Reporter.ToUser(eUserMsgKey.ShareEnvAppWithAllEnvs);
            }
        }
예제 #22
0
        //get test set explorer(tree view)
        public static IEnumerable <Object> GetTestSetExplorer(string PathNode)
        {
            TestSetTreeManager treeM    = (TestSetTreeManager)mTDConn.TestSetTreeManager;
            TestSetFolder      tsFolder = treeM.get_NodeByPath(PathNode);

            if (tsFolder == null && PathNode.ToUpper() == "ROOT")
            {
                tsFolder = treeM.Root;
            }

            TestSetFactory TSetFact = mTDConn.TestSetFactory;
            TDFilter       tsFilter = TSetFact.Filter;

            try
            {
                tsFilter["CY_FOLDER_ID"] = "" + tsFolder.NodeID + "";
            }
            catch (Exception e)
            {
                tsFilter["CY_FOLDER_ID"] = "\"" + tsFolder.Path.ToString() + "\"";
                Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e);
            }

            List TestsetList = TSetFact.NewList(tsFilter.Text);
            List <QCTestSetSummary> testlabPathList = new List <QCTestSetSummary>();

            foreach (TestSet testset in TestsetList)
            {
                QCTestSetSummary QCTestSetTreeItem = new QCTestSetSummary();
                QCTestSetTreeItem.TestSetID   = testset.ID;
                QCTestSetTreeItem.TestSetName = testset.Name;
                testlabPathList.Add(QCTestSetTreeItem);
            }

            return(testlabPathList);
        }
예제 #23
0
        private void LoadPluginsActions()
        {
            ObservableList <PluginPackage> plugins        = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <PluginPackage>();
            ObservableList <Act>           PlugInsActions = new ObservableList <Act>();

            foreach (PluginPackage pluginPackage in plugins)
            {
                try
                {
                    ObservableList <StandAloneAction> actions = pluginPackage.GetStandAloneActions();

                    foreach (StandAloneAction SAA in actions)
                    {
                        ActPlugIn act = new ActPlugIn();
                        act.Description = SAA.Description;
                        act.GetOrCreateInputParam(nameof(ActPlugIn.ServiceId), pluginPackage.PluginID);
                        act.GetOrCreateInputParam(nameof(ActPlugIn.GingerActionID), SAA.ID);
                        foreach (var v in SAA.InputValues)
                        {
                            act.InputValues.Add(new ActInputValue()
                            {
                                Param = v.Param
                            });
                        }
                        act.Active = true;
                        PlugInsActions.Add(act);
                    }
                }
                catch (Exception ex)
                {
                    Reporter.ToLog(eLogLevel.ERROR, "Failed to get the Action of the Plugin '" + pluginPackage.PluginID + "'", ex);
                }
            }

            PlugInsActionsGrid.DataSourceList = PlugInsActions;
        }
예제 #24
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            List <RecoveredItem> SelectedFiles = mRecoveredItems.Where(x => x.Selected == true && (x.Status != eRecoveredItemStatus.Deleted && x.Status != eRecoveredItemStatus.Recovered)).ToList();

            if (SelectedFiles == null || SelectedFiles.Count == 0)
            {
                //TODO: please select valid Recover items to delete
                Reporter.ToUser(eUserMsgKeys.RecoverItemsMissingSelectionToRecover, "delete");
                return;
            }

            foreach (RecoveredItem Ri in SelectedFiles)
            {
                try
                {
                    File.Delete(Ri.RecoveredItemObject.FileName);
                    Ri.Status = eRecoveredItemStatus.Deleted;
                }
                catch
                {
                    Ri.Status = eRecoveredItemStatus.DeleteFailed;
                }
            }
        }
예제 #25
0
        internal string GetRecordCount(string SQL)
        {
            string sql = "SELECT COUNT(1) FROM " + SQL;

            String       rc     = null;
            DbDataReader reader = null;

            if (MakeSureConnectionIsOpen())
            {
                try
                {
                    DbCommand command = oConn.CreateCommand();
                    command.CommandText = sql;
                    command.CommandType = CommandType.Text;

                    // Retrieve the data.
                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        rc = reader[0].ToString();
                        break; // We read only first row = count of records
                    }
                }
                catch (Exception e)
                {
                    Reporter.ToLog(eAppReporterLogLevel.ERROR, "Failed to execute query:" + SQL, e, writeOnlyInDebugMode: true);
                    throw e;
                }
                finally
                {
                    reader.Close();
                }
            }

            return(rc);
        }
예제 #26
0
        /// <summary>
        /// Create summary json of the execution
        /// </summary>
        /// <param name="fileName"></param>
        public void CreateExecutionHTMLReport(string fileName)
        {
            WorkSpace.Instance.RunsetExecutor.CreateGingerExecutionReportAutomaticly();


            HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault();
            HTMLReportConfiguration  htmlRep     = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>().Where(x => (x.IsSelected == true)).FirstOrDefault();
            //if (grdExecutionsHistory.CurrentItem == null)
            //{
            //    Reporter.ToUser(eUserMsgKey.NoItemWasSelected);
            //    return;
            //}

            // string runSetFolder = ExecutionLogger.GetLoggerDirectory(((RunSetReport)grdExecutionsHistory.CurrentItem).LogFolder);

            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! temp
            string runSetFolder = @"C:\Users\yaronwe\source\repos\Ginger\Ginger\GingerCoreNETUnitTest\bin\Debug\netcoreapp2.2\TestResources\Solutions\CLI\ExecutionResults\Default Run Set_04082019_115742";

            string reportsResultFolder = ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, htmlRep, null, false, currentConf.HTMLReportConfigurationMaximalFolderSize);

            if (reportsResultFolder == string.Empty)
            {
                Reporter.ToUser(eUserMsgKey.NoItemWasSelected);
                return;
            }
            else
            {
                Process.Start(reportsResultFolder);
                Process.Start(reportsResultFolder + "\\" + "GingerExecutionReport.html");
            }


            // System.IO.File.WriteAllText(fileName, s);

            // ExtensionMethods.CreateGingerExecutionReport()
        }
예제 #27
0
        public void Run(Reporter reporter)
        {
            reporter.ExampleGroupStarted(this);

            foreach (var example in Examples)
            {
                if (BeforeEach != null)
                {
                    BeforeEach();
                }

                example.Run(reporter);
            }

            foreach (var child in Children)
            {
                if (BeforeEach != null)
                {
                    BeforeEach();
                }

                child.Run(reporter);
            }
        }
        private void XAddGroupBtn_Click(object sender, RoutedEventArgs e)
        {
            string groupName = string.Empty;

            if (InputBoxWindow.GetInputWithValidation(GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup, "New"), GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup, "New", "Name:"), ref groupName))
            {
                if (!string.IsNullOrEmpty(groupName))
                {
                    if (mWizard.Context.BusinessFlow.ActivitiesGroups.Where(x => x.Name.Trim() == groupName.Trim()).FirstOrDefault() == null)
                    {
                        ActivitiesGroup activitiesGroup = new ActivitiesGroup()
                        {
                            Name = groupName.Trim()
                        };
                        mWizard.Context.BusinessFlow.AddActivitiesGroup(activitiesGroup);
                        xGroupComboBox.SelectedItem = activitiesGroup;
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKey.StaticWarnMessage, "Group with same name already exist, please set unique name.");
                    }
                }
            }
        }
        private void LiveSpyHandler(object sender, RoutedEventArgs e)
        {
            if (mWinExplorer == null)
            {
                Reporter.ToUser(eUserMsgKey.POMAgentIsNotRunning);
                LiveSpyButton.IsChecked = false;
                return;
            }

            if (mAgent.Driver.IsDriverBusy)
            {
                Reporter.ToUser(eUserMsgKey.POMDriverIsBusy);
                LiveSpyButton.IsChecked = false;
                return;
            }

            if (LiveSpyButton.IsChecked == true)
            {
                mWinExplorer.StartSpying();
                xStatusLable.Content = "Spying is On";
                if (mDispatcherTimer == null)
                {
                    mDispatcherTimer          = new System.Windows.Threading.DispatcherTimer();
                    mDispatcherTimer.Tick    += new EventHandler(timenow);
                    mDispatcherTimer.Interval = new TimeSpan(0, 0, 1);
                }

                mDispatcherTimer.IsEnabled = true;
            }
            else
            {
                xCreateNewElement.Visibility = Visibility.Collapsed;
                xStatusLable.Content         = "Spying is Off";
                mDispatcherTimer.IsEnabled   = false;
            }
        }
        // TODO: Make this function to just generate the report folder !!!
        public LiteDbRunSet RunNewHtmlReport(string runSetGuid = null, WebReportFilter openObject = null, bool shouldDisplayReport = true)
        {
            LiteDbRunSet lightDbRunSet = new LiteDbRunSet();
            bool         response      = false;

            try
            {
                string clientAppFolderPath = Path.Combine(WorkSpace.Instance.LocalUserApplicationDataFolderPath, "Reports", "Ginger-Web-Client");
                if (!Directory.Exists(clientAppFolderPath))
                {
                    return(lightDbRunSet);
                }
                DeleteFoldersData(Path.Combine(clientAppFolderPath, "assets", "Execution_Data"));
                DeleteFoldersData(Path.Combine(clientAppFolderPath, "assets", "screenshots"));
                LiteDbManager       dbManager  = new LiteDbManager(new ExecutionLoggerHelper().GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder));
                var                 result     = dbManager.GetRunSetLiteData();
                List <LiteDbRunSet> filterData = null;
                if (!string.IsNullOrEmpty(runSetGuid))
                {
                    filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetGuid).ToList();
                }
                else
                {
                    filterData = dbManager.FilterCollection(result, Query.All());
                }
                lightDbRunSet = filterData.Last();
                PopulateMissingFields(lightDbRunSet, clientAppFolderPath);
                string json = Newtonsoft.Json.JsonConvert.SerializeObject(filterData.Last());
                response = RunClientApp(json, clientAppFolderPath, openObject, shouldDisplayReport);
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "RunNewHtmlReport,error :" + ex.ToString());
            }
            return(lightDbRunSet);
        }
예제 #31
0
파일: OutputTest.cs 프로젝트: sebgod/hime
        /// <summary>
        /// Executes this test on the .Net runtime
        /// </summary>
        /// <param name="reporter">The reported to use</param>
        /// <param name="fixture">The parent fixture's name</param>
        /// <returns>The test result</returns>
        private TestResult ExecuteOnNet(Reporter reporter, string fixture)
        {
            TestResult    result = new TestResult();
            List <string> output = new List <string>();
            int           code   = TestResult.RESULT_FAILURE_PARSING;

            try
            {
                StringBuilder args = new StringBuilder("Hime.Tests.Generated.");
                args.Append(Helper.ToUpperCamelCase(fixture));
                args.Append(".");
                args.Append(Name);
                args.Append("Parser outputs");
                code = ExecuteCommand(reporter, "mono", "executor-net.exe " + args, output);
            }
            catch (Exception ex)
            {
                output.Add(ex.ToString());
            }
            result.Finish(code, output);
            switch (code)
            {
            case TestResult.RESULT_SUCCESS:
                reporter.Info("\t=> Success");
                break;

            case TestResult.RESULT_FAILURE_PARSING:
                reporter.Info("\t=> Error");
                break;

            case TestResult.RESULT_FAILURE_VERB:
                reporter.Info("\t=> Failure");
                break;
            }
            return(result);
        }
예제 #32
0
        public override bool SaveTreeItem(object item, bool saveOnlyIfDirty = false)
        {
            if (item is RepositoryItemBase)
            {
                RepositoryItemBase RI = (RepositoryItemBase)item;
                if (saveOnlyIfDirty && RI.DirtyStatus != eDirtyStatus.Modified)
                {
                    return(false);//no need to Save because not Dirty
                }
                Reporter.ToGingerHelper(eGingerHelperMsgKey.SaveItem, null, RI.ItemName, "item");
                WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(RI);
                Reporter.CloseGingerHelper();

                //refresh node header
                PostSaveTreeItemHandler();
                return(true);
            }
            else
            {
                //implement for other item types
                Reporter.ToUser(eUserMsgKeys.StaticWarnMessage, "Save operation for this item type was not implemented yet.");
                return(false);
            }
        }
        private object InvokeOperationImpl(string operationName, IDictionary arguments, bool isVoid = false)
        {
            var resultHandler = (dynamic)CreateResultHandler();

            Execute(operationName, resultHandler, arguments);

            if (resultHandler.ErrorType != null)
            {
                if (resultHandler.ErrorType == OperationExceptionTypeName)
                {
                    Reporter.Verbose(resultHandler.ErrorStackTrace);
                }
#if NET451
                else if (resultHandler.ErrorType == typeof(RemotingException).FullName)
                {
                    Reporter.Verbose(resultHandler.ErrorStackTrace);
                    throw new OperationErrorException(ToolsStrings.DesignDependencyIncompatible);
                }
#endif
                else
                {
                    Reporter.Error(resultHandler.ErrorStackTrace, suppressColor: true);
                }

                throw new OperationErrorException(resultHandler.ErrorMessage);
            }

            if (!isVoid &&
                !resultHandler.HasResult)
            {
                throw new InvalidOperationException(
                          $"A value was not returned for operation '{operationName}'.");
            }

            return(resultHandler.Result);
        }
예제 #34
0
        public bool AutoALMProjectConnect(eALMConnectType almConnectStyle = eALMConnectType.Silence, bool showConnWin = true, bool asConnWin = false)
        {
            int  retryConnect = 0;
            bool isConnected  = false;

            while (!isConnected && retryConnect < 2)
            {
                try { isConnected = ConnectALMProject(); }
                catch (Exception e) { Reporter.ToLog(eAppReporterLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e); }
                retryConnect++;
            }
            if (!isConnected && almConnectStyle != eALMConnectType.Silence)
            {
                if (showConnWin)
                {
                    ALMConnectionPage almConnPage = new ALMConnectionPage(almConnectStyle, asConnWin);
                    almConnPage.ShowAsWindow();
                    try { isConnected = ConnectALMProject(); }
                    catch (Exception e) { Reporter.ToLog(eAppReporterLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e); }
                }
            }

            return(isConnected);
        }
예제 #35
0
        public ShellBag(RegistryKey rootKey, short timeZoneBias, bool outputUtc, Reporter reporter, Logger logger)
            : base(rootKey, timeZoneBias, outputUtc, reporter, logger)
        {
            // 他を触らないでルートからキーを取り直すための苦肉の策
            if (this.Key == null)
            {
                KeyPath  = @"Software\Microsoft\Windows\ShellNoRoam\BagMRU";
                this.Key = this.RootKey.GetSubkey(KeyPath);

                if (null != Key)
                {
                    Reporter.Write("XPのキーを検索");
                    Reporter.Write("キーのパス:" + KeyPath);

                    if (PrintKeyInBase)
                    {
                        Reporter.Write("キーの最終更新日時:" + Library.TransrateTimestamp(Key.Timestamp, TimeZoneBias, OutputUtc));
                        Reporter.Write("");
                    }

                    this._isXp = true;
                }
            }
        }
        public void novoMetodo(Completa[] produto, string[] mesa)
        {
            try
            {
                Reporter mr = new Reporter();
                EpsonCodes mer = new EpsonCodes();

                if (File.Exists(endereco))
                    File.Delete(endereco);

                mr.Output = endereco;
                mr.StartJob();
                Comanda cc = new Comanda(venda.cod_venda, true);
                string pont = "|---------------------------|";
                int line = 1;
                int limite = 29;
                mr.PrintText(line++, 01, "|----------COZINHA----------|");

                mr.PrintText(line, 01, "|Data:" + DateTime.Now.ToShortDateString()); mr.PrintText(line++, limite, "|");
                mr.PrintText(line, 01, "|Hora:" + DateTime.Now.ToShortTimeString()); mr.PrintText(line++, limite, "|");
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line, 01, "|"); mr.PrintText(line++, limite, "|");
                //produto
                int ii = produto.Length;

                while (ii-- > 0)
                {
                    mr.PrintText(line, 1, "| - " + produto[ii].segmentoImprimir); mr.PrintText(line++, limite, "|");
                    string tam = new BancoInformacao().tamanhoDescricaoByCodigo(produto[ii].produto[0].cod_tamanho);
                    if (tam.Length > 18) tam = tam.Substring(0, 18);
                    mr.PrintText(line, 1, "|Tamanho- " + tam); mr.PrintText(line++, limite, "|");
                    for (int j = 0; j < produto[ii].produto.Length; j++)
                    {
                        string prod = new Banco().preencherNomeProdctAll(produto[ii].produto[j].cod_produto);
                        if (prod.Length > 27) prod = prod.Substring(0, 27);
                        mr.PrintText(line, 01, "|" + prod); mr.PrintText(line++, limite, "|");
                        mr.PrintText(line, 01, "|"); mr.PrintText(line, 6, "--" + (produto[ii].produto[j].porcentagem * 100) + " %"); mr.PrintText(line++, limite, "|");
                    }

                    mr.PrintText(line, 1, "|Quantidade - " + produto[ii].quantidade); mr.PrintText(line++, limite, "|");
                    string noticia = "";
                    int u = 0;
                    string nota = produto[ii].getNoticia(); string obs = "obs. "; int limit = limite -7;
                    while (u < nota.Length)
                    {
                        if (noticia.Length % limit == 0 && u >= limit)
                        {
                            mr.PrintText(line, 01, obs + noticia); mr.PrintText(line++, limite, "|"); noticia = ""; obs = ""; limit = limite-1;
                        }
                        noticia += produto[ii].getNoticia().Substring(u++, 1);
                    }
                    mr.PrintText(line, 01, "|" + noticia); mr.PrintText(line++, limite, "|"); noticia = "";
                    mr.PrintText(line++, 01, "| -- - -- - --  |");
                }
                //produto
                mr.PrintText(line++, 01, pont);
                if (produto[0].garconImprimir.Length > 15) produto[0].garconImprimir = produto[0].garconImprimir.Substring(0, 15);
                string garc = "|GARCON -" + produto[0].garconImprimir;
                mr.PrintText(line, 01, garc); mr.PrintText(line++, limite, "|");

                mr.PrintText(line, 01, "| " + mesa[mesa.Length - 1]); mr.PrintText(line++, limite, "|");
                mr.PrintText(line++, 01, pont);

                mr.PrintJob();
                mr.EndJob();

                ImprimirBematech(endereco, new Banco().getCodImpressoraByTipo(new BancoConsulta().cod_tipoPeloNome(new Banco().segmentoDoProduto(produto[0].produto[0].cod_produto))));

            }
            catch { }
        }
        public void gerarComandaCozinha(Completa[] produto, string[] mesa, bool reimpresso)
        {
            try
            {
                this.printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("comanda", 304, 2000);
                printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
                Reporter mr = new Reporter();
                if (File.Exists(endereco))
                    File.Delete(endereco);

                mr.Output = endereco;
                mr.StartJob();
                //tamanho Interno 23

                Comanda cc = new Comanda(venda.cod_venda, true);
                string pont = "|---------------------|";
                int line = 1;
                //

                string cozinha = new Banco().carregaComandaCozinha();
                mr.PrintText(line++, 01, "|----" + cozinha + "----|");//13

                mr.PrintText(line, 01, "| Data : " + DateTime.Now.ToShortDateString()); mr.PrintText(line++, 23, "|");
                mr.PrintText(line, 01, "| Hora : " + DateTime.Now.ToShortTimeString()); mr.PrintText(line++, 23, "|");
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line, 01, "|"); mr.PrintText(line++, 23, "|");
                //produto
                int ii = produto.Length;

                while (ii-- > 0)
                {
                    if (reimpresso)
                    {
                        mr.PrintText(line, 1, "| - REIMPRESSAO "); mr.PrintText(line++, 23, "|");
                    }
                    mr.PrintText(line, 1, "| - " + produto[ii].segmentoImprimir); mr.PrintText(line++, 23, "|");

                    string tam = new BancoInformacao().tamanhoDescricaoByCodigo(produto[ii].produto[0].cod_tamanho);
                    if (tam.Length > 14) tam = tam.Substring(0, 14);
                    mr.PrintText(line, 1, "| Especif. - " + tam); mr.PrintText(line++, 23, "|");
                    for (int j = 0; j < produto[ii].produto.Length; j++)
                    {
                        string prod = "Item - " + new Banco().preencherNomeProdctAll(produto[ii].produto[j].cod_produto);
                        if (prod.Length > 16) prod = prod.Substring(0, 16);
                        mr.PrintText(line, 01, "| " + prod); mr.PrintText(line++, 23, "|");
                        mr.PrintText(line, 1, "| PRECO UNITARIO - " + produto[ii].valorUnitario); mr.PrintText(line++, 23, "|");
                        if (produto[ii].produto[j].porcentagem != 1)
                        {
                            mr.PrintText(line, 01, "|");
                            mr.PrintText(line, 6, " -- " + (produto[ii].produto[j].porcentagem * 100) + " %");
                            mr.PrintText(line++, 23, "|");
                        }
                    }
                    mr.PrintText(line, 1, "|Quantidade - " + produto[ii].quantidade.ToString("0.000")); mr.PrintText(line++, 23, "|");
                    mr.PrintText(line, 1, "|Valor Item - " + (produto[ii].valorUnitario * produto[ii].quantidade).ToString("0.00")); mr.PrintText(line++, 23, "|");
                    //   mr.PrintText(line, 01, "|"); mr.PrintText(line++, 17, "|");
                    string noticia = "";
                    int u = 0;
                    string nota = produto[ii].getNoticia(); string obs = "obs. "; int limite = 16;
                    while (u < nota.Length)
                    {
                        if (noticia.Length % limite == 0 && u >= limite)
                        {
                            mr.PrintText(line, 01, obs + noticia); mr.PrintText(line++, 23, "|"); noticia = ""; obs = ""; limite = 22;
                        }
                        noticia += produto[ii].getNoticia().Substring(u++, 1);
                    }
                    mr.PrintText(line, 01, "|" + noticia); mr.PrintText(line++, 23, "|"); noticia = "";
                    mr.PrintText(line++, 01, "| --  -   --   -  --  |");
                }
                //produto
                mr.PrintText(line++, 01, pont);
                if (produto[0].garconImprimir.Length > 12) produto[0].garconImprimir = produto[0].garconImprimir.Substring(0, 12);
                string garc = "| GARCOM -" + produto[0].garconImprimir;
                mr.PrintText(line, 01, garc); mr.PrintText(line++, 23, "|");

                mr.PrintText(line, 01, "| " + mesa[mesa.Length - 1]); mr.PrintText(line++, 23, "|");
                mr.PrintText(line++, 01, pont);

                mr.PrintJob();
                mr.EndJob();
                lerArquivo(new Banco().getCodImpressoraByTipo(new BancoConsulta().cod_tipoPeloNome(new Banco().segmentoDoProduto(produto[0].produto[0].cod_produto))));
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message+ "info add:  "+ ee.Data);
            }
        }
예제 #38
0
        public void UpdateExecutionStats()
        {
            //TODO: break to smaller funcs
            List <GingerCoreNET.GeneralLib.StatItem> allItems = new List <GingerCoreNET.GeneralLib.StatItem>();
            int totalActivityCount = 0;
            int totalActionCount   = 0;

            try//Added try catch, to catch the exception caused when acts object is modified by other thread
            {
                this.Dispatcher.Invoke(() =>
                {
                    mBFESs = mRunner.BusinessFlows;
                    //Business Flows
                    List <GingerCoreNET.GeneralLib.StatItem> bizsList = new List <GingerCoreNET.GeneralLib.StatItem>();
                    var bizGroups = mBFESs
                                    .GroupBy(n => n.RunStatus)
                                    .Select(n => new
                    {
                        Status = n.Key.ToString(),
                        Count  = n.Count()
                    })
                                    .OrderBy(n => n.Status);
                    foreach (var v in bizGroups)
                    {
                        bizsList.Add(new GingerCoreNET.GeneralLib.StatItem()
                        {
                            Description = v.Status, Count = v.Count
                        });
                    }
                    BizFlowsPieChartLayout.DataContext = bizsList;
                    CreateStatistics(bizsList, eObjectType.BusinessFlow);
                    //Activities
                    List <GingerCoreNET.GeneralLib.StatItem> activitiesList = new List <GingerCoreNET.GeneralLib.StatItem>();
                    var activitiesGroups = mBFESs.SelectMany(b => b.Activities).Where(b => b.GetType() != typeof(ErrorHandler))
                                           .GroupBy(n => n.Status)
                                           .Select(n => new
                    {
                        Status = n.Key.ToString(),
                        Count  = n.Count()
                    })
                                           .OrderBy(n => n.Status);
                    foreach (var v in activitiesGroups)
                    {
                        activitiesList.Add(new GingerCoreNET.GeneralLib.StatItem()
                        {
                            Description = v.Status, Count = v.Count
                        });
                        totalActivityCount += v.Count;
                    }
                    ActivitiesPieChartLayout.DataContext = activitiesList;
                    CreateStatistics(activitiesList, eObjectType.Activity);
                    //Actions
                    List <GingerCoreNET.GeneralLib.StatItem> actionsList = new List <GingerCoreNET.GeneralLib.StatItem>();
                    var actionsGroups = mBFESs.SelectMany(b => b.Activities).Where(b => b.GetType() != typeof(ErrorHandler)).SelectMany(x => x.Acts)
                                        .GroupBy(n => n.Status)
                                        .Select(n => new
                    {
                        Status = n.Key.ToString(),
                        Count  = n.Count()
                    })
                                        .OrderBy(n => n.Status);
                    foreach (var v in actionsGroups)
                    {
                        actionsList.Add(new GingerCoreNET.GeneralLib.StatItem()
                        {
                            Description = v.Status, Count = v.Count
                        });
                        totalActionCount += v.Count;
                    }
                    ActionsPieChartLayout.DataContext = actionsList;
                    CreateStatistics(actionsList, eObjectType.Action);
                    xActivitiesTotalCount.Content = totalActivityCount;
                    xActionsTotalCount.Content    = totalActionCount;
                    allItems = bizsList.Concat(activitiesList.Concat(actionsList)).GroupBy(n => n.Description)
                               .Select(n => n.First())
                               .ToList();
                    CreateStatistics(allItems, eObjectType.Legend);
                    if (mRunner.IsRunning)
                    {
                        xruntime.Content = mRunner.RunnerExecutionWatch.runWatch.Elapsed.ToString(@"hh\:mm\:ss");
                    }
                });
            }
            catch (InvalidOperationException e)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Failed to Update Stats", e);
            }
        }
	void Start()
	{
		reporter = gameObject.GetComponent<Reporter>();
	}
예제 #40
0
파일: Report.cs 프로젝트: gdlprj/duscusys
	private void LinkTable(Reporter.ReportCollector hardReport, LinkReportResponse link, string image)
    {
		
        
        #line default
        #line hidden
        
        #line 402 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t\r\n\t\t<div class=\"link\" style=\"border-left-color:");

        
        #line default
        #line hidden
        
        #line 404 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Helpers.IntToHtml(link.initOwner.Color)));

        
        #line default
        #line hidden
        
        #line 404 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\">\r\n\t\t\t<div class=\"boldCaption\">\r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 406 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"

				if (string.IsNullOrEmpty(link.Caption))
				{   
        
        #line default
        #line hidden
        
        #line 408 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t\t\t\tLink\r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 410 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
}
				else
				{
        
        #line default
        #line hidden
        
        #line 412 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 413 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(string.Format("Link \"{0}\"", link.Caption)));

        
        #line default
        #line hidden
        
        #line 413 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write(" \r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 414 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
}
        
        #line default
        #line hidden
        
        #line 414 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t\t</div>\r\n\t\t\r\n\t\t\t<table>\r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 418 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"


			    if (link.EndpointArgPoint1)
					EmitCommentOrArgPointLine(link.ArgPoint1.Person, Helpers.ArgPointToStr(link.ArgPoint1), 
											 new DiscLink{Id=link.ArgPoint1.Id, LinkObject=LinkObject.ArgPoint, EmitType=EmitType.Ref});			
				else
                {
					var idOfCluster = link.IdOfCluster1;
					var cluster = hardReport.ClusterReports.Single(c=>c.clusterId==idOfCluster);
					EmitCommentOrArgPointLine(cluster.initialOwner, strClusterTableLine(link.ClusterCaption1, link.IdOfCluster1), 
												new DiscLink{Id=link.IdOfCluster1, LinkObject=LinkObject.Cluster, EmitType=EmitType.Ref});
                }
				
			    if (link.EndpointArgPoint2)
					EmitCommentOrArgPointLine(link.ArgPoint2.Person, Helpers.ArgPointToStr(link.ArgPoint2),
										     new DiscLink{Id=link.ArgPoint2.Id, LinkObject=LinkObject.ArgPoint, EmitType=EmitType.Ref});			
				else
                {
					var idOfCluster = link.IdOfCluster2;
					var cluster = hardReport.ClusterReports.Single(c=>c.clusterId==idOfCluster);
					EmitCommentOrArgPointLine(cluster.initialOwner, strClusterTableLine(link.ClusterCaption2, link.IdOfCluster2),
											 new DiscLink{Id=link.IdOfCluster2, LinkObject=LinkObject.Cluster, EmitType=EmitType.Ref});				
                }
				
        
        #line default
        #line hidden
        
        #line 441 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t\t</table>\r\n\t\t</div> \r\n\t\t");

        
        #line default
        #line hidden
        
        #line 444 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"

    }
예제 #41
0
        public static void ConsoleTest(Reporter rep)
        {
            Console.WriteLine("");
            Console.WriteLine("How many clients (max 256)?");
            int clients = 0;

            while (true)
            {
                string s = Console.ReadLine();
                s = s.Trim().ToLower();

                if (int.TryParse(s, out int a))
                {
                    clients = a;
                    break;
                }
            }

            Console.WriteLine("");
            Console.WriteLine("How many dynamic 1st entities (max 256)?");
            int firsts = 0;

            while (true)
            {
                string s = Console.ReadLine();
                s = s.Trim().ToLower();

                if (int.TryParse(s, out int a))
                {
                    firsts = a;
                    break;
                }
            }

            int maxFirstStatic = 256 - firsts;

            Console.WriteLine("");
            Console.WriteLine("How many static 1st entities (max " + maxFirstStatic + ")?");
            int firstStatics = 0;

            while (true)
            {
                string s = Console.ReadLine();
                s = s.Trim().ToLower();

                if (int.TryParse(s, out int a))
                {
                    firstStatics = a;
                    break;
                }
            }

            Console.WriteLine("");
            Console.WriteLine("How many dynamic 2nd entities (max 65535)?");
            int seconds = 0;

            while (true)
            {
                string s = Console.ReadLine();
                s = s.Trim().ToLower();

                if (int.TryParse(s, out int a))
                {
                    seconds = a;
                    break;
                }
            }

            int maxSecondStatic = 65535 - seconds;

            Console.WriteLine("");
            Console.WriteLine("How many static 2nd entities (max " + maxSecondStatic + ")?");
            int secondStatics = 0;

            while (true)
            {
                string s = Console.ReadLine();
                s = s.Trim().ToLower();

                if (int.TryParse(s, out int a))
                {
                    secondStatics = a;
                    break;
                }
            }

            Console.WriteLine("");
            Console.WriteLine("How many runs?");
            int runs = 0;

            while (true)
            {
                string s = Console.ReadLine();
                s = s.Trim().ToLower();

                if (int.TryParse(s, out int a))
                {
                    runs = a;
                    break;
                }
            }

            Test(rep, clients, (byte)firsts, (byte)firstStatics,
                 (ushort)seconds, (ushort)secondStatics, runs);
        }
예제 #42
0
 public StepEventArgs(Reporter reporter)
     : base(reporter)
 {
     Step = reporter.CurrentStep;
 }
예제 #43
0
파일: Report.cs 프로젝트: gdlprj/duscusys
	private void ClusterTable(Reporter.ClusterReport clustReport, string image)
    {
		
        
        #line default
        #line hidden
        
        #line 351 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t<div class=\"cluster\" style=\"page-break-after: always; border-left-color:");

        
        #line default
        #line hidden
        
        #line 352 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Helpers.IntToHtml(clustReport.initialOwner.Color)));

        
        #line default
        #line hidden
        
        #line 352 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\">\r\n\t\t\t<div class=\"boldCaption\">\r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 354 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
 ClusterTableLine(clustReport.clusterTitle, clustReport.clusterId); 
        
        #line default
        #line hidden
        
        #line 354 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\r\n\t\t\t</div>\r\n\t\t\r\n\t\t\t<div style=\"text-align: center; padding-top:40px\">\r\n\t\t\t\t<img" +
        " src=");

        
        #line default
        #line hidden
        
        #line 358 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(image));

        
        #line default
        #line hidden
        
        #line 358 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write(" style=\"max-width:800px\"> \t\t\r\n\t\t\t</div>\r\n\r\n\t\t\t<table>\r\n\t\t\t <tbody>\r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 363 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"

				foreach (var point in clustReport.points)
				{
					if(point.Person!=null && point.Topic != null && point.SharedToPublic)
					{
						ArgPointNode(point, false);  						
						//EmitCommentOrArgPointLine(point.Person,  "Point# " + point.OrderNumber + ". " + point.Point, 
						//				          new DiscLink{Id=point.Id, LinkObject=LinkObject.ArgPoint, EmitType=EmitType.Ref});			
					}
				};
				
        
        #line default
        #line hidden
        
        #line 373 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("\t\t    \t</tbody>\r\n\t\t\t</table>\r\n\t\t</div> \r\n\t\t");

        
        #line default
        #line hidden
        
        #line 377 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"

    }
예제 #44
0
파일: Main.cs 프로젝트: leanftqa/DemoApp
 private void InitReport()
 {
     if (useReport)
     {
         // Intialize Reporter
         string reportDBDir = Path.Combine(this._context.ReportDirectory, @"Report");
         CleanupReport(reportDBDir);
         string reportDBPath = Path.Combine(reportDBDir, "VTDReport.mdb");
         if (reporter == null)
         {
             reporter = new Reporter(reportDBPath);
         }
         _context.Reporter = reporter;
     }
 }
예제 #45
0
        // Conversion routine the first
        // (lame, libsndfile)
        //
        // Convert() default routine
        // Handles WAV->MP3 encoding,
        // !MP3->!MP3 audio encoding.
        public void Convert(string inputFile, int convertFrom,
            string outputFile, int convertTo, Reporter updateStatus)
        {
            // Verify existence of inputFilenm, throw
            // exception if not exist

            if (!System.IO.File.Exists(inputFile))
            {
                throw new FileNotFoundException(
                        "Cannot find file " + inputFile);
            }

            // Input file information
            // (Set input file size)

            FileInfo fi = new FileInfo(inputFile);
            int soundFileSize = (int)fi.Length;

            // Select conversion routines based
            // on input/output file types

            // If outfile = MP3 then use LameWriter
            // to encode, using the settings in the
            // structure mp3set (essentially the LHV1
            // struct from LameWrapper):

            if ((soundFormat)convertTo == soundFormat.MP3)
            {

                // File to convert from must be WAV

                if ( !( (convertFrom >= (int)soundFormat.WAV) &&
                            (convertFrom < (int)soundFormat.AIFF) ) )
                {
                    throw new Exception(
                            "Cannot encode to MP3 directly from this format ("
                            + convertFrom + "). Convert to WAV first");
                }

                LameWriter mp3Writer = null;

                // Instantiate LameWriter object
                // with output filename

                if (beConfig == null)
                {

                    // Use default MP3 output settings
                    mp3Writer = new LameWriter(
                        new FileStream(outputFile, FileMode.Create),
                        inputFile);

                }
                else
                {

                    // Use custom settings

                    mp3Writer = new LameWriter(
                        new FileStream(outputFile, FileMode.Create),
                        inputFile,
                        beConfig);

                }

                // open input file for binary reading

                Stream s = new FileStream(inputFile,
                        FileMode.Open, FileAccess.Read);

                BinaryReader br = new BinaryReader(s);

                // setup byte buffer -- use mp3Writer.sampleSize
                // to ensure correct buffer size

                byte[] wavBuffer = new byte[mp3Writer.sampleSize];

                // skip WAV header

                s.Seek(LameWrapper.SKIP_WAV_HEADER, SeekOrigin.Begin);

                // write mp3 file

                int index = 0;
                int processedBytes = 0;

                while
                ((index = br.Read(wavBuffer, 0, mp3Writer.sampleSize)) > 0)
                {

                    processedBytes += mp3Writer.sampleSize;

                    // Send to callback:

                    updateStatus(soundFileSize, processedBytes, this);

                    // Check for kill

                    if (this.killSwitch) break;

                    mp3Writer.Write(wavBuffer, 0, index);

                }

                // Finish up

                mp3Writer.Close();
                mp3Writer.WriteTags(outputFile);

            }

            // Assume libsndfile conversion:

            else
            {

                // Check and make sure we are not
                // trying to decode MP3->WAV

                // Instantiate object

                LibsndfileWrapper libSndFile = new LibsndfileWrapper();
                LibsndfileWrapper.SF_INFO soundInfo =
                    new LibsndfileWrapper.SF_INFO();

                // Calculate total frames to convert

                int i = libSndFile.GetSoundFileType(inputFile, ref soundInfo);

                // Each frame is 16bit:

                long totalFrames = soundInfo.frames*2;

                // Initialize

                libSndFile.Initialize (inputFile,
                        outputFile, (LibsndfileWrapper.soundFormat)convertTo);

                // The main decoding loop

                long readCount;
                long readIndex = 0;

                while ( (readCount = libSndFile.Read()) > 0)
                {

                    readIndex += readCount;

                    // Send update to delegate.
                    // Note that this is in
                    // libsndfile specific frames
                    // rather than in actual bytes.
                    //
                    // 	readIndex / totalFrames =
                    // 	percentage complete

                    updateStatus((int)totalFrames, (int)readIndex, this);

                    // Check for kill

                    if (this.killSwitch) break;

                    // Write to file

                    libSndFile.Write();

                }

                // Close up shop

                libSndFile.Close();

            }
        }
예제 #46
0
        public void SendReportsTestNotReports()
        {
            var builder = new Mock<IReportBuilder>();
            builder.Setup(m => m.CreateReports()).Returns(new List<Report>());

            var sender = new Mock<IReportSender>();

            var reporter = new Reporter(builder.Object, sender.Object);

            Assert.Throws<NoReportsException>(reporter.SendReports);
        }
		public ScenarioEventArgs(Reporter reporter)
			: base(reporter)
		{
			Scenario = Reporter.CurrentScenario;
		}
	void OnLog( Reporter.Log log )
	{
		//TO DO : put you custom code 
	}
		public ScenarioBlockEventArgs(Reporter reporter)
			: base(reporter)
		{
			ScenarioBlock = reporter.CurrentScenarioBlock;
		}
예제 #50
0
		private TestAllProjectsInFolder(Reporter reporter, TestAllProjectsInFolderOptions testOptions)
		{
			_reporter = reporter;
			_testOptions = testOptions;
		}
예제 #51
0
파일: Report.cs 프로젝트: gdlprj/duscusys
	void LinkInformation(Reporter.ReportCollector hardReport)
    {
        if (hardReport.LinkReports.Count > 0)
        {
            foreach (var linkReport in hardReport.LinkReports)  
			{
			    if(Screenshots.ContainsKey(linkReport.linkShId)) 
				{
					LinkTable(hardReport, linkReport, Screenshots[linkReport.linkShId].url);  
				}    
			}                         
        }
        else
        {
			
        
        #line default
        #line hidden
        
        #line 461 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("             {No links}\r\n\t\t\t");

        
        #line default
        #line hidden
        
        #line 463 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"

        }
    }
예제 #52
0
		private static void InternalVerifyOpeningOfDocumentsWithoutExceptionStart(TestAllProjectsInFolderOptions testOptions, Altaxo.Main.Services.ExternalDrivenBackgroundMonitor monitor)
		{
			var reporter = new Reporter(testOptions, Current.Console);
			var oldOutputService = Current.SetOutputService(reporter);

			var test = new TestAllProjectsInFolder(reporter, testOptions);

			Current.ProjectService.ProjectChanged += test.EhProjectChanged;

			try
			{
				test.InternalVerifyOpeningOfDocumentsWithoutException(testOptions, monitor);
			}
			catch (Exception ex)
			{
				reporter.WriteLine("Fatal error: Test has to close due to an unhandled exception. The exception details:");
				reporter.WriteLine(ex.ToString());
			}
			finally
			{
				Current.ProjectService.ProjectChanged += test.EhProjectChanged;

				reporter.WriteLine("----------------------- End of test ------------------------------------------");
				reporter.Close();
				Current.SetOutputService(oldOutputService);
			}
		}
예제 #53
0
파일: Report.cs 프로젝트: gdlprj/duscusys
	void ClusterInformation(Reporter.ReportCollector hardReport)
    {
        if (hardReport.ClusterReports.Count > 0)
        {
            foreach (var clusterReport in hardReport.ClusterReports)    
			{    
			    if(Screenshots.ContainsKey(clusterReport.clusterShId))    
					ClusterTable(clusterReport, Screenshots[clusterReport.clusterShId].url);
				else    
					Debug.WriteLine(clusterReport.clusterShId);  
	        }                     
        }
        else
        {
			
        
        #line default
        #line hidden
        
        #line 394 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"
this.Write("             {No clusters}\r\n\t\t\t");

        
        #line default
        #line hidden
        
        #line 396 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt"

        }
    }
		public FeatureEventArgs(Reporter reporter)
			: base(reporter)
		{
			Feature = Reporter.CurrentFeature;
		}
예제 #55
0
        public static void Test(Reporter rep, int clients,
                                byte amount, byte staticAmount,
                                ushort secondAmount, ushort staticSecondAmount,
                                int runs)
        {
            rep.StartRecord("Basic2dSimple", "Test " + clients + "c " + amount
                            + "e " + secondAmount + "e", runs);
            rep.StartTimer();

            SnapBasic2dEnvironment senv = new SnapBasic2dEnvironment(clients);

            senv.Activate();
            senv.FastTick();

            // have the server ghost some new entities
            for (int i = 0; i < amount; i++)
            {
                senv.AddEntityFirst(new NentBasic2d()
                {
                    X    = 10f + i,
                    Y    = 5f + i,
                    XVel = 3f
                }, out byte eid);
            }

            for (int i = 0; i < staticAmount; i++)
            {
                senv.AddEntityFirst(new NentBasic2d()
                {
                    X = 10f + i,
                    Y = 5f + i
                }, out byte eid);
            }

            for (int i = 0; i < secondAmount; i++)
            {
                senv.AddEntitySecond(new NentBasic2d()
                {
                    X    = 10f + i,
                    Y    = 5f + i,
                    XVel = 3f
                }, out ushort eid);
            }

            for (int i = 0; i < staticSecondAmount; i++)
            {
                senv.AddEntitySecond(new NentBasic2d()
                {
                    X = 10f + i,
                    Y = 5f + i
                }, out ushort eid);
            }

            ushort timeAdded = senv.NetSnappers[0].CurrentTime;

            senv.FastTick();

            rep.EndWarmup();

            // verify that the client has the entities
            float tickTime = senv.NetSnappers[0].TickMSTarget;

            for (int r = 0; r < runs; r++)
            {
                rep.StartTimer();
                senv.Tick(tickTime);
                rep.EndRun();
            }

            rep.EndRecord();
        }
        public void gerarComandaNaoFiscal(string formaPagamento,double dinheiro, double troco)
        {
            int qtdLinha = 30 + (venda.Completos.Length * 2);
            qtdLinha *= 10;
            qtdLinha += 70;
            this.printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("comanda", 304, qtdLinha);
                        printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
            try
            {
                Reporter mr = new Reporter();
                //quem vai colocar em italico e talz
                EpsonCodes mer = new EpsonCodes();
                if (File.Exists(endereco))
                    File.Delete(endereco);
                mr.Output = endereco;
                mr.StartJob();
                //--------------------------------------------------------------------------------
                Comanda cc = new Comanda(venda.cod_venda);
                string pont = "|-----------------------------------|";
                int line = 1; int i = 0; int ii = 0;
                mr.PrintText(line++, 02, cc.empresa);
                //o \n serve como paper feed na impressora...
                mr.PrintText(line++, 01, cc.telefone);
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line++, 01, cc.fixCenter("Cupom Nao Fiscal", 1));
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line, 01, "ID da VENDA : " + venda.cod_venda); mr.PrintText(line++, 37, "|");
                mr.PrintText(line++, 01, pont);
                //data e hora
                mr.PrintText(line++, 01,  cc.fixCenter("Data : "+DateTime.Now.ToShortDateString()+" Hora : "+DateTime.Now.ToShortTimeString(),1));
                mr.PrintText(line++, 01, pont);

                mr.PrintText(line++, 01, "| ID |COD |     DESCRICAO    |CATEG |");//id casa 1  - cod casa 7 -  desc - casa 12 - categ casa 32
                mr.PrintText(line++, 01, "|    QTD Un X VL Un   =  SUB-TOTAL  |");// qtd - casa 6  - X na casa 7 - val Uni - casa 8 - sub total casa 18
                mr.PrintText(line++, 01, pont);

                i = venda.Completos.Length;
                while (ii < i)
                {
                    mr.PrintText(line, 01, "|"); mr.PrintText(line, 02, "" + new Tratamento().makeId(ii + 1)); mr.PrintText(line, 06, "-");
                    mr.PrintText(line, 07, "" + venda.Completos[ii].produto[0].cod_produto); mr.PrintText(line, 11, "-");
                    string prod = new Banco().preencherNomeProdctAll(venda.Completos[ii].produto[0].cod_produto);
                    if (venda.Completos[ii].produto.Length > 1) prod = "mist " + prod;
                    if (prod.Length > 16) prod = prod.Substring(0, 16);
                    mr.PrintText(line, 12, prod);
                    mr.PrintText(line, 28, "-");
                    string tam = new BancoInformacao().tamanhoDescricaoByCodigo(venda.Completos[ii].produto[0].cod_tamanho);
                    if (tam.Length > 7) tam = tam.Substring(0, 7); mr.PrintText(line, 29, tam);
                    mr.PrintText(line++, 37, "|");

                    mr.PrintText(line, 01, "|"); mr.PrintText(line, 08, "" + venda.Completos[ii].quantidade); mr.PrintText(line, 11, "X");

                    mr.PrintText(line, 15, new Tratamento().retornaValorEscritoCo(venda.Completos[ii].valorUnitario));
                    mr.PrintText(line, 23, "=");

                    if ((venda.Completos[ii].valorUnitario * venda.Completos[ii].quantidade) >= 100)
                        mr.PrintText(line, 26, new Tratamento().retornaValorEscritoCo((venda.Completos[ii].valorUnitario * venda.Completos[ii++].quantidade)));
                    else
                        mr.PrintText(line, 25, new Tratamento().retornaValorEscritoCo((venda.Completos[ii].valorUnitario * venda.Completos[ii++].quantidade)));
                    mr.PrintText(line++, 37, "|");
                }
                mr.PrintText(line++, 01, pont);
                if (venda.valorComissao > 0)
                {
                    mr.PrintText(line++, 01, cc.fixRightPont("COUVERT : " + new Tratamento().retornaValorEscrito(venda.valorComissao), 1));

                }

                mr.PrintText(line++, 01, pont);
                                mr.PrintText(line++, 01,cc.fixCenter( "FORMA DE PAGAMENTO : "+formaPagamento, 1));

                mr.PrintText(line, 01, "|"); mr.PrintText(line, 18, ("TOTAL RS : " + new Tratamento().retornaValorEscrito(venda.valorSomado)));
                mr.PrintText(line++, 37, "|");
                mr.PrintText(line, 01, "|"); mr.PrintText(line, 18, ("DINHEIRO : " + new Tratamento().retornaValorEscrito(dinheiro)));
                mr.PrintText(line++, 37, "|");
                mr.PrintText(line, 01, "|"); mr.PrintText(line, 18, ("TROCO    : " + new Tratamento().retornaValorEscrito(troco)));
                mr.PrintText(line++, 37, "|");
                mr.PrintText(line++, 01, pont);
                //--------------------------------

                mr.PrintText(line, 01, "|"); mr.PrintText(line++, 37, "|");
                mr.PrintText(line++, 01, cc.mensagem);
                mr.PrintText(line, 01, "|"); mr.PrintText(line++, 37, "|");
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line++, 01, cc.cidade);
                mr.PrintText(line++, 01, pont);
                mr.PrintText(line++, 01, cc.progNome);
                mr.PrintText(line++, 01, cc.progTelefone);
                mr.PrintText(line++, 01, "|___________________________________|");

                mr.PrintJob();
                mr.EndJob();
                lerArquivo(1);

            }
            catch { }
        }
예제 #57
0
        private void GenerateReport()
        {
            try
            {
                var projName = SelectedProject.Code;
                var logoPath = System.IO.Directory.GetCurrentDirectory() + "\\logo.png";
                var path     = Path.GetDirectoryName(SelectedProject.Path);
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path);
                }

                //export images
                foreach (var item in SelectedProject.Units)
                {
                    if (item.Image != null)
                    {
                        ((System.Drawing.Image)item.Image).Save(path + "\\" + item.Code + ".png");                     //item.Image.ToImage().Save(path + "\\" + item.Code + ".png");
                    }
                }

                //initialize and detailed report
                var profiles    = new List <Profile>();
                var fillings    = new List <Domain.Models.Filling>();
                var accessories = new List <Accessory>();
                foreach (var item in SelectedProject.Units)
                {
                    if (item.Frame == null) //|| item.Frame.Length == 0)
                    {
                        continue;
                    }
                    byte[] frameByte = item.Frame;
                    if (frameByte == null || frameByte.Length == 0)
                    {
                        continue;
                    }

                    var formatter = new BinaryFormatter();
                    formatter.SurrogateSelector = PUtil.FrameworkSurrogateSelector;
                    var stream  = new MemoryStream(frameByte);
                    var pStream = new PStream(stream);
                    var frame   = (PVCFrame)pStream.ReadObjectTree(formatter);
                    stream.Close();

                    for (int i = 0; i < item.Quantity; i++)
                    {
                        profiles.AddRange(frame.Model.GetProfiles(true, true));
                        fillings.AddRange(frame.Model.GetFillings(true));
                        accessories.AddRange(frame.Model.GetAccessories());
                    }
                }

                var profileTables   = new List <PdfPTable>();
                var fillingTables   = new List <PdfPTable>();
                var accessoryTables = new List <PdfPTable>();
                var tables          = new List <PdfPTable>();

                if (profiles != null && profiles.Count > 0)
                {
                    profileTables = Reporter.ProfilesTable(profiles, includesPrice: true).ToList();
                }
                if (fillings != null && fillings.Count > 0)
                {
                    fillingTables = Reporter.FillingsTable(fillings, includesPrice: true).ToList();
                }
                if (accessories != null && fillings.Count > 0)
                {
                    accessoryTables = Reporter.AccessoriesTable(accessories, includesPrice: true).ToList();
                }

                if (profileTables != null && profileTables.Count > 0)
                {
                    tables.AddRange(profileTables);
                }
                if (fillingTables != null && fillingTables.Count > 0)
                {
                    tables.AddRange(fillingTables);
                }
                if (accessoryTables != null && accessoryTables.Count > 0)
                {
                    tables.AddRange(accessoryTables);
                }

                var fileName = path + "\\" + projName + "-Details.pdf";
                if (tables != null && tables.Count > 0)
                {
                    Reporter.ItemsReport(fileName, tables, projName, logoPath);
                }

                //total report
                tables = new List <PdfPTable>();
                if (profiles != null && profiles.Count > 0)
                {
                    profileTables = Reporter.ProfilesTable(profiles, includesPrice: true, onlyTotal: true).ToList();
                }
                if (fillings != null && fillings.Count > 0)
                {
                    fillingTables = Reporter.FillingsTable(fillings, includesPrice: true, onlyTotal: true).ToList();
                }
                if (accessories != null && fillings.Count > 0)
                {
                    accessoryTables = Reporter.AccessoriesTable(accessories, includesPrice: true, onlyTotal: true).ToList();
                }

                if (profileTables != null && profileTables.Count > 0)
                {
                    tables.AddRange(profileTables);
                }
                if (fillingTables != null && fillingTables.Count > 0)
                {
                    tables.AddRange(fillingTables);
                }
                if (accessoryTables != null && accessoryTables.Count > 0)
                {
                    tables.AddRange(accessoryTables);
                }

                fileName = path + "\\" + projName + "-Total.pdf";
                if (tables != null && tables.Count > 0)
                {
                    Reporter.ItemsReport(fileName, tables, projName, logoPath);
                }

                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
                {
                    FileName = path, UseShellExecute = true, Verb = "open"
                });
            }
            catch (IOException e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void gerarLeituraX(LeituraX leitu)
        {
            int qtdLinha = 20 + leitu.itens.Count;
            linePorFolha = qtdLinha;
            qtdLinha *= 10;
            qtdLinha += 70;
            this.printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("comanda", 304, qtdLinha);
            printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
            try
            {
                Reporter mr = new Reporter();
                //quem vai colocar em italico e talz
                EpsonCodes mer = new EpsonCodes();
                if (File.Exists(endereco))
                    File.Delete(endereco);
                mr.Output = endereco;
                mr.StartJob();
                //--------------------------------------------------------------------------------

                string pont = "|-----------------------------------|";

                int line = 1;
                mr.PrintText(line++, 01, "|------------- LEITURA X -----------|");
                mr.PrintText(line++, 02, leitu.empresa);
                //o \n serve como paper feed na impressora...

                mr.PrintText(line++, 01, pont);
                mr.PrintText(line, 01, "|Data:" + leitu.dataLeitura); mr.PrintText(line++, 37, "|");
                mr.PrintText(line, 01, "|Hora:" + DateTime.Now.ToShortTimeString()); mr.PrintText(line++, 37, "|");

                mr.PrintText(line++, 01, pont);
                //data e hora

                mr.PrintText(line++, 01, "|HORA  -VENDA- PAGAM -VALOR  -SITUAC|");//id casa 1  - cod casa 7 -  desc - casa 12 - categ casa 32
                mr.PrintText(line++, 01, pont);
                //itens
                {
                    for (int i = 0; i < leitu.itens.Count; i++)
                    {
                        mr.PrintText(line, 01, "|");
                        mr.PrintText(line, 02, leitu.itens[i].hora);
                        mr.PrintText(line, 08, "-");
                        mr.PrintText(line, 09, ""+leitu.itens[i].cod_venda);
                        mr.PrintText(line, 15, "-");
                        mr.PrintText(line, 16, leitu.itens[i].formaPagamento.Substring(0,5));

                        mr.PrintText(line, 22, "-");
                        mr.PrintText(line, 23, new Tratamento().retornaValorEscrito( leitu.itens[i].valor));
                        mr.PrintText(line, 30,"-"+ leitu.itens[i].situac.Substring(0,6));
                        mr.PrintText(line++, 37, "|");
                    }

                }
                //itens

                mr.PrintText(line++, 01, pont);
                mr.PrintText(line, 01, "|"); mr.PrintText(line, 15, ("TOTAL R$ " + new Tratamento().retornaValorEscrito(leitu.valorTotal))); mr.PrintText(line++, 37, "|");
                if (leitu.extorno > 0)
                { mr.PrintText(line, 01, "|"); mr.PrintText(line, 15, ("EXTORNO RS " + new Tratamento().retornaValorEscrito(leitu.extorno))); mr.PrintText(line++, 37, "|"); }
                if (leitu.totDinheiro > 0)
                { mr.PrintText(line, 01, "|"); mr.PrintText(line, 15, ("DINHEIRO RS " + new Tratamento().retornaValorEscrito(leitu.totDinheiro))); mr.PrintText(line++, 37, "|"); }
                if (leitu.totCredito > 0)
                { mr.PrintText(line, 01, "|"); mr.PrintText(line, 15, ("CREDITO RS " + new Tratamento().retornaValorEscrito(leitu.totCredito))); mr.PrintText(line++, 37, "|"); }
                if (leitu.totDebito > 0)
                { mr.PrintText(line, 01, "|"); mr.PrintText(line, 15, ("DEBITO RS " + new Tratamento().retornaValorEscrito(leitu.totDebito))); mr.PrintText(line++, 37, "|"); }
                if (leitu.totCheque > 0)
                { mr.PrintText(line, 01, "|"); mr.PrintText(line, 15, ("CHEQUE RS " + new Tratamento().retornaValorEscrito(leitu.totCheque))); mr.PrintText(line++, 37, "|"); }

                mr.PrintText(line++, 01, pont);
                //--------------------------------
                mr.PrintText(line, 01, "|"); mr.PrintText(line++, 37, "|");
                mr.PrintText(line, 01, "|Data Impresao :" + DateTime.Now.ToShortDateString()); mr.PrintText(line++, 37, "|");
                mr.PrintText(line++, 01, "|___________________________________|");

                mr.PrintJob();
                mr.EndJob();
                lerArquivo(0);

            }
            catch { }
        }
예제 #59
0
        private void SetDescriptionDetails()
        {
            try
            {
                if (txtDescription == null || cmbColSelectorValue.SelectedItem == null)
                {
                    return;
                }

                txtDescription.Text = string.Empty;
                TextBlockHelper TBH = new TextBlockHelper(txtDescription);

                TBH.AddText("Select the grid cell located by ");
                TBH.AddUnderLineText(cmbColSelectorValue.SelectedItem.ToString());
                TBH.AddText(" ");
                if (cmbColumnValue.SelectedIndex != -1)
                {
                    TBH.AddBoldText(cmbColumnValue.SelectedItem.ToString());
                }
                else
                {
                    TBH.AddBoldText(cmbColumnValue.Text);
                }
                TBH.AddText(" and ");
                if (RowNum.IsChecked == true)
                {
                    TBH.AddUnderLineText("row number ");
                    if (RowSelectorValue.SelectedIndex != -1)
                    {
                        TBH.AddBoldText(RowSelectorValue.SelectedItem.ToString());
                    }
                    else
                    {
                        TBH.AddBoldText(RowSelectorValue.Text);
                    }
                }
                else if (AnyRow.IsChecked == true)
                {
                    TBH.AddUnderLineText("random ");
                    TBH.AddText("row number");
                }
                else if (Where.IsChecked == true)
                {
                    TBH.AddText("the row located by a cell in ");
                    TBH.AddUnderLineText(WhereColumn.SelectedItem.ToString());
                    TBH.AddText(" ");
                    if (WhereColumnTitle.SelectedIndex != -1)
                    {
                        TBH.AddBoldText(WhereColumnTitle.SelectedItem.ToString());
                    }
                    else
                    {
                        TBH.AddBoldText(WhereColumnTitle.Text);
                    }
                    TBH.AddText(" having control property ");
                    TBH.AddUnderLineText(WhereProperty.SelectedItem.ToString());
                    TBH.AddText(" ");
                    TBH.AddUnderLineText(WhereOperator.SelectedItem.ToString());
                    TBH.AddText(" ");
                    TBH.AddBoldText(WhereColumnValue.ValueTextBox.Text);
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Failed", ex);
            }
        }
예제 #60
0
 public ReportingApprovalNamer(Reporter reporter)
 {
     SourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\\..\\approvals\\", reporter.Name);
     Name = "";
 }