Ejemplo n.º 1
0
        private void Frm_Addloop_Manual_Load(object sender, EventArgs e)
        {
            string    s  = "select * from tags_type";
            DataTable dt = new DataTable();

            TEST_DB.ExecuteSQL(s, dt);
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember   = "ID";
            List <listItem> list = new List <listItem>();
            int             i    = 0;

            for (i = 0; i < dt.Rows.Count; i++)
            {
                listItem li = new listItem();
                li.ID   = Convert.ToInt32(dt.Rows[i][0]);
                li.Name = Convert.ToString(dt.Rows[i][1]);
                list.Add(li);
            }
            dt.Dispose();
            comboBox1.DataSource = list;
            if (id > 0)
            {
                s = "select name,note,tt_id,FB_Tag from tags where id = @id";
                TEST_DB.Add_Param("@id", id);
                dt = new DataTable();
                TEST_DB.ExecuteSQL(s, dt);
                if (dt.Rows.Count > 0)
                {
                    textBox1.Text           = Convert.ToString(dt.Rows[0][0]);
                    textBox2.Text           = Convert.ToString(dt.Rows[0][1]);
                    comboBox1.SelectedIndex = Convert.ToInt32(dt.Rows[0][2]) - 1;
                    textBox3.Text           = Convert.ToString(dt.Rows[0][3]);
                }
                dt.Dispose();
            }
        }
Ejemplo n.º 2
0
        private void Frm_AddEquipment_Load(object sender, EventArgs e)
        {
            int       i  = 0;
            DataTable dt = new DataTable();

            TEST_DB.ExecuteSQL(s, dt);
            comboBox2.DisplayMember = "Name";
            comboBox2.ValueMember   = "ID";
            List <listItem> list = new List <listItem>();

            for (i = 0; i < dt.Rows.Count; i++)
            {
                listItem li = new listItem();
                li.ID   = Convert.ToInt32(dt.Rows[i][0]);
                li.Name = Convert.ToString(dt.Rows[i][1]);
                list.Add(li);
            }
            dt.Dispose();
            comboBox2.DataSource = list;
            s  = "select * from tags where tt_id = 1 and tags.id not in (select e.szd_tag from equipment e where e.szd_tag is not null)";
            dt = new DataTable();
            TEST_DB.ExecuteSQL(s, dt);
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember   = "ID";
            list = new List <listItem>();
            for (i = 0; i < dt.Rows.Count; i++)
            {
                listItem li = new listItem();
                li.ID   = Convert.ToInt32(dt.Rows[i][0]);
                li.Name = Convert.ToString(dt.Rows[i][1]);
                list.Add(li);
            }
            tagsCount = dt.Rows.Count;
            dt.Dispose();
            comboBox1.DataSource = list;
        }