コード例 #1
0
 public string GetDataToSign()
 {
     return(ExternalUniqueNumber.Length + ExternalUniqueNumber
            + Total.ToString().Length + Total.ToString()
            + ItemsQuantity.ToString().Length + ItemsQuantity.ToString()
            + IssuedAt.ToString().Length + IssuedAt.ToString()
            + CallbackUrl.Length + CallbackUrl);
 }
コード例 #2
0
        public void Criar_ValoresValido_DeveTerSucesso(decimal valor)
        {
            //Arrange & Act
            Total total = new Total(valor);

            //Assert
            total.Valor.ShouldBe(valor);
        }
コード例 #3
0
        public XmlNode ToXml(XmlDocument xmlDocument)
        {
            var xmlNode = xmlDocument.CreateElement("reputation");

            xmlNode.AppendChild(XmlHelper.AddTextNode(xmlDocument, "current", Total.ToString()));
            xmlNode.AppendChild(XmlHelper.AddCDataNode(xmlDocument, "total", Current.ToString()));
            return(xmlNode);
        }
コード例 #4
0
        public async void SearchStreamsTest()
        {
            Total <List <Stream> > searchedStreams = await twixel.SearchStreams("league");

            Stream leagueStream = searchedStreams.wrapped.FirstOrDefault((stream) => stream.game == "League of Legends");

            Assert.NotNull(leagueStream);
        }
コード例 #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ProdA = Convert.ToInt32(txtProduct1.Text);
            ProdB = Convert.ToInt32(txtProduct2.Text);

            Total          = AddValue(ProdA, ProdB);
            txtResult.Text = "Total Amount is: " + Total.ToString();
        }
コード例 #6
0
        public void Preco_ConversaoExlicita_DeveTerSucesso(decimal valor)
        {
            //Arrange & Act
            Total total = (Total)valor;

            //Assert
            total.Valor.ShouldBe(valor);
        }
コード例 #7
0
    public void Remove_first()
    {
        int num = Total.Bingo()[0];

        button.GetComponentInChildren <Text>().text = num.ToString();
        Total.Bingo().Remove(num);
        //print("removed first " + String.Join(",", Total.Bingo().Select(x => x.ToString()).ToArray()));
    }
コード例 #8
0
        private void listView2_DoubleClick(object sender, EventArgs e)
        {
            var cl = cliente.GetPlato();

            listBox1.Items.Add(cl.ElementAt(listView2.FocusedItem.Index).nombre + " --->$" + cl.ElementAt(listView2.FocusedItem.Index).precio);
            Total         += cl.ElementAt(listView2.FocusedItem.Index).precio;
            labelSuma.Text = Total.ToString();
        }
コード例 #9
0
ファイル: Telemetry.cs プロジェクト: Trevsaster14/PocceMod
            public dynamic Serialize()
            {
                dynamic result = new ExpandoObject();

                result.Total       = Total.Serialize();
                result.FeatureData = FeatureData.Values.Select(data => data.Serialize());
                return(result);
            }
コード例 #10
0
        public async void SearchChannelsTest()
        {
            Total <List <Channel> > searchedChannels = await twixel.SearchChannels("golf1052");

            Channel channel = searchedChannels.wrapped.FirstOrDefault((c) => c.name == "golf1052");

            Assert.NotNull(channel);
        }
コード例 #11
0
        static XElement FormatValue(Total total, object value)
        {
            try
            {
                if (IsNull(value))
                {
                    return(new XElement("td", new XAttribute("style", "text-align:center;"), new XElement("i", "null")));
                }

                NumberFormatter nf;

                if (_numberFormatters.TryGetValue(value.GetType(), out nf))
                {
                    nf.AddTotal(total, value);
                    return(new XElement("td", new XAttribute("class", "n"), value));
                }

                ValueFormatter vf;

                if (_valueFormatters.TryGetValue(value.GetType(), out vf))
                {
                    var list = new List <object>();

                    if (vf.NoWrap)
                    {
                        list.Add(new XAttribute("nowrap", "nowrap"));
                    }

                    var style = "";

                    if (vf.Font != null)
                    {
                        style += $"font-family:{vf.Font};";
                    }
                    if (vf.Size != null)
                    {
                        style += $"font-size:{vf.Size};";
                    }

                    if (style.Length > 0)
                    {
                        list.Add(new XAttribute("style", style));
                    }

                    list.Add(vf.FormatValue(value));

                    return(new XElement("td", list.ToArray()));
                }

                return(new XElement("td", value.ToString()));
            }
            catch (Exception ex)
            {
                return(new XElement("td",
                                    new XAttribute("style", "color:red"),
                                    ex.Message));
            }
        }
