public bool Recuperar_Dotacion_DB() { try { var db = new DataBase(); var cryp = new CCryptorEngine(); var sConexion = db.GenerarConexionString(DataBase.getDefaultPathDB()); var dt = db.ExecQuery(QueryListAll, sConexion); if (dt.Rows.Count > 0) { this.personas = new List <Persona>(); foreach (DataRow row in dt.Rows) { var per = new Persona(); try { per.id = Convert.ToInt32(cryp.Desencriptar(row["Id"].ToString())); per.ape = cryp.Desencriptar(row["Ape"].ToString()); per.nom = cryp.Desencriptar(row["Nom"].ToString()); per.tar = cryp.Desencriptar(row["Tar"].ToString()); per.doc = Convert.ToInt32(cryp.Desencriptar(row["Doc"].ToString())); this.personas.Add(per); } catch { continue; } } return(true); } throw new Exception(); } catch { return(false); } }
private void button1_Click(object sender, EventArgs e) { if (txtOriginal.Text.CompareTo(string.Empty) == 0) { return; } CCryptorEngine c = new CCryptorEngine(); txtMD5.Text = c.EncodeMD5(txtOriginal.Text); txtEncriptado.Text = c.Encriptar(txtOriginal.Text); txtDesencriptado.Text = c.Desencriptar(txtEncriptado.Text); }
public bool Cargar_Registros_Del_Lote() { var db = new DataBase(); var cryp = new CCryptorEngine(); var sConexion = db.GenerarConexionString(DataBase.getDefaultPathDB()); var query = QueryRegLote; query = query.Replace("@lot", cryp.Encriptar(this.id)); var dt = db.ExecQuery(query, sConexion); this.registros = new List <RegistroControlAcceso>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { var rca = new RegistroControlAcceso(); try { rca.id = Convert.ToInt32(row["Id"]); rca.per_id = Convert.ToInt32(cryp.Desencriptar(row["pid"].ToString())); rca.fecha = DateTime.ParseExact(cryp.Desencriptar(row["fec"].ToString()), "yyyyMMdd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); rca.es_ingreso = (Convert.ToInt32(row["ing"]) != 0? true : false); rca.usu = cryp.Desencriptar(row["usr"].ToString()); rca.edif = Convert.ToInt32(cryp.Desencriptar(row["edi"].ToString())); try { rca.reg_x_doc = (cryp.Desencriptar(row["rdc"].ToString()) == true.ToString() ? true : false); } catch { rca.reg_x_doc = false; } this.registros.Add(rca); } catch { continue; } } return(true); } return(false); }
public bool Recuperar_Dotacion_JS() { try { var cryp = new CCryptorEngine(); var path_file = DataBase.getDefaultPathDotacionJsCryp(); var dot_js = cryp.Desencriptar(System.IO.File.ReadAllText(path_file)); this.personas = JsonConvert.DeserializeObject <List <Persona> >(dot_js); return(true); } catch (Exception ex) { this._error_desc = ex.Message; return(false); } }
// private static string QuerySelect = "SELECT TOP 1 * FROM Dot WHERE Doc = @Doc OR Tar = '@Tar';"; // private static string QueryListAll = "SELECT * FROM Dot;"; public bool Fecha_Actual_Es_Mayor_Ult_Fecha_Grabacion(ref DateTime ult_fecha_grabada) { try { var db = new DataBase(); var cryp = new CCryptorEngine(); var sConexion = db.GenerarConexionString(DataBase.getDefaultPathDB()); var dt = db.ExecQuery(QueryUltFecha, sConexion); if (dt.Rows.Count < 1) { return(true); // No hay registros ingresados } ult_fecha_grabada = DateTime.ParseExact(cryp.Desencriptar((string)dt.Rows[0]["fec"]), "yyyyMMdd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); return(ult_fecha_grabada.CompareTo(DateTime.Now) < 0); } catch { return(false); } }
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); } }