コード例 #1
0
        public long InsertarConfigHandHeld(DA.eTipoConexion tc, int iCodUsuario, int iCodOperador, int iCodSupervisor, DateTime dtFecha, int iCodTurno, int iCodPlanta, int iCodProceso, int?iCodConfigBanco, DateTime?dtFechaRegistro)
        {
            long lCodConfigHandHeld = -1;
            bool bCodConfigHandHeld = false;

            try
            {
                if (tc == DA.eTipoConexion.Local)
                {
                    lCodConfigHandHeld = this.ObtenerSigCodConfigHandHeld();

                    // Parameters
                    SqlCeParameter[] pars = new SqlCeParameter[9];
                    pars[0]       = new SqlCeParameter("@CodConfigHandHeld", SqlDbType.BigInt);
                    pars[0].Value = lCodConfigHandHeld;
                    pars[1]       = new SqlCeParameter("@CodUsuario", SqlDbType.Int);
                    pars[1].Value = iCodUsuario;
                    pars[2]       = new SqlCeParameter("@CodOperador", SqlDbType.Int);
                    pars[2].Value = iCodOperador;
                    pars[3]       = new SqlCeParameter("@CodSupervisor", SqlDbType.Int);
                    pars[3].Value = iCodSupervisor;
                    pars[4]       = new SqlCeParameter("@Fecha", SqlDbType.DateTime);
                    pars[4].Value = dtFecha;
                    pars[5]       = new SqlCeParameter("@CodTurno", SqlDbType.Int);
                    pars[5].Value = iCodTurno;
                    pars[6]       = new SqlCeParameter("@CodPlanta", SqlDbType.Int);
                    pars[6].Value = iCodPlanta;
                    pars[7]       = new SqlCeParameter("@CodProceso", SqlDbType.Int);
                    pars[7].Value = iCodProceso;
                    pars[8]       = new SqlCeParameter("@CodConfigBanco", SqlDbType.Int);
                    if (iCodConfigBanco == null)
                    {
                        pars[8].Value = DBNull.Value;
                    }
                    else
                    {
                        pars[8].Value = iCodConfigBanco;
                    }

                    // Query Execution
                    DA.ConfigDataAccess.ObtenerConexion().EjecutarConsulta(c03_ConfiguracionInicial.query_InsertarConfigHandHeld(), pars);
                }
                else if (tc == DA.eTipoConexion.Servicio)
                {
                    if (this.oDA0.EstaServicioDisponible())
                    {
                        HHsvc.SCPP_HH proxy = DA.ConfigDataAccess.ObtenerServiceProxy();
                        //dtFecha = this.oDA0.ObtenerFechaServidor();

                        proxy.InsertarConfigHandHeld(iCodUsuario, true, iCodOperador, true, iCodSupervisor, true,
                                                     dtFecha, true, iCodTurno, true, iCodPlanta, true,
                                                     iCodProceso, true, iCodConfigBanco.Value, true, dtFechaRegistro.Value, true,
                                                     out lCodConfigHandHeld, out bCodConfigHandHeld);

                        if (!bCodConfigHandHeld)
                        {
                            lCodConfigHandHeld = -1;
                        }
                    }
                    else
                    {
                        lCodConfigHandHeld = -1;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", InsertarConfigHandHeld: " + ex.Message);
            }
            return(lCodConfigHandHeld);
        }