コード例 #12
0
        /// <summary>
        /// Returns true if InventoryOrderStatistic instances are equal
        /// </summary>
        /// <param name="other">Instance of InventoryOrderStatistic to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InventoryOrderStatistic other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Total == other.Total ||
                     Total != null &&
                     Total.Equals(other.Total)
                 ) &&
                 (
                     Default == other.Default ||
                     Default != null &&
                     Default.Equals(other.Default)
                 ) &&
                 (
                     Missed == other.Missed ||
                     Missed != null &&
                     Missed.Equals(other.Missed)
                 ) &&
                 (
                     Broken == other.Broken ||
                     Broken != null &&
                     Broken.Equals(other.Broken)
                 ) &&
                 (
                     Active == other.Active ||
                     Active != null &&
                     Active.Equals(other.Active)
                 ) &&
                 (
                     Remaining == other.Remaining ||
                     Remaining != null &&
                     Remaining.Equals(other.Remaining)
                 ) &&
                 (
                     Research == other.Research ||
                     Research != null &&
                     Research.Equals(other.Research)
                 ) &&
                 (
                     Transferred == other.Transferred ||
                     Transferred != null &&
                     Transferred.Equals(other.Transferred)
                 ));
        }
コード例 #13
0
        //JİRADAN TOTALVALUE DEĞERİNİ ÇEK
        private int GetTotalValue()
        {
            string response = _jiraRequestService.GetTotal();
            Total  total    = JsonConvert.DeserializeObject <Total>(response);

            int totalValue = total.total;

            return(totalValue);
        }
コード例 #14
0
 public override int GetHashCode()
 {
     return(InvoiceNumber.GetHashCode()
            ^ InvoiceType.GetHashCode()
            ^ InvoiceStatus.GetHashCode()
            ^ Lines.GetHashCode()
            ^ Total.GetHashCode()
            ^ Carrier.GetHashCode());
 }
コード例 #15
0
        /// <summary>
        /// Copy data from managed array to this Mat
        /// </summary>
        /// <typeparam name="T">The type of managed data array</typeparam>
        /// <param name="data">The managed array where data will be copied from</param>
        public void SetTo <T>(T[] data)
        {
            Debug.Assert(
                data.Length == Total.ToInt32() * ElementSize / Toolbox.SizeOf <T>(), String.Format("Invalid data length, expecting {0} but was {1}", Total.ToInt32() * ElementSize / Toolbox.SizeOf <T>(), data.Length));
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            UMatInvoke.cveUMatCopyDataFrom(this, handle.AddrOfPinnedObject());
            handle.Free();
        }
コード例 #16
0
ファイル: Reputation.cs プロジェクト: wanddy/OurUmbraco
        public XmlNode ToXml(XmlDocument d)
        {
            XmlNode tx = d.CreateElement("reputation");

            tx.AppendChild(umbraco.xmlHelper.addTextNode(d, "current", Total.ToString()));
            tx.AppendChild(umbraco.xmlHelper.addCDataNode(d, "total", Current.ToString()));

            return(tx);
        }
コード例 #17
0
        //button to calculate total cost of parts from the subtotal
        private void btnTotal_Click(object sender, RoutedEventArgs e)
        {
            double sub;
            double Total;

            sub              = 775.55;
            Total            = sub * 1.13;
            lblTotal.Content = "Total: " + Total.ToString("#.00");
        }
コード例 #18
0
 public void Count(int number)
 {
     if (Total == Null)
     {
         Total = 0;
     }
     Total = Total + Convert.ToSingle(number);
     Console.WriteLine(Total.ToString());
 }
