Example #1
0
        public void AgregarValorHorario(DTOScheduleValue value)
        {
            string sSel;
            string sSelCount;
            bool   exist;

            sSelCount = "SELECT COUNT(*) FROM \"tbl_ScheduleValue\" WHERE \"idScheduleValue\" = " + value.IdScheduleValue;
            NpgsqlDataAdapter daCount;
            DataSet           dtCount = new DataSet();

            try
            {
                daCount = new NpgsqlDataAdapter(sSelCount, sConexion);
                daCount.Fill(dtCount);
                if (dtCount.Tables[0].Rows[0][0].ToString() == "0")
                {
                    exist = false;
                }
                else
                {
                    exist = true;
                }
            }
            catch (Exception)
            {
                exist = false;
            }
            if (!exist)
            {
                sSel = "INSERT INTO \"tbl_ScheduleValue\" VALUES(" + value.IdScheduleValue + ",'" + value.Name + "','" + value.Pname + "','" + value.Description + "')";

                NpgsqlDataAdapter da;
                DataSet           dt = new DataSet();

                try
                {
                    da = new NpgsqlDataAdapter(sSel, sConexion);
                    da.Fill(dt);
                }
                catch (Exception)
                {
                }
            }
        }
Example #2
0
        static void InsertScheduleValues(XmlDocument doc)
        {
            try
            {
                Console.WriteLine("Valor de Horarios");
                DTOScheduleValue valor          = new DTOScheduleValue();
                XmlNodeList      scheduleValues = doc.GetElementsByTagName("glf")[0].ChildNodes[0].ChildNodes[7].ChildNodes;

                foreach (XmlNode value in scheduleValues)
                {
                    valor.IdScheduleValue = Int64.Parse(value.Attributes["id"].Value);
                    valor.Name            = value.Attributes["name"].Value;
                    valor.Pname           = value.Attributes["pname"].Value;
                    valor.Description     = value.Attributes["desc"].Value;
                    conexion.AgregarValorHorario(valor);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public void AgregarValorHorario(DTOScheduleValue value)
        {
            string sSel;
            string sSelCount;
            bool exist;
            sSelCount = "SELECT COUNT(*) FROM \"tbl_ScheduleValue\" WHERE \"idScheduleValue\" = " + value.IdScheduleValue;
            NpgsqlDataAdapter daCount;
            DataSet dtCount = new DataSet();
            try
            {
                daCount = new NpgsqlDataAdapter(sSelCount, sConexion);
                daCount.Fill(dtCount);
                if (dtCount.Tables[0].Rows[0][0].ToString() == "0")
                    exist = false;
                else
                    exist = true;
            }
            catch (Exception)
            {
                exist = false;
            }
            if (!exist)
            {
                sSel = "INSERT INTO \"tbl_ScheduleValue\" VALUES("+ value.IdScheduleValue +",'"+ value.Name +"','"+ value.Pname +"','"+ value.Description +"')";

                NpgsqlDataAdapter da;
                DataSet dt = new DataSet();

                try
                {
                    da = new NpgsqlDataAdapter(sSel, sConexion);
                    da.Fill(dt);
                }
                catch (Exception)
                {

                }
            }
        }
Example #4
0
        static void InsertScheduleValues(XmlDocument doc)
        {
            try
            {
                Console.WriteLine("Valor de Horarios");
                DTOScheduleValue valor = new DTOScheduleValue();
                XmlNodeList scheduleValues = doc.GetElementsByTagName("glf")[0].ChildNodes[0].ChildNodes[7].ChildNodes;

                foreach (XmlNode value in scheduleValues)
                {
                    valor.IdScheduleValue = Int64.Parse(value.Attributes["id"].Value);
                    valor.Name = value.Attributes["name"].Value;
                    valor.Pname = value.Attributes["pname"].Value;
                    valor.Description = value.Attributes["desc"].Value;
                    conexion.AgregarValorHorario(valor);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }