protected override void RefreshMainData()
        {
            Datos.DataSource        = _entity;
            Datos_Lineas.DataSource = _entity.Conceptos;
            PgMng.Grow();

            if (_entity.OidAcreedor > 0)
            {
                Datos_Emisor.DataSource = ProviderBaseInfo.Get(_entity.OidAcreedor, _entity.ETipoAcreedor, true);
            }
            PgMng.Grow();

            if (_entity.OidSerie > 0)
            {
                SerieInfo serie = SerieInfo.Get(_entity.OidSerie, false);
                Serie_TB.Text = serie.Nombre;
            }
            PgMng.Grow();

            DiasPago_NTB.Text       = _entity.DiasPago.ToString();
            Fecha_DTP.Value         = _entity.Fecha;
            FechaRegistro_DTP.Value = _entity.FechaRegistro;
            Prevision_TB.Text       = _entity.Prevision.ToShortDateString();

            base.RefreshMainData();
        }
Beispiel #2
0
        private static SerieInfo Parse(string raw)
        {
            SerieInfo info = new SerieInfo();
            info.ServiceAddress = SERVICE_ADDRESS;
            string[] lines = raw.Split('\n');
            foreach (var line in lines)
            {
                string[] pair = line.Split('@');
                if (pair.Length != 2)
                    continue;
                switch (pair[0])
                {
                    case "Show Name": info.Name = pair[1]; break;
                    case "Status": info.Status = pair[1]; break;
                    case "Genres": info.Genres = pair[1]; break;
                    case "Next Episode": info.NextEpisode = EpisodeInfo.Parse(pair[1]); break;
                    case "Latest Episode": info.LatestEpisode = EpisodeInfo.Parse(pair[1]); break;
                    case "Show URL": info.URL = pair[1]; break;
                }
            }

            if (!string.IsNullOrEmpty(info.Name))
            {
                IsValid = true;
                return info;
            }

            if (!string.IsNullOrEmpty(raw) && raw.StartsWith("No Show Results"))
            {
                return new EmptySerieInfo { ServiceAddress = SERVICE_ADDRESS };
            }
            IsValid = false;
            return null;
        }
Beispiel #3
0
        public override void PrintDetailAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

            InputInvoiceReportMng reportMng = new InputInvoiceReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues);

            InputInvoiceInfo item = InputInvoiceInfo.Get(ActiveOID, ActiveItem.ETipoAcreedor, true);

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            ProviderBaseInfo provider = ProviderBaseInfo.Get(ActiveItem.OidAcreedor, ActiveItem.ETipoAcreedor, false);
            SerieInfo        serie    = SerieInfo.Get(ActiveItem.OidSerie, false);

            conf.nota            = (provider.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
            conf.nota           += (conf.nota != string.Empty) ? Environment.NewLine : string.Empty;
            conf.nota           += (ActiveItem.Nota ? serie.Cabecera : "");
            conf.cuenta_bancaria = ActiveItem.CuentaBancaria;
            PgMng.Grow();

            ReportClass report = reportMng.GetDetailReport(item, conf);

            if (SettingsMng.Instance.GetUseDefaultPrinter())
            {
                int n_copias = SettingsMng.Instance.GetDefaultNCopies();
                PrintReport(report, n_copias);
            }
            else
            {
                ShowReport(report);
            }
        }
