using iTextSharp.text;
using iTextSharp.text.pdf;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SQLite;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CKUERA
{
public partial class DrAutos : Form
{
public DrAutos()
{
InitializeComponent();
}
private void DrAutos_Load(object sender, EventArgs e)
{
//Principal principal = new Principal();
//this.Left = principal.Barra_izq.Width + 5;
//this.Width = 1000;
textEstado.SelectedIndex = 0;
this.BackColor = Global.ColorSistema;
panel5.Top = 0;
panel5.Left = 0;
panel5.Height= this.Height;
panel5.Width = this.Width;
Licencia();
}
private void Licencia()
{
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_reg_lic.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼", ""));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length); // utf8_encode
stream.Close();
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Split('▲');
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
89)//SI EL REGISTRO TIENE 90 DÍGITOS...
{
string LicNum = Global.DrAutosLic.Replace("xTz", "1");
LicNum = LicNum.Replace("QkU", "2");
LicNum = LicNum.Replace("oPi", "3");
LicNum = LicNum.Replace("YwB", "4");
LicNum = LicNum.Replace("lnI", "5");
LicNum = LicNum.Replace("CfL", "6");
LicNum = LicNum.Replace("VaZ", "7");
LicNum = LicNum.Replace("RgM", "8");
LicNum = LicNum.Replace("HsD", "9");
LicNum = LicNum.Replace("JuE", "0");
Global.DrAutosLic = LicNum;
}
else
{
MessageBox.Show("Licencia inválida para el uso del sistema.\nConsulte con su proveedor.", "UFF, ¡QUÉ PENA!", MessageBoxButtons.OK, MessageBoxIcon.Error);
panel5.Visible = true;
Titulo_Lic.Text = "Dr. Autos - SERIE: " + Global.SerieServ;
return;
}
if (Global.DrAutosLic.Length > 29)//SI EL REGISTRO TIENE 30 DÍGITOS...
{
int fechalim = 0;
int Modulo = int.Parse(Global.DrAutosLic.Substring(0, 4));
if (Modulo!=101)//SI EL MÓDULO NO ES
{
MessageBox.Show("La licencia del modulo no corresponde.\nConsulte con su proveedor.", "UFF, ¡QUÉ PENA!", MessageBoxButtons.OK, MessageBoxIcon.Error);
panel5.Visible = true;
Titulo_Lic.Text = "Dr. Autos - SERIE: " + Global.SerieServ;
return;
}
if (Global.DrAutosLic.Substring(4, 15) != Global.SerieServ)//SI LOS 15 DÍGITOS NO SON IGUALES A LA SERIE DEL SERVIDOR...
{
MessageBox.Show("Licencia vencida o no es correcta.\nConsulte con su proveedor.", "UFF, ¡QUÉ PENA!", MessageBoxButtons.OK, MessageBoxIcon.Error);
panel5.Visible = true;
Titulo_Lic.Text = "Dr. Autos - SERIE: " + Global.SerieServ;
return;
}
else//SI EL REGISTRO CORRECPONDE A LA SERIE DE LA PC...
{
//CONSULTA LA VALIDÉZ DE LA FECHA**
fechalim = int.Parse(Global.DrAutosLic.Substring(22, 8));
//SI EL REGISTRO.FECHA ES IGUAL A LA SERIE.FECHA (20210321)...
if (Global.fechahoy > fechalim)
{
MessageBox.Show("Licencia vencida.\nConsulte con su proveedor.", "UFF, ¡QUÉ PENA!", MessageBoxButtons.OK, MessageBoxIcon.Error);
panel5.Visible = true;
Titulo_Lic.Text = "Dr. Autos - SERIE: " + Global.SerieServ;
return;
}
}
panel5.Visible = false;
string fechaL = Global.DrAutosLic.Substring(22, 8);
label23.Text = "Dr. Autos - v.01.22.06.08 - Licencia de uso hasta el " + fechaL.Substring(6, 2) + "-" + fechaL.Substring(4, 2) + "-" + fechaL.Substring(0,4);
}
else
{
MessageBox.Show("Licencia inválida para el uso del sistema.\nConsulte con su proveedor.", "UFF, ¡QUÉ PENA!", MessageBoxButtons.OK, MessageBoxIcon.Error);
panel5.Visible = true;
Titulo_Lic.Text = "Dr. Autos - SERIE: " + Global.SerieServ;
return;
}
}
private void DrAutos_Resize(object sender, EventArgs e)
{
//if (WindowState == (FormWindowState)1)
//{
// WindowState = (FormWindowState)0;
//}
//Principal principal = new Principal();
//this.Top = principal.Top + 32;
//this.Left = principal.Barra_izq.Width + 1;
textOtros.Left = lab_OTROS.Left + 1;
textOtros.Top = lab_OTROS.Top + 1;
textOtros.Height = lab_OTROS.Height -2;
textOtros.Width = lab_OTROS.Width -2;
panel6.Left = this.Width / 2 - panel6.Width / 2;
panel6.Top = this.Height / 2 - panel6.Height / 2;
Btn_Cerrar.Top = 0;
Btn_Cerrar.Left = panel6.Width - Btn_Cerrar.Width;
label23.Top = Btn_Cerrar.Top;
button1.Left = 3000;
}
private void Text_OTROS_Enter(object sender, EventArgs e)
{
lab_OTROS.BackColor = Color.RoyalBlue;
}
private void Text_OTROS_Leave(object sender, EventArgs e)
{
lab_OTROS.BackColor = Color.Black;
}
private void label22_MouseMove(object sender, MouseEventArgs e)
{
label22.ForeColor = Color.Red;
}
private void label22_MouseLeave(object sender, EventArgs e)
{
label22.ForeColor = Color.Black;
}
private void label14_MouseMove(object sender, MouseEventArgs e)
{
btnServicios.ForeColor = Color.Red;
}
private void label14_MouseLeave(object sender, EventArgs e)
{
btnServicios.ForeColor = Color.White;
}
private void label1_MouseMove(object sender, MouseEventArgs e)
{
btnRegistrar.ForeColor = Color.Red;
}
private void label1_MouseLeave(object sender, EventArgs e)
{
btnRegistrar.ForeColor = Color.White;
}
private void btnServicios_MouseMove(object sender, MouseEventArgs e)
{
btnServicios.ForeColor= Color.Red;
}
private void btnServicios_MouseLeave(object sender, EventArgs e)
{
btnServicios.ForeColor = Color.White;
}
private void btnRegistrar_Click(object sender, EventArgs e)
{
}
private void btnServicios_Click(object sender, EventArgs e)
{
}
private void btnAgregar_Click(object sender, EventArgs e)
{
if (textChapa.Text == "")
{
textChapa.Select();//ENFOCAR EL CURSOR
labelAyuda.Text = "Escriba las letras y números de la chapa del vehículo y presione ENTER.";
return;
}
textChapa.Text = textChapa.Text.ToUpper();
this.Cursor = Cursors.WaitCursor;//VALIDA EXISTENCIA DE UN VEHÍCULO
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_existe.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼", textChapa.Text.Trim()));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Trim().Split('▲');
this.Cursor = Cursors.Default;
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
1)
{
MessageBox.Show("Ya existe un vehículo con esta chapa.", "¡ATENCIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//textChapa.Text = "";
textChapa.Select();
return;
}
btnLimpiar.Enabled = true;
if (textMarca.Text == "")
{
textMarca.Select();
labelAyuda.Text = "Escriba la marca del vehículo y presione ENTER.";
return;
}
textMarca.Text = textMarca.Text.ToUpper();
if (textModelo.Text == "")
{
textModelo.Select();
labelAyuda.Text = "Escriba el modelo del vehículo y presione ENTER.";
return;
}
textModelo.Text = textModelo.Text.ToUpper();
if (textAno.Text == "")
{
textAno.Select();
labelAyuda.Text = "Escriba el año de fabricación del vehículo y presione ENTER.";
return;
}
textAno.Text = textAno.Text.ToUpper();
if (textTipo.Text == "")
{
textTipo.Select();
labelAyuda.Text = "Escriba el tipo del vehículo y presione ENTER.";
return;
}
textTipo.Text = textTipo.Text.ToUpper();
if (textColor.Text == "")
{
textColor.Select();
labelAyuda.Text = "Escriba el color del vehículo y presione ENTER.";
return;
}
textColor.Text = textColor.Text.ToUpper();
if (textCombustible.Text == "")
{
textCombustible.Select();
labelAyuda.Text = "Escriba el combustible del vehículo y presione ENTER.";
return;
}
textCombustible.Text = textCombustible.Text.ToUpper();
if (textMotor.Text == "")
{
textMotor.Select();
labelAyuda.Text = "Escriba la cilindrada del motor del vehículo (Ej.: 2000) y presione ENTER.";
return;
}
textMotor.Text = textMotor.Text.ToUpper();
if (textTitular.Text == "")
{
textTitular.Select();
labelAyuda.Text = "Escriba el nombre del titular del vehículo y presione ENTER.";
return;
}
textTitular.Text = textTitular.Text.ToUpper();
if (textOtros.Text == "")
{
textOtros.Text = " ";
textOtros.Select();
labelAyuda.Text = "Escriba alguna observación u otros datos adicional del vehículo o presione espacio y ENTER.";
return;
}
textOtros.Text = textOtros.Text.ToUpper();
labelAyuda.Text = "";
this.Cursor = Cursors.WaitCursor;//REGISTRA VEHÍCULO
HttpWebRequest rq2 = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_insertar_veh.php");
rq2.Method = "POST";
byte[] byteArray2 = Encoding.UTF8.GetBytes(string.Format("nu={0}▼{1}▼{2}▼{3}▼{4}▼{5}▼{6}▼{7}▼{8}▼{9}▼{10}▼{11}", textChapa.Text.Trim(), textMarca.Text.Trim(),
textModelo.Text.Trim(), textAno.Text.Trim(), textTipo.Text.Trim(), textColor.Text.Trim(), textCombustible.Text.Trim(),
textMotor.Text.Trim(), textTitular.Text.Trim(), textOtros.Text.Trim(), DateTime.Now.ToString("yyyy-MM-dd"), Global.USUARIO_SIST));
rq2.ContentType = "application/x-www-form-urlencoded";
rq2.ContentLength = byteArray2.Length;
Stream stream2 = rq2.GetRequestStream();
stream2.Write(byteArray2, 0, byteArray2.Length);
stream2.Close();
//
WebResponse response2 = rq2.GetResponse();
stream2 = response2.GetResponseStream();
StreamReader reader2 = new StreamReader(stream2);
string devuelve2 = reader2.ReadToEnd();
reader2.Close();
stream2.Close();
response2.Close();
string[] c2 = devuelve2.Split('▲');
this.Cursor = Cursors.Default;
string resultado2 = devuelve2.ToUpper();
bool re2;
re2 = resultado2.Contains("ERROR");
if (re2 == true)
{
MessageBox.Show(devuelve2);
return;
}
MessageBox.Show(devuelve2);
Limpiar();
}
private void btnModificar_Click(object sender, EventArgs e)
{
this.AcceptButton = btnModificar;
if (textChapa.Text == "")
{
textChapa.Select();//ENFOCAR EL CURSOR
labelAyuda.Text = "Escriba las letras y números de la chapa del vehículo y presione ENTER.";
return;
}
textChapa.Text = textChapa.Text.ToUpper();
btnLimpiar.Enabled = true;
if (textMarca.Text == "")
{
textMarca.Select();
labelAyuda.Text = "Escriba la marca del vehículo y presione ENTER.";
return;
}
textMarca.Text = textMarca.Text.ToUpper();
if (textModelo.Text == "")
{
textModelo.Select();
labelAyuda.Text = "Escriba el modelo del vehículo y presione ENTER.";
return;
}
textModelo.Text = textModelo.Text.ToUpper();
if (textAno.Text == "")
{
textAno.Select();
labelAyuda.Text = "Escriba el año de fabricación del vehículo y presione ENTER.";
return;
}
textAno.Text = textAno.Text.ToUpper();
if (textTipo.Text == "")
{
textTipo.Select();
labelAyuda.Text = "Escriba el tipo del vehículo y presione ENTER.";
return;
}
textTipo.Text = textTipo.Text.ToUpper();
if (textColor.Text == "")
{
textColor.Select();
labelAyuda.Text = "Escriba el color del vehículo y presione ENTER.";
return;
}
textColor.Text = textColor.Text.ToUpper();
if (textCombustible.Text == "")
{
textCombustible.Select();
labelAyuda.Text = "Escriba el combustible del vehículo y presione ENTER.";
return;
}
textCombustible.Text = textCombustible.Text.ToUpper();
if (textMotor.Text == "")
{
textMotor.Select();
labelAyuda.Text = "Escriba la cilindrada del motor del vehículo (Ej.: 2000) y presione ENTER.";
return;
}
textMotor.Text = textMotor.Text.ToUpper();
if (textTitular.Text == "")
{
textTitular.Select();
labelAyuda.Text = "Escriba el nombre del titular del vehículo y presione ENTER.";
return;
}
textTitular.Text = textTitular.Text.ToUpper();
//if (textOtros.Text == "")
//{
// textOtros.Text = " ";
// textOtros.Select();
// labelAyuda.Text = "Escriba alguna observación u otros datos adicional del vehículo o presione espacio y ENTER.";
// return;
//}
textOtros.Text = textOtros.Text.ToUpper();
labelAyuda.Text = "";
this.Cursor = Cursors.WaitCursor;
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_modificar_veh.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼{1}▼{2}▼{3}▼{4}▼{5}▼{6}▼{7}▼{8}▼{9}▼{10}▼{11}", textChapa.Text.Trim(), textMarca.Text.Trim(),
textModelo.Text.Trim(), textAno.Text.Trim(), textTipo.Text.Trim(), textColor.Text.Trim(), textCombustible.Text.Trim(),
textMotor.Text.Trim(), textTitular.Text.Trim(), textOtros.Text.Trim(), DateTime.Now.ToString("yyyy-MM-dd"), Global.USUARIO_SIST));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Trim().Split('▲');
this.Cursor = Cursors.Default;
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
0) { btnBuscar.Enabled=true; btnLimpiar.Enabled = true; } else { btnBuscar.Enabled=false; }
}
private void btnBuscar_Click(object sender, EventArgs e)
{
textChapa.Text = textChapa.Text.ToUpper();
this.Cursor = Cursors.WaitCursor;//VALIDA EXISTENCIA DE UN VEHÍCULO
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_buscar.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼", textChapa.Text.Trim()));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Trim().Split('▲');
this.Cursor = Cursors.Default;
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
0) { textServicio.Select(); }
}
}
private void textChapa_Leave(object sender, EventArgs e)
{
textChapa.Text = textChapa.Text.ToUpper();
}
private void textMarca_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textMarca.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textMarca.Text = ""; return; }
}
private void textModelo_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textModelo.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textModelo.Text = ""; return; }
}
private void textAno_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textAno.Text, "[^0-9`]")) { textAno.Text = ""; return; }
}
private void textTipo_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textTipo.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textTipo.Text = ""; return; }
}
private void textColor_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textColor.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textColor.Text = ""; return; }
}
private void textCombustible_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textCombustible.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textCombustible.Text = ""; return; }
}
private void textMotor_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textMotor.Text, "[^0-9`]")) { textMotor.Text = ""; return; }
}
private void textTitular_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textTitular.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textTitular.Text = ""; return; }
}
private void textOtros_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textOtros.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textOtros.Text = ""; return; }
}
private void textOtros_Enter(object sender, EventArgs e)
{
lab_OTROS.BackColor = Color.DodgerBlue;
}
private void textOtros_Leave(object sender, EventArgs e)
{
lab_OTROS.BackColor = Color.Black;
}
private void textKilometraje_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textKilometraje.Text, "[^0-9`]")) { textKilometraje.Text = ""; return; }
}
private void textMecanico_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textMecanico.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textMecanico.Text = ""; return; }
}
private void textDiagnostico_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textDiagnostico.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textDiagnostico.Text = ""; return; }
}
private void textServicio_TextChanged(object sender, EventArgs e)
{
//CARACTERES PERMITIDOS
if (System.Text.RegularExpressions.Regex.IsMatch(textServicio.Text, "[^a-zA-Z0-9-/_() .áéíóúÁÉÍÓÚ`]")) { textServicio.Text = ""; return; }
if (textServicio.Text.Length > 0)
{
panel3.Top = textServicio.Height+ textServicio.Top + 3;
panel3.Height = 236;
panel3.Width = 496;
panel3.Left = 3;
panel3.Visible = true;
label1.Top = -2;
label1.Left = 3;
label1.Width = 487;
label1.Height = 23;
dataProd.Width = 478;
dataProd.Height = 205;
dataProd.Top = 20;
dataProd.Left = 9;
}
else
{
textCant.Text = "";
}
ConsultarPrecios();
}
public void ConsultarPrecios()
{
dataProd.Rows.Clear();
string filtro = textServicio.Text; //cons_temp_usu.php
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/consultar_precios.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼{1}▼{2}", filtro, Global.num_esta, Global.ConSuc));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
") { labelAyuda2.Text = "Seleccione un estado para este servicio y presione ENTER."; textEstado.Select(); return; }
if (textKilometraje.Text == "") { labelAyuda2.Text = "Escriba el kilometraje actual del vehículo y presione ENTER."; textKilometraje.Select(); return; }
if (textMecanico.Text == "") { labelAyuda2.Text = "Escriba el mecánico asignado para este vehículo y presione ENTER."; textMecanico.Select(); return; }
textMecanico.Text = textMecanico.Text.ToUpper();
if (textDiagnostico.Text == "") { labelAyuda2.Text = "Escriba el diagnóstico de este vehículo y presione ENTER."; textDiagnostico.Select(); return; }
textDiagnostico.Text = textDiagnostico.Text.ToUpper();
if (textServicio.Text == "") { labelAyuda2.Text = "Escriba un producto o servicio y precione ENTER o seleccione uno del registro."; textServicio.Select(); return; } else { panel3.Visible = false; }
if(textServicio.Text.Length<7)
{
string v = textServicio.Text;
textServicio.Text = "000000" + v;
textServicio.Text = textServicio.Text.Substring(textServicio.Text.Length - 7, 7);
}
textServicio.Text = textServicio.Text.ToUpper();
if (textCant.Text == "") { labelAyuda2.Text = "Escriba la cantidad del producto o servicio y presione ENTER."; textCant.Text = "1"; textCant.Select(); return; }
labelAyuda2.Text = "";
dataProd_Click(null, null);
}
private void textKilometraje_Enter(object sender, EventArgs e)
{
if (textKilometraje.Text=="")
{
labelAyuda2.Text = "Escriba el kilometraje actual del vehículo.";
}
}
private void labelCerrar_Click(object sender, EventArgs e)
{
panel3.Visible = false;
}
private void dataProd_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void dataProd_Click(object sender, EventArgs e)
{
if (dataProd.CurrentRow != null)
{
textServicio.Text = dataProd.CurrentRow.Cells[1].Value.ToString();
if (textCant.TextLength < 1)
{
labelAyuda2.Text = "Escriba la cantidad que desea agregar.";
textCant.Text = "1";
textCant.Select();
return;
}
string NumSer = DateTime.Now.ToString("yyMMdd-HHmmssf");
string Chapa = textChapa.Text;
string Marca = textMarca.Text;
string Modelo = textModelo.Text;
string Anio = textAno.Text;
string Tipo = textTipo.Text;
string Color = textColor.Text;
string Combus = textCombustible.Text;
string Motor = textMotor.Text;
string Titular = textTitular.Text;
string Otros = textOtros.Text;
string Kilom = textKilometraje.Text;
string Diag = textDiagnostico.Text;
string Mecan = textMecanico.Text;
string Fecha = textFecha.Text;
string Usuario = Global.USUARIO_SIST;
string Estado = textEstado.Text;
string Codigo = dataProd.CurrentRow.Cells[1].Value.ToString();
string Cant = textCant.Text;
string Prod = dataProd.CurrentRow.Cells[2].Value.ToString();
string Secc = dataProd.CurrentRow.Cells[5].Value.ToString();
string SubSecc = dataProd.CurrentRow.Cells[6].Value.ToString();
string Provee = dataProd.CurrentRow.Cells[7].Value.ToString();
string Compra = dataProd.CurrentRow.Cells[8].Value.ToString();
string Iva = dataProd.CurrentRow.Cells[9].Value.ToString();
double Venta = double.Parse(dataProd.CurrentRow.Cells[3].Value.ToString());
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_insertar_ser.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼{1}▼{2}▼{3}▼{4}▼{5}▼{6}▼{7}▼{8}▼{9}▼{10}▼{11}▼{12}▼{13}▼{14}▼{15}▼{16}▼{17}▼{18}▼{19}▼{20}▼{21}▼{22}▼{23}▼{24}▼{25}▼",
NumSer, Chapa, Marca, Modelo, Anio, Tipo, Color, Combus, Motor, Titular, Otros, Kilom, Diag, Mecan, Fecha, Usuario, Estado,
Codigo, Cant, Prod, Secc, SubSecc, Provee, Compra, Iva, Venta));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
100)
{
MessageBox.Show(devuelve);
return;
}
MostrarServicios();
ID_LABEL.Text = "";
}
private void dataLista_CellClick(object sender, DataGridViewCellEventArgs e)
{
ID_LABEL.Text = dataLista.CurrentRow.Cells[0].Value.ToString();
}
private void btnCancelar_Click(object sender, EventArgs e)
{
CancelarServ();
}
private void CancelarServ()
{
labelID.Text = "";
textEstado.SelectedIndex = 0;
textKilometraje.Text = "";
textFecha.Text = "";
textMecanico.Text = "";
textDiagnostico.Text = "";
textServicio.Text = "";
textCant.Text = "";
panel1.Enabled = false;
btnHistorial.Enabled = false;
ID_LABEL.Text = "";
panel1.Enabled=false;
string Usuario = Global.USUARIO_SIST;
this.Cursor = Cursors.WaitCursor;
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/cancelar_serv.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼{1}▼", Usuario, textChapa.Text));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Split('▲');
this.Cursor = Cursors.Default;
if (c[0].Length > 100)
{
MessageBox.Show(devuelve);
return;
}
MostrarServicios();
}
private void btnEliminar_Click(object sender, EventArgs e)
{
if (textChapa.Text == "") { textChapa.Select(); return; }
textChapa.Text = textChapa.Text.ToUpper();
this.Cursor = Cursors.WaitCursor;//VALIDA EXISTENCIA DE UN VEHÍCULO
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_eliminar.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼", textChapa.Text.Trim()));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Trim().Split('▲');
this.Cursor = Cursors.Default;
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
0)
{
this.Cursor = Cursors.WaitCursor;//VALIDA EXISTENCIA DE UN VEHÍCULO
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_facturar.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼{1}▼", textChapa.Text.Trim(), Global.USUARIO_SIST));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
//
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Trim().Split('▲');
this.Cursor = Cursors.Default;
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("
20220620)
//{
// MessageBox.Show("Demo vencido");
// this.Close();
//}
}
private void btnRegVeh_Click(object sender, EventArgs e)
{
panel2.Enabled = true;
btnAgregar.Enabled = true;
btnEliminar.Enabled = false;
btnModificar.Enabled = false;
btnBuscar.Enabled = false;
btnHistorial.Enabled = false;
btnLimpiar.Enabled = false;
this.AcceptButton = btnAgregar;
textChapa.Select();
}
private void btnRegServ_Click(object sender, EventArgs e)
{
panel2.Enabled = true;
this.AcceptButton = btnBuscar;
textChapa.Select();
btnAgregar.Enabled = false;
btnEliminar.Enabled = false;
btnModificar.Enabled = false;
btnBuscar.Enabled = true;
}
private void textEstado_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void CerrarRegLic_Click(object sender, EventArgs e)
{
Lic.Text = "";
this.Close();
}
private void button3_Click(object sender, EventArgs e)
{
//DEVOLVIENDO EN NÚMEROS LAS LETRAS REGISTRADAS
//string Encrip1 = Lic.Text.Trim().Replace("XT", "1");
//string Encrip2 = Encrip1.Replace("Q!K", "2");
//string Encrip3 = Encrip2.Replace("OP#", "3");
//string Encrip4 = Encrip3.Replace("Y$W", "4");
//string Encrip5 = Encrip4.Replace("NI%", "5");
//string Encrip6 = Encrip5.Replace("C&F", "6");
//string Encrip7 = Encrip6.Replace("AZ/", "7");
//string Encrip8 = Encrip7.Replace("R(G", "8");
//string Encrip9 = Encrip8.Replace("SD)", "9");
//string Encrip10 = Encrip9.Replace("U=E", "0");
string LicNum = Lic.Text.Trim();
if (LicNum.Length > 89)
{
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/drautos_reg_lic.php");
rq.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼", LicNum));
rq.ContentType = "application/x-www-form-urlencoded";
rq.ContentLength = byteArray.Length;
Stream stream = rq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length); // utf8_encode
stream.Close();
WebResponse response = rq.GetResponse();
stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string devuelve = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
string[] c = devuelve.Split('▲');
string resultado = devuelve.ToUpper();
bool re;
re = resultado.Contains("