public MefDependencyScope(Export<CompositionContext> compositionScope)
        {
            if (compositionScope == null)
                throw new ArgumentNullException("compositionScope");

            _compositionScope = compositionScope;
        }
Ejemplo n.º 2
0
        public CKResult callExport(int index, Export.SExportData args)
        {
            if(checkIndex(index) && checkType(index, typeof(IPluginExport)))
            {
                return ((IPluginExport)m_PluginList[index]).Export(null, args);
            }

            return CKResult.CK_IOOR;
        }
        public StandaloneDependencyScope(Export<CompositionContext> compositionScope)
        {
            if (compositionScope == null)
            {
                throw new ArgumentNullException(nameof(compositionScope));
            }

            this.compositionScope = compositionScope;
        }
Ejemplo n.º 4
0
        public void ExportCupomFiscal()
        {
            Export export = new Export();

            export.Where = new Where {
                {"fat_Lan.GUID = '736bb21b-df88-40b0-85b1-0c7941ad48d4'"}
            };

            export.Execute("CupomFiscal");
        }
        public ResponseHolder CreateExport(String queryString)
        {
            Export exp = new Export();
            exp.Name = "API Export " + DateTime.Now;
            exp.Query = queryString;
            exp.Format = "csv";

            List<ResponseHolder> rh = zs.Create(new List<zObject> { exp }, false);

            return rh[0];
        }
Ejemplo n.º 6
0
        public void ExportMapaResumo()
        {
            Export export = new Export();
            export.Where = new Where{
                {"arq_Registro02.GUID = @p1",
                    new  Unimake.Data.Generic.Parameter {
                        ParameterName = "@p1",
                        Value = "b8fc6ab8-d198-4b44-98d1-a91b8552b72d"
                    }
                 }
            };

            export.Execute("MapaResumo");
        }
Ejemplo n.º 7
0
        public void ExportNFe()
        {
            Export export = new Export();
            export.Where = new Where {
                { "fat_LanMovNF.EGUID = @p1",
                    new Parameter
                    {
                        ParameterName = "@p1",
                        Value = "362804410"
                    }
                }
            };

            export.Execute("NFe");
        }
Ejemplo n.º 8
0
        protected virtual void ExportData(DataTable dataTbl, Export.ExportFormat outputFormat,int[] columnList,string[] headerList)
        {
            try
            {
                switch (outputFormat)
                {
                    case Export.ExportFormat.Excel:
                        this.saveFileDialog.DefaultExt = "xls";
                        this.saveFileDialog.Filter = "Microsoft Excel(*.xls)|*.xls";
                        break;
                    case Export.ExportFormat.CSV:
                        this.saveFileDialog.DefaultExt = "csv";
                        this.saveFileDialog.Filter = "Van ban(*.csv)|*.csv";
                        break;
                    case Export.ExportFormat.XML:
                        this.saveFileDialog.DefaultExt = "html";
                        this.saveFileDialog.Filter = "Trang web(*.html)|*.html";
                        break;
                    default: return;
                }
                this.saveFileDialog.CheckPathExists = true;
                this.saveFileDialog.AddExtension = true;
                this.saveFileDialog.RestoreDirectory = true;
                this.saveFileDialog.Title = "Thu muc luu tap tin ?";
                if (this.saveFileDialog.ShowDialog() != DialogResult.OK) return;

                // Get the datatable to export			
                DataTable dtTbl = dataTbl.Copy();
                common.Export.ExportToExcel(dtTbl, this.saveFileDialog.FileName,columnList,headerList);
                dtTbl.Dispose();
                common.sysLibs.ShowMessage("Đã xuất dữ liệu ra tập tin : " + this.saveFileDialog.FileName);
            }
            catch(Exception er) 
            {
                common.sysLibs.ShowMessage("Xuất dữ liệu gặp lỗi.\n\r\n\r" + er.Message.ToString());
            }
        }
		private static object LazyInstanceFor(Type lazyType, Type metadataType, Export export)
		{
			Func<object> factory = () => export.Value;
			if (metadataType == null)
				return lazyType.GetMethod("FromUntyped").Invoke(null, new object[] { factory });
			var metadata = export.Metadata.Single(metadataType.IsInstanceOfType);
			return lazyType.GetMethod("FromUntypedWithMetadata").Invoke(null, new[] { factory, metadata });
		}