Beispiel #4
0
        public static OutputDeliveryList GetList(bool childs,
                                                 long oidHolder,
                                                 ETipoEntidad holderType,
                                                 long oidSerie,
                                                 ETipoAlbaranes deliveryType,
                                                 ETipoFactura invoiceType,
                                                 DateTime from,
                                                 DateTime till)
        {
            QueryConditions conditions = new QueryConditions
            {
                Serie         = (oidSerie != 0) ? SerieInfo.New(oidSerie) : null,
                TipoEntidad   = holderType,
                TipoAlbaranes = deliveryType,
                TipoFactura   = invoiceType,
                FechaIni      = from,
                FechaFin      = till,
            };

            switch (holderType)
            {
            case ETipoEntidad.Cliente:
                conditions.Cliente = (oidHolder != 0) ? ClienteInfo.New(oidHolder) : null;
                break;

            case ETipoEntidad.WorkReport:
                conditions.WorkReport = (oidHolder != 0) ? WorkReportInfo.New(oidHolder) : null;
                break;
            }

            return(GetList(childs, SELECT(conditions)));
        }
        protected void SetSerie(SerieInfo source, bool newCode)
        {
            if (source == null)
            {
                return;
            }

            _serie = source;

            _delivery_type = (_entity.Contado) ? ETipoAlbaranes.Agrupados : ETipoAlbaranes.Todos;

            _entity.OidSerie    = source.Oid;
            _entity.NumeroSerie = source.Identificador;
            _entity.NombreSerie = source.Nombre;
            Serie_TB.Text       = _entity.NSerieSerie;
            Nota_TB.Text        = source.Cabecera;

            if (newCode)
            {
                _entity.GetNewCode(_entity.EHolderType, _delivery_type);
            }

            Cache.Instance.Remove(typeof(BatchList));
            Cache.Instance.Remove(typeof(ProductList));

            ProductList.GetListBySerie(_serie.Oid, false, true);
        }
        protected override void RefreshMainData()
        {
            Datos.DataSource          = _entity;
            Datos_Concepto.DataSource = _entity.Conceptos;
            PgMng.Grow();

            if (_entity.OidCliente > 0)
            {
                Datos_Cliente.DataSource = ClienteInfo.Get(_entity.OidCliente, false);
            }
            PgMng.Grow();

            if (_entity.OidSerie > 0)
            {
                SerieInfo serie = SerieInfo.Get(_entity.OidSerie, false);
                Serie_TB.Text = serie.Nombre;
                Nota_TB.Text  = serie.Cabecera;
            }
            PgMng.Grow();

            Fecha_DTP.Value = _entity.Fecha;
            PgMng.Grow();

            base.RefreshMainData();
        }
Beispiel #7
0
        public override void RefreshSecondaryData()
        {
            if (_entity.OidSerie != 0)
            {
                SetSerie(SerieInfo.Get(_entity.OidSerie, false), false);
            }
            PgMng.Grow();

            if (_entity.OidAcreedor != 0)
            {
                SetProvider(ProviderBaseInfo.Get(_entity.OidAcreedor, _entity.ETipoAcreedor, false));
            }
            PgMng.Grow();

            if (_entity.OidAlmacen != 0)
            {
                SetStore(StoreInfo.Get(_entity.OidAlmacen, false));
            }
            PgMng.Grow();

            if (_entity.OidExpediente != 0)
            {
                SetExpedient(ExpedientInfo.Get(_entity.OidExpediente, false), false);
            }
            PgMng.Grow();

            base.RefreshSecondaryData();
        }
Beispiel #8
0
        public BudgetLineAddForm(ETipoProducto tipo, Budget proforma, SerieInfo serie, ClienteInfo cliente, Form parent)
            : base(tipo, proforma, serie, cliente, parent)
        {
            InitializeComponent();

            this.Text = Resources.Labels.CONCEPTO_NEW_TITLE;
        }
Beispiel #9
0
        protected void SetSerie(SerieInfo source, bool new_code)
        {
            if (source == null)
            {
                return;
            }

            _serie = source;

            _entity.OidSerie      = source.Oid;
            _entity.NumeroSerie   = source.Identificador;
            _entity.NombreSerie   = source.Nombre;
            Serie_TB.Text         = _entity.NSerieSerie;
            Observaciones_TB.Text = source.Cabecera;

            if (new_code)
            {
                _entity.GetNewCode(_deliveryType);
            }

            Cache.Instance.Remove(typeof(BatchList));
            Cache.Instance.Remove(typeof(ProductList));

            ProductList.GetListBySerie(_serie.Oid, false, true);
        }
        /// <summary>
        /// Copia los atributos del objeto
        /// </summary>
        /// <param name="source">Objeto origen</param>
        protected void CopyValues(AlbaranTicketInfo source, ClienteInfo cliente, TicketInfo ticket, OutputDeliveryInfo Albaran)
        {
            if (source == null)
            {
                return;
            }

            Oid = source.Oid;
            _base.Record.OidAlbaran = source.OidAlbaran;
            _base.Record.OidTicket  = source.OidTicket;

            SerieInfo serie = SerieInfo.Get(ticket.OidSerie, false);

            _base.CodigoTicket = ticket.Codigo;
            _total_factura     = ticket.Total;
            _numero_serie      = serie.Identificador;
            _fecha_factura     = ticket.Fecha;
            _prevision         = ticket.Prevision;

            //INNER JOIN
            _codigo_cliente = cliente.Codigo;
            _nombre         = cliente.Nombre;
            _telefonos      = cliente.Telefonos;
            _movil          = cliente.Movil;
            _dias_pago      = Albaran.Fecha.Subtract(ticket.Fecha).Days;
        }
        public override void RefreshSecondaryData()
        {
            if (_entity.OidCliente != 0)
            {
                SetCliente(ClienteInfo.Get(_entity.OidCliente, false));
            }
            PgMng.Grow();

            if (_entity.OidSerie != 0)
            {
                SetSerie(SerieInfo.Get(_entity.OidSerie, false), false);
            }
            PgMng.Grow();

            if (_entity.OidAlmacen != 0)
            {
                SetAlmacen(StoreInfo.Get(_entity.OidAlmacen, false, true));
            }
            PgMng.Grow();

            if (_entity.OidExpediente != 0)
            {
                SetExpediente(ExpedientInfo.Get(_entity.OidExpediente, false, true));
            }
            PgMng.Grow();
        }
