Exemple #1
0
        void AlComenzarComando(Comando c, string info, SyncroStep step)
        {
            string msg   = string.Empty;
            int    len   = 0;
            int    start = 0;

            strBuffer = string.Empty;
            dlg       = null;
            if (this.splitContainer1.Panel2.Controls.Count > 0)
            {
                this.splitContainer1.Panel2.Controls.RemoveAt(0);
            }
            this.tsslMsg.Text = strStatusBuffer = c.Descripcion;
            switch (step)
            {
            case SyncroStep.NotSyncro:
                msg = string.Format("        [{1}] COMANDO: {0} {2}", c.Descripcion, DateTime.Now.ToString(), info);
                break;

            case SyncroStep.ExceptionsCfg:
                msg = string.Format("        [{1}] COMANDO: {0} {2}", c.Descripcion, DateTime.Now.ToString(), info);
                break;

            case SyncroStep.Simulation:
                len   = this.txProgreso.Lines[this.txProgreso.Lines.GetUpperBound(0) - 1].Length;
                start = sb.ToString().Length - len;
                sb.Remove(start, len);
                msg = string.Format("        [{1}] COMANDO: {0} {2}", c.Descripcion, DateTime.Now.ToString(), info);
                break;

            case SyncroStep.Transaction:
                len   = this.txProgreso.Lines[this.txProgreso.Lines.GetUpperBound(0) - 1].Length;
                start = sb.ToString().Length - len;
                sb.Remove(start, len);
                msg = string.Format("        [{1}] COMANDO: {0} {2}", c.Descripcion, DateTime.Now.ToString(), info);
                break;
            }
            sb.AppendLine(msg);
            this.txProgreso.Text = sb.ToString();
        }
Exemple #2
0
        private bool Exec(CmdSincronizar c, SyncroStep step)
        {
            bool      r = false;
            DataTable dt;
            string    msg = string.Empty;

            switch (step)
            {
            case SyncroStep.ExceptionsCfg:
                this.ComandoComienza(c, " >>> FASE DE CONFIGURACIÓN DE EXCEPCIONES", step);
                if (c.Direccion != TipoComprobacion.ModificacionesPendientesEnSIGUA)
                {
                    this.ComandoSolicitaExcepcionesSincro(c);
                }
                break;

            case SyncroStep.Simulation:
                this.ComandoComienza(c, " >>> FASE DE SIMULACIÓN", step);
                dt = c.Simular();
                if (dt.TableName == "Excepcion")
                {
                    this.ComandoInforma((string)dt.Rows[0]["Mensaje"]);
                    r = true;
                }
                else
                {
                    if (dt.Rows.Count > 0)
                    {
                        this.ComandoObtieneDatosCriticos(dt);
                        this.ComandoInforma("¡ATENCIÓN: SE DETECTARON INCIDENCIAS DURANTE LA FASE DE SIMULACIÓN!");
                        r = true;
                    }
                    else
                    {
                        this.ComandoInforma("NO SE DETECTARON INCIDENCIAS DURANTE LA FASE DE SIMULACIÓN");
                    }
                }
                break;

            case SyncroStep.Transaction:
                this.ComandoComienza(c, " >>> FASE DE TRANSACCIÓN", step);
                dt = c.ObtenerDatos();
                if (dt.TableName == "Excepcion")
                {
                    this.ComandoInforma((string)dt.Rows[0]["Mensaje"]);
                    r = true;
                }
                else
                {
                    if (this.ComandoSolicitaSincro(c))
                    {
                        DataTable dt1 = c.Sincronizar();
                        msg = (string)dt1.Rows[0]["Mensaje"];
                        this.ComandoInforma(msg);
                        r = true;
                    }
                    else
                    {
                        this.ComandoInforma("TRANSACCIÓN CANCELADA");
                        r = true;
                    }
                }
                break;
            }
            return(r);
        }