Ejemplo n.º 10
0
        protected override void Run()
        {
            SafeToExit = false;
            Description = Messages.ACTION_EXPORT_DESCRIPTION_IN_PROGRESS;

            RelatedTask = XenAPI.Task.create(Session,
                string.Format(Messages.ACTION_EXPORT_TASK_NAME, VM.Name),
                string.Format(Messages.ACTION_EXPORT_TASK_DESCRIPTION, VM.Name));

            UriBuilder uriBuilder = new UriBuilder(this.Session.Url);
            uriBuilder.Path = "export";
            uriBuilder.Query = string.Format("session_id={0}&uuid={1}&task_id={2}",
                Uri.EscapeDataString(this.Session.uuid),
                Uri.EscapeDataString(this.VM.uuid),
                Uri.EscapeDataString(this.RelatedTask.opaque_ref));

            log.DebugFormat("Exporting {0} from {1} to {2}", VM.Name, uriBuilder.ToString(), _filename);

            // The DownloadFile call will block, so we need a separate thread to poll for task status.
            Thread taskThread = new Thread((ThreadStart)progressPoll);
            taskThread.Name = "Progress polling thread for ExportVmAction for " + VM.Name.Ellipsise(20);
            taskThread.IsBackground = true;
            taskThread.Start();

            // Create the file with a temporary name till it is fully downloaded
            String tmpFile = _filename + ".tmp";
            try
            {
                HttpGet(tmpFile, uriBuilder.Uri);
            }
            catch (Exception e)
            {
                if (XenAPI.Task.get_status(this.Session, this.RelatedTask.opaque_ref) == XenAPI.task_status_type.pending
                    && XenAPI.Task.get_progress(this.Session, this.RelatedTask.opaque_ref) == 0)
                {
                    // If task is pending and has zero progress, it probably hasn't been started,
                    // which probably means there was an exception in the GUI code before the
                    // action got going. Kill the task so that we don't block forever on
                    // taskThread.Join(). Brought to light by CA-11100.
                    XenAPI.Task.destroy(this.Session, this.RelatedTask.opaque_ref);
                }
                // Test for null: don't overwrite a previous exception
                if (_exception == null)
                    _exception = e;
            }

            taskThread.Join();

            using (FileStream fs = new FileStream(tmpFile, FileMode.Append))
            {
                // Flush written data to disk
                if (!Win32.FlushFileBuffers(fs.SafeFileHandle))
                {
                    Win32Exception exn = new Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error());
                    log.ErrorFormat("FlushFileBuffers failed in ExportVmAction.\nNativeErrorCode={0}\nMessage={1}\nToString={2}",
                        exn.NativeErrorCode, exn.Message, exn.ToString());
                }
            }

            if (verify && _exception == null)
            {
                long read = 0;
                int i = 0;
                long filesize = new FileInfo(tmpFile).Length / 50; //Div by 50 to save doing the * 50 in the callback

                Export.verifyCallback callback = new Export.verifyCallback(delegate(uint size)
                    {
                        read += size;
                        i++;

                        //divide number of updates by 10, so as not to spend all out time redrawing the control
                        //but try and send an update every second to keep the timer ticking
                        if (i > 10)
                        {
                            PercentComplete = 50 + (int)(read / filesize);
                            i = 0;
                        }
                    });

                try
                {
                    using (FileStream fs = new FileStream(tmpFile, FileMode.Open, FileAccess.Read))
                    {
                        log.DebugFormat("Verifying export of {0} in {1}", VM.Name, _filename);
                        this.Description = Messages.ACTION_EXPORT_VERIFY;

                        export = new Export();
                        export.verify(fs, null, (Export.cancellingCallback)delegate() { return Cancelling; }, callback);
                    }
                }
                catch (Exception e)
                {
                    if (_exception == null)
                        _exception = e;
                }
            }

            if (Cancelling || _exception is CancelledException)
            {
                log.InfoFormat("Export of VM {0} cancelled", VM.Name);
                this.Description = Messages.ACTION_EXPORT_DESCRIPTION_CANCELLED;

                log.DebugFormat("Deleting {0}", tmpFile);
                File.Delete(tmpFile);
                throw new CancelledException();
            }
            else if (_exception != null)
            {
                log.Warn(string.Format("Export of VM {0} failed", VM.Name), _exception);

                if (_exception is HeaderChecksumFailed || _exception is FormatException)
                    this.Description = Messages.ACTION_EXPORT_DESCRIPTION_HEADER_CHECKSUM_FAILED;
                else if (_exception is BlockChecksumFailed)
                    this.Description = Messages.ACTION_EXPORT_DESCRIPTION_BLOCK_CHECKSUM_FAILED;
                else if (_exception is IOException && Win32.GetHResult(_exception) == Win32.ERROR_DISK_FULL)
                    this.Description = Messages.ACTION_EXPORT_DESCRIPTION_DISK_FULL;
                else if (_exception is Failure && ((Failure)_exception).ErrorDescription[0] == Failure.VDI_IN_USE)
                    this.Description = Messages.ACTION_EXPORT_DESCRIPTION_VDI_IN_USE;
                else
                    this.Description = Messages.ACTION_EXPORT_DESCRIPTION_FAILED;

                var fi = new FileInfo(tmpFile);
                log.DebugFormat("Progress of the action until exception: {0}", PercentComplete);
                log.DebugFormat("Size file exported until exception: {0}", fi.Length);
                try
                {
                    using (Stream stream = new FileStream(tmpFile, FileMode.Open, FileAccess.Read))
                    {
                        ArchiveIterator iterator = ArchiveFactory.Reader(ArchiveFactory.Type.Tar,
                                                                                        stream);
                        while (iterator.HasNext())
                        {
                            log.DebugFormat("Tar entry: {0} {1}", iterator.CurrentFileName(), iterator.CurrentFileSize());
                        }
                    }
                }
                catch (Exception)
                {}
                log.DebugFormat("Deleting {0}", tmpFile);
                File.Delete(tmpFile);
                throw new Exception(Description);
            }
            else
            {
                log.InfoFormat("Export of VM {0} successful", VM.Name);
                this.Description = Messages.ACTION_EXPORT_DESCRIPTION_SUCCESSFUL;

                log.DebugFormat("Renaming {0} to {1}", tmpFile, _filename);
                if (File.Exists(_filename))
                    File.Delete(_filename);
                File.Move(tmpFile, _filename);
            }
        }
