internal void GetCaptionDataBase()
        {
            try
            {
                if (!ACSDataBase.FormInGEDCaptionControl(this.Name))
                {
                    return;
                }

                foreach (var ctrl in this.Controls.All())
                {
                    var ControlCaption = ACSDataBase.GetControlCaption(this.Name, ctrl.Name);
                    var ctroltype      = ctrl.GetType();
                    var prop           = ctroltype.GetProperty("Text");
                    if (ControlCaption != string.Empty)
                    {
                        if (prop != null)
                        {
                            prop.SetValue(ctrl, ControlCaption, null);
                            ctrl.Invalidate();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
            }
        }
 private void WFStandard_Enter(object sender, EventArgs e)
 {
     try
     {
         if (Program.MainForm != sender)
         {
             if (ACSGlobal.UsuarioLogado != null)
             {
                 if (ACSGlobal.SetoresUsuario != null)
                 {
                     Program.MainForm.lbCaptionForm.Text = Application.ProductName + " - " + (sender as Form).Text + " - [Usuário: " + ACSGlobal.NomeLogado + "] - "; //+ ACSGlobal.SetorUsuario.SET_DESCRICAO;
                 }
                 else
                 {
                     Program.MainForm.lbCaptionForm.Text = Application.ProductName + " - " + (sender as Form).Text + " - [Usuário: " + ACSGlobal.NomeLogado + "]";
                 }
             }
             else
             {
                 Program.MainForm.lbCaptionForm.Text = Application.ProductName + " - " + (sender as Form).Text;
             }
         }
     }
     catch (Exception ex)
     {
         ACSLog.InsertLog(MessageBoxIcon.Error, ex, Program.MainForm.ToString());
     }
 }
示例#3
0
        public new void Remove()
        {
            for (var i = this.Nodes.Count - 1; i >= 0; i--)
            {
                try
                {
                    (this.Nodes[i] as Page).Remove();
                }
                catch (Exception e)
                {
                    ACSLog.InsertLog(MessageBoxIcon.Error, e);

                    return;
                }
            }

            if (this.DirInfo != null)
            {
                if (this.DirInfo.GetFiles().Count() <= 0)
                {
                    this.DirInfo.Delete();
                    this.DirInfo = null;
                }
            }

            base.Remove();
        }
示例#4
0
        public new void Remove()
        {
            try
            {
                var Doc = (Document)this.Parent;

                if (BeforeRemovePageEvent != null)
                {
                    BeforeRemovePageEvent(this);
                }

                if (File.Exists(this.FileName))
                {
                    File.Delete(this.FileName);
                }

                if (!File.Exists(this.FileName))
                {
                    base.Remove();
                }

                if (Doc.Pages.Count() <= 0)
                {
                    Doc.Remove();
                }
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
                WFMessageBox.Show(e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#5
0
        static ACSConfig()
        {
            try
            {
                if (IniFile == null)
                {
                    var pathIni = Path.GetDirectoryName(Application.ExecutablePath) + @"\Config.ypt";

                    if (!File.Exists(pathIni))
                    {
                        var msg = "Arquivo de configuração não encontrado. Avise o administrador do sistema!";
                        var e   = new Exception(msg, new Exception(pathIni));
                        ACSLog.InsertLog(MessageBoxIcon.Error, e, "ACS.Config.cs: line 28");
                        WFMessageBox.Show(msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Process.GetCurrentProcess().Kill();
                    }

                    IniFile = new IniParser(pathIni);
                }
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex.ToString());
                WFMessageBox.Show(ex.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#6
0
        public Page NewPage(string FileName)
        {
            try
            {
                if (this.DirInfo == null)
                {
                    this.DirInfo = new DirectoryInfo(Path.GetDirectoryName(FileName));
                }

                var ChilName = (this.Nodes.Count + 1);
                var result   = new Page(ChilName.ToString((this.TreeView as TreeViewCustom).MaskPageName),
                                        FileName, (this.TreeView as TreeViewCustom).ImageIndexPageValid,
                                        (this.TreeView as TreeViewCustom).ImageIndexPageNotValid,
                                        (this.TreeView as TreeViewCustom).ImageIndexPageOCR);
                this.Nodes.Add(result);

                return(result);
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);

                return(null);
            }
        }
        // Handle the UI exceptions by showing a dialog box, and asking the user whether
        // or not they wish to abort execution.
        private static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            try
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, t.Exception);
                var fVerifica = t.Exception.StackTrace.ToUpper().Contains("SYSTEM.WINDOWS.FORMS.TREEVIEW.CUSTOMDRAW");
                if (!fVerifica)
                {
                    DialogResult result = DialogResult.Cancel;

                    result = ShowThreadExceptionDialog("Windows Forms Error", t.Exception);


                    // Exits the program when the user clicks Abort.
                    if (result == DialogResult.Abort)
                    {
                        Application.Exit();
                    }
                }
            }
            catch
            {
                try
                {
                    MessageBox.Show("Erro", "Ocorreu um erro na aplicação. Por favor entre em contato com o administrador informando a seguinte mensagem: \n\n" +
                                    "Erro desconhecido - Form1_UIThreadException",
                                    MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }
        }
示例#8
0
        public Document NewDocument()
        {
            try
            {
                var DocName = (this.Nodes.Count + 1);

                var Doc = new Document(this.MaskDocumentName + DocName.ToString(),
                                       this.ImageIndexDocumentValid,
                                       this.ImageIndexDocumentNotValid,
                                       this.ImageIndexDocumentOCR);

                if (Doc == null)
                {
                    ACSLog.InsertLog(MessageBoxIcon.Error, "DOCUMENTO NULO: " + DocName);
                }
                else
                {
                    this.Nodes.Add(Doc);
                }

                return(Doc);
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
                return(null);
            }
        }
示例#9
0
 private void fnBtnAssinar()
 {
     btnCoAssinador.Enabled = false;
     lblInformativo.Text    = "Trabalhando em sua requisição...";
     if (ACSConfig.GetNetworkAccesser().Valid)
     {
         try
         {
             using (var nsa = NetworkShareAccesser.Access(ACSConfig.GetStorage().Output,
                                                          ACSConfig.GetNetworkAccesser().Domain,
                                                          ACSConfig.GetNetworkAccesser().User,
                                                          ACSConfig.GetNetworkAccesser().Password))
             {
                 fnCoassinar();
             }
         }
         catch (Exception g)
         {
             ACSLog.InsertLog(MessageBoxIcon.Error, g);
             WFMessageBox.Show(g.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
             btnCoAssinador.Enabled = true;
         }
     }
     else
     {
         fnCoassinar();
     }
 }
示例#10
0
        private void dtgv_DocsN2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (ACSConfig.GetNetworkAccesser().Valid)
            {
                try
                {
                    using (var nsa = NetworkShareAccesser.Access(ACSConfig.GetStorage().Output,
                                                                 ACSConfig.GetNetworkAccesser().Domain,
                                                                 ACSConfig.GetNetworkAccesser().User,
                                                                 ACSConfig.GetNetworkAccesser().Password))
                    {
                        getPictureInGrid(e, senderGrid);
                    }
                }
                catch (Exception g)
                {
                    ACSLog.InsertLog(MessageBoxIcon.Error, g);
                    WFMessageBox.Show(g.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                getPictureInGrid(e, senderGrid);
            }
        }
示例#11
0
        private bool AssinaN3_2First(GEDDocumentosNivel2 item)
        {
            string caminhoDocOriginal   = "";
            string caminhoDocAssinadoN1 = "";

            caminhoDocOriginal   = GetPathOutput() + "\\" + item.PAS_REGISTRO + "\\" + item.PAS_REGISTRO + item.DOC_DIVISAO + "\\" + item.PAS_CODIGOPASSAGEM + "\\" + item.DOC_NOMEARQUIVO + ".jpeg";
            caminhoDocAssinadoN1 = GetPathOutput() + "\\" + item.PAS_REGISTRO + "\\" + item.PAS_REGISTRO + item.DOC_DIVISAO + "\\" + item.PAS_CODIGOPASSAGEM + "\\" + item.DOC_NOMEARQUIVO + "_N3.p7s";


            byte[] retorno = null;

            Stream fileToSignDocOriginal   = ConvertDocToStream(caminhoDocOriginal);
            Stream fileToSignDocAssinadoN1 = ConvertDocToStream(caminhoDocAssinadoN1);

            BRYSIGNERCOMLib.IAssinador assinador = new BRYSIGNERCOMLib.Assinador();

            String docOriginal   = BitConverter.ToString(lerArquivo(fileToSignDocOriginal)).Replace("-", string.Empty);
            String docAssinadoN1 = BitConverter.ToString(lerArquivo(fileToSignDocAssinadoN1)).Replace("-", string.Empty);

            String idCertificado = ACSGlobal.UsuarioLogado.USR_SERIALNUMBERCERT;

            assinador.setFormatoDadosMemoria(FORMATO_ARQUIVO_HEXADECIMAL);

            String assinaturaHex    = "";
            int    statusAssinatura = -1;

            statusAssinatura = assinador.coAssineMemDetached(docAssinadoN1, docOriginal, "Orion Digital - 2016 - ACS Capture", idCertificado, ref assinaturaHex);

            if (statusAssinatura == 1)
            {
                retorno = StringToByteArray(assinaturaHex);

                string pathNew = GetPathOutput() + "\\" + item.PAS_REGISTRO + "\\" + item.PAS_REGISTRO + item.DOC_DIVISAO + "\\" + item.PAS_CODIGOPASSAGEM + "\\" + item.DOC_NOMEARQUIVO;
                System.IO.FileStream _FileStream = new System.IO.FileStream(pathNew + "_N3_2.p7s", System.IO.FileMode.Create, System.IO.FileAccess.Write);

                _FileStream.Write(retorno, 0, retorno.Length);

                // close file stream
                _FileStream.Close();

                ACSDataBase.UpdateDocumentoAssinadoN2((decimal)ACSGlobal.UsuarioLogado.USR_IDUSUARIO, (decimal)item.DOC_IDDOCUMENTO, getInfoCertificado(idCertificado, "2"));

                return(true);
            }
            else
            {
                var error = ErrorCertificado.ListaErroCertificado().Where(c => c.IdErro == statusAssinatura.ToString().Replace("-", "")).FirstOrDefault().DescricaoErro;
                if (error == ".LLLLLLLLLLLLLLLLÇMNK1")
                {
                    error = "Ocorreu um erro na validação do certificado digital!";
                }

                ACSLog.InsertLog(MessageBoxIcon.Error, "Não foi possível assinar o documento. Motivo: " + statusAssinatura);
                throw new ExceptionCustom("Não foi possível assinar o documento. Motivo: " + error);
                return(false);
            }
        }
示例#12
0
        private bool AssinaN3First(GEDDocumentosNivel2 item)
        {
            string caminhoDocOriginal   = "";
            string caminhoDocAssinadoN1 = "";

            try
            {
                if (item.DOC_IDUSUARIOASSINANIVEL2 != null || item.DOC_IDUSUARIOASSINANIVEL3 != null)
                {
                    return(CoAssinarN3(item));
                }
                else
                {
                    ACSLog.InsertLog(MessageBoxIcon.Error, "-----------------------------------  Entrou para assinar  ----------------------------------- ");


                    caminhoDocOriginal = GetPathOutput() + "\\" + item.PAS_REGISTRO + "\\" + item.PAS_REGISTRO + item.DOC_DIVISAO + "\\" + item.PAS_CODIGOPASSAGEM + "\\" + item.DOC_NOMEARQUIVO + ".jpeg";
                    //  caminhoDocAssinadoN1 = GetPathOutput() + "\\" + item.PAS_REGISTRO + "\\" + item.PAS_REGISTRO + item.DOC_DIVISAO + "\\" + item.PAS_CODIGOPASSAGEM + "\\" + item.DOC_NOMEARQUIVO + "_N1.p7s";



                    ACSLog.InsertLog(MessageBoxIcon.Error, "Montou um caminho: " + caminhoDocOriginal);

                    var    sCertificado = ACSGlobal.UsuarioLogado.USR_SERIALNUMBERCERT;
                    byte[] assinatura   = Assinador.assinar(Assinador.ConvertDocToStream(caminhoDocOriginal), sCertificado);


                    string pathNew = Path.GetDirectoryName(caminhoDocOriginal) + "\\" + Path.GetFileNameWithoutExtension(caminhoDocOriginal);
                    System.IO.FileStream _FileStream = new System.IO.FileStream(pathNew + "_N3.p7s", System.IO.FileMode.Create, System.IO.FileAccess.Write);


                    ACSLog.InsertLog(MessageBoxIcon.Error, "Geraou o caminho para o _N3.p7s: " + pathNew);

                    _FileStream.Write(assinatura, 0, assinatura.Length);

                    // close file stream
                    _FileStream.Close();
                    ACSDataBase.UpdateDocumentoAssinadoN3((decimal)ACSGlobal.UsuarioLogado.USR_IDUSUARIO, (decimal)item.DOC_IDDOCUMENTO, getInfoCertificado(sCertificado, "3"));

                    ACSLog.InsertLog(MessageBoxIcon.Error, "Salvou a alteração na base de dados");

                    ACSLog.InsertLog(MessageBoxIcon.Error, "-----------------------------------  Finalizou assinar  ----------------------------------- ");
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, "Erro ao assinar o documento: " + caminhoDocOriginal);

                ACSLog.InsertLog(MessageBoxIcon.Error, "Não foi possível assinar o documento. Motivo: " + ex.InnerException);
                ACSLog.InsertLog(MessageBoxIcon.Error, "Não foi possível assinar o documento. Motivo w: " + ex.Message);
                ACSLog.InsertLog(MessageBoxIcon.Error, "Não foi possível assinar o documento. Motivo e: " + ex.InnerException);
                throw new ExceptionCustom("Não foi possível assinar o documento. Motivo e: " + ex.InnerException);
                throw new ExceptionCustom("Não foi possível assinar o documento. Motivo w: " + ex.Message);
                return(false);
            }
        }
示例#13
0
        protected override void OnItemDrag(ItemDragEventArgs e)
        {
            try
            {
                // Get drag node and select it
                this.dragNode = (TreeNode)e.Item;

                this.SelectedNode = this.dragNode;

                // Reset image list used for drag image
                this.imageListDrag.Images.Clear();
                this.imageListDrag.ImageSize = new Size(this.dragNode.Bounds.Size.Width + this.Indent, this.dragNode.Bounds.Height);

                // Create new bitmap
                // This bitmap will contain the tree node image to be dragged
                Bitmap bmp = new Bitmap(this.dragNode.Bounds.Width + this.Indent, this.dragNode.Bounds.Height);

                // Get graphics from bitmap
                Graphics gfx = Graphics.FromImage(bmp);

                // Draw node icon into the bitmap
                if (this.ImageList != null)
                {
                    this.imageListDrag.ColorDepth = this.ImageList.ColorDepth;

                    gfx.DrawImage(this.ImageList.Images[this.dragNode.ImageIndex], 0, 0);

                    // Draw node label into bitmap
                    gfx.DrawString(this.dragNode.Text,
                                   this.Font,
                                   new SolidBrush(this.ForeColor),
                                   (float)this.Indent, 1.0f);
                }
                // Add bitmap to imagelist
                this.imageListDrag.Images.Add(bmp);

                // Get mouse position in client coordinates
                Point p = this.PointToClient(Control.MousePosition);

                // Compute delta between mouse position and node bounds
                int dx = p.X + this.Indent - this.dragNode.Bounds.Left;
                int dy = p.Y - this.dragNode.Bounds.Top;

                // Begin dragging image
                if (DragHelper.ImageList_BeginDrag(this.imageListDrag.Handle, 0, dx, dy))
                {
                    // Begin dragging
                    this.DoDragDrop(bmp, DragDropEffects.Move);
                    // End dragging image
                    DragHelper.ImageList_EndDrag();
                }
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
            }
        }
示例#14
0
        public bool PreFilterMessage(ref Message m)
        {
            try
            {
                if (tw == null)
                {
                    return(true);
                }

                TwainCommand cmd = tw.PassMessage(ref m);

                if (cmd == TwainCommand.Not)
                {
                    return(false);
                }

                if (cmd == TwainCommand.Null)
                {
                    return(false);
                }
                switch (cmd)
                {
                case TwainCommand.CloseRequest:
                {
                    //  EndingScan();
                    break;
                }

                case TwainCommand.CloseOk:
                {
                    EndingScan();
                    break;
                }

                case TwainCommand.DeviceEvent:
                {
                    break;
                }

                case TwainCommand.TransferReady:
                {
                    tw.TransferPictures();
                    EndingScan();
                    break;
                }
                }

                return(true);
            }
            catch (Exception a)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, a);
                return(true);
            }
        }
示例#15
0
        /// <summary>
        /// Save settings to new file.
        /// </summary>
        /// <param name="newFilePath">New file path.</param>
        public void SaveSettings(String newFilePath)
        {
            ArrayList sections  = new ArrayList();
            String    tmpValue  = "";
            String    strToSave = "";

            foreach (SectionPair sectionPair in keyPairs.Keys)
            {
                if (!sections.Contains(sectionPair.Section))
                {
                    sections.Add(sectionPair.Section);
                }
            }

            foreach (String section in sections)
            {
                strToSave += ("[" + section + "]\r\n");

                foreach (SectionPair sectionPair in keyPairs.Keys)
                {
                    if (sectionPair.Section == section)
                    {
                        tmpValue = (String)keyPairs[sectionPair];

                        if (tmpValue != null)
                        {
                            tmpValue = "=" + tmpValue;
                        }

                        strToSave += (sectionPair.Key + tmpValue + "\r\n");
                    }
                }

                strToSave += "\r\n";
            }

            try
            {
                if (Path.GetExtension(iniFilePath).ToUpper() == ".YPT")
                {
                    strToSave = CUtils.Encrypt(strToSave);
                }

                TextWriter tw = new StreamWriter(newFilePath);
                tw.Write(strToSave);
                tw.Close();
                tw.Dispose();
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
                throw ex;
            }
        }
示例#16
0
        public TreeViewCustom(IContainer container)
        {
            try
            {
                container.Add(this);

                InitializeComponent();
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
            }
        }
示例#17
0
        protected override void OnDrawNode(DrawTreeNodeEventArgs e)
        {
            try
            {
                this.dragging = true;
                if (e.Node == null || String.IsNullOrEmpty(e.Node.Text))
                {
                    return;
                }

                var backColorSelected = SystemColors.Highlight;
                var backColor         = System.Drawing.Color.Red;
                var foreColor         = e.Node.ForeColor;


                if ((e.State & TreeNodeStates.Selected) != 0)
                {
                    using (SolidBrush brush = new SolidBrush(backColorSelected))
                    {
                        e.Graphics.FillRectangle(brush, e.Bounds);
                    }

                    foreColor = Color.White;

                    e.Graphics.DrawRectangle(SystemPens.Window, e.Bounds);

                    TextRenderer.DrawText(e.Graphics,
                                          e.Node.Text,
                                          e.Node.TreeView.Font,
                                          e.Node.Bounds,
                                          foreColor);
                }
                else
                {
                    using (SolidBrush brush = new SolidBrush(this.BackColor))
                    {
                        e.Graphics.FillRectangle(brush, e.Bounds);
                    }
                    TextRenderer.DrawText(e.Graphics,
                                          e.Node.Text,
                                          e.Node.TreeView.Font,
                                          e.Node.Bounds,
                                          foreColor);
                }
                this.dragging = false;
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
            }
        }
示例#18
0
 public IEnumerable <ImageBoxCapture> AllImageBoxCapture()
 {
     try
     {
         var Ctrls    = this.Controls.All();
         var ImgsCtrl = Ctrls.OfType <ImageBoxCapture>();
         return(ImgsCtrl);
     }
     catch (Exception ex)
     {
         ACSLog.InsertLog(MessageBoxIcon.Error, ex);
         return(new List <ImageBoxCapture>());
     }
 }
示例#19
0
        private void timer_Tick(object sender, EventArgs e)
        {
            try
            {
                // get node at mouse position
                Point    pt   = PointToClient(Control.MousePosition);
                TreeNode node = this.GetNodeAt(pt);

                if (node == null)
                {
                    return;
                }

                // if mouse is near to the top, scroll up
                if (pt.Y < 30)
                {
                    // set actual node to the upper one
                    if (node.PrevVisibleNode != null)
                    {
                        node = node.PrevVisibleNode;

                        // hide drag image
                        DragHelper.ImageList_DragShowNolock(false);
                        // scroll and refresh
                        node.EnsureVisible();
                        this.Refresh();
                        // show drag image
                        DragHelper.ImageList_DragShowNolock(true);
                    }
                }
                // if mouse is near to the bottom, scroll down
                else if (pt.Y > this.Size.Height - 30)
                {
                    if (node.NextVisibleNode != null)
                    {
                        node = node.NextVisibleNode;

                        DragHelper.ImageList_DragShowNolock(false);
                        node.EnsureVisible();
                        this.Refresh();
                        DragHelper.ImageList_DragShowNolock(true);
                    }
                }
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
            }
        }
示例#20
0
        protected override void OnDragEnter(DragEventArgs drgevent)
        {
            try
            {
                DragHelper.ImageList_DragEnter(this.Handle, drgevent.X - this.Left,
                                               drgevent.Y - this.Top);

                // Enable timer for scrolling dragged item
                this.timer.Enabled = true;
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
            }
        }
示例#21
0
        public TreeViewCustom()
        {
            try
            {
                InitializeComponent();
                this.AllowDrop = true;

                this.timer.Interval = 200;
                this.timer.Tick    += new EventHandler(timer_Tick);
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
            }
        }
示例#22
0
        protected override void OnDragLeave(EventArgs e)
        {
            try
            {
                this.dragging = false;
                DragHelper.ImageList_DragLeave(this.Handle);

                // Disable timer for scrolling dragged item
                this.timer.Enabled = false;
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
            }
        }
        public void btnOk_Click1(object sender, EventArgs e)
        {
            try
            {
                if (this.tbText.Text.Trim() == string.Empty)
                {
                    WFMessageBox.Show("Informe Código de Barras!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    this.DialogResult = DialogResult.None;
                    return;
                }

                var flagTipoCliente  = ACSGlobal.flagTipoCliente;
                var idArea           = ACSGlobal.idAreaSelecionada;
                var listaDivisoes    = ACSDataBase.GetDivisoesUsuario(idArea);
                var listaTipoCliente = ACSDataBase.GetTipoClienteArea(idArea);

                List <GED_PROC_CodigosBarras_Result> ListDataSource = new List <GED_PROC_CodigosBarras_Result>();

                var result = ACSDataBase.GetGED_PROC_CodigosBarras(1, 1, this.tbText.Text.Trim()).ToList();



                foreach (var item in result)
                {
                    if (listaDivisoes.Any(c => c.DIV_IDDIVISAO == item.TPD_IDDIVISAO && item.TPD_FLAGTIPOCLIENTE == flagTipoCliente))
                    {
                        ListDataSource.Add(item);
                    }
                }



                if (ListDataSource.Count() <= 0)
                {
                    WFMessageBox.Show("Código de Barras não localizado!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    this.DialogResult = DialogResult.None;
                }
                else
                {
                    this.BarCodeSelected = (GED_PROC_CodigosBarras_Result)result.First().Clone();
                    this.DialogResult    = DialogResult.OK;
                }
            }
            catch (Exception err)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, err);
            }
        }
示例#24
0
        protected override void OnDragOver(DragEventArgs drgevent)
        {
            try
            {
                // Compute drag position and move image
                Point formP = this.PointToClient(new Point(drgevent.X, drgevent.Y));
                //DragHelper.ImageList_DragMove(formP.X - this.Left, formP.Y - this.Top);
                DragHelper.ImageList_DragMove(formP.X, formP.Y);

                // Get actual drop node
                TreeNode dropNode = this.GetNodeAt(this.PointToClient(new Point(drgevent.X, drgevent.Y)));
                if (dropNode == null)
                {
                    //Verificar
                    //drgevent.Effect = DragDropEffects.None;
                    return;
                }

                drgevent.Effect = DragDropEffects.Move;

                // if mouse is on a new node select it
                if (this.tempDropNode != dropNode)
                {
                    DragHelper.ImageList_DragShowNolock(false);
                    this.SelectedNode = dropNode;
                    DragHelper.ImageList_DragShowNolock(true);
                    tempDropNode = dropNode;
                }

                // Avoid that drop node is child of drag node
                TreeNode tmpNode = dropNode;
                while (tmpNode.Parent != null)
                {
                    if (tmpNode.Parent == this.dragNode)
                    {
                        drgevent.Effect = DragDropEffects.None;
                    }
                    tmpNode = tmpNode.Parent;
                }
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
            }
        }
示例#25
0
        public ImageBoxCapture LoadFromBitmap(Bitmap bmp, string FileName)
        {
            try
            {
                var             listImbAll = this.tlpImages.Controls.OfType <ImageBoxCapture>().ToList();
                var             listImb    = listImbAll.Where(imb => imb.Image == null);
                ImageBoxCapture result;
                if (listImb.Count() > 0)
                {
                    result = listImb.First();
                }
                else if (listImbAll.Count() > 0)
                {
                    ClearAllImages();
                    result = listImbAll.First();
                }
                else
                {
                    result = null;
                }

                if (result != null)
                {
                    result.Image    = bmp;
                    result.fileName = FileName;
                    if (this.ZoomFitOnLoadBitmap)
                    {
                        result.Zoom = 37;
                    }
                }

                if (AfterLoadFromFile != null)
                {
                    AfterLoadFromFile(this, result, FileName);
                }

                return(result);
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
                WFMessageBox.Show(e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
示例#26
0
        public ImageBoxCapture LoadFromFile(string FileName, bool Select = true)
        {
            try
            {
                ImageBoxCapture result = LoadFromBitmap(new Bitmap(FileName), FileName);

                if (result != null)
                {
                    result.Selected = Select;
                }

                return(result);
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
                return(null);
            }
        }
示例#27
0
        public static byte[] assinar(Stream fileToSign, string sCertificado)
        {
            byte[] retorno = null;

            try
            {
                BRYSIGNERCOMLib.IAssinador assinador = new BRYSIGNERCOMLib.Assinador();
                String dataToSign = BitConverter.ToString(lerArquivo(fileToSign)).Replace("-", string.Empty);

                String idCertificado = sCertificado;
                assinador.setFormatoDadosMemoria(FORMATO_ARQUIVO_HEXADECIMAL);

                String assinaturaHex    = "";
                int    statusAssinatura = -1;


                statusAssinatura = assinador.assineMemDetached(dataToSign, "Orion Digital - 2016 - ACS Capture", idCertificado, ref assinaturaHex);

                if (statusAssinatura != 1)
                {
                    var error = ErrorCertificado.ListaErroCertificado().Where(c => c.IdErro == statusAssinatura.ToString().Replace("-", "")).FirstOrDefault().DescricaoErro;
                    if (error.Contains("ÇMNK1"))
                    {
                        error = "Ocorreu um erro na validação do certificado digital (" + statusAssinatura + ")";
                    }
                    else
                    {
                        error = error + " (" + statusAssinatura + ")";
                    }

                    ACSLog.InsertLog(MessageBoxIcon.Error, "Não foi possível assinar o documento. Motivo: " + statusAssinatura);
                    throw new ExceptionCustom("Não foi possível assinar o documento. Motivo: " + error);
                }
                retorno = StringToByteArray(assinaturaHex);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(retorno);
        }
示例#28
0
        public AtendimentoResponse  GetAtendimento(string numeroAtendimento)
        {
            try
            {
                string atendimentoTasy    = ACSConfig.GetUrlServices().UrlDadosTasy;
                var    client             = new RestClient(atendimentoTasy);
                var    requestAtendimento = new RestRequest("IntegracaoGEDH/Atendimento/Pesquisar", Method.POST);
                requestAtendimento.AddHeader("Content-type", "application/json");

                requestAtendimento.AddJsonBody(new AtendimentoRequest
                {
                    numeroAtendimento = numeroAtendimento
                });

                RestResponse responseAtendimento = (RestResponse)client.Execute(requestAtendimento);
                var          contentAtendimento  = responseAtendimento.Content; // raw content as string


                Response respostaAtendimento = JsonConvert.DeserializeObject <Response>(contentAtendimento);
                if (respostaAtendimento.flgConfirmacao == "N" && respostaAtendimento.codMotivo != 1)
                {
                    ACSLog.InsertLog(MessageBoxIcon.Error, "Erro ao retornar os dados do serviço. " + respostaAtendimento.codMotivo + " - " + respostaAtendimento.descMotivo);
                    throw new Exception("Não foi possível retornar os atendimentos. " + respostaAtendimento.descMotivo);
                }
                respostaAtendimento.retorno = JsonConvert.DeserializeObject <AtendimentoResponse>(respostaAtendimento.retorno.ToString());

                if (respostaAtendimento.codMotivo == 5)
                {
                    return(null);
                }


                return((AtendimentoResponse)respostaAtendimento.retorno);
            }
            catch (Exception ex)
            {
                return(null);

                throw;
            }
        }
        public List <Certificado> BuscaCertificados()
        {
            try
            {
                List <Certificado> ListaRetorno = new List <Certificado>();

                BRYSIGNERCOMLib.IRepositorio repositorio = new BRYSIGNERCOMLib.Repositorio();
                repositorio.inicialize("MY", CERT_SYSTEM_STORE_CURRENT_USER);
                int totalCertificados = repositorio.getCountCertificados();

                BRYSIGNERCOMLib.ICertificado certificado = null;


                for (int i = 0; i < totalCertificados; ++i)
                {
                    certificado = repositorio.getCertificado(i);

                    if (certificado.verificarValidade() == 1)
                    {
                        ListaRetorno.Add(new Certificado()
                        {
                            Chave = certificado.getIdCertificado(),
                            Nome  = certificado.getAssuntoCN()
                        });
                        certificado.finalize();
                    }
                }
                repositorio.finalize();

                return(ListaRetorno);
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex.Message);
                throw;
            }
        }
示例#30
0
        public void ClearAllImages()
        {
            try
            {
                for (var row = 0; row <= Rows - 1; row++)
                {
                    var col = 0;
                    ClearImage(col, row);
                    for (col = 0; col <= Columns - 1; col++)
                    {
                        ClearImage(col, row);
                    }
                }

                if (AfterClearAllImages != null)
                {
                    AfterClearAllImages(this);
                }
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex);
            }
        }