/// <summary>
        /// Actualiza un FiguraAreaPreventa a partir del id
        /// </summary>
        internal int Update(Models.FiguraAreaPreventa oFiguraAreaPreventa)
        {
            try
            {
                SqlParameter[] dbparams = new SqlParameter[3] {
                    Param(enumDBFields.ta200_idareapreventa, oFiguraAreaPreventa.ta200_idareapreventa),
                    Param(enumDBFields.t001_idficepi, oFiguraAreaPreventa.t001_idficepi),
                    Param(enumDBFields.ta202_figura, oFiguraAreaPreventa.ta202_figura)
                };

                return((int)cDblib.Execute("SUPER.SIC_FiguraAreaPreventa_UPD", dbparams));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Inserta un FiguraAreaPreventa
        /// </summary>
        internal int Insert(Models.FiguraAreaPreventa oFiguraAreaPreventa)
        {
            try
            {
                SqlParameter[] dbparams = new SqlParameter[3] {
                    Param(enumDBFields.ta200_idareapreventa, oFiguraAreaPreventa.ta200_idareapreventa),
                    Param(enumDBFields.t001_idficepi, oFiguraAreaPreventa.t001_idficepi),
                    Param(enumDBFields.ta202_figura, oFiguraAreaPreventa.ta202_figura)
                };

                return((int)cDblib.Execute("SIC_AREAPREVENTA_FIGURAS_I", dbparams));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Obtiene todos los FiguraAreaPreventa
        /// </summary>
        internal List <Models.FiguraAreaPreventa> Catalogo(Int32 ta200_idareapreventa)
        {
            Models.FiguraAreaPreventa        oFiguraAreaPreventa = null;
            List <Models.FiguraAreaPreventa> lst = new List <Models.FiguraAreaPreventa>();
            IDataReader dr = null;

            try
            {
                SqlParameter[] dbparams = new SqlParameter[1] {
                    Param(enumDBFields.ta200_idareapreventa, ta200_idareapreventa)
                };

                dr = cDblib.DataReader("SIC_AREAPREVENTA_FIGURAS_C", dbparams);
                while (dr.Read())
                {
                    oFiguraAreaPreventa = new Models.FiguraAreaPreventa();
                    oFiguraAreaPreventa.ta200_idareapreventa = Convert.ToInt32(dr["ta200_idareapreventa"]);
                    oFiguraAreaPreventa.t001_idficepi        = Convert.ToInt32(dr["t001_idficepi"]);
                    oFiguraAreaPreventa.ta202_figura         = Convert.ToString(dr["ta202_figura"]);

                    oFiguraAreaPreventa.sexo        = Convert.ToString(dr["t001_sexo"]);
                    oFiguraAreaPreventa.tipoProf    = Convert.ToString(dr["tipo"]);
                    oFiguraAreaPreventa.profesional = Convert.ToString(dr["Profesional"]);
                    oFiguraAreaPreventa.orden       = Convert.ToInt32(dr["orden"]);

                    lst.Add(oFiguraAreaPreventa);
                }
                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                    dr.Dispose();
                }
            }
        }
        /// <summary>
        /// Obtiene todos los AreaPreventa
        /// </summary>
        /// <summary>
        /// Obtiene todos los FiguraAreaPreventa
        /// </summary>
        internal List <Models.FiguraAreaPreventa> ObtenerFigurasAreaUsuario(int ta200_idareapreventa, int t001_idficepi)
        {
            Models.FiguraAreaPreventa        oFiguraAreaPreventa = null;
            List <Models.FiguraAreaPreventa> lst = new List <Models.FiguraAreaPreventa>();
            IDataReader dr = null;

            try
            {
                SqlParameter[] dbparams = new SqlParameter[2] {
                    Param(enumDBFields.ta200_idareapreventa, ta200_idareapreventa),
                    Param(enumDBFields.t001_idficepi, t001_idficepi)
                };

                dr = cDblib.DataReader("SIC_FIGURAAREAPREVENTA_S1", dbparams);
                while (dr.Read())
                {
                    oFiguraAreaPreventa = new Models.FiguraAreaPreventa();
                    oFiguraAreaPreventa.ta200_idareapreventa = Convert.ToInt32(dr["ta200_idareapreventa"]);
                    oFiguraAreaPreventa.t001_idficepi        = Convert.ToInt32(dr["t001_idficepi"]);
                    oFiguraAreaPreventa.ta202_figura         = Convert.ToString(dr["ta202_figura"]);

                    lst.Add(oFiguraAreaPreventa);
                }
                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                    dr.Dispose();
                }
            }
        }
        /// <summary>
        /// Obtiene un FiguraAreaPreventa a partir del id
        /// </summary>
        internal Models.FiguraAreaPreventa Select(Int32 ta200_idareapreventa, Int32 t001_idficepi)
        {
            Models.FiguraAreaPreventa oFiguraAreaPreventa = null;
            IDataReader dr = null;

            try
            {
                SqlParameter[] dbparams = new SqlParameter[2] {
                    Param(enumDBFields.ta200_idareapreventa, ta200_idareapreventa),
                    Param(enumDBFields.t001_idficepi, t001_idficepi)
                };

                dr = cDblib.DataReader("SUPER.SIC_FiguraAreaPreventa_SEL", dbparams);
                if (dr.Read())
                {
                    oFiguraAreaPreventa = new Models.FiguraAreaPreventa();
                    oFiguraAreaPreventa.ta200_idareapreventa = Convert.ToInt32(dr["ta200_idareapreventa"]);
                    oFiguraAreaPreventa.t001_idficepi        = Convert.ToInt32(dr["t001_idficepi"]);
                    oFiguraAreaPreventa.ta202_figura         = Convert.ToString(dr["ta202_figura"]);
                }
                return(oFiguraAreaPreventa);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                    dr.Dispose();
                }
            }
        }
        public int Insert(Models.FiguraAreaPreventa oFiguraAreaPreventa)
        {
            Guid methodOwnerID = new Guid("f7969532-eb41-40a0-98b2-15dfb5c2d980");

            OpenDbConn();

            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                cDblib.beginTransaction(methodOwnerID);
            }

            try
            {
                DAL.FiguraAreaPreventa cFiguraAreaPreventa = new DAL.FiguraAreaPreventa(cDblib);

                int idFiguraAreaPreventa = cFiguraAreaPreventa.Insert(oFiguraAreaPreventa);

                //Finalizar transacción
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.commitTransaction(methodOwnerID);
                }

                return(idFiguraAreaPreventa);
            }
            catch (Exception ex)
            {
                //rollback
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }

                throw ex;
            }
        }
Esempio n. 7
0
        internal int Update(Models.FiguraAreaPreventa oFiguraAreaPreventa)
        {
            Guid methodOwnerID = new Guid("b6a8a7d3-00cd-461c-8224-0e14e1671b67");

            OpenDbConn();

            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                cDblib.beginTransaction(methodOwnerID);
            }

            try
            {
                DAL.FiguraAreaPreventa cFiguraAreaPreventa = new DAL.FiguraAreaPreventa(cDblib);

                int result = cFiguraAreaPreventa.Update(oFiguraAreaPreventa);

                //Finalizar transacción
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.commitTransaction(methodOwnerID);
                }

                return(result);
            }
            catch (Exception ex)
            {
                //rollback
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }

                throw ex;
            }
        }