Ejemplo n.º 11
0
 public IParamsView CreateView(Export.ExportNetwork.Params.IExportNetworkParamMgr mgr)
 {
     return new UI.Export.ExportNetwork.ExportNetworkParamsCtrl(mgr.ParentId, mgr.Bag as Export.ExportNetwork.Params.IExportNetworkParamBag);
 }
		public void SatisfyWith(Export[] export, object target)
		{
			_action(export, target);
		}
		public bool IsSatisfiableBy(Export export)
		{
			return _constraint(export);
		}
        /// <summary>
        /// Imports a server from a export file.
        /// </summary>
        private static RegisteredDotNetOpcServer Import(Export.RegisteredServer serverToImport)
        {
            RegisteredDotNetOpcServer server = new RegisteredDotNetOpcServer();

            // assign clsid if none specified.
            if (String.IsNullOrEmpty(serverToImport.Clsid))
            {
                server.Clsid = ConfigUtils.CLSIDFromProgID(serverToImport.ProgId);

                if (server.Clsid == Guid.Empty)
                {
                    server.Clsid = Guid.NewGuid();
                }
            }
            else
            {
                server.Clsid = new Guid(serverToImport.Clsid);
            }

            // get prog id and description.
            server.ProgId      = serverToImport.ProgId;
            server.Description = serverToImport.Description;

            // parse wrapper clsid/prog id.
            try
            {
                server.WrapperClsid = new Guid(serverToImport.WrapperClsid);
            }
            catch
            {
                server.WrapperClsid = ConfigUtils.CLSIDFromProgID(serverToImport.WrapperClsid);
            }

            // parse wrapped server clsid/prog id.
            try
            {
                server.ServerClsid = new Guid(serverToImport.ServerClsid);
            }
            catch
            {
                server.ServerClsid = ConfigUtils.CLSIDFromProgID(serverToImport.ServerClsid);
            }

            // read parameters.
            server.Parameters.Clear();

            if (!ConfigUtils.IsEmpty(serverToImport.Parameter))
            {
                for (int ii = 0; ii < serverToImport.Parameter.Length; ii++)
                {
                    Export.Parameter parameter = serverToImport.Parameter[ii];

                    if (parameter != null && !String.IsNullOrEmpty(parameter.Name))
                    {
                        server.Parameters.Add(parameter.Name, parameter.Value);
                    }
                }
            }

            // return new server.
            return server;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 
        /// </summary>
        private void CriaRegistro02()
        {
            #region Registro R01
            IRegistro01 registro01 = Registro01.Create(Settings.ECF.ECFAtual);

            if (registro01.IsNullOrEmpty())
            {
                //Tornar os campos Inscrição Estadual e Inscrição Municipal com 14 posições, pois temos mandar a string com essa quantidade
                string inscEst = Unimake.Convert.ToString(Unimake.Utilities.OnlyNumbers(Settings.SoftwareHouse.IE, "-,.\\/"));
                string inscMun = Unimake.Convert.ToString(Unimake.Utilities.OnlyNumbers(Settings.SoftwareHouse.IM, "-,.\\/"));

                inscEst = inscEst.PadRight(14, ' ').Substring(0, 14);
                inscMun = inscMun.PadRight(14, ' ').Substring(0, 14);

                registro01 = new Registro01();
                registro01.Impressora = Settings.ECF.ECFAtual;
                registro01.TipoECF = TipoECF.ECFIF.ToString();
                registro01.MarcaECF = ACBrECF.SubModeloECF;
                registro01.VersaoSB = ACBrECF.NumVersao;
                registro01.DataInstalacaoSB = ACBrECF.DataHoraSB.Date;
                registro01.HoraInstalacaoSB = ACBrECF.DataHoraSB;
                registro01.NumeroSequenciaECF = Unimake.Convert.ToInt(ACBrECF.NumECF);
                registro01.CNPJEmitente = Utilities.OnlyNumbers(ACBrECF.CNPJ, "-.,/").ToString();
                registro01.IEEmitente = Utilities.OnlyNumbers(ACBrECF.IE, ".-\\/").ToString();
                registro01.CNPJSoftwareHouse = System.Convert.ToString(Unimake.Utilities.OnlyNumbers(Settings.SoftwareHouse.CNPJ, "./-"));
                registro01.IESoftwareHouse = inscEst;
                registro01.InscrMunicipalSoftwareHouse = inscMun;
                registro01.DenominacaoSoftwareHouse = Settings.SoftwareHouse.Nome;
                registro01.NomePAFECF = Settings.SoftwareHouse.NomeApp;
                registro01.VersaoPAFECF = Settings.SoftwareHouse.Versao;
                registro01.CodigoMD5PAFECF = Cryptography.Files.MD5.GetMD5Hash(Settings.PAF.FilesFullPath);
                registro01.DataCriacao = DateTime.Today;
                registro01.VersaoEspecReqPAFECF = Settings.SoftwareHouse.VersaoER;
                registro01.Save();
            }
            #endregion

            #region Registro R02 - Relações da Redução Z
            IRegistro02 registro02 = new Registro02();
            registro02.Parent = registro01;
            registro02.CRZ = DadosReducaoZ.CRZ;
            registro02.COO = DadosReducaoZ.COO;
            registro02.CRO = DadosReducaoZ.CRO;
            registro02.CCF = DadosReducaoZ.CCF;
            registro02.DataMovimento = DadosReducaoZ.DataDoMovimento;
            registro02.DataHoraEmissao = DadosReducaoZ.DataHoraEmissao;
            registro02.VendaBrutaDiaria = Unimake.Convert.ToDouble(DadosReducaoZ.ValorVendaBruta);
            registro02.GrandeTotal = Unimake.Convert.ToDouble(DadosReducaoZ.ValorGrandeTotal);
            //TODO André: Por enquanto mandamos com o valor 0.00, pois não temos a parte tributária
            registro02.TotalPIS = 0;
            registro02.TotalCofins = 0;
            registro02.ParametroECFISSQN = true;

            #region Registro R02 - Meios de pagamentos

            foreach (FormaPagamento formaPagto in DadosReducaoZ.MeiosDePagamento)
            {
                if (formaPagto.Total > 0)
                {
                    registro02.MeiosPagamentos.Add(new Registro02MeiosPagto
                    {
                        Indice = Unimake.Convert.ToInt(formaPagto.Indice),
                        FormaPagamento = formaPagto.Descricao,
                        ValorAcumulado = Unimake.Convert.ToDouble(formaPagto.Total)
                    });
                }
            }
            #endregion

            #region Registro R03 - Detalhes da Redução Z
            foreach (ACBrFramework.ECF.Aliquota aliquotaICMS in DadosReducaoZ.ICMS.OrderBy(o => o.Indice))
            {
                //Gravar o total vendido pela alíquota de ICMS
                if (aliquotaICMS.Total > 0)
                {
                    registro02.Registros03.Add(new Registro03
                    {
                        TotalizadorParcial = string.Format("{0}T{1:0000}", aliquotaICMS.Indice.PadLeft(2, '0'),
                                                            aliquotaICMS.ValorAliquota.ToString("00.00", CultureInfo.InvariantCulture).Replace(".", "")),
                        ValorAcumulado = Unimake.Convert.ToDouble(aliquotaICMS.Total)
                    });
                }
            }

            foreach (ACBrFramework.ECF.Aliquota aliquotaISS in DadosReducaoZ.ISSQN.OrderBy(o => o.Indice))
            {
                //Gravar o total vendido pela alíquota de ISSQN
                if (aliquotaISS.Total > 0)
                {
                    registro02.Registros03.Add(new Registro03
                    {
                        TotalizadorParcial = string.Format("{0}S{1:0000}", aliquotaISS.Indice.PadLeft(2, '0'),
                                                            aliquotaISS.ValorAliquota.ToString("00.00", CultureInfo.InvariantCulture).Replace(".", "")),
                        ValorAcumulado = Unimake.Convert.ToDouble(aliquotaISS.Total)
                    });
                }
            }

            //Gravar o total vendido de Substituição Tributária de ICMS
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "F1",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.SubstituicaoTributariaICMS)
            });

            //Gravar o total vendido de Substituição Tributária de ISSQN
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "FS1",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.SubstituicaoTributariaISSQN)
            });

            //Gravar o total vendido de Isentos de ICMS
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "I1",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.IsentoICMS)
            });

            //Gravar o total vendido de Isentos de ISSQN
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "IS1",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.IsentoISSQN)
            });

            //Gravar o total vendido de Não Tributados pelo ICMS
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "N1",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.NaoTributadoICMS)
            });

            //Gravar o total vendido de Não Tributados pelo ISSQN
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "NS1",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.NaoTributadoISSQN)
            });

            //Gravar o total vendido de Operações Não Fiscais
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "OPNF",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.TotalOperacaoNaoFiscal)
            });

            //Gravar o total de Desconto de ICMS
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "DT",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.DescontoICMS)
            });

            //Gravar o total de Desconto de ISSQN
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "DS",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.DescontoISSQN)
            });

            //Gravar o total de Acréscimo de ICMS
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "AT",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.AcrescimoICMS)
            });

            //Gravar o total de Acréscimo de ISSQN
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "AS",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.AcrescimoISSQN)
            });

            //Gravar o total de cancelamento de ICMS
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "Can-T",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.CancelamentoICMS)
            });

            //Gravar o total de cancelamento de ISSQN
            registro02.Registros03.Add(new Registro03
            {
                TotalizadorParcial = "Can-S",
                ValorAcumulado = Unimake.Convert.ToDouble(DadosReducaoZ.CancelamentoISSQN)
            });
            #endregion

            registro02.Save();
            #endregion

            #region Mapa resumo
            //Exporta os dados do mapa resumo de acordo com as informações da Redução Z gerada
            Export export = new Export();
            export.Where = new Where
            {
                { "arq_Registro02.GUID = @guid",
                    new Parameter
                    {
                        ParameterName = "@guid",
                        Value = registro02.GUID
                    }
                }
            };
            export.Execute("MapaResumo");
            #endregion
        }