コード例 #19
0
        private void SetAwayTeamTotalPricesToDatabase(Total awayTotal)
        {
            List <decimal?>      awayTotalsDisc = new List <decimal?>();
            IList <PropertyInfo> propertyInfos  = GetPropertiesByPrefix("T2O_", "T2U_", this.properties);

            for (int i = 0; i < propertyInfos.Count; i++)
            {
                decimal points = this.GetTeamTwoTotal(propertyInfos[i]);


                if (awayTotal.Points == points)
                {
                    if (propertyInfos[i].Name.Contains("T2O_") && propertyInfos[i].Name.Contains("computed") == false && propertyInfos[i].Name.Contains("disc") == false)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, awayTotal.Over);
                    }

                    if (propertyInfos[i].Name.Contains("T2O_") && propertyInfos[i].Name.Contains("computed") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, awayTotal.OverComputed);
                    }
                    if (propertyInfos[i].Name.Contains("T2O_") && propertyInfos[i].Name.Contains("disc") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, awayTotal.OverDisc);
                        //awayTotalsDisc.Add(awayTotal.OverDisc);

                        //this.eventDiscs.Add(awayTotal.OverDisc);
                    }



                    if (propertyInfos[i].Name.Contains("T2U_") && propertyInfos[i].Name.Contains("computed") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, awayTotal.UnderComputed);
                    }

                    if (propertyInfos[i].Name.Contains("T2U_") && propertyInfos[i].Name.Contains("disc") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, awayTotal.UnderDisc);
                        //awayTotalsDisc.Add(awayTotal.UnderDisc);

                        //this.eventDiscs.Add(awayTotal.UnderDisc);
                    }

                    if (propertyInfos[i].Name.Contains("T2U_") && propertyInfos[i].Name.Contains("disc") == false && propertyInfos[i].Name.Contains("computed") == false)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, awayTotal.Under);
                    }
                }
            }

            //var result = MathClass.GetStatsForMarket(awayTotalsDisc);
            //this.pinaccle.T2_disc_max = result.maxDisc;
            //this.pinaccle.T2_disc_average = result.averageDisc;

            //this.pinaccle.T2_disc_mediana = MathClass.GetMedForMarket(awayTotalsDisc);
        }
コード例 #20
0
ファイル: Mat.cs プロジェクト: formylover/emgucv-1
        /// <summary>
        /// Copy data from this Mat to the managed array
        /// </summary>
        /// <typeparam name="T">The type of managed data array</typeparam>
        /// <param name="data">The managed array where data will be copied to.</param>
        public void CopyTo <T>(T[] data)
        {
            Debug.Assert(Toolbox.SizeOf <T>() * data.Length >= Total.ToInt32() * ElementSize,
                         String.Format("Size of data is not enough, required at least {0}, but was {1} ", Total.ToInt32() * ElementSize / Toolbox.SizeOf <T>(), data.Length));
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            MatInvoke.cveMatCopyDataTo(this, handle.AddrOfPinnedObject());
            handle.Free();
        }
コード例 #21
0
        public VTotalReporte()
        {
            InitializeComponent();
            Total report = new Total();

            CrearDirectorioFacturas();
            report.ExportToPdf("../Sistema para el Control de los Medios Informáticos/Control Total de Medios/Control Total de Medios Informaticos.pdf");
            documentViewer1.PrintingSystem = report.PrintingSystem;
        }
コード例 #22
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = (int)2166136261;
         hash = (hash * 16777619) ^ Total.GetHashCode();
         return((hash * 16777619) ^ (FileReports != null ? FileReports.GetHashCode() : 0));
     }
 }