Beispiel #12
0
        public virtual void Vende(Budget proforma, SerieInfo serie, ClienteInfo cliente, ProductInfo producto, BatchInfo partida)
        {
            if (cliente == null)
            {
                throw new iQException(Library.Invoice.Resources.Messages.NO_CLIENTE_SELECTED);
            }

            if (cliente.Productos == null)
            {
                cliente.LoadChilds(typeof(ProductoCliente), true);
            }

            ProductoClienteInfo productoCliente = cliente.Productos.GetByProducto(producto.Oid);

            if (partida == null)
            {
                CopyFrom(proforma, producto);
            }
            else
            {
                CopyFrom(partida);
            }

            SetTipoFacturacion(productoCliente, producto);
            SetImpuestos(serie, cliente, producto);
            Precio = producto.GetPrecioVenta(productoCliente, partida, ETipoFacturacion);
        }
		private static void AppendSerieInfo(string raw, ref SerieInfo info)
		{
			try
			{
				XDocument xdoc = XDocument.Parse(raw);
				string geners = (from extendedInfo in xdoc.Descendants("Series")
							 select extendedInfo.Element("Genre").Value).FirstOrDefault();
				info.Genres = geners.Trim('|').Replace("|", " | ");

				var episodes = from ep in xdoc.Descendants("Episode")
							   select new EpisodeInfo
							   {
								    Name = ep.Element("EpisodeName").Value,
									 Date = ep.Element("FirstAired").Value.ToDateTime(),
									Version = (ep.Element("SeasonNumber").Value + "x" + ep.Element("EpisodeNumber").Value).ToEpisodeVersion()
							   };

				DateTime dateNow = DateTime.Now;
				// Get last sent episode
				info.LatestEpisode = episodes.Reverse().SkipWhile(f => f.Date > dateNow || f.Date == DateTime.MinValue).FirstOrDefault();

				// Get Next episode
				info.NextEpisode = episodes.Where(f => f.Date > dateNow).FirstOrDefault();
			}
			catch (Exception) { }
		}
        public override void PrintDetailAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

            InputDeliveryReportMng reportMng = new InputDeliveryReportMng(AppContext.ActiveSchema, Text, FilterValues);
            SerieInfo serie = SerieInfo.Get(ActiveItem.OidSerie, false);

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            conf.nota = ActiveItem.Nota ? serie.Cabecera : "";

            /*AlbaranProveedorRpt report = reportMng.GetAlbaranProveedorReport(InputDeliveryInfo.Get(ActiveOID, true), conf);
             *
             * if (report != null)
             * {
             *      ReportViewer.SetReport(report);
             *      ReportViewer.ShowDialog();
             * }
             * else
             * {
             *      MessageBox.Show(moleQule.Face.Resources.Messages.NO_DATA_REPORTS,
             *                                      moleQule.Face.Resources.Labels.ADVISE_TITLE,
             *                                      MessageBoxButtons.OK,
             *                                      MessageBoxIcon.Exclamation);
             * }*/
        }
        public override void RefreshSecondaryData()
        {
            if (_entity.OidSerie != 0)
            {
                SetSerie(SerieInfo.Get(_entity.OidSerie, false), false);
            }
            PgMng.Grow();

            if (_entity.OidAcreedor != 0)
            {
                SetAcreedor(ProviderBaseInfo.Get(_entity.OidAcreedor, _entity.ETipoAcreedor, false));
            }
            PgMng.Grow();

            if (_entity.OidAlmacen != 0)
            {
                SetAlmacen(StoreInfo.Get(_entity.OidAlmacen, false));
            }
            PgMng.Grow();

            if (_entity.OidExpediente != 0)
            {
                SetExpediente(ExpedientInfo.Get(_entity.OidExpediente, false));
            }
            PgMng.Grow();

            if (_acreedor != null)
            {
                ProductList.GetList(_acreedor, _serie, false, true);
            }
        }
Beispiel #16
0
        protected override void RefreshMainData()
        {
            Datos.DataSource    = _entity;
            Lines_BS.DataSource = _entity.ConceptoFacturas;
            PgMng.Grow();

            if (_entity.OidCliente > 0)
            {
                Client_BS.DataSource = ClienteInfo.Get(_entity.OidCliente, true);
            }
            PgMng.Grow();

            if (_entity.OidSerie > 0)
            {
                _serie        = SerieInfo.Get(_entity.OidSerie, false);
                Serie_TB.Text = _serie.Nombre;
                Nota_TB.Text  = _serie.Cabecera;
            }
            PgMng.Grow();

            if (_entity.OidTransportista > 0)
            {
                _transporter          = TransporterInfo.Get(_entity.OidTransportista, ETipoAcreedor.TransportistaDestino, false);
                Transportista_TB.Text = _transporter.Nombre;
            }
            PgMng.Grow();

            DiasPago_NTB.Text = _entity.DiasPago.ToString();
            Fecha_DTP.Value   = _entity.Fecha;
            Prevision_TB.Text = _entity.Prevision.ToShortDateString();

            base.RefreshMainData();
        }
Beispiel #17
0
 public InputDeliveryAddForm(IAcreedorInfo acreedor, PedidoProveedorInfo pedido, Form parent)
     : this(parent, ETipoAlbaranes.Todos)
 {
     SetProvider(acreedor);
     SetSerie(SerieInfo.Get(pedido.OidSerie, false), true);
     AddPedidoAction(pedido);
 }
        public BatchSelectForm(Form parent, SerieInfo serie, BatchList lista)
            : base(true, parent, serie, lista)
        {
            InitializeComponent();
            _view_mode = molView.Select;

            _action_result = DialogResult.Cancel;
        }
Beispiel #19
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ConceptoProformaLibreAddForm(Form parent, Proforma Proforma, SerieInfo serie, ClienteInfo cliente)
            : base(parent, Proforma, serie, cliente)
        {
            InitializeComponent();

            // Va aquí porque si no peta en el padre porque _entity es nulo
            _entity.PropertyChanged += new PropertyChangedEventHandler(Entity_PropertyChanged);
        }
