public static string[] IngresarParte(string Maquina, string FechaParte, string Turno, string Codigo, string OT, string NombreOT, string Pliego,
                                      string Hora, string Minutos, string Buenos, string Malos, string IngresaCantidad, string Factor, string Usuario)
 {
     try
     {
         if (Maquina == "" || FechaParte == "" || Codigo == "" || OT == "" || Pliego == "Seleccione..." || Hora == "" || Minutos == "" || Buenos == "" || Malos == "" || IngresaCantidad == "" || Usuario == "")
         {
             return(new[] { "Debe ingresar Todos los campos" });
         }
         else
         {
             Controller_IngresoPartes c = new Controller_IngresoPartes();
             PartesIngreso            p = new PartesIngreso();
             p.Maquina = Maquina;
             string[] str2 = FechaParte.Split('/');
             p.FechaParte = str2[1] + "/" + str2[0] + "/" + str2[2] + " 00:00:00";
             p.Turno      = Turno;
             p.Codigo     = Codigo;
             p.OT         = OT;
             p.NombreOT   = NombreOT;
             p.Pliego     = Pliego;
             string[] str = FechaParte.Split('/');
             p.FechaInicio = str[1] + "/" + str[0] + "/" + str[2] + " " + Hora + ":" + Minutos + ":00";
             p.Buenos      = Buenos;
             p.Malos       = Malos;
             p.Usuario     = Usuario;
             p.Factor      = Factor;
             if (c.IngresarDetalleParte_V2(p, 0) > 0)
             {
                 return(new[] { "Registro Ingresado Correctamente" });
             }
             else
             {
                 return(new[] { "Ha ocurrido un Error al ingresar" });
             }
         }
     }
     catch
     {
         return(new[] { "OT Incorrecta" });
     }
 }
 public static string[] BuscaOT(string OT)
 {
     try
     {
         string Resultado            = "";
         Controller_IngresoPartes ip = new Controller_IngresoPartes();
         Resultado = ip.Carga_NombreOT(OT);
         if (Resultado == "")
         {
             return(new[] { "OT Incorrecta" });
         }
         else
         {
             return(new[] { Resultado });
         }
     }
     catch
     {
         return(new[] { "OT Incorrecta" });
     }
 }
 public static string[] BuscaCodigo(string Codigo)
 {
     try
     {
         string Resultado            = "";
         Controller_IngresoPartes ip = new Controller_IngresoPartes();
         Resultado = ip.Carga_CodigoParte(Codigo);
         if (Resultado == "")
         {
             return(new[] { "Codigo Incorrecto" });
         }
         else
         {
             return(new[] { Resultado });
         }
     }
     catch
     {
         return(new[] { "Codigo Incorrecto" });
     }
 }
        public static string[] BuscaCodigo(string Codigo)
        {
            try
            {
                Controller_IngresoPartes ip = new Controller_IngresoPartes();
                PartesIngreso            pi = ip.Carga_CodigoParte_V2(Codigo);

                if (pi == null)
                {
                    return(new[] { "Codigo Incorrecto", "" });
                }
                else
                {
                    return(new[] { pi.Codigo, pi.Malos });
                }
            }
            catch
            {
                return(new[] { "Codigo Incorrecto", "" });
            }
        }
        public static string CargaPliego(string OT)
        {
            Controller_IngresoPartes c      = new Controller_IngresoPartes();
            List <PartesIngreso>     lista  = c.CargaPliegos(OT, 0);
            List <PartesIngreso>     lista2 = new List <PartesIngreso>();

            int           contador = 1;
            PartesIngreso insert1  = new PartesIngreso();

            insert1.Pliego = "Seleccione...";
            lista2.Insert(0, insert1);
            foreach (PartesIngreso ps in lista)
            {
                PartesIngreso objst = new PartesIngreso();
                //objst.Componente = ps.Componente;
                objst.Pliego = ps.Pliego;
                lista2.Insert(contador, objst);
                contador++;
            }

            JavaScriptSerializer jscript = new JavaScriptSerializer();

            return(jscript.Serialize(lista2));
        }