コード例 #23
0
        private void SetHomeTeamTotalPricesTodatabase(Total homeTotal)
        {
            IList <PropertyInfo> propertyInfos  = GetPropertiesByPrefix("T1O_", "T1U_", this.properties);
            List <decimal?>      teamTotalDiscs = new List <decimal?>();

            for (int i = 0; i < propertyInfos.Count; i++)
            {
                decimal points = this.GetTeamOneTotalValue(propertyInfos[i]);


                if (homeTotal.Points == points)
                {
                    if (propertyInfos[i].Name.Contains("T1O_") && propertyInfos[i].Name.Contains("computed") == false && propertyInfos[i].Name.Contains("disc") == false)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, homeTotal.Over);
                    }

                    if (propertyInfos[i].Name.Contains("T1O_") && propertyInfos[i].Name.Contains("computed") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, homeTotal.OverComputed);
                    }

                    if (propertyInfos[i].Name.Contains("T1U_") && propertyInfos[i].Name.Contains("computed") == false && propertyInfos[i].Name.Contains("disc") == false)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, homeTotal.Under);
                    }

                    if (propertyInfos[i].Name.Contains("T1U_") && propertyInfos[i].Name.Contains("computed") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, homeTotal.UnderComputed);
                    }

                    if (propertyInfos[i].Name.Contains("T1U_") && propertyInfos[i].Name.Contains("disc") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, homeTotal.UnderDisc);
                        //teamTotalDiscs.Add(homeTotal.UnderDisc);

                        //this.eventDiscs.Add(homeTotal.UnderDisc);
                    }

                    if (propertyInfos[i].Name.Contains("T1O_") && propertyInfos[i].Name.Contains("disc") == true)
                    {
                        propertyInfos[i].SetValue(this.pinaccle, homeTotal.OverDisc);
                        //teamTotalDiscs.Add(homeTotal.OverDisc);

                        //this.eventDiscs.Add(homeTotal.OverDisc);
                    }
                }
            }

            //var result = MathClass.GetStatsForMarket(teamTotalDiscs);
            //this.pinaccle.T1_disc_max = result.maxDisc;
            //this.pinaccle.T1_disc_average = result.averageDisc;

            //this.pinaccle.T1_disc_mediana = MathClass.GetMedForMarket(teamTotalDiscs);
        }
コード例 #24
0
        public Detalle_Pedido(string json)
        {
            InitializeComponent();
            elegido = JsonConvert.DeserializeObject <Pedido>(json);

            if (elegido.Estatus.Equals("A"))
            {
                elegido.OracionEstatus = "Agendado";
                elegido.OracionImagen  = "confirmado.png";
            }

            if (elegido.Estatus.Equals("C"))
            {
                elegido.OracionEstatus = "Cancelado";
                elegido.OracionImagen  = "cancel.png";
            }

            elegido.TotalLitros    += " Totales";
            elegido.OracionMagna   += " Magna";
            elegido.OracionPremium += " Premium";
            elegido.OracionDiesel  += " Diesel";

            ImagenEstado.SetBinding(Image.SourceProperty, "OracionImagen");
            ImagenEstado.BindingContext = elegido;

            Confirmado.SetBinding(Label.TextProperty, "OracionEstatus");
            Confirmado.BindingContext = elegido;

            Folio.SetBinding(Label.TextProperty, "Folio_Pedido");
            Folio.BindingContext = elegido;

            ValorEstacion.SetBinding(Label.TextProperty, "Nombre_Estacion");
            ValorEstacion.BindingContext = elegido;

            FechaAgendada.SetBinding(Label.TextProperty, "OracionFecha");
            FechaAgendada.BindingContext = elegido;

            Total.SetBinding(Label.TextProperty, "TotalLitros");
            Total.BindingContext = elegido;

            Diesel.SetBinding(Label.TextProperty, "OracionDiesel");
            Diesel.BindingContext = elegido;

            Premium.SetBinding(Label.TextProperty, "OracionPremium");
            Premium.BindingContext = elegido;

            Magna.SetBinding(Label.TextProperty, "OracionMagna");
            Magna.BindingContext = elegido;


            ValorAutanque.SetBinding(Label.TextProperty, "Autotanque");
            ValorAutanque.BindingContext = elegido;

            FechaRegistro.SetBinding(Label.TextProperty, "OracionRegistro");
            FechaRegistro.BindingContext = elegido;
        }
コード例 #25
0
        public void Update()
        {
            Used = (Profiler.GetMonoUsedSizeLong() >> 10) / 1024f;

            // ヒープが大きいほど GC の時間がかかりますが、実行される頻度は少なくなる
            Total = (Profiler.GetMonoHeapSizeLong() >> 10) / 1024f;

            UsedText  = Used.ToString("0.0") + " MB";
            TotalText = Total.ToString("0.0") + " MB";
        }
