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

            try
            {
                using (SistemaDriveInDataContext dc = new SistemaDriveInDataContext(Helper.ConnectionString()))
                {
                    var query = from item in dc.stp_setDatosBarandal(barandal.intDatosBarandalID, barandal.intElementoID, barandal.intCotizacionID, barandal.intDetCotizaID,
                                                                     barandal.sintPinturaID, barandal.decLargo, barandal.intCantidad, barandal.decPrecioUnitario, barandal.decPrecioTotal,
                                                                     barandal.decPrecioUnitario, barandal.decPesoTotal, barandal.bitActivo, (byte)tinOpcion)
                                select new Resultado
                    {
                        vchDescripcion = item.vchDescripcion,
                        vchResultado   = item.vchResultado
                    };
                    result = query.First();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #2
0
        ///// <summary>
        ///// Procedimiento que lista los datos de precio DriveIn Barandal en base al largo
        ///// </summary>
        ///// <param name="decLargo"></param>
        ///// <returns></returns>
        //public List<SeleccionBarandal> ListarDriveInBarandal(decimal decLargo)
        //{
        //    List<SeleccionBarandal> result = new List<SeleccionBarandal>();
        //    try
        //    {
        //        result = (new BarandalLogic()).ListarDriveInBarandal(decLargo);
        //    }
        //    catch (Exception ex)
        //    {
        //        Adsisplus.Cotyrsa.BusinessLogic.EventLogManager.LogErrorEntry(ex.Message);
        //    }
        //    return result;
        //}
        /// <summary>
        /// Procedimiento que realiza el alta, baja o modificación de los datos de barandal
        /// </summary>
        /// <param name="barandal"></param>
        /// <param name="intCotizacionID"></param>
        /// <param name="intDetCotizaID"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDatosBarandal(DatosBarandal barandal, int intCotizacionID, int intDetCotizaID, short tinOpcion)
        {
            Resultado result = new Resultado();

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

            try
            {
                result = DriveInDA.setDatosBarandal(barandal, tinOpcion);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #4
0
        ///// <summary>
        ///// Procedimiento que lista los datos de precio DriveIn Barandal en base al largo
        ///// </summary>
        ///// <param name="decLargo"></param>
        ///// <returns></returns>
        //public List<SeleccionBarandal> ListarDriveInBarandal(decimal decLargo)
        //{
        //    List<SeleccionBarandal> result = new List<SeleccionBarandal>();
        //    try
        //    {
        //        result = BarandalDA.ListarDriveInBarandal(decLargo);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    return result;
        //}
        /// <summary>
        /// Procedimiento que realiza el alta, baja o modificación de los datos de barandal
        /// </summary>
        /// <param name="barandal"></param>
        /// <param name="intCotizacionID"></param>
        /// <param name="intDetCotizaID"></param>
        /// <param name="tinOpcion"></param>
        /// <returns></returns>
        public Resultado setDatosBarandal(DatosBarandal barandal, int intCotizacionID, int intDetCotizaID, short tinOpcion)
        {
            Resultado result = new Resultado();

            try
            {
                Cotizacion detCotizacion = new Cotizacion();
                detCotizacion.intCotizacionID = intCotizacionID;
                detCotizacion.intDetCotizaID  = intDetCotizaID;
                detCotizacion.intElementoID   = 22;
                detCotizacion.intPartida      = 0;
                detCotizacion.intCantidad     = tinOpcion == 3 ? 0 : Convert.ToInt32(barandal.intCantidad);
                detCotizacion.decMonto        = tinOpcion == 3 ? 0 : barandal.decPrecioTotal;
                //detCotizacion.decSubtotal = Decimal.Round((Math.Truncate(100 * barandal.decPrecioTotal.Value) / 100) * barandal.decCantidad.Value);

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

                    List <DatosBarandal> ListBarandal = new List <DatosBarandal>();
                    DatosBarandal        _barandal    = new DatosBarandal();

                    //Validamos si es un nuevo registro
                    if (tinOpcion != 1)
                    {
                        ListBarandal = ListarDatosBarandal((int)barandal.intDatosBarandalID, intCotizacionID);
                    }
                    //Validamos si existe registro
                    if (ListBarandal.Count > 0)
                    {
                        _barandal = ListBarandal.First();
                    }
                    else
                    {
                        _barandal.intDatosBarandalID = 0;
                    }

                    _barandal.intCotizacionID = intCotizacionID;
                    _barandal.intDetCotizaID  = intDetCotizaID;

                    // actualizamos la información cuando se trata de un alta o modificación
                    if (tinOpcion != 3)
                    {
                        // Actualizamos la información
                        _barandal.intElementoID     = 22;
                        _barandal.sintPinturaID     = barandal.sintPinturaID;
                        _barandal.bitActivo         = barandal.bitActivo;
                        _barandal.intCantidad       = barandal.intCantidad;
                        _barandal.decLargo          = barandal.decLargo;
                        _barandal.decPrecioTotal    = barandal.decPrecioTotal;
                        _barandal.decPrecioUnitario = barandal.decPrecioUnitario;
                    }
                    // Realizamos el registro del atirantado
                    result = (new DriveInLogic()).setDatosBarandal(_barandal, tinOpcion);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }