Ejemplo n.º 1
0
        public void UpdateProjectQuote()
        {
            QuoteItems.Clear();

            FileBasedProject project = ProjectsController.SelectedProjects.FirstOrDefault();

            if (project != null)
            {
                ProjectStatistics stats = project.GetProjectStatistics();

                QuoteItems.Clear();
                QuoteItems.Columns.Clear();

                QuoteItems.Columns.Add("Language", typeof(string));
                QuoteItems.Columns.Add("Perfect", typeof(double));
                QuoteItems.Columns.Add("Repetitions", typeof(double));
                QuoteItems.Columns.Add("InContextExact", typeof(double));
                QuoteItems.Columns.Add("Exact", typeof(double));

                FuzzyCountData[] fuzzy = stats.TargetLanguageStatistics[0].AnalysisStatistics.Fuzzy;
                for (int i = fuzzy.Length - 1; i >= 0; i--)
                {
                    AnalysisBand band = fuzzy[i].Band;
                    QuoteItems.Columns.Add(GetBandName(band), typeof(double));
                }

                QuoteItems.Columns.Add("New", typeof(double));
                QuoteItems.Columns.Add("Total", typeof(double));


                AddItemRows(stats);
            }
        }
        private DataRow CreateRow(AnalysisStatistics stats, string name)
        {
            DataRow row = QuoteItems.NewRow();

            row["Language"]       = name;
            row["Perfect"]        = GetPrice("Perfect", stats.Perfect);
            row["InContextExact"] = GetPrice("InContextExact", stats.InContextExact);
            row["Exact"]          = GetPrice("Exact", stats.Exact);
            row["Repetitions"]    = GetPrice("Repetitions", stats.Repetitions);

            FuzzyCountData[] fuzzy = stats.Fuzzy;
            int columnIndex        = 5;

            for (int k = fuzzy.Length - 1; k >= 0; k--)
            {
                AnalysisBand band = fuzzy[k].Band;
                row[columnIndex] = GetPrice(fuzzy[k]);
                columnIndex++;
            }

            row["New"] = GetPrice("New", stats.New);

            row["Total"] = CalculateRowTotal(row);
            return(row);
        }
Ejemplo n.º 3
0
            public PriceGroup()
            {
                Id          = Guid.NewGuid().ToString();
                Name        = string.Empty;
                Description = string.Empty;
                Currency    = string.Empty;


                DefaultAnalysisBand = new AnalysisBand();

                GroupPrices = new List <Price>();

                SourceLanguages = new List <Language>();
                TargetLanguages = new List <Language>();
            }
        //should be AnalysisBand from Sdl.ProjectApi.Implementation but the class is internal and this  it's not accessible here. Also the IAnalysisBand that it's the base of AnalysisBand it's in SDL.ProjectAPI which can be referenced as assembly because it's restricted be the Studio rules.
        //To use IAnalysisBand we can't because the SDL.ProjectAPI is restricted to be referenced. It's marked as non public.
        //so basically can't handle the AnalysisBand type that is used in Project.
        private AnalysisBand[] GetAnalysisBandsValues(dynamic internalDynamicProject)
        {
            var analysisList = internalDynamicProject?.AnalysisBands;

            if (analysisList != null)
            {
                var result = new AnalysisBand[analysisList.Length];

                for (var i = 0; i < analysisList.Length - 1; i++)
                {
                    result[i] = analysisList[i] as AnalysisBand;
                }
            }


            return(null);
        }
Ejemplo n.º 5
0
 private string GetBandName(AnalysisBand band)
 {
     return(string.Format("{0}%-{1}%", band.MinimumMatchValue, band.MaximumMatchValue));
 }
Ejemplo n.º 6
0
 private double GetPricePerWord(AnalysisBand band)
 {
     // fuzzy match pays a percentage of the price for a new translation
     return(0.05 + 0.3 * (100 - band.MinimumMatchValue) / 100.0);
 }