コード例 #26
0
        public async void RetrieveStreamsTest()
        {
            Total <List <Stream> > topStreams = await twixel.RetrieveStreams();

            Assert.Equal(25, topStreams.wrapped.Count);

            Total <List <Stream> > leagueStreams = await twixel.RetrieveStreams("League of Legends");

            Assert.Equal("League of Legends", leagueStreams.wrapped[0].game);
        }
コード例 #27
0
ファイル: FormImportReport.cs プロジェクト: rotovibe/engage
 private void FormImportReport_Load(object sender, EventArgs e)
 {
     this.dataGridView1.DataSource = this.dataSetImportReport.ImportResult;
     lblTotalValue.Text            = Total.ToString();
     lblInsertPassedValue.Text     = InsertPassed.ToString();
     lblInsertFailedValue.Text     = InsertFailed.ToString();
     lblUpdatePassedValue.Text     = UpdatePassed.ToString();
     lblUpdatedFailedValue.Text    = UpdateFailed.ToString();
     lblUpdatedSkippedValue.Text   = skippedRow.ToString();
 }
コード例 #28
0
        protected async override void OnAppearing() //data when screen is shown
        {
            base.OnAppearing();
            user  = Application.Current.Properties[CommonSettings.GLOBAL_USER] as User;
            total = await totalController.getModel(user.userId);

            lblExpenseAmount.Text = total.expenseAmount.ToString();
            lblIncomeAmount.Text  = total.incomeAmount.ToString();
            lblWelcome.Text       = "Welcome " + user.firstName + "!";
        }
コード例 #29
0
        public async void RetrieveFollowersTest()
        {
            User user = await twixel.RetrieveUserWithAccessToken(accessToken);

            Total <List <Follow <User> > > followers = await user.RetrieveFollowers();

            User zeroAurora = followers.wrapped.FirstOrDefault((follower) => follower.wrapped.name == "zero_aurora").wrapped;

            Assert.NotNull(zeroAurora);
        }
コード例 #30
0
ファイル: ReporterPeers.cs プロジェクト: vnvizitiu/leak
        public void Handle(PeerDisconnectedNotification notification)
        {
            Total.Remove(notification.Peer);

            LocalChoking.Remove(notification.Peer);
            LocalInterested.Remove(notification.Peer);

            RemoteChoking.Remove(notification.Peer);
            RemoteInterested.Remove(notification.Peer);
        }
コード例 #31
0
        static public void GenerateXLS(string fileName, List<RoadMap> roadmaps, double conso, double gasCost)
        {

            Total total = new Total();
            SpreadsheetDocument doc = new SpreadsheetDocument();
            doc.ApplicationName = "PlanMyWay";
            doc.Creator = "SuperBen";
            doc.Company = "PlanMyWay & Co.";


            doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[0].Cells[1].SetValue("Consommation moyenne du véhicule");
            doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[1].Cells[1].SetValue("Prix du carburant");
            consoDefinition = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[0].Cells[3];
            gasCostDefinition = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[1].Cells[3];
            consoDefinition.SetValue(new Decimal(conso));
            gasCostDefinition.SetValue(new Decimal(gasCost));

            for (int i = 0; i< roadmaps.Count; i++)
            {
                if (i > 0)
                {
                    total.Distance += "+";
                    total.Conso += "+";
                    total.CoutTotal += "+";
                }
                total += SpreadSheetRoadmapGenerator.AddTableXLS(ref doc, roadmaps[i]);

            }
            SpreadSheetRoadmapGenerator.AddTotalXLS(ref doc, total);

            using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
            using (Stream writeFile = new IsolatedStorageFileStream(fileName, FileMode.Create, file))
            using (IStreamProvider storage = new ZipStreamProvider(writeFile))
            {
                doc.Save(storage);
            }
        }