Beispiel #20
0
 public Serie GetSerie(SerieInfo serie)
 {
     return(new Serie
     {
         Name = serie.Name,
         Rounds = _roundManager.GetRounds(serie),
         Settings = _seriesRepository.GetSettings(serie)
     });
 }
        public BudgetLineEditForm(ETipoProducto productType, Budget budget, SerieInfo serie, ClienteInfo client, BudgetLine line, Form parent)
            : base(productType, budget, serie, client, parent)
        {
            InitializeComponent();

            _entity = line;

            RefreshMainData();
        }
        public override void PrintDetailAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

            PgMng.Reset(6, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues);

            SerieInfo serie = SerieInfo.Get(ActiveItem.OidSerie, false);

            PgMng.Grow();

            ClienteInfo client = ClienteInfo.Get(ActiveItem.OidCliente, false);

            PgMng.Grow();

            TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTransportista, ETipoAcreedor.TransportistaDestino, false);

            PgMng.Grow();

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            conf.nota            = (client.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
            conf.nota           += (conf.nota != string.Empty) ? Environment.NewLine : string.Empty;
            conf.nota           += (ActiveItem.Nota ? serie.Cabecera : "");
            conf.cuenta_bancaria = ActiveItem.CuentaBancaria;
            PgMng.Grow();

            OutputInvoiceInfo item = OutputInvoiceInfo.Get(ActiveOID, true);

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

            ReportClass report = reportMng.GetDetailReport(item, serie, client, transporter, conf);

            PgMng.FillUp();

            if (report != null)
            {
                if (SettingsMng.Instance.GetUseDefaultPrinter())
                {
                    int n_copias = SettingsMng.Instance.GetDefaultNCopies();
                    PrintReport(report, n_copias);
                }
                else
                {
                    ShowReport(report);
                }

                if (item.EEstado == EEstado.Abierto)
                {
                    ChangeStateAction(EEstadoItem.Emitido);
                }
            }
        }
 public InvoiceAddForm(ClienteInfo client, OutputDeliveryInfo delivery, Form parent)
     : this(parent)
 {
     SetClient(client);
     SetSerie(SerieInfo.Get(delivery.OidSerie, false), true);
     _entity.AlbaranContado = delivery.Contado;
     _entity.Rectificativa  = delivery.Rectificativo;
     _out_delivery          = delivery;
 }
 public DeliveryAddForm(ClienteInfo cliente, PedidoInfo pedido, Form parent)
     : this(new object[3] {
     null, ETipoEntidad.Cliente, ETipoAlbaranes.Todos
 }, parent)
 {
     SetCliente(cliente);
     SetSerie(SerieInfo.Get(pedido.OidSerie, false), true);
     AddPedidoAction(pedido);
 }
        protected override void GetFormSourceData(object[] parameters)
        {
            if (parameters[0] == null)
            {
                ETipoEntidad holder_type = (ETipoEntidad)parameters[1];

                _entity = OutputDelivery.New(holder_type);
                _entity.BeginEdit();

                switch (holder_type)
                {
                case ETipoEntidad.Cliente:
                {
                    if (parameters.Length >= 3)
                    {
                        _delivery_type = (ETipoAlbaranes)parameters[2];

                        if (_delivery_type == ETipoAlbaranes.Agrupados)
                        {
                            _entity.Contado = true;
                            _entity.GetNewCode(ETipoEntidad.Cliente, ETipoAlbaranes.Agrupados);
                            _entity.EMedioPago = EMedioPago.Efectivo;
                        }
                    }
                }
                break;

                case ETipoEntidad.WorkReport:
                {
                    //Se ha pasado como parametro en el constructor
                    if (parameters.Length >= 3)
                    {
                        _work_report = (WorkReportInfo)parameters[2];
                    }
                    //Venimos de un parte de trabajo y esta en cache
                    else if (Cache.Instance.Contains(typeof(WorkReport)))
                    {
                        _work_report = (Cache.Instance.Get(typeof(WorkReport)) as WorkReport).GetInfo();
                    }

                    _entity.OidHolder  = (_work_report != null) ? _work_report.Oid : 0;
                    _entity.EMedioPago = EMedioPago.Efectivo;
                    SerieInfo serie = SerieInfo.Get(Library.Invoice.ModulePrincipal.GetWorkDeliverySerieSetting(), false);
                    _entity.OidSerie = (serie != null) ? serie.Oid : 0;
                }
                break;
                }
            }
            else
            {
                _entity = (OutputDelivery)parameters[0];
                _entity.BeginEdit();
                SerieInfo serie = SerieInfo.Get(_entity.OidSerie, false);
                _entity.OidSerie = (serie != null) ? serie.Oid : 0;
            }
        }
Beispiel #26
0
        protected override void RefreshMainData()
        {
            if (Library.Invoice.ModulePrincipal.GetDefaultSerieSetting() > 0)
            {
                SetSerie(SerieInfo.Get(Library.Invoice.ModulePrincipal.GetDefaultSerieSetting(), false), true);
            }
            PgMng.Grow();

            base.RefreshMainData();
        }
        private void Serie_BT_Click(object sender, EventArgs e)
        {
            SerieSelectForm form = new SerieSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                _serie        = form.Selected as SerieInfo;
                Serie_TB.Text = _serie.Nombre;
            }
        }
Beispiel #28
0
        /// Constructor
        /// </summary>
        public InputDeliveryLineUIForm(InputDeliveryLine line, InputDelivery delivery, SerieInfo serie, IAcreedorInfo provider, Form parent)
            : base(true, parent)
        {
            InitializeComponent();

            _entity   = line;
            _delivery = delivery;
            _serie    = serie;
            _provider = provider;
        }
        protected override void RefreshMainData()
        {
            if (_entity.OidSerie > 0)
            {
                SetSerie(SerieInfo.Get(_entity.OidSerie, false), false);
            }
            PgMng.Grow();

            base.RefreshMainData();
        }
