Пример #1
0
        public bool FnUTico(ClsTipoControl OTico)
        {
            bool UpdateTIco = false;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spUTico", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                Cmd_D.Parameters.AddWithValue("prmUIdTC", Convert.ToInt16(OTico.Idtipocontrol));
                Cmd_D.Parameters.AddWithValue("prmUTico", OTico.Tipocontrol);
                ObjConexion.Abrircon();
                int FilasNTiCo = Cmd_D.ExecuteNonQuery();
                if (FilasNTiCo > 0)
                {
                    UpdateTIco = true;
                }
                return(UpdateTIco);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Пример #2
0
        public bool FnCTico(ClsTipoControl OTico)
        {
            bool CreateTico = false;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spCTico", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                Cmd_D.Parameters.AddWithValue("prmCTico", OTico.Tipocontrol);
                ObjConexion.Abrircon();
                int FilasCTiCo = Cmd_D.ExecuteNonQuery();
                if (FilasCTiCo > 0)
                {
                    CreateTico = true;
                }

                return(CreateTico);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Пример #3
0
        private MySqlCommand Cmd_D = null; // ejecutamos comandos de transact o procedimiento almacenado

        public List <ClsTipoControl> MostrarTC()
        {
            ClsTipoControl OTC = null;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spVerTC", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                ObjConexion.Abrircon();
                Dr_D = Cmd_D.ExecuteReader();
                List <ClsTipoControl> LstTC = new List <ClsTipoControl>();
                while (Dr_D.Read())
                {
                    OTC = new ClsTipoControl();
                    OTC.Idtipocontrol = Dr_D[0].ToString(); //ID_tipo_control
                    OTC.Tipocontrol   = Dr_D[1].ToString(); //tipo_control
                    LstTC.Add(OTC);
                }
                return(LstTC);
            }
            catch (Exception ex)
            {
                return(null);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Пример #4
0
        public bool FnETicoTC(ClsTipoControl OTico)
        {
            bool ExisteTCTC = false;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spETicoTC", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                Cmd_D.Parameters.AddWithValue("prmEIdTC", Convert.ToInt16(OTico.Idtipocontrol));
                Cmd_D.Parameters.AddWithValue("prmETCTC", OTico.Tipocontrol);
                ObjConexion.Abrircon();
                Dr_D = Cmd_D.ExecuteReader();
                if (Dr_D.Read())
                {
                    ExisteTCTC = Convert.ToBoolean(Dr_D[0]);
                }
                return(ExisteTCTC);
            }
            catch (Exception ex)
            {
                return(true);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Пример #5
0
        public static bool FnETicoTC(string id, string tc, string CUDE)
        {
            bool           ExisteTCTC = false;
            ClsTipoControl OTico      = new ClsTipoControl();

            OTico.Idtipocontrol = id;
            OTico.Tipocontrol   = tc;

            ExisteTCTC = new ClsTicoControlN().FnETicoTC(OTico, CUDE);
            return(ExisteTCTC);
        }
Пример #6
0
        public bool FnETicoTC(ClsTipoControl OTico, string CUDE)
        {
            bool ExisteTCTC = false;

            if (OTico.Idtipocontrol != "" && OTico.Idtipocontrol != null)
            {
                switch (CUDE)
                {
                case "C":
                    ExisteTCTC = new ClsTipoControlD().FnCTico(OTico);
                    break;

                case "U":
                    ExisteTCTC = new ClsTipoControlD().FnUTico(OTico);
                    break;

                case "D":
                    ExisteTCTC = new ClsTipoControlD().FnDTico(OTico);
                    break;

                case "ETC":
                    ExisteTCTC = new ClsTipoControlD().FnETicoTC(OTico);     // instanciar de la capa datos con el parametro del obj
                    break;

                default:
                    ExisteTCTC = false;
                    break;
                }

                return(ExisteTCTC); //retornar si no se pudo hacer la operación
            }
            else
            {
                return(ExisteTCTC);
            }
        }