コード例 #32
0
        static private Total AddTableXLS(ref SpreadsheetDocument doc, RoadMap roadmap)
        {
            Total total = new Total();
            int countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[countRows].Cells[0].SetValue(String.Empty);
            countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[countRows].Cells[1].SetValue("Feuille de route du "+ roadmap.Date);

            Debug.WriteLine("tableau " + roadmap.Meetings.FirstOrDefault().DateTime.ToShortDateString());
            List<SharedStringDefinition> strList = new List<SharedStringDefinition>();
            strList.Add(doc.Workbook.SharedStrings.AddString("Départ"));
            strList.Add(doc.Workbook.SharedStrings.AddString("Arrivée"));
            strList.Add(doc.Workbook.SharedStrings.AddString("Distance(km)"));
            strList.Add(doc.Workbook.SharedStrings.AddString("Consomation(Litre)"));
            strList.Add(doc.Workbook.SharedStrings.AddString("Coût(€)"));

            countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            Debug.WriteLine("countRows 1 : "+countRows);
            // Entêtes de colonne
            for (var i=0; i<strList.Count; i++)
            {
                doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[countRows].Cells[i + 1].SetValue(strList[i]);
            }
            // 1 ligne par trip
            foreach (var trip in roadmap.Trips)
            {
                countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
                doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[1].SetValue(trip.Start.City);
                doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[2].SetValue(trip.End.City);
                //Consommmation d'essence en fonction de la conso moyenne du véhicule
                int distance = (int)Math.Round(trip.Distance, 0);
                Cell distanceCell =  doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[3];
                Cell ConsumptionCell = doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[4];
                distanceCell.SetValue(distance);
                //double consumption = distance * conso / 100;
                ConsumptionCell.Formula = distanceCell.CellName + "*" + consoDefinition.CellName + "/100";
                //Prix du trajet en fonction de la consommation pendant le trajet et le prix du carburant
                //double cost = consumption * gasCost;
                doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[5].Formula = ConsumptionCell.CellName + "*" + gasCostDefinition.CellName;
            }
            //Taille des colonnes
            doc.Workbook.Sheets[0].Sheet.AddColumnSizeDefinition(0, 1, 30);
            doc.Workbook.Sheets[0].Sheet.AddColumnSizeDefinition(1, 5, 22);
            //Mise à jour du prochain numéro de ligne libre
            countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            Debug.WriteLine("countRows 3 : " + countRows);
            //Récupération du numéro de ligne de début et de fin du tableau courrant
            int idRowTableStart, idRowTableEnd;
            idRowTableStart = countRows - roadmap.Trips.Count;
            idRowTableEnd = countRows - 1;
            Debug.WriteLine("idRowTableStart : " + idRowTableStart);
            Debug.WriteLine("idRowTableEnd : " + idRowTableEnd);
            Row rowTop = doc.Workbook.Sheets[0].Sheet.Rows[idRowTableStart];
            Row rowBottom = doc.Workbook.Sheets[0].Sheet.Rows[idRowTableEnd];
            //// Total
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[1].SetValue("Total");
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[3].Formula = "SUM(" + rowTop.Cells[3].CellName + ":" + rowBottom.Cells[3].CellName + ")";
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[4].Formula = "SUM(" + rowTop.Cells[4].CellName + ":" + rowBottom.Cells[4].CellName + ")";
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[5].Formula = "SUM(" + rowTop.Cells[5].CellName + ":" + rowBottom.Cells[5].CellName + ")";
            //Incrémentation du total
            total.Distance += "SUM(" + rowTop.Cells[3].CellName + ":" + rowBottom.Cells[3].CellName + ")";
            total.Conso += "SUM(" + rowTop.Cells[4].CellName + ":" + rowBottom.Cells[4].CellName + ")";
            total.CoutTotal += "SUM(" + rowTop.Cells[5].CellName + ":" + rowBottom.Cells[5].CellName + ")";


            Debug.WriteLine(roadmap.Meetings.FirstOrDefault().DateTime.ToShortDateString());
            //Ajout d'un tableau
            Row rowCol = doc.Workbook.Sheets[0].Sheet.Rows[idRowTableStart - 1];
            Row rowTotal = doc.Workbook.Sheets[0].Sheet.Rows[idRowTableEnd + 1];
            Debug.WriteLine("rowCol : " + (idRowTableStart - 1));
            Debug.WriteLine("rowTotal : " + (idRowTableEnd + 1));
            TablePart table = doc.Workbook.Sheets[0].Sheet.AddTable(
                "tableau 1",
                "rapport du " + roadmap.Meetings.FirstOrDefault().DateTime.ToShortDateString(),
                rowCol.Cells[1],
                rowTotal.Cells[5]
                );
            //Précision explicite des colonnes du tableau
            for (var i = 0; i < strList.Count; i++)
            {
                table.TableColumns[i].Name = strList[i].String;
            }
            table.ShowTotalsRow = true;
            table.TableStyle.ShowColumnStripes = true;
            table.TableStyle.ShowRowStripes = true;
            return total;
        }
コード例 #33
0
        static private void AddTotalXLS(ref SpreadsheetDocument doc, Total total)
        {
            int countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[countRows].Cells[0].SetValue(String.Empty);
            List<SharedStringDefinition> strList = new List<SharedStringDefinition>();
            strList.Add(doc.Workbook.SharedStrings.AddString("Distance totale(km)"));
            strList.Add(doc.Workbook.SharedStrings.AddString("Consomation totale(Litre)"));
            strList.Add(doc.Workbook.SharedStrings.AddString("Coût total(€)"));

            countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            // Entêtes de colonne
            for (var i = 0; i < strList.Count; i++)
            {
                doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows[countRows].Cells[i + 3].SetValue(strList[i]);
            }
            countRows = doc.Workbook.Sheets.FirstOrDefault().Sheet.Rows.Indexes.Count();
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[2].SetValue("Récapitulatif");
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[3].Formula = total.Distance;
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[4].Formula = total.Conso;
            doc.Workbook.Sheets[0].Sheet.Rows[countRows].Cells[5].Formula = total.CoutTotal;
        }
コード例 #34
0
    // Use this for initialization
    void Start()
    {
        TextAsset dataasset = Resources.Load("data") as TextAsset;
        TextAsset popasset = Resources.Load("Population") as TextAsset;
        byte[] databytes = Encoding.ASCII.GetBytes(dataasset.text);
        byte[] popbytes = Encoding.ASCII.GetBytes(popasset.text);

        //using(Stream s = new FileStream("Assets//data.xml",FileMode.Open))
        //	world = (World)new XmlSerializer(typeof(World)).Deserialize(s);
        //using(Stream s = new FileStream("Assets//Population.xml",FileMode.Open))
        //	pop = (Total)new XmlSerializer(typeof(Total)).Deserialize(s);

        using(Stream s = new MemoryStream(databytes))
            world = (World)new XmlSerializer(typeof(World)).Deserialize(s);
        using(Stream s = new MemoryStream(popbytes))
            pop = (Total)new XmlSerializer(typeof(Total)).Deserialize(s);

        List<Rect> regionrects  = new List<Rect>(){new Rect(-10,-20,35,40),new Rect(-100,-35,90,80),new Rect(35,-5,65,55),new Rect(8,15,17,10),new Rect(-10,20,40,30),new Rect(30,-30,70,40)};
        for(int i = 0;i<world.regions.Count;i++)
        {

            locations.Add(world.regions[i],regionrects[i]);

        }
        int total = 0;
        foreach(Region r in world.regions) total+= r.population;
        float proportion = ((float)numberofpeople)/(float)total;
        foreach(Region r in world.regions)
        {
            var index = world.regions.IndexOf(r);
            Color regioncolour = Color.yellow;
            if(index==0)
            {
                regioncolour = Color.yellow;

            }
            if(index==1)
            {
                regioncolour = Color.red;

            }
            if(index==2)
            {
                regioncolour = Color.blue;

            }
            if(index==3)
            {
                regioncolour = Color.green;

            }
            if(index==4)
            {
                regioncolour = Color.magenta;

            }
            if(index==5)
            {
                regioncolour = Color.white;

            }

            float pop = r.population;
            float number = r.population*proportion;

            for(int i = 0;i<number;i++)
                People.Add(Person.Create(r,regioncolour,index));

        }
    }