示例#1
0
        private void Cargar_Registros_Lote()
        {
            var lote = new LoteControlAcceso(Lote_Id);

            if (lote.Cargar_Registros_Del_Lote())
            {
                dgvLote.DataSource = lote.Get_Registos_DataTable(this.Dot, this.Edif);
            }
        }
示例#2
0
        public LoteResponse Informar_Lote(LoteControlAcceso lote)
        {
            var json = JsonConvert.SerializeObject(lote);
            var sr   = this.Call(eMethod.mInformarLote, json);

            if (sr._Status != ServiceResponse.eStatus.eResponseOK)
            {
                throw new ServiceLayerException(sr._StatusDesc);
            }
            return(JsonConvert.DeserializeObject <LoteResponse>(sr._Json));
        }
示例#3
0
        private List <LoteControlAcceso> Cargar_Lotes_No_Informados()
        {
            var lst_lotes = new List <LoteControlAcceso>();

            foreach (DataGridViewRow row in dgvLotes.Rows)
            {
                if (!row.Cells[0].Value.ToString().Contains("<"))
                {
                    try
                    {
                        var lote = new LoteControlAcceso();
                        lote.id = row.Cells[0].Value.ToString();
                        if (lote.Cargar_Registros_Del_Lote())
                        {
                            lst_lotes.Add(lote);
                            txtBitcora.Text += "Se cargaron los registros del lote " + lote.id + "." + System.Environment.NewLine;
                        }
                        else
                        {
                            txtBitcora.Text += "No fue posible cargar los registros del lote " + lote.id + " (Error 1)." + System.Environment.NewLine;
                        }
                    }
                    catch
                    {
                        txtBitcora.Text += "No fue posible cargar los registros del lote " + row.Cells[0].Value.ToString() + " (Error 2)." + System.Environment.NewLine;
                    }
                    this.Refresh();
                }
                else
                {
                    do
                    {
                        var nuevo_lote = Crear_Nuevo_Lote();
                        if (nuevo_lote != null)
                        {
                            lst_lotes.Add(nuevo_lote);
                            txtBitcora.Text += "El nuevo lote generado es el " + nuevo_lote.id + System.Environment.NewLine;
                        }
                        else
                        {
                            txtBitcora.Text += "No fue posible crear un nuevo lote (Error 4)." + System.Environment.NewLine;
                        }
                        this.Refresh();
                    } while (LoteControlAcceso.Cantidad_De_Reg_Para_Informar() > 0);
                }
            }
            return(lst_lotes);
        }
示例#4
0
        private void Procesar_Respuesta_Lote(LoteControlAcceso lote, LoteResponse lote_resp)
        {
            txtBitcora.Text += "Resultado lote " + lote.id + ": ";

            if (lote_resp.resultado.ToUpper() == "OK")
            {
                txtBitcora.Text += "Todos los registros del lote fueron informados correctamente." + System.Environment.NewLine;
            }
            else
            {
                txtBitcora.Text += "Se produjo un error en el procesamiento remoto (" + lote_resp.resultado + ")." + System.Environment.NewLine;
            }

            this.Refresh();
            return;
        }
示例#5
0
        private LoteControlAcceso Crear_Nuevo_Lote()
        {
            LoteControlAcceso lote;

            try
            {
                txtBitcora.Text     = string.Empty;
                btnInformar.Enabled = false;
                lote = new LoteControlAcceso();
                if (!lote.Marcar_Registros_No_Informados())
                {
                    txtBitcora.Text += "No fue posible marcar los registros para generar el lote a informar (Error 3.1)." + System.Environment.NewLine;
                    this.Refresh();
                    return(null);
                }
                txtBitcora.Text += "Se marcaron registros para generar un nuevo lote." + System.Environment.NewLine;
                if (!lote.Cargar_Registros_Del_Lote())
                {
                    if (lote.registros != null)
                    {
                        if (lote.registros.Count == 0)
                        {
                            txtBitcora.Text += "No se encontraron nuevos registros para informar (Error 3.2)." + System.Environment.NewLine;
                        }
                        else
                        {
                            txtBitcora.Text += "No fue posible recuperar la totalidad de los regisros para informar (Error 3.3)." + System.Environment.NewLine;
                        }
                    }
                    else
                    {
                        txtBitcora.Text += "No fue posible cargar nuevos registros a informar (Error 3.4)." + System.Environment.NewLine;
                    }
                    this.Refresh();
                    return(null);
                }
                txtBitcora.Text += "Se cargaron los registros del nuevo lote." + System.Environment.NewLine;
                this.Refresh();
                return(lote);
            }
            catch
            {
                this.Refresh();
                return(null);
            }
        }
示例#6
0
        private bool Marcar_Registros_Informados(LoteControlAcceso lote, LoteResponse lote_resp)
        {
            var error = false;

            foreach (var reg in lote.registros)
            {
                try
                {
                    if (!reg.Marcar_Como_Informado())
                    {
                        throw new Exception();
                    }
                }
                catch
                {
                    error            = true;
                    txtBitcora.Text += "* Error al grabar el registro " + reg.id.ToString() + " del lote " + lote.id + " no pudo ser marcado como informado." + System.Environment.NewLine;
                    this.Refresh();
                }
            }
            return(error);
        }
示例#7
0
        private void Cargar_Grilla_Lotes_Informados()
        {
            var cryp = new CCryptorEngine();
            var lca  = new LoteControlAcceso();
            var dt   = lca.Get_Lotes_Informados();

            foreach (DataRow row in dt.Rows)
            {
                if (row["LOTE"].ToString() == string.Empty)
                {
                    row["LOTE"] = "< Registros sin Lote >";
                }
                else
                {
                    row["LOTE"] = cryp.Desencriptar(row["LOTE"].ToString());
                }
            }
            dgvLotes.DataSource = dt;
            foreach (DataGridViewColumn col in dgvLotes.Columns)
            {
                col.Width = ((dgvLotes.Width - 45) / dgvLotes.Columns.Count);
            }
        }