/// <summary>
        /// Procedimiento que realiza el alta, baja y modificación de los datos poste
        /// </summary>
        /// <param name="poste"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDatosPosteDriveIn(DatosPosteDriveIn poste, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                using (SistemaDriveInDataContext dc = new SistemaDriveInDataContext(Helper.ConnectionString()))
                {
                    var query = from item in dc.stp_setDatosPosteDriveIn(poste.intDatoPosteDriveInID, poste.intElementoID, poste.intCotizacionID, poste.intDetCotizaID,
                                                                         poste.intDatoMarcoID, poste.seleccion.First().intSKUID, poste.intCantidad, poste.seleccion.First().decCalibre, poste.seleccion.First().decSolera, poste.seleccion.First().decTotalKilo,
                                                                         poste.seleccion.First().decPrecioTyrsa, poste.seleccion.First().decRelacionPrecios, poste.seleccion.First().decPrecioTyrsaMetro, poste.seleccion.First().decPrecioTyrsaKg,
                                                                         poste.seleccion.First().sintNumPosteReq, poste.seleccion.First().sintNumTravesanio, poste.seleccion.First().decPesoTotal, poste.seleccion.First().decPrecioVentaTotal,
                                                                         poste.bitDobleMonten, poste.decAlturaDobleMonten, poste.bitActivo,
                                                                         (byte)tinOpcion)
                                select new Resultado
                    {
                        vchDescripcion = item.vchDescripcion,
                        vchResultado   = item.vchResultado
                    };
                    result = query.First();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        /// <summary>
        /// Procedimiento que realiza el alta, modificación o baja de los datos Poste Drive In
        /// </summary>
        /// <param name="poste"></param>
        /// <param name="intCotizacionID"></param>
        /// <param name="intDetCotizaID"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDatosPosteDriveIn(DatosPosteDriveIn poste, int intCotizacionID, int intDetCotizaID, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                result = (new PosteDriveInLogic()).setDatosPosteDriveIn(poste, intCotizacionID, intDetCotizaID, tinOpcion);
            }
            catch (Exception ex)
            {
                Adsisplus.Cotyrsa.BusinessLogic.EventLogManager.LogErrorEntry(ex.Message);
            }
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// Procedimiento que realiza el alta, baja y modificación de los datos poste
        /// </summary>
        /// <param name="poste"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDatosPosteDriveIn(DatosPosteDriveIn poste, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                result = DriveInDA.setDatosPosteDriveIn(poste, tinOpcion);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        /// <summary>
        /// Procedimiento que realiza el alta, modificación o baja de los datos Poste Drive In
        /// </summary>
        /// <param name="poste"></param>
        /// <param name="intCotizacionID"></param>
        /// <param name="intDetCotizaID"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDatosPosteDriveIn(DatosPosteDriveIn poste, int intCotizacionID, int intDetCotizaID, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                Cotizacion detCotizacion = new Cotizacion();
                detCotizacion.intCotizacionID = intCotizacionID;
                detCotizacion.intDetCotizaID  = intDetCotizaID;
                detCotizacion.intElementoID   = 31;
                detCotizacion.intPartida      = 0;
                detCotizacion.intCantidad     = poste.intCantidad;
                detCotizacion.decMonto        = tinOpcion == 3 ? 0 : poste.seleccion.First().decPrecioTyrsa;
                detCotizacion.decSubtotal     = tinOpcion == 3 ? 0 : poste.intCantidad * poste.seleccion.First().decPrecioTyrsa;

                // Almacenamos el registro
                result = (new CotizacionLogic()).setDetCotizacion(detCotizacion, (short)(intDetCotizaID == 0 ? 1 : tinOpcion));
                if (result.vchResultado != "NOK")
                {
                    intDetCotizaID       = Convert.ToInt32(result.vchResultado);
                    poste.intDetCotizaID = intDetCotizaID;

                    List <DatosPosteDriveIn> ListPoste = new List <DatosPosteDriveIn>();
                    DatosPosteDriveIn        _poste    = new DatosPosteDriveIn();


                    if (tinOpcion != 1)
                    {
                        ListPoste = ListarDatosPosteDriveIn((int)poste.intDatoPosteDriveInID, intCotizacionID, (int)poste.intDatoMarcoID);
                    }
                    // Validamos si existe registro
                    if (ListPoste.Count() > 0)
                    {
                        _poste = ListPoste.First();
                    }
                    else
                    {
                        _poste.intDatoPosteDriveInID = 0;
                        tinOpcion = 1;
                    }
                    // Actualizamos la información
                    _poste.intCotizacionID = intCotizacionID;
                    _poste.intDetCotizaID  = intDetCotizaID;
                    _poste.seleccion       = new List <DatosPrecioPoste>();

                    if (tinOpcion != 3)
                    {
                        //_poste.decCalibre = poste.decCalibre;
                        //_poste.decPrecioTyrsa = poste.decPrecioTyrsa;
                        //_poste.decPrecioTyrsaKg = poste.decPrecioTyrsaKg;
                        //_poste.decPrecioTyrsaMetro = poste.decPrecioTyrsaMetro;
                        //_poste.decRelacionPrecios = poste.decRelacionPrecios;
                        //_poste.decSolera = poste.decSolera;
                        //_poste.decTotalKilo = poste.decTotalKilo;
                        _poste.bitActivo            = poste.bitActivo;
                        _poste.intDatoMarcoID       = poste.intDatoMarcoID;
                        _poste.intCantidad          = poste.intCantidad;
                        _poste.bitDobleMonten       = poste.bitDobleMonten;
                        _poste.decAlturaDobleMonten = poste.decAlturaDobleMonten;
                        _poste.intElementoID        = 31;
                        //_poste.intSKUID = poste.intSKUID;
                        //_poste.sintNumPosteReq = poste.sintNumPosteReq;
                        //_poste.sintNumTravesanio = poste.sintNumTravesanio;
                        _poste.seleccion = poste.seleccion;
                    }
                    //Realizamos el registro del DRIVEIN
                    result = (new DriveInLogic()).setDatosPosteDriveIn(_poste, tinOpcion);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }