コード例 #1
0
        /// <summary>
        /// Costruttore da oggetto di dominio
        /// </summary>
        /// <param name="evaluation">
        /// Oggetto dominio: valutazione economica
        /// </param>
        public dtoEcoEvaluation(lm.Comol.Modules.CallForPapers.AdvEconomic.Domain.EconomicEvaluation evaluation)
        {
            if (evaluation == null)
            {
                return;
            }

            if (evaluation.Submission != null)
            {
                SubmissionId   = evaluation.Submission.Id;
                SubmissionType = (evaluation.Submission.Type != null) ? evaluation.Submission.Type.Name : "Unknow";

                SubmissionName = (evaluation.Submission.SubmittedBy != null) ?
                                 evaluation.Submission.SubmittedBy.SurnameAndName :
                                 evaluation.Submission.CreatedBy.SurnameAndName;
            }
            else
            {
                SubmissionId   = 0;
                SubmissionType = "Unknow";
                SubmissionName = "Unknow";
            }

            AdmitMax = (evaluation.Commission != null) ? evaluation.Commission.MaxValue : 0;

            status = evaluation.Status;

            RequestTotal = evaluation.RequestTotal;
            AdmitTotal   = evaluation.AdmitTotal;

            Tables = evaluation.Tables.Select(t => new dtoEcoEvTable(t)).ToList();
        }
コード例 #2
0
        /// <summary>
        /// Costruttore da oggetto di dominio: valutazione (economica)
        /// </summary>
        /// <param name="evaluation"></param>
        public dtoEcoSummary(lm.Comol.Modules.CallForPapers.AdvEconomic.Domain.EconomicEvaluation evaluation)
        {
            if (evaluation == null)
            {
                return;
            }

            EvalautionId = evaluation.Id;
            status       = evaluation.Status;

            if (evaluation.Submission != null)
            {
                SubmissionId   = evaluation.Submission.Id;
                SubmissionType = (evaluation.Submission.Type != null) ? evaluation.Submission.Type.Name : "Unknow";

                SubmissionName = (evaluation.Submission.SubmittedBy != null) ?
                                 evaluation.Submission.SubmittedBy.SurnameAndName :
                                 evaluation.Submission.CreatedBy.SurnameAndName;

                SubmittedOn = (evaluation.Submission != null) ? evaluation.Submission.SubmittedOn : null;
            }
            else
            {
                SubmissionId   = 0;
                SubmissionType = "Unknow";
                SubmissionName = "Unknow";
            }

            CallId = (evaluation.Call != null) ? evaluation.Call.Id : 0;
            StepId = (evaluation.Step != null) ? evaluation.Step.Id : 0;

            CurrentMember = (evaluation.CurrentMember != null && evaluation.CurrentMember.Member != null) ?
                            evaluation.CurrentMember.Member.SurnameAndName : "";

            Rank = evaluation.Rank;

            AverageRating = evaluation.AverageRating;
            SumRating     = evaluation.SumRating;

            Founded = evaluation.Tables.Sum(t => t.AdmitTotal);
        }
コード例 #3
0
        /// <summary>
        /// Crea via stream un documento Excel (csv non previsto per via di fogli multipli) con tutte le tabelle economiche di una valutazione
        /// </summary>
        /// <param name="Eval">Dati valutazione (definizioni, tabelle, ammissioni, importi)</param>
        /// <param name="documentStream">Stream output</param>
        /// <param name="DocFormat">Formato - Solo XLSX</param>
        /// <param name="settings">Impostazioni di esportazione (caratteri, larghezze, colori) - Per personalizzazioni future.</param>
        public static void EcoEvalTableExportStream(
            Eco.Domain.EconomicEvaluation Eval,
            Stream documentStream,
            SpreadDocumentFormat DocFormat         = SpreadDocumentFormat.Xlsx,
            dto.dtoEcoTableExportSettings settings = null)
        {
            if (settings == null)
            {
                settings = new dto.dtoEcoTableExportSettings();
            }


            int exportedCellsCount = 0;

            SpreadDocumentFormat selectedDocumentFormat;
            int      totalCellsCount;
            DateTime exportStarted;
            bool     canExport;

            if (Eval == null || Eval.Tables == null || !Eval.Tables.Any())
            {
                return;
            }


            using (IWorkbookExporter workbookExporter = SpreadExporter.CreateWorkbookExporter(DocFormat, documentStream))
            {
                int SheetNumber = 0;
                foreach (Eco.Domain.EconomicTable table in Eval.Tables)
                {
                    if (table != null && table.FieldDefinition != null)
                    {
                        SheetNumber++;
                        int headCols  = table.HeaderValues.Count();
                        int totalCols = headCols + 7;

                        string sheetName = string.Format("{0}-{1}", SheetNumber, table.FieldDefinition.Name);

                        if (sheetName.Length > 25)
                        {
                            sheetName = string.Format("{0}...", sheetName.Substring(0, 20));
                        }

                        sheetName = CleanFileName(sheetName);


                        using (IWorksheetExporter worksheetExporter = workbookExporter.CreateWorksheetExporter(sheetName))
                        {
                            for (int i = 0; i < totalCols; i++)
                            {
                                using (IColumnExporter columnExporter = worksheetExporter.CreateColumnExporter())
                                {
                                    if (i >= headCols)
                                    {
                                        columnExporter.SetWidthInCharacters(settings.ColumnWidths[i - headCols]);
                                    }
                                    else
                                    {
                                        columnExporter.SetWidthInCharacters(settings.ColumnAddWidth);
                                    }
                                }
                            }

                            ExportHeaderRows(worksheetExporter, table.HeaderValues, settings, table.FieldDefinition.Name);


                            foreach (AdvEconomic.Domain.EconomicItem itm in table.Items)
                            {
                                using (IRowExporter rowExporter = worksheetExporter.CreateRowExporter())
                                {
                                    rowExporter.SetHeightInPoints(settings.RowHeight);

                                    int columnIndex = 0;

                                    int iv = 0;


                                    foreach (string value in itm.InfoValues)
                                    {
                                        iv++;

                                        if (iv <= headCols)
                                        {
                                            using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                            {
                                                cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.NormalFormat, itm.IsAdmit));
                                                cellExporter.SetValue(value.Replace("&nbsp;", " "));
                                            }
                                        }
                                    }

                                    if (iv < headCols)
                                    {
                                        using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                        {
                                            cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.NormalFormat, itm.IsAdmit));
                                            cellExporter.SetValue("");
                                        }
                                    }


                                    //Quantità
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.DoubleFormat, itm.IsAdmit));
                                        cellExporter.SetValue(itm.RequestQuantity);
                                    }

                                    //Prezzo unitario
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.DoubleEcoFormat, itm.IsAdmit));
                                        cellExporter.SetValue(itm.RequestUnitPrice);
                                    }

                                    //Totale richiesto
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.DoubleEcoFormat, itm.IsAdmit));
                                        cellExporter.SetValue(itm.RequestTotal);
                                    }
                                    //Approvato
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.NormalFormat, itm.IsAdmit));
                                        cellExporter.SetValue(itm.IsAdmit ? settings.BoolValue[1] : settings.BoolValue[0]);
                                    }
                                    //Quantità ammessa
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.DoubleFormat, itm.IsAdmit));
                                        cellExporter.SetValue(itm.AdmitQuantity);
                                    }
                                    //Totale ammesso
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.DoubleEcoFormat, itm.IsAdmit));
                                        cellExporter.SetValue(itm.AdmitTotal);
                                    }
                                    //Commenti
                                    using (ICellExporter cellExporter = rowExporter.CreateCellExporter())
                                    {
                                        cellExporter.SetFormat(dto.dtoEcoTableExportSettings.InvalidCellFormat(settings.NormalFormat, itm.IsAdmit));
                                        if (itm.Comment != null)
                                        {
                                            cellExporter.SetValue(itm.Comment.Replace("&nbsp;", " ").Replace("<br>", "\r\n"));
                                        }
                                        else
                                        {
                                            cellExporter.SetValue("");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }