Example #1
0
        public int InsertarCarroPieza(DA.eTipoConexion tc, int iCodPlanta, int iCodProceso, int iCodCarro, int iCodPieza, DateTime?dtFechaRegistro, int tipoTransporte)
        {
            int  iRes = -1;
            bool bRes = false;

            try
            {
                if (tc == DA.eTipoConexion.Local)
                {
                    // Parameters
                    SqlCeParameter[] pars = new SqlCeParameter[5];
                    pars[0]       = new SqlCeParameter("@CodPlanta", SqlDbType.Int);
                    pars[0].Value = iCodPlanta;
                    pars[1]       = new SqlCeParameter("@CodProceso", SqlDbType.Int);
                    pars[1].Value = iCodProceso;
                    pars[2]       = new SqlCeParameter("@CodCarro", SqlDbType.Int);
                    pars[2].Value = iCodCarro;
                    pars[3]       = new SqlCeParameter("@CodPieza", SqlDbType.Int);
                    pars[3].Value = iCodPieza;
                    pars[4]       = new SqlCeParameter("@TiopoTransporte", SqlDbType.Int);
                    pars[4].Value = tipoTransporte;

                    // Query Execution
                    DA.ConfigDataAccess.ObtenerConexion().EjecutarConsulta(c05_ArmadoCarroSecado.query_InsertarCarroPieza(), pars);

                    iRes = 0;
                }
                else
                {
                    if (this.oDA0.EstaServicioDisponible())
                    {
                        HHsvc.SCPP_HH proxy = DA.ConfigDataAccess.ObtenerServiceProxy();
                        proxy.InsertarCarroPieza(iCodPlanta, true, iCodProceso, true, iCodCarro, true, iCodPieza, true,
                                                 dtFechaRegistro.Value, true, out iRes, out bRes);

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