Beispiel #30
0
        public LineaPedidoAddForm(ETipoProducto tipo, Pedido albaran, SerieInfo serie, ClienteInfo cliente, Form parent)
            : base(tipo, albaran, serie, cliente, parent)
        {
            InitializeComponent();

            this.Text = Resources.Labels.CONCEPTO_NEW_TITLE;

            // Va aquí porque si no peta en el padre porque _entity es nulo
            _entity.PropertyChanged += new PropertyChangedEventHandler(Entity_PropertyChanged);
        }
Beispiel #31
0
        public void OutputInvoiceListHasItemsOnlyFromASerie()
        {
            OutputInvoiceList list       = null;
            QueryConditions   conditions = new QueryConditions {
                Serie = SerieInfo.New(1)
            };

            list = OutputInvoiceList.GetList(conditions, false);
            Assert.IsNull(list.FirstOrDefault(x => x.OidSerie != conditions.Serie.Oid));
        }
Beispiel #32
0
        private static void AppendSerieInfo(string raw, ref SerieInfo info)
        {
            try
            {
                XDocument xdoc = XDocument.Parse(raw);
                string geners = (from extendedInfo in xdoc.Descendants("Series")
                             select extendedInfo.Element("Genre").Value).FirstOrDefault();
                info.Genres = geners.Trim('|').Replace("|", " | ");

                var episodes = from ep in xdoc.Descendants("Episode")
                               select new EpisodeInfo
                               {
                                    Name = ep.Element("EpisodeName").Value,
                                     Date = ep.Element("FirstAired").Value.ToDateTime(),
                                    Version = (ep.Element("SeasonNumber").Value + "x" + ep.Element("EpisodeNumber").Value).ToEpisodeVersion()
                               };

                DateTime dateNow = DateTime.Now;
                // Get last sent episode
                info.LatestEpisode = episodes.Reverse().SkipWhile(f => f.Date > dateNow || f.Date == DateTime.MinValue).FirstOrDefault();

                // Get Next episode
                info.NextEpisode = episodes.Where(f => f.Date > dateNow).FirstOrDefault();
            }
            catch (Exception) { }
        }
Beispiel #33
0
 public SerieItem(SerieInfo a_info)
 {
     SerieInfo = a_info;
     Initialize();
 }
        static void Main()
        {
            var serviceUrl = "http://ws.lokad.com/TimeSeries2.asmx";
            var login = "******"; // your Sandbox login here
            var pwd = "yourpassword"; // your Sandbox password here

            var service = ServiceFactory
                .GetConnectorForTesting(login, pwd, serviceUrl);

            var existingSeries = service.GetSeries();
            service.DeleteSeries(existingSeries);

            var serie1 = new SerieInfo
            {
                Name = "MySerie1"
            };
            var serie2 = new SerieInfo
            {
                Name = "MySerie2"
            };

            var mySeries = new[] {serie1, serie2};

            Console.WriteLine("Saving series...");
            service.AddSeries(mySeries);

            // add values
            var value1 = new TimeValue
            {
                Time = new DateTime(2008, 7, 1),
                Value = 10
            };
            var value2 = new TimeValue
            {
                Time = new DateTime(2008, 7, 2),
                Value = 12
            };
            var value3 = new TimeValue
            {
                Time = new DateTime(2008, 7, 3),
                Value = 11
            };
            // create association between serie1 and values 1,2,3
            var segment1 = new SegmentForSerie(serie1, new[] {value1, value2, value3});
            // create association between serie2 and values 1,2
            var segment2 = new SegmentForSerie(serie2, new[] {value1, value2});

            Console.WriteLine("Saving values...");
            service.UpdateSerieSegments(new[] {segment1, segment2});

            // create new forecasting task
            // to create 3 days forecast with daily interval
            var task = new TaskInfo(serie1)
            {
                FuturePeriods = 3,
                Period = Period.Day
            };

            Console.WriteLine("Saving Tasks...");
            service.AddTasks(new[] {task});

            Console.WriteLine("Retrieving forecasts...");
            var forecasts = service.GetForecasts(new[] {task});

            foreach (var forecast in forecasts)
            {
                Console.WriteLine("Forecast for task {0}", forecast.TaskID);
                foreach (var value in forecast.Values)
                {
                    Console.WriteLine("  {0} - {1}", value.Time.ToShortDateString(), value.Value);
                }
            }

            Console.WriteLine("Press any key to continue");
            Console.ReadKey(true);
        }