Ejemplo n.º 16
0
        private void InternalAddItem(List<FrameInfo> listFrames, string fileName, Export type)
        {
            //Creates the Cancellation Token
            var cancellationTokenSource = new CancellationTokenSource();
            CancellationTokenList.Add(cancellationTokenSource);

            var context = TaskScheduler.FromCurrentSynchronizationContext();

            //Creates Task and send the Task Id.
            int a = -1;
            var task = new Task(() =>
                {
                    Encode(listFrames, a, fileName, type, cancellationTokenSource);
                },
                CancellationTokenList.Last().Token, TaskCreationOptions.LongRunning);
            a = task.Id;

            #region Error Handling

            task.ContinueWith(t =>
            {
                AggregateException aggregateException = t.Exception;
                if (aggregateException != null)
                    aggregateException.Handle(exception => true);

                SetStatus(Status.Error, a);

                LogWriter.Log(t.Exception, "Encoding Error");
            },
                CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, context);

            #endregion

            #region Creates List Item

            var encoderItem = new EncoderListViewItem
            {
                Image = type == Export.Gif ? (UIElement)FindResource("Vector.Image") : (UIElement)FindResource("Vector.Video"),
                Text = "Starting",
                FrameCount = listFrames.Count,
                Id = a,
                TokenSource = cancellationTokenSource,
            };

            encoderItem.CloseButtonClickedEvent += EncoderItem_CloseButtonClickedEvent;
            encoderItem.LabelLinkClickedEvent += EncoderItem_LabelLinkClickedEvent;

            EncodingListBox.Items.Add(encoderItem);

            #endregion

            try
            {
                TaskList.Add(task);
                TaskList.Last().Start();
            }
            catch (Exception ex)
            {
                Dialog.Ok("Task Error", "Unable to start the encoding task", "A generic error occured while trying to start the encoding task. " + ex.Message);
                LogWriter.Log(ex, "Errow while starting the task.");
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Verifies that everything is good in the attachment
 /// </summary>
 /// <param name="log">Logger to output messages to</param>
 /// <returns>true if successfully verified</returns>
 public override bool Verify(Export.ProgressLogger log)
 {
     log.WriteMessage("Verifying " + Name);
     if (Joint == null)
         log.WriteError(Name + " must be associated with a joint.");
     return true;
 }
Ejemplo n.º 18
0
 protected virtual void ExportData(DataTable dataTbl, Export.ExportFormat outputFormat, int[]  columnList)
 {
     ExportData(dataTbl, outputFormat, columnList, null);
 }
Ejemplo n.º 19
0
		//导出
		private void tsbExport_Click(object sender, EventArgs e)
		{
			if (BackDataSet.Tables.Count > 0)
			{
				Export FormE = new Export(BackDataSet);
				FormE.ShowDialog(this);
			}

			//Apq.Windows.Forms.Wizard w = new Apq.Windows.Forms.Wizard();
			//w.StepIndex = 0;
			//w.btnBack.Click += new EventHandler(btnBack_Click);
			//w.btnNext.Click += new EventHandler(btnNext_Click);
			//w.btnFinish.Click += new EventHandler(btnFinish_Click);
			//w.btnCancel.Click += new EventHandler(btnCancel_Click);

			//ShowExportForm(w, 0, 1);
		}
Ejemplo n.º 20
0
 protected virtual void ExportData(DataTable dataTbl, Export.ExportFormat outputFormat)
 {
     ExportData(dataTbl, outputFormat,null,null);
 }
 static void SetCurrentRequestContext(Export<CompositionContext> context)
 {
     if (context == null) throw new ArgumentNullException("context");
     HttpContext.Current.Items[typeof(MvcCompositionProvider)] = context;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        //internal static List<KeepconPost> Update_Sended_Post()
        //{
        //    using (BB_MovistarSM_LogsEntities dc = new BB_MovistarSM_LogsEntities())
        //    {
        //        var x = from s in dc.KeepconPost where s.keepcon_send_date.HasValue == false select s;
        //        return x.ToList<KeepconPost>();

        //    }
        //}


        #endregion

        /// <summary>
        /// Almacena resultado de moderacion
        /// </summary>
        /// <param name="export"></param>
        internal static void SaveResult(Export.Export export)
        {

            using (BB_MovistarSM_LogsEntities dc = new BB_MovistarSM_LogsEntities())
            {
                   foreach (Export.Content c in export.Contents)
                {
                    var post = dc.KeepconPost.Where(s => s.PostID.Equals(c.Id)).FirstOrDefault();
                    post.keepcon_result_resived_date = System.DateTime.Now;
                    post.keepcon_moderator_date = Fwk.HelperFunctions.DateFunctions.UnixLongTimeToDateTime(c.ModerationDate);
                    post.keepcon_moderator_decision = c.ModerationDecision;
                    post.keepcon_result_setId = export.SetId;

                   
                    if (c.Tagging != null)
                        if (c.Tagging.Count > 0)
                        {

                            
                            //try
                            //{
                                post.keepcon_result_tagging = Fwk.HelperFunctions.FormatFunctions.GetStringBuilderWhitSeparator<Allus.Keepcon.Export.Tag>(c.Tagging, ',').ToString();
                            //}
                            //catch (Exception r)
                            //{
                            //    throw r;
                            //}
                        }
                    if (c.Comments != null)
                        if (c.Comments.Count > 0)
                            post.keepcon_result_comments = c.Comments[0].Text.Text;

                }
                dc.SaveChanges();
            }
        }
        public static List<Export> Get_Export(SalesCodeModel data)
        {

            /*-------------------匯出宣告-------------------*/
            s26webDataContext db = new s26webDataContext();
            Export export = new Export();
            List<Export> exp = new List<Export>();
            List<string> bir = new List<string> { "", "", "" };
            var newdata = data.Get().OrderByDescending(o => o.Id);
            /*-------------------匯出宣告End-------------------*/
            foreach (var d in newdata)
            {

                export.Id = d.Id.ToString();
                export.SalesPromotionName = Get_SalesPromotionName(d.SalesPromotionId);
                export.Code = d.Code;
                export.SalesPromotionDeadline = d.SalesPromotionDeadline.ToString("yyyy/MM/dd");
                export.SalesPromotionPoint = d.SalesPromotionPoint.ToString();
                if (d.ExchangeStatus == true)
                {
                    export.ExchangeStatus = "已兌換";
                }
                else
                {
                    export.ExchangeStatus = "未兌換";
                }
                if (d.ExchangeTime != null)
                {
                    export.ExchangeTime = d.ExchangeTime.Value.ToString("yyyy/MM/dd HH:mm:ss");
                }
                if (d.VolunteersId != 0)
                {
                    export.VolunteersId = d.VolunteersId.Value.ToString("");
                }
                exp.Add(export);
                export = new Export();
            }
            db.Connection.Close();
            return exp;
        }
Ejemplo n.º 24
0
            // *** Constructors ***

            public ViewLifetimeContext(Export<object> pageLifetimeContext, Export<object> viewModelLifetimeContext)
            {
                this.pageLifetimeContext = pageLifetimeContext;
                this.viewModelLifetimeContext = viewModelLifetimeContext;
            }
Ejemplo n.º 25
0
        private void Encode(List<FrameInfo> listFrames, int id, string fileName, Export type, CancellationTokenSource tokenSource)
        {
            if (type == Export.Gif)
            {
                #region Gif

                if (Settings.Default.CustomEncoding)
                {
                    #region Custom Gif Encoding

                    using (var encoder = new AnimatedGifEncoder())
                    {
                        string cutFolder = null;

                        #region Cut/Paint Unchanged Pixels

                        if (Settings.Default.DetectUnchanged)
                        {
                            Update(id, 0, "Analizing Unchanged Pixels");

                            if (Settings.Default.PaintTransparent)
                            {
                                var color = Color.FromArgb(Settings.Default.TransparentColor.R,
                                    Settings.Default.TransparentColor.G, Settings.Default.TransparentColor.B);

                                listFrames = ImageMethods.PaintTransparentAndCut(listFrames, color, id, tokenSource);

                                //TODO: Use System.Windows.Media.Color inside the AnimatedGifEncoder.
                                encoder.SetTransparent(color);
                                encoder.SetDispose(1); //Undraw Method, "Leave".
                            }
                            else
                            {
                                listFrames = ImageMethods.CutUnchanged(listFrames, id, tokenSource);
                            }
                        }

                        #endregion

                        encoder.Start(fileName);
                        encoder.SetQuality(Settings.Default.Quality);
                        encoder.SetRepeat(Settings.Default.Looped ? (Settings.Default.RepeatForever ? 0 : Settings.Default.RepeatCount) : -1); // 0 = Always, -1 once

                        int numImage = 0;
                        foreach (FrameInfo image in listFrames)
                        {
                            #region Cancellation

                            if (tokenSource.Token.IsCancellationRequested)
                            {
                                SetStatus(Status.Cancelled, id);

                                break;
                            }

                            #endregion

                            var bitmapAux = new Bitmap(image.ImageLocation);

                            encoder.SetDelay(image.Delay);
                            encoder.AddFrame(bitmapAux, image.PositionTopLeft.X, image.PositionTopLeft.Y);

                            bitmapAux.Dispose();

                            Update(id, numImage, "Processing " + numImage);
                            numImage++;
                        }

                        #region Specific Clear

                        try
                        {
                            if (!String.IsNullOrEmpty(cutFolder))
                                if (Directory.Exists(cutFolder))
                                    Directory.Delete(cutFolder, true);
                        }
                        catch (Exception ex)
                        {
                            LogWriter.Log(ex, "Errow while Deleting and Cleaning Specific Variables");
                        }

                        #endregion
                    }

                    #endregion
                }
                else
                {
                    #region paint.NET encoding

                    //0 = Always, -1 = no repeat, n = repeat number (first shown + repeat number = total number of iterations)
                    var repeat = (Settings.Default.Looped ? (Settings.Default.RepeatForever ? 0 : Settings.Default.RepeatCount) : -1);

                    using (var stream = new MemoryStream())
                    {
                        using (var encoderNet = new GifEncoder(stream, null, null, repeat))
                        {
                            for (int i = 0; i < listFrames.Count; i++)
                            {
                                var bitmapAux = new Bitmap(listFrames[i].ImageLocation);
                                encoderNet.AddFrame(bitmapAux, 0, 0, TimeSpan.FromMilliseconds(listFrames[i].Delay));
                                bitmapAux.Dispose();

                                Update(id, i, "Processing " + i);

                                #region Cancellation

                                if (tokenSource.Token.IsCancellationRequested)
                                {
                                    SetStatus(Status.Cancelled, id);

                                    break;
                                }

                                #endregion
                            }
                        }

                        stream.Position = 0;

                        try
                        {
                            using (var fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None,
                            Constants.BufferSize, false))
                            {
                                stream.WriteTo(fileStream);
                            }
                        }
                        catch (Exception ex)
                        {
                            SetStatus(Status.Error, id);
                            LogWriter.Log(ex, "Error while writing to disk.");
                        }
                    }

                    #endregion
                }

                #endregion
            }
            else
            {
                #region Avi

                var image = listFrames[0].ImageLocation.SourceFrom();

                using (var aviWriter = new AviWriter(fileName, 1000 / listFrames[0].Delay,
                    (int)image.PixelWidth, (int)image.PixelHeight, 5000))
                {
                    int numImage = 0;
                    foreach (FrameInfo frame in listFrames)
                    {
                        using (MemoryStream outStream = new MemoryStream())
                        {
                            var bitImage = frame.ImageLocation.SourceFrom();

                            var enc = new BmpBitmapEncoder();
                            enc.Frames.Add(BitmapFrame.Create(bitImage));
                            enc.Save(outStream);

                            outStream.Flush();

                            using (var bitmap = new Bitmap(outStream))
                            {
                                aviWriter.AddFrame(bitmap);
                            }
                        }

                        //aviWriter.AddFrame(new BitmapImage(new Uri(frame.ImageLocation)));

                        Update(id, numImage, "Processing " + numImage);
                        numImage++;

                        #region Cancellation

                        if (tokenSource.Token.IsCancellationRequested)
                        {
                            SetStatus(Status.Cancelled, id);
                            break;
                        }

                        #endregion
                    }
                }

                #endregion
            }

            #region Delete Encoder Folder

            try
            {
                var encoderFolder = Path.GetDirectoryName(listFrames[0].ImageLocation);

                if (!String.IsNullOrEmpty(encoderFolder))
                    if (Directory.Exists(encoderFolder))
                        Directory.Delete(encoderFolder, true);
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Errow while deleting and cleaning the Encode folder");
            }

            #endregion

            GC.Collect();

            if (!tokenSource.Token.IsCancellationRequested)
                SetStatus(Status.Completed, id, fileName);
        }
Ejemplo n.º 26
0
        public CKResult Export(byte[] mapData, Export.SExportData args)
        {
            Util.showInfo();

            args.args.Result = CKResult.CK_PARAM;

            return CKResult.CK_PARAM;
        }
        /// <summary>
        /// Writes the SDF Limits tags for this axis
        /// </summary>
        /// <param name="log">logger to use to print messages</param>
        /// <param name="writer">writer to use to write the SDF</param>
        protected override void WriteLimits(Export.ProgressLogger log, System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("limit");
            {
                if (!IsContinuous)
                {
                    SDFExporter.writeSDFElement(writer, "upper", UpperLimit.ToString());
                    SDFExporter.writeSDFElement(writer, "lower", LowerLimit.ToString());
                }

                SDFExporter.writeSDFElement(writer, "effort", EffortLimit.ToString());
            }
            writer.WriteEndElement();
        }
Ejemplo n.º 28
0
 public void CreateProduct()
 {
     Product = _factory.CreateExport();
 }
 private static object LazyInstanceFor(Type lazyType, Type metadataType, Export export)
 {
     Func<object> factory = () => export.Value;
     var metadata = export.Metadata.Single(metadataType.IsInstanceOfType);
     return Activator.CreateInstance(lazyType, new[] { factory, metadata });
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Verifies that everything is good in the attachment
 /// </summary>
 /// <param name="log">Logger to output messages to</param>
 /// <returns>true if successfully verified</returns>
 public override bool Verify(Export.ProgressLogger log)
 {
     log.WriteMessage("Verifying " + Name);
     return true;
 }