예제 #1
0
        public string GetNombreCategoria(int IdCategoria)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_NOMBRE_CATEGORIA_GET";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_CATEGORIA", IdCategoria);
                        cmd.Parameters.Add("@NOM_CATEGORIA", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        return(Convert.ToString(cmd.Parameters["@NOM_CATEGORIA"].Value));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public string EsCartelModeloCeroDigitos(int IdCartel)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_SCE_CARTEL_CERO_DIGITOS";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
                        cmd.Parameters.Add("@RSPTA", SqlDbType.Char, 1).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        return(Convert.ToString(cmd.Parameters["@RSPTA"].Value));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public void Actualizar(SCE_CATEGORIA_BE BE)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CATEGORIA_UPD";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_CATEGORIA", BE.ID_CATEGORIA);
                        cmd.Parameters.AddWithValue("@NOM_CATEGORIA", BE.NOM_CATEGORIA);

                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void EliminarCMCP(SCE_CARTEL_MODELO_BE BE)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartelModelo = "SP_SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_DEL";

                    using (SqlCommand cmd = new SqlCommand(sqlCartelModelo, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        foreach (SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE CARTEL_MODELO_CATEGORIA_PROMOCION_BE in BE.CATEGS_PROMOS)
                        {
                            cmd.Parameters.Clear();

                            cmd.Parameters.AddWithValue("@ID_CARTEL", BE.ID_CARTEL);
                            cmd.Parameters.AddWithValue("@ID_MODELO", BE.ID_MODELO);
                            cmd.Parameters.AddWithValue("@ID_CATEGORIA", CARTEL_MODELO_CATEGORIA_PROMOCION_BE.ID_CATEGORIA);
                            cmd.Parameters.AddWithValue("@ID_PROMOCION", CARTEL_MODELO_CATEGORIA_PROMOCION_BE.ID_PROMOCION);
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
        public void ActualizarFileGuia(SCE_FILE_GUIA_MASIVA_BE BE)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlGuia = "SP_SCE_FILE_GUIA_MASIVA_UPD";

                    using (SqlCommand cmd = new SqlCommand(sqlGuia, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_FILE", BE.ID_FILE);
                        cmd.Parameters.AddWithValue("@NOM_FILE", BE.NOM_FILE);
                        cmd.Parameters.AddWithValue("@ESTADO", BE.ESTADO);
                        cmd.Parameters.AddWithValue("@USER_MOD", BE.USER_MOD);
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public string ObtenerPlantilla(int IdCartel, int IdModelo, int Digitos)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_SCE_GET_PLANTILLA_CARTEL_IMPR";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
                        cmd.Parameters.AddWithValue("@ID_MODELO", IdModelo);
                        cmd.Parameters.AddWithValue("@DIGITOS", Digitos);
                        cmd.Parameters.Add("@PLANTILLA", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        string Plantilla = Convert.ToString(cmd.Parameters["@PLANTILLA"].Value);

                        return(Plantilla);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        public void Insertar(SCE_CAMPO_BE BE)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CAMPO_INS";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@NOM_CAMPO", BE.NOM_CAMPO);
                        cmd.Parameters.AddWithValue("@ALIAS", BE.ALIAS);
                        cmd.Parameters.AddWithValue("@RESTRINGIR", BE.RESTINGIR);
                        cmd.Parameters.AddWithValue("@VALDIGITOS", BE.VALDIGITOS);
                        cmd.Parameters.AddWithValue("@TIPO", BE.TIPO);

                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #8
0
        public bool EliminarFileGuia(int Id)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_FILE_GUIA_MASIVA_DEL";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_FILE", Id);
                        cmd.Parameters.Add("@RSPTA", SqlDbType.Bit).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        bool Rspta = Convert.ToBoolean(cmd.Parameters["@RSPTA"].Value);

                        if (Rspta == false)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
        public DataTable GetAllCampos()
        {
            DataTable dt = new DataTable();

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CAMPO_SEL1";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        SqlDataReader reader = cmd.ExecuteReader();

                        dt.Load(reader);

                        return(dt);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #10
0
        public int GetIdCampo(string NomCampo)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_OBTENER_IDCAMPO";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ALIAS", NomCampo);
                        cmd.Parameters.Add("@IDCAMPO", SqlDbType.Int).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        return(Convert.ToInt32(cmd.Parameters["@IDCAMPO"].Value));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public string GetNombreModelo(int IdModelo)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_SCE_GET_NOMBRE_MODELO_IMPR";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_MODELO", IdModelo);
                        cmd.Parameters.Add("@NOMBRE", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        string Nombre = Convert.ToString(cmd.Parameters["@NOMBRE"].Value);

                        return(Nombre);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #12
0
        public int Eliminar(int Id, string Alias)
        {
            int Rspta;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CAMPO_DEL";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_CAMPO", Id);
                        cmd.Parameters.AddWithValue("@ALIAS", Alias);
                        cmd.Parameters.Add("@RSPTA", SqlDbType.Int).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        Rspta = Convert.ToInt32(cmd.Parameters["@RSPTA"].Value);
                    }
                }

                return(Rspta);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public SCE_CARTEL_MODELO_BE ObtenerPorID(int IdCartel, int IdModelo)
        {
            SCE_CARTEL_MODELO_BE BE = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CARTEL_MODELO_GET1";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
                        cmd.Parameters.AddWithValue("@ID_MODELO", IdModelo);

                        SqlDataReader reader = cmd.ExecuteReader();

                        if (reader.Read())
                        {
                            BE = new SCE_CARTEL_MODELO_BE();

                            BE.ID_CARTEL   = Convert.ToInt32(reader["ID_CARTEL"]);
                            BE.ID_MODELO   = Convert.ToInt32(reader["ID_MODELO"]);
                            BE.CODIGO      = Convert.ToString(reader["CODIGO"]).Trim();
                            BE.DESCRIPCION = Convert.ToString(reader["DESCRIPCION"]).Trim();

                            /* LLENA LA LISTA DE CAMPOS DEL CARTEL-MODELO */
                            List <SCE_CARTEL_MODELO_CAMPO_BE> lstCARTELMODELOCAMPO = new List <SCE_CARTEL_MODELO_CAMPO_BE>();

                            SqlDataReader drCARTELMODELOCAMPO = null;
                            drCARTELMODELOCAMPO = getCampos(IdCartel, IdModelo);

                            while (drCARTELMODELOCAMPO.Read())
                            {
                                SCE_CARTEL_MODELO_CAMPO_BE CARTEL_MODELO_CAMPO = new SCE_CARTEL_MODELO_CAMPO_BE();
                                CARTEL_MODELO_CAMPO.ID_CAMPO      = drCARTELMODELOCAMPO.GetInt32(0);
                                CARTEL_MODELO_CAMPO.NOM_CAMPO     = drCARTELMODELOCAMPO.GetString(1);
                                CARTEL_MODELO_CAMPO.DESCRIPCION   = drCARTELMODELOCAMPO.GetString(2);
                                CARTEL_MODELO_CAMPO.FLAGPERTENECE = drCARTELMODELOCAMPO.GetInt32(3);

                                lstCARTELMODELOCAMPO.Add(CARTEL_MODELO_CAMPO);
                            }

                            BE.CAMPOS = lstCARTELMODELOCAMPO;
                        }

                        return(BE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #14
0
        public void Insertar(SCE_CARTEL_BE BE, int numMaxDigitos, string CeroDigitos)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_SCE_CARTEL_INS";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@NOM_CARTEL", BE.NOM_CARTEL);
                        cmd.Parameters.AddWithValue("@CERO_DIGITOS", CeroDigitos);
                        cmd.Parameters.Add("@ID_CARTEL", SqlDbType.Int).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        BE.ID_CARTEL = (int)cmd.Parameters["@ID_CARTEL"].Value;
                    }

                    string sqlCartelModeloDigito = "SP_SCE_CARTEL_MODELO_INS";

                    using (SqlCommand cmd = new SqlCommand(sqlCartelModeloDigito, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        foreach (SCE_CARTEL_MODELO_BE CARTEL_MODELO_BE in BE.MODELOS)
                        {
                            if (CeroDigitos == "S")
                            {
                                cmd.Parameters.Clear();
                                cmd.Parameters.AddWithValue("@ID_CARTEL", BE.ID_CARTEL);
                                cmd.Parameters.AddWithValue("@ID_MODELO", CARTEL_MODELO_BE.ID_MODELO);
                                cmd.Parameters.AddWithValue("@DIGITOS", 0);
                                cmd.ExecuteNonQuery();
                            }
                            else if (CeroDigitos == "N")
                            {
                                for (int i = 1; i <= numMaxDigitos; i++)
                                {
                                    cmd.Parameters.Clear();
                                    cmd.Parameters.AddWithValue("@ID_CARTEL", BE.ID_CARTEL);
                                    cmd.Parameters.AddWithValue("@ID_MODELO", CARTEL_MODELO_BE.ID_MODELO);
                                    cmd.Parameters.AddWithValue("@DIGITOS", i);
                                    cmd.ExecuteNonQuery();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void ActualizarCMC(SCE_CARTEL_MODELO_BE BE, int numMaxDigitos, string CeroDigitos)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartelModelo1 = "SP_SCE_CARTEL_MODELO_CAMPO_DEL0";

                    using (SqlCommand cmd = new SqlCommand(sqlCartelModelo1, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_CARTEL", BE.ID_CARTEL);
                        cmd.Parameters.AddWithValue("@ID_MODELO", BE.ID_MODELO);
                        cmd.ExecuteNonQuery();
                    }

                    string sqlCartelModelo2 = "SP_SCE_CARTEL_MODELO_CAMPO_INS";

                    using (SqlCommand cmd = new SqlCommand(sqlCartelModelo2, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        foreach (SCE_CARTEL_MODELO_CAMPO_BE CARTEL_MODELO_CAMPO_BE in BE.CAMPOS)
                        {
                            if (CeroDigitos == "S")
                            {
                                cmd.Parameters.Clear();
                                cmd.Parameters.AddWithValue("@ID_CARTEL", BE.ID_CARTEL);
                                cmd.Parameters.AddWithValue("@ID_MODELO", BE.ID_MODELO);
                                cmd.Parameters.AddWithValue("@DIGITOS", 0);
                                cmd.Parameters.AddWithValue("@ID_CAMPO", CARTEL_MODELO_CAMPO_BE.ID_CAMPO);
                                cmd.ExecuteNonQuery();
                            }
                            else if (CeroDigitos == "N")
                            {
                                for (int i = 1; i <= numMaxDigitos; i++)
                                {
                                    cmd.Parameters.Clear();
                                    cmd.Parameters.AddWithValue("@ID_CARTEL", BE.ID_CARTEL);
                                    cmd.Parameters.AddWithValue("@ID_MODELO", BE.ID_MODELO);
                                    cmd.Parameters.AddWithValue("@DIGITOS", i);
                                    cmd.Parameters.AddWithValue("@ID_CAMPO", CARTEL_MODELO_CAMPO_BE.ID_CAMPO);
                                    cmd.ExecuteNonQuery();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #16
0
        public SCE_GRUPOTDA_BE ObtenerPorID(int Id)
        {
            SCE_GRUPOTDA_BE BE = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_GRUPOTDA_GET";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_GRUPO", Id);

                        SqlDataReader reader = cmd.ExecuteReader();

                        if (reader.Read())
                        {
                            BE = new SCE_GRUPOTDA_BE();

                            BE.ID_GRUPO  = Convert.ToInt32(reader["ID_GRUPO"]);
                            BE.NOM_GRUPO = Convert.ToString(reader["NOM_GRUPO"]);

                            /* LLENA LA LISTA DE TIENDAS DEL GRUPO */
                            List <SCE_GRUPOTDA_TIENDA_BE> lstTIENDAS = new List <SCE_GRUPOTDA_TIENDA_BE>();

                            SqlDataReader drTIENDAS = null;
                            drTIENDAS = getTiendas(Id);

                            while (drTIENDAS.Read())
                            {
                                SCE_GRUPOTDA_TIENDA_BE TIENDA = new SCE_GRUPOTDA_TIENDA_BE();
                                TIENDA.ID_GRUPO   = drTIENDAS.GetInt32(0);
                                TIENDA.ID_TIENDA  = drTIENDAS.GetInt32(1);
                                TIENDA.NOM_TIENDA = drTIENDAS.GetString(2);
                                lstTIENDAS.Add(TIENDA);
                            }

                            BE.TIENDAS = lstTIENDAS;
                        }

                        return(BE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #17
0
        public void Actualizar(SCE_GRUPOTDA_BE BE)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_GRUPOTDA_UPD";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_GRUPO", BE.ID_GRUPO);
                        cmd.Parameters.AddWithValue("@NOM_GRUPO", BE.NOM_GRUPO);
                        cmd.ExecuteNonQuery();
                    }

                    string sqlGrupoTienda1 = "SP_SCE_GRUPOTDA_TIENDA_DEL";

                    using (SqlCommand cmd = new SqlCommand(sqlGrupoTienda1, cn))
                    {
                        cmd.Parameters.Clear();

                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_GRUPO", BE.ID_GRUPO);
                        cmd.ExecuteNonQuery();
                    }

                    string sqlGrupoTienda2 = "SP_SCE_GRUPOTDA_TIENDA_INS";

                    using (SqlCommand cmd = new SqlCommand(sqlGrupoTienda2, cn))
                    {
                        foreach (SCE_GRUPOTDA_TIENDA_BE GRUPOTDA_TIENDA_BE in BE.TIENDAS)
                        {
                            cmd.Parameters.Clear();

                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@ID_GRUPO", BE.ID_GRUPO);
                            cmd.Parameters.AddWithValue("@ID_TIENDA", GRUPOTDA_TIENDA_BE.ID_TIENDA);
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <SCE_CARTEL_MODELO_CAMPO_BE> grvCampos(int IdCartel, int IdModelo, int Digitos)
        {
            List <SCE_CARTEL_MODELO_CAMPO_BE> lstBE = new List <SCE_CARTEL_MODELO_CAMPO_BE>();
            SCE_CARTEL_MODELO_CAMPO_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CARTEL_MODELO_CAMPO_GET2";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
                        cmd.Parameters.AddWithValue("@ID_MODELO", IdModelo);
                        cmd.Parameters.AddWithValue("@DIGITOS", Digitos);

                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_CARTEL_MODELO_CAMPO_BE();

                            BE.ID_CARTEL = Convert.ToInt32(reader["ID_CARTEL"]);
                            BE.ID_MODELO = Convert.ToInt32(reader["ID_MODELO"]);
                            BE.DIGITOS   = Convert.ToInt32(reader["DIGITOS"]);
                            BE.ID_CAMPO  = Convert.ToInt32(reader["ID_CAMPO"]);
                            BE.POSX      = Convert.ToString(reader["POS_X"]).Trim();
                            BE.POSY      = Convert.ToString(reader["POS_Y"]).Trim();
                            BE.ALIAS     = Convert.ToString(reader["CAMPO"]).Trim();
                            BE.NOM_CAMPO = Convert.ToString(reader["DESCRIPCION"]).Trim();

                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #19
0
        public SqlDataReader getTiendas(int IdGrupo)
        {
            string        sql = "SP_SCE_GRUPOTDA_TIENDA_GET";
            SqlConnection cn  = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin));
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ID_GRUPO", IdGrupo);
            cmd.CommandText = sql;

            cn.Open();

            SqlDataReader dr = cmd.ExecuteReader();

            return(dr);
        }
예제 #20
0
        public SqlDataReader getModelos(int IdCartel)
        {
            string        sql = "SP_SCE_CARTEL_MODELO_GET";
            SqlConnection cn  = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin));
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
            cmd.CommandText = sql;

            cn.Open();

            SqlDataReader dr = cmd.ExecuteReader();

            return(dr);
        }
        public bool ValidaCartelModeloLineaProducto(int IdLinea,
                                                    int IdGuia,
                                                    int IdCartel,
                                                    int IdModelo,
                                                    int Digitos)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "VALIDA_CARTEL_LINEA_PRODUCTO";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_LINEA", IdLinea);
                        cmd.Parameters.AddWithValue("@ID_GUIA", IdGuia);
                        cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
                        cmd.Parameters.AddWithValue("@ID_MODELO", IdModelo);
                        cmd.Parameters.AddWithValue("@DIGITOS", Digitos);

                        cmd.Parameters.Add("@RPTA", SqlDbType.Bit).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        bool Rpta = Convert.ToBoolean(cmd.Parameters["@RPTA"].Value);

                        if (Rpta == false)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE> ListarCMCP(int IdCategoria, int IdPromocion)
        {
            List <SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE> lstBE = new List <SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE>();
            SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_SEL";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_CATEGORIA", IdCategoria);
                        cmd.Parameters.AddWithValue("@ID_PROMOCION", IdPromocion);

                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE();

                            BE.ID_CARTEL    = Convert.ToInt32(reader["ID_CARTEL"]);
                            BE.ID_MODELO    = Convert.ToInt32(reader["ID_MODELO"]);
                            BE.ID_CATEGORIA = Convert.ToInt32(reader["ID_CATEGORIA"]);
                            BE.ID_PROMOCION = Convert.ToInt32(reader["ID_PROMOCION"]);
                            BE.DESCRIPCION  = Convert.ToString(reader["DESCRIPCION"]);

                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <SCE_CARTEL_MODELO_BE> ListarCMConf()
        {
            List <SCE_CARTEL_MODELO_BE> lstBE = new List <SCE_CARTEL_MODELO_BE>();
            SCE_CARTEL_MODELO_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CARTEL_MODELO_SEL4";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_CARTEL_MODELO_BE();

                            BE.ID_CARTEL     = Convert.ToInt32(reader["ID_CARTEL"]);
                            BE.ID_MODELO     = Convert.ToInt32(reader["ID_MODELO"]);
                            BE.DIGITOS       = Convert.ToInt32(reader["DIGITOS"]);
                            BE.DESCRIPCION   = Convert.ToString(reader["DESCRIPCION"]).Trim();
                            BE.NRODIGITOS    = Convert.ToString(reader["NRODIGITOS"]).Trim();
                            BE.NOM_PLANTILLA = Convert.ToString(reader["NOM_PLANTILLA"]).Trim();

                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #24
0
        public List <SCE_CAMPO_BE> Listar()
        {
            List <SCE_CAMPO_BE> lstBE = new List <SCE_CAMPO_BE>();
            SCE_CAMPO_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CAMPO_SEL";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_CAMPO_BE();

                            BE.ID_CAMPO      = Convert.ToInt32(reader["ID_CAMPO"]);
                            BE.ALIAS         = Convert.ToString(reader["ALIAS"]);
                            BE.NOM_CAMPO     = Convert.ToString(reader["NOM_CAMPO"]);
                            BE.FLAGPERTENECE = Convert.ToInt32(reader["FLAGPERTENECE"]);
                            BE.TIPO          = Convert.ToString(reader["TIPO"]);
                            BE.RESTINGIR     = Convert.ToString(reader["RESTINGIR"]);
                            BE.VALDIGITOS    = Convert.ToString(reader["VALIDAR"]);
                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #25
0
        public void Insertar(SCE_GRUPOTDA_BE BE)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlGrupo = "SP_SCE_GRUPOTDA_INS";

                    using (SqlCommand cmd = new SqlCommand(sqlGrupo, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@NOM_GRUPO", BE.NOM_GRUPO);
                        cmd.Parameters.Add("@ID_GRUPO", SqlDbType.Int).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        BE.ID_GRUPO = (int)cmd.Parameters["@ID_GRUPO"].Value;
                    }

                    string sqlGrupoTienda = "SP_SCE_GRUPOTDA_TIENDA_INS";

                    using (SqlCommand cmd = new SqlCommand(sqlGrupoTienda, cn))
                    {
                        foreach (SCE_GRUPOTDA_TIENDA_BE GRUPOTDA_TIENDA_BE in BE.TIENDAS)
                        {
                            cmd.Parameters.Clear();

                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@ID_GRUPO", BE.ID_GRUPO);
                            cmd.Parameters.AddWithValue("@ID_TIENDA", GRUPOTDA_TIENDA_BE.ID_TIENDA);
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #26
0
        public List <SCE_FILE_GUIA_MASIVA_BE> ListarFilesGuia()
        {
            List <SCE_FILE_GUIA_MASIVA_BE> lstBE = new List <SCE_FILE_GUIA_MASIVA_BE>();
            SCE_FILE_GUIA_MASIVA_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_FILE_GUIA_MASIVA_LISTAR";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_FILE_GUIA_MASIVA_BE();

                            BE.ID_FILE   = Convert.ToInt32(reader["ID_FILE"]);
                            BE.NOM_FILE  = Convert.ToString(reader["NOM_FILE"]);
                            BE.FECHA_MOD = Convert.ToDateTime(reader["FECHA_MOD"]);
                            BE.USER_MOD  = Convert.ToString(reader["USER_MOD"]);
                            BE.ESTADO    = Convert.ToString(reader["ESTADO_FILE"]);

                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #27
0
        public SCE_FILE_GUIA_MASIVA_BE ObtenerFileGuia(int Id)
        {
            SCE_FILE_GUIA_MASIVA_BE BE = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_FILE_GUIA_MASIVA_GET";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ID_FILE", Id);

                        SqlDataReader reader = cmd.ExecuteReader();

                        if (reader.Read())
                        {
                            BE = new SCE_FILE_GUIA_MASIVA_BE();

                            BE.ID_FILE   = Convert.ToInt32(reader["ID_FILE"]);
                            BE.NOM_FILE  = Convert.ToString(reader["NOM_FILE"]);
                            BE.FECHA_MOD = Convert.ToDateTime(reader["FECHA_MOD"]);
                            BE.USER_MOD  = Convert.ToString(reader["USER_MOD"]);
                            BE.ESTADO    = Convert.ToString(reader["ESTADO_FILE"]);
                        }

                        return(BE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool ExisteCartelModeloInTB_CMCP(int IdCartel, int IdModelo, int IdCategoria, int IdPromocion)
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sqlCartel = "SP_SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_EXISTE";

                    using (SqlCommand cmd = new SqlCommand(sqlCartel, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@ID_CARTEL", IdCartel);
                        cmd.Parameters.AddWithValue("@ID_MODELO", IdModelo);
                        cmd.Parameters.AddWithValue("@ID_CATEGORIA", IdCategoria);
                        cmd.Parameters.AddWithValue("@ID_PROMOCION", IdPromocion);
                        cmd.Parameters.Add("@EXISTE", SqlDbType.Bit).Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        bool Existe = Convert.ToBoolean(cmd.Parameters["@EXISTE"].Value);

                        if (Existe == false)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #29
0
        public List <SCE_CATEGORIA_BE> ListarConf()
        {
            List <SCE_CATEGORIA_BE> lstBE = new List <SCE_CATEGORIA_BE>();
            SCE_CATEGORIA_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CATEGORIA_SEL_CONF";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_CATEGORIA_BE();

                            BE.ID_CATEGORIA  = Convert.ToInt32(reader["ID_CATEGORIA"]);
                            BE.NOM_CATEGORIA = Convert.ToString(reader["NOM_CATEGORIA"]);

                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #30
0
        public List <SCE_CARTEL_BE> Listar()
        {
            List <SCE_CARTEL_BE> lstBE = new List <SCE_CARTEL_BE>();
            SCE_CARTEL_BE        BE    = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin)))
                {
                    cn.Open();

                    string sql = "SP_SCE_CARTEL_SEL";

                    using (SqlCommand cmd = new SqlCommand(sql, cn))
                    {
                        SqlDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            BE = new SCE_CARTEL_BE();

                            BE.ID_CARTEL     = Convert.ToInt32(reader["ID_CARTEL"]);
                            BE.CARTEL        = Convert.ToString(reader["CARTEL"]);
                            BE.NOM_MODELO    = Convert.ToString(reader["NOM_MODELO"]);
                            BE.FLAGPERTENECE = Convert.ToInt32(reader["FLAGPERTENECE"]);

                            lstBE.Add(BE);
                        }

                        return(lstBE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }