154 lines
6.8 KiB
C#
154 lines
6.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Security;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using ADSUtileriasWF.Helpers;
|
|
using Microsoft.VisualBasic;
|
|
|
|
namespace ADSUtileriasWF.Data.Externa.PV
|
|
{
|
|
|
|
public class ClsClientes : CLSExternoBase
|
|
{
|
|
#region propiedades
|
|
public int CveCliente { get; set; }
|
|
public string Nombre { get; set; }
|
|
public string NombreComercial { get; set; }
|
|
public string Direccion { get; set; }
|
|
public string NoExt { get; set; }
|
|
public string NoInt { get; set; }
|
|
public string Colonia { get; set; }
|
|
public string Localidad { get; set; }
|
|
public string Ciudad { get; set; }
|
|
public string Estado { get; set; }
|
|
public string Pais { get; set; }
|
|
public string CP { get; set; }
|
|
public string Telefono { get; set; }
|
|
public string Contacto { get; set; }
|
|
public string Mail { get; set; }
|
|
public string Codigo { get; set; }
|
|
public string NombreCorto { get; set; }
|
|
public string RFC { get; set; }
|
|
public double IVA { get; set; }
|
|
public int CveSucursal { get; set; }
|
|
public int CveEmpresa { get; set; }
|
|
#endregion
|
|
|
|
public ClsClientes() { }
|
|
|
|
public bool GetClientes(string RFC)
|
|
{
|
|
bool Retorno = false;
|
|
|
|
try
|
|
{
|
|
datos = proxy.GetCliente(RFC);
|
|
if (datos.Tabla.Rows.Count > 0)
|
|
{
|
|
this.CveCliente = datos.Tabla.Rows[0]["CveCliente"].ToString().ToEntero();
|
|
this.Nombre = datos.Tabla.Rows[0]["Nombre"].ToString();
|
|
this.Codigo = datos.Tabla.Rows[0]["Codigo"].ToString();
|
|
this.NombreCorto = datos.Tabla.Rows[0]["NombreCorto"].ToString();
|
|
this.RFC = datos.Tabla.Rows[0]["RFC"].ToString();
|
|
this.IVA = datos.Tabla.Rows[0]["IVA"].ToString().ToDouble();
|
|
|
|
this.CveSucursal = datos.Tabla.Rows[0]["CveSucursal"].ToString().ToEntero();
|
|
this.CveEmpresa = datos.Tabla.Rows[0]["CveEmpresa"].ToString().ToEntero();
|
|
}
|
|
Retorno = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
OnError("Ocurrió un error al consultar Los Clientes.", "Error", ex, MessageBoxIcon.Error);
|
|
}
|
|
|
|
return Retorno;
|
|
}
|
|
|
|
public bool GetClientes(int CveCliente, string Nombre, string Codigo, string NombreCorto, string RFC, string Telefono, string Mail, int CveSucursal, int CveEmpresa)
|
|
{
|
|
bool Retorno = false;
|
|
|
|
try
|
|
{
|
|
datos = proxy.GetClientes(CveCliente, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, CveSucursal, CveEmpresa);
|
|
if (datos.Tabla.Rows.Count > 0)
|
|
{
|
|
this.CveCliente = datos.Tabla.Rows[0]["CveCliente"].ToString().ToEntero();
|
|
this.Nombre = datos.Tabla.Rows[0]["Nombre"].ToString();
|
|
this.Codigo = datos.Tabla.Rows[0]["Codigo"].ToString();
|
|
this.NombreCorto = datos.Tabla.Rows[0]["NombreCorto"].ToString();
|
|
this.RFC = datos.Tabla.Rows[0]["RFC"].ToString();
|
|
|
|
this.NombreComercial = !IsDBNull(datos.Tabla.Rows[0]["NombreComercial"]) ? datos.Tabla.Rows[0]["NombreComercial"].ToString() : "";
|
|
this.Direccion = !IsDBNull(datos.Tabla.Rows[0]["Direccion"]) ? datos.Tabla.Rows[0]["Direccion"].ToString() : "";
|
|
this.NoExt = !IsDBNull(datos.Tabla.Rows[0]["NoExt"]) ? datos.Tabla.Rows[0]["NoExt"].ToString() : "";
|
|
this.NoInt = !IsDBNull(datos.Tabla.Rows[0]["NoInt"]) ? datos.Tabla.Rows[0]["NoInt"].ToString() : "";
|
|
this.Colonia = !IsDBNull(datos.Tabla.Rows[0]["Colonia"]) ? datos.Tabla.Rows[0]["Colonia"].ToString() : "";
|
|
this.Localidad = !IsDBNull(datos.Tabla.Rows[0]["Localidad"]) ? datos.Tabla.Rows[0]["Localidad"].ToString() : "";
|
|
this.Ciudad = !IsDBNull(datos.Tabla.Rows[0]["Ciudad"]) ? datos.Tabla.Rows[0]["Ciudad"].ToString() : "";
|
|
this.Estado = !IsDBNull(datos.Tabla.Rows[0]["Estado"]) ? datos.Tabla.Rows[0]["Estado"].ToString() : "";
|
|
this.Pais = !IsDBNull(datos.Tabla.Rows[0]["Pais"]) ? datos.Tabla.Rows[0]["Pais"].ToString() : "";
|
|
this.CP = !IsDBNull(datos.Tabla.Rows[0]["CP"]) ? datos.Tabla.Rows[0]["CP"].ToString() : "";
|
|
this.Telefono = !IsDBNull(datos.Tabla.Rows[0]["Telefono"]) ? datos.Tabla.Rows[0]["Telefono"].ToString() : "";
|
|
this.Contacto = !IsDBNull(datos.Tabla.Rows[0]["Contacto"]) ? datos.Tabla.Rows[0]["Contacto"].ToString() : "";
|
|
this.Mail = !IsDBNull(datos.Tabla.Rows[0]["Mail"]) ? datos.Tabla.Rows[0]["Mail"].ToString() : "";
|
|
|
|
this.CveSucursal = datos.Tabla.Rows[0]["CveSucursal"].ToString().ToEntero();
|
|
this.CveEmpresa = datos.Tabla.Rows[0]["CveEmpresa"].ToString().ToEntero();
|
|
}
|
|
Retorno = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
OnError("Ocurrió un error al consultar Los Clientes.", "Error", ex, MessageBoxIcon.Error);
|
|
}
|
|
|
|
return Retorno;
|
|
}
|
|
|
|
public bool AddClientes(int CveCliente, string Nombre, string Codigo, string NombreCorto, string RFC, int CveSucursal, int CveEmpresa, string NombreComercial, string Direccion, string NoExt, string NoInt, string Colonia, string Localidad, string Ciudad, string Estado, string Pais, string CP, string Telefono, string Contacto, string Mail)
|
|
{
|
|
bool Retorno = false;
|
|
|
|
try
|
|
{
|
|
datos = proxy.AddClientes(CveCliente, Nombre, Codigo, NombreCorto, RFC, CveSucursal, CveEmpresa, NombreComercial, Direccion, NoExt, NoInt, Colonia, Localidad, Ciudad, Estado, Pais, CP, Telefono, Contacto, Mail);
|
|
Retorno = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
OnError("Ocurrió un error al agregar El Cliente.", "Error", ex, MessageBoxIcon.Error);
|
|
}
|
|
|
|
return Retorno;
|
|
}
|
|
|
|
public bool RemoveCliente(int CveCliente)
|
|
{
|
|
bool Retorno = false;
|
|
|
|
try
|
|
{
|
|
datos = proxy.RemoveCliente(CveCliente);
|
|
Retorno = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
OnError("El Cliente no se pudo eliminar por que esta siendo usada por un registro.", "Error", ex, MessageBoxIcon.Error);
|
|
}
|
|
|
|
return Retorno;
|
|
}
|
|
|
|
}
|
|
|
|
} |