Version OScar
This commit is contained in:
20
ADSUtileriasWF/Helpers/ADSControls.cs
Normal file
20
ADSUtileriasWF/Helpers/ADSControls.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
public class ADSTextBox : TextBox
|
||||
{
|
||||
public ADSTextBox()
|
||||
{
|
||||
BorderStyle = BorderStyle.None;
|
||||
AutoSize = false; //Allows you to change height to have bottom padding
|
||||
Font = new System.Drawing.Font("Open Sans", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
Controls.Add(new Label()
|
||||
{ Height = 1, Dock = DockStyle.Bottom, BackColor = System.Drawing.Color.FromArgb(64, 64, 64) });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
97
ADSUtileriasWF/Helpers/FormBase.cs
Normal file
97
ADSUtileriasWF/Helpers/FormBase.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using FontAwesome.Sharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
public class FormBase : Form
|
||||
{
|
||||
public void GuardaLog(string mensaje)
|
||||
{
|
||||
ModExtensiones.GuardaLog(mensaje);
|
||||
}
|
||||
//UtileriasServiceWCF.ResponseLogin UserV2
|
||||
|
||||
|
||||
|
||||
public WCF_PV.Usuario UsuarioActual { get { return ModVarsPV.UsuarioActual; } set { ModVarsPV.UsuarioActual = value; } }
|
||||
|
||||
//public UtileriasServiceWCF.ResponseLogin UsuarioActual { get { return ModVarsPV.UserV2; } set { ModVarsPV.UserV2 = value; } } //FIXME OIC pRUEBA
|
||||
#region "F U N C I O N E S D E W I N D O W S"
|
||||
#region "mover /arrastrar formulario"
|
||||
|
||||
private const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
private const int HT_CAPTION = 0x2;
|
||||
[DllImportAttribute("user32.dll")]
|
||||
private static extern int SendMessage(IntPtr hWnd,
|
||||
int Msg, int wParam, int lParam);
|
||||
[DllImportAttribute("user32.dll")]
|
||||
private static extern bool ReleaseCapture();
|
||||
|
||||
#endregion
|
||||
#region colorbar
|
||||
//[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
//public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||
|
||||
//[DllImport("User32.dll")]
|
||||
//private static extern IntPtr GetWindowDC(IntPtr hWnd);
|
||||
|
||||
//protected override void WndProc(ref Message m)
|
||||
//{
|
||||
// base.WndProc(ref m);
|
||||
// const int WM_NCPAINT = 0x85;
|
||||
// if (m.Msg == WM_NCPAINT)
|
||||
// {
|
||||
// IntPtr hdc = GetWindowDC(m.HWnd);
|
||||
// if ((int)hdc != 0)
|
||||
// {
|
||||
// Graphics g = Graphics.FromHdc(hdc);
|
||||
// g.FillRectangle(Brushes.Green, new Rectangle(0, 0, 4800, 23));
|
||||
// g.Flush();
|
||||
// ReleaseDC(m.HWnd, hdc);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
public void ArrastrarForm_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
ReleaseCapture();
|
||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
||||
}
|
||||
|
||||
}
|
||||
public void BtnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
|
||||
public void BtnMaximizeRestore_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
WindowState = FormWindowState.Normal;
|
||||
((IconButton)sender).IconChar = FontAwesome.Sharp.IconChar.WindowMaximize;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowState = FormWindowState.Maximized;
|
||||
((IconButton)sender).IconChar = FontAwesome.Sharp.IconChar.WindowRestore;
|
||||
|
||||
}
|
||||
}
|
||||
public void BtnMinimize_Click(object sender, EventArgs e)
|
||||
{
|
||||
WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
120
ADSUtileriasWF/Helpers/FormBase.resx
Normal file
120
ADSUtileriasWF/Helpers/FormBase.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
28
ADSUtileriasWF/Helpers/FormsColors.cs
Normal file
28
ADSUtileriasWF/Helpers/FormsColors.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// Represents an ARGB (alpha, red, green, blue) color.
|
||||
public readonly struct FormsColors
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// Represents a color that is null.
|
||||
public static readonly Color Empty;
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// Gets a system-defined color that has an ARGB value of #FF66CDAA.
|
||||
//
|
||||
// Returns:
|
||||
// A System.Drawing.Color representing a system-defined color.
|
||||
public static Color BlueDarkMenu { get { return System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(54)))), ((int)(((byte)(67))))); } }
|
||||
public static Color BlueDarkBarMenu { get { return System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(65)))), ((int)(((byte)(80))))); } }
|
||||
}
|
||||
}
|
||||
19
ADSUtileriasWF/Helpers/LogicChecador.cs
Normal file
19
ADSUtileriasWF/Helpers/LogicChecador.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using ADSNetLibrary.Helpers.Conexiones.ZkTeckoLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
class LogicChecador
|
||||
{
|
||||
public static System.Collections.Concurrent.ConcurrentDictionary<string, SDKZkTeckoHelper> GPSByIMEI = new System.Collections.Concurrent.ConcurrentDictionary<string, SDKZkTeckoHelper>(80, 100);
|
||||
|
||||
//public GetConexion(string ip,int port)
|
||||
//{
|
||||
// SDKZkTeckoHelper
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
244
ADSUtileriasWF/Helpers/ModExtensiones.cs
Normal file
244
ADSUtileriasWF/Helpers/ModExtensiones.cs
Normal file
@@ -0,0 +1,244 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
public static class ModExtensiones
|
||||
{
|
||||
|
||||
public static System.Windows.Forms.DialogResult Alert(string mensage, string Titulo, System.Windows.Forms.MessageBoxButtons botones = System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon Icon = System.Windows.Forms.MessageBoxIcon.None)
|
||||
{
|
||||
System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.None;
|
||||
result = System.Windows.Forms.MessageBox.Show(mensage, Titulo, botones, Icon);
|
||||
//switch (button)
|
||||
//{
|
||||
// case MessageBoxButtons.YesNo:
|
||||
// using (frmYesNo yesNo = new frmYesNo())
|
||||
// {
|
||||
// yesNo.Text = caption;
|
||||
// yesNo.Message = message;
|
||||
// result = yesNo.ShowDialog();
|
||||
// }
|
||||
// break;
|
||||
// case MessageBoxButtons.OK:
|
||||
// using (frmOK ok = new frmOK())
|
||||
// {
|
||||
// ok.Text = caption;
|
||||
// ok.Message = message;
|
||||
// result = ok.ShowDialog();
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
public static void OnError(string Mensaje, string Caption, Exception Exeption, System.Windows.Forms.MessageBoxIcon Icon, string InfoAdicional = "")
|
||||
{
|
||||
GuardaLog(string.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString(), "\r\n", InfoAdicional));
|
||||
Alert(Mensaje, Caption, System.Windows.Forms.MessageBoxButtons.OK, Icon);
|
||||
}
|
||||
|
||||
public static void GuardaLog(string Str)
|
||||
{
|
||||
string strLineaTMP;
|
||||
// strLineaTMP = Chr(13) & Chr(10) & Day(Now) & "/" & Month(Now) & "/" & Year(Now) & " " & Hour(Now) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10)
|
||||
strLineaTMP = string.Format("{0}{1}{2: dd-MM-yyyy HH\\:mm}", "\r\n", Str, DateTime.Now);
|
||||
try
|
||||
{
|
||||
using (System.IO.StreamWriter ArchivoW = new System.IO.StreamWriter(string.Format(@"{0}\Log.txt", AppDomain.CurrentDomain.BaseDirectory), true, System.Text.Encoding.UTF8))
|
||||
{
|
||||
ArchivoW.WriteLine(strLineaTMP);
|
||||
ArchivoW.Close();
|
||||
}
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
#region "String To Another type"
|
||||
public static int ToEntero(this string Obj)
|
||||
{
|
||||
int result = 0;
|
||||
// restriccion menor a 10, se quitan ceros a la izquiera primero, porque provoca desbordamiento si pasa mas de una cantidad,Holds signed 32-bit (4-byte) integers that range in value from -2,147,483,648 through 2,147,483,647.
|
||||
Obj = Obj.ToString().Trim().Replace(",", "");
|
||||
int.TryParse(Obj, out result);
|
||||
return result;
|
||||
}
|
||||
public static bool ToBool(this string Obj)
|
||||
{
|
||||
|
||||
return Obj == "1" || Obj.ToUpper() == "TRUE";
|
||||
}
|
||||
public static double ToDouble(this string Str, double TipoCambio = 1)
|
||||
{
|
||||
double result = 0;
|
||||
Str = Str.Trim().Replace(",", "").Replace("$", "").Replace("%", "");
|
||||
if (!string.IsNullOrEmpty(Str))
|
||||
{
|
||||
double.TryParse(Str, out result);
|
||||
}
|
||||
return result * TipoCambio;
|
||||
}
|
||||
public static decimal ToDecimal(this string Str, decimal TipoCambio = 1)
|
||||
{
|
||||
decimal result = 0;
|
||||
Str = Str.Trim().Replace(",", "").Replace("$", "").Replace("%", "");
|
||||
if (!string.IsNullOrEmpty(Str))
|
||||
{
|
||||
Decimal.TryParse(Str, out result);
|
||||
}
|
||||
return result * TipoCambio;
|
||||
}
|
||||
public static DateTime ToDateTime(this string Str)
|
||||
{
|
||||
return Str.ToDate();
|
||||
}
|
||||
public static DateTime ToDate(this string Str, IFormatProvider culture = null)
|
||||
{
|
||||
DateTime retorno = DateTime.MinValue;
|
||||
if (Str != null && !string.IsNullOrEmpty(Str.Trim()))
|
||||
{
|
||||
if (culture == null)
|
||||
{
|
||||
DateTime.TryParse(Str, out retorno);
|
||||
//retorno = Convert.ToDateTime(Str.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
retorno = Convert.ToDateTime(Str.ToString().Trim(), culture);
|
||||
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
}
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
#endregion
|
||||
|
||||
static public object GetValObjDy(this object obj, string propertyName)
|
||||
{
|
||||
return obj.GetType().GetProperty(propertyName).GetValue(obj, null);
|
||||
}
|
||||
public static string FormatoNumero(this string Str, int Decimales = 2)
|
||||
{
|
||||
decimal numero = 0;
|
||||
decimal.TryParse(Str, out numero);
|
||||
StringBuilder zeros = new StringBuilder();
|
||||
for (int i = 0; i < Decimales; i++)
|
||||
{
|
||||
zeros.Append("0");
|
||||
}
|
||||
if (zeros.Length > 0)
|
||||
{
|
||||
zeros.Insert(0, ".");
|
||||
}
|
||||
string Tmp = string.Format("{0:#,0.00}", numero);
|
||||
return Tmp;
|
||||
}
|
||||
|
||||
public static bool Contiene(this int Valor, params int[] Valores)
|
||||
{
|
||||
return Array.IndexOf(Valores, Valor) >= 0;
|
||||
}
|
||||
public static bool Contiene(this string Valor, params string[] Valores)
|
||||
{
|
||||
return Array.IndexOf(Valores, Valor) >= 0;
|
||||
}
|
||||
public static string Mid(string input, int index, char newChar)
|
||||
|
||||
{
|
||||
|
||||
if (input == null)
|
||||
|
||||
{
|
||||
|
||||
throw new ArgumentNullException("input");
|
||||
|
||||
}
|
||||
|
||||
char[] chars = input.ToCharArray();
|
||||
|
||||
chars[index - 1] = newChar;
|
||||
|
||||
return new string(chars);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is equivalent to Mid Function in VB6
|
||||
/// </summary>
|
||||
/// <param name="s"> String to Check.</param>
|
||||
/// <param name="a">Position of Character</param>
|
||||
/// <param name="b">Length </param>
|
||||
/// <returns></returns> ]
|
||||
public static string Mid(string s, int a, int b)
|
||||
|
||||
{
|
||||
|
||||
string temp = s.Substring(a - 1, b);
|
||||
|
||||
return temp;
|
||||
|
||||
}
|
||||
|
||||
public static System.Data.DataTable FiltraParametros(this System.Data.DataTable dt, string RowFilter, string Orderby = "", string[] DistinctColumns = null)
|
||||
{
|
||||
System.Data.DataTable TmpDt = new System.Data.DataTable();
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
System.Data.DataView Dv = new System.Data.DataView(dt, RowFilter, Orderby, System.Data.DataViewRowState.CurrentRows);
|
||||
if (DistinctColumns != null)
|
||||
TmpDt = Dv.ToTable(true, DistinctColumns);
|
||||
else
|
||||
try
|
||||
{
|
||||
TmpDt = Dv.ToTable();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
TmpDt = null;
|
||||
}
|
||||
|
||||
Dv.Dispose();
|
||||
}
|
||||
else { TmpDt = dt; }
|
||||
return TmpDt;
|
||||
}
|
||||
|
||||
public static System.Data.DataRow FiltroPrimero(this System.Data.DataTable dt, string RowFilter, string Orderby = "")
|
||||
{
|
||||
System.Data.DataRow TmpDr = null;
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
if (RowFilter != "")
|
||||
{
|
||||
System.Data.DataView Dv = new System.Data.DataView(dt, RowFilter, Orderby, System.Data.DataViewRowState.CurrentRows);
|
||||
if (Dv.ToTable().Rows.Count > 0)
|
||||
TmpDr = Dv.ToTable().Rows[0];
|
||||
Dv.Dispose();
|
||||
}
|
||||
else
|
||||
TmpDr = dt.Rows[0];
|
||||
}
|
||||
return TmpDr;
|
||||
}
|
||||
public static bool HasRows(this System.Data.DataTable dt)
|
||||
{
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static double SUM(this System.Data.DataTable dt, string Campo, string Filtro ="")
|
||||
{
|
||||
|
||||
return dt.Compute("SUM(" + Campo + ")", Filtro).ToString().ToDouble();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
96
ADSUtileriasWF/Helpers/ModVars.cs
Normal file
96
ADSUtileriasWF/Helpers/ModVars.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using ADSUtileriasWF.Data.Externa.PV;
|
||||
using DocumentFormat.OpenXml.Office2013.Word;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Text;
|
||||
using UtileriasServiceWCF;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
public static class ModVarsPV
|
||||
{
|
||||
|
||||
public enum ModuloActivo
|
||||
{
|
||||
Checador,
|
||||
PuntoVenta
|
||||
}
|
||||
|
||||
public static ModuloActivo moduloActivo = ModuloActivo.Checador;
|
||||
#region PuntodeVenta
|
||||
public static WCF_PV.Usuario UsuarioActual;
|
||||
public static UtileriasServiceWCF.ResponseLogin UserV2;
|
||||
|
||||
public static string subproyecto;
|
||||
public static WCF_PV.PuntoVentaClient.EndpointConfiguration EndPointName = WCF_PV.PuntoVentaClient.EndpointConfiguration.basicHttpBinding_IPuntoVenta;
|
||||
public static string RutaWCF = "http://localhost:8000/WCF/";
|
||||
public static string Address { get { return string.Format("{0}Clase", RutaWCF); } }
|
||||
|
||||
|
||||
public static ClsVta_Cortes.ClsVta_CortesModel CorteActual;
|
||||
public static int CveClientePG = 3940;//Publico general
|
||||
public static decimal IVAClientePG = (decimal)0.16;//Publico general
|
||||
public static Data.Externa.PV.TamanoTicket TamanoTicketConfigurado = Data.Externa.PV.TamanoTicket.Chico;
|
||||
public static bool ImprimirComandas = false;
|
||||
public static System.Drawing.Color ColorBTNs = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveBorder);
|
||||
|
||||
public static string TipoTerminal;
|
||||
public static int CveTipoTerminal
|
||||
{
|
||||
get
|
||||
{
|
||||
int cvetipoterminal = 0;
|
||||
if (ModVarsPV.TipoTerminal != null)
|
||||
{
|
||||
string[] spliteditems = ModVarsPV.TipoTerminal.Split("_");
|
||||
cvetipoterminal = (spliteditems[0]).ToEntero();
|
||||
|
||||
}
|
||||
return cvetipoterminal;
|
||||
}
|
||||
|
||||
}
|
||||
public static string txtTipoTerminal
|
||||
{
|
||||
get
|
||||
{
|
||||
string txttipoterminal = "";
|
||||
if (ModVarsPV.TipoTerminal != null)
|
||||
{
|
||||
string[] spliteditems = ModVarsPV.TipoTerminal.Split("_");
|
||||
if (spliteditems.Length > 1)
|
||||
{ txttipoterminal = (spliteditems[1]); }
|
||||
|
||||
}
|
||||
return txttipoterminal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool TieneProceso(this ResponseLogin UsuarioClase, int CveProceso)
|
||||
{
|
||||
|
||||
|
||||
var result = UsuarioClase.UsuariosRolesProcesos?.Where(kv => kv.cveProceso == CveProceso )?.ToList();
|
||||
|
||||
if(result!= null && result.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//public static string Istouch;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
BIN
ADSUtileriasWF/Helpers/ZKTecko.rar
Normal file
BIN
ADSUtileriasWF/Helpers/ZKTecko.rar
Normal file
Binary file not shown.
138
ADSUtileriasWF/Helpers/serviceconection.cs
Normal file
138
ADSUtileriasWF/Helpers/serviceconection.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
public class Servicecon
|
||||
{
|
||||
public static void GuardaLog(string mensaje)
|
||||
{
|
||||
ModExtensiones.GuardaLog(mensaje);
|
||||
}
|
||||
|
||||
public static UtileriasServiceWCF.ResponseLogin Login(string usuario, string password,int CveEmpresa)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.Login(new UtileriasServiceWCF.RequestLogin() { UserName = usuario, Password = password, CvePlataforma = 8, CveEmpresa = CveEmpresa });
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
public static UtileriasServiceWCF.UsuariosqliteModel CambiarEmpresa(int CveUsuario, int CveEmpresa, int cveSubProyecto)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.CambiarEmpresa( CveUsuario, CveEmpresa, cveSubProyecto);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
public static bool SetPersonalHuella(UtileriasServiceWCF.RequestPersonalHuella perhuella)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.SetEmpleadoHuella(perhuella);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static UtileriasServiceWCF.ResponseGetChecadoresModel[] GetChecadores(int CveUsuario, int cveSubProyecto, int CveEmpresa)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.GetChecadores(CveUsuario, cveSubProyecto, CveEmpresa);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static List<UtileriasServiceWCF.PersonalsqliteModel> GETPersonal(int CveUsuario, int CveEmpresa, int cveSubProyecto)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
|
||||
return new List<UtileriasServiceWCF.PersonalsqliteModel>( client.GETPersonal(CveUsuario, CveEmpresa, cveSubProyecto));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<UtileriasServiceWCF.PersonalChecadorsqliteModel> GETPersonalChecador(int CveUsuario, int CveEmpresa, int CvePersonal)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return new List<UtileriasServiceWCF.PersonalChecadorsqliteModel>(client.GETPersonalChecador(CveUsuario, CveEmpresa, CvePersonal));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool UpChecadorEmpleado(int CveUsuario, int CveEmpresa, int CvePersonal, List<UtileriasServiceWCF.PersonalChecadorUPsqliteModel> CveChecadores)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.UpChecadorEmpleado(CveUsuario, CveEmpresa, CvePersonal, CveChecadores.ToArray());
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static UtileriasServiceWCF.ResponseSubProyectoUsuario[] GetSubProyectos(int CveUsuario, int CveEmpresa)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.RequestSubProyectoUsuario parames=new UtileriasServiceWCF.RequestSubProyectoUsuario { CveUsuario=CveUsuario, CveProyecto =-1, CveSubProyecto=-1, CveEmpresa = CveEmpresa, CveEstatus =-1 };
|
||||
//public UtileriasServiceWCF.ResponseSubProyectoUsuario[] GetSubProyectos(int CveUsuario, int CveEmpresa, )
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.GetSubProyectos(CveUsuario, CveEmpresa, parames);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user