Exemplo n.º 1
0
        private void mainMenuPrintChk_Click(object sender, EventArgs e)
        {
            //listBox1.Items.Clear();
            /*if (listView1.CheckedItems.Count != 0) {
                listchecked();
                if (listView1.CheckedItems.Count != 0) labelResult.Text = ": " + listView1.CheckedItems.Count.ToString();
                else labelResult.Text = ": ";
            } else {labelResult.Text = ": ";}*/

            ArrayList alMembers = new ArrayList();
            ArrayList alPrintSelect = new ArrayList();
            mylib ml = new mylib();

            ml.delete("DELETE FROM PrintTable");
            bool print = false;
            foreach (DataGridViewRow row in dgMembers.Rows) {
                if (Convert.ToBoolean(row.Cells[0].Value) == true) {
                    print = true;
                    DataGridViewCell cell = row.Cells[1];
                    alMembers.Add(cell.Value.ToString());
                    string val = alMembers[(alMembers.Count - 1)].ToString();
                    //MessageBox.Show(val);

                    string cmd1 = "SELECT * FROM cards WHERE uid = '" + val + "'";
                    alPrintSelect = (ArrayList)ml.select(cmd1);
                    if (alPrintSelect.Count != 0) {
                        foreach (object[] myTargetArray in alPrintSelect) {
                            string cid = myTargetArray[0].ToString();
                            string uid = myTargetArray[1].ToString();
                            string tip = myTargetArray[2].ToString();
                            string phid = myTargetArray[3].ToString();
                            ml.insert("INSERT INTO PrintTable (cid,phid,uid,tip) VALUES ('" + cid + "','" + phid + "','" + uid + "','" + tip + "')");
                        }
                    }
                }
            }

            if (print) {
                //report1.Load();
                //report1.RegisterData();

                report1.Show();
            }
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            mylib ml = new mylib();
            SqlCeDataAdapter da;
            DataTable dt = new DataTable();

            ArrayList al = new ArrayList();

            string SQLQuery =
                "SELECT us.uid, us.fname, us.lname, us.ftname, us.tabnum, cs.type " +
                "FROM users AS us " +
                "LEFT OUTER JOIN cards AS cs ON us.uid = cs.uid ";// +
                //"WHERE (us.uid = 3)";

            //da = new SqlCeDataAdapter(cmd, ml.connectHandler);
            //da.Fill(dt);
            //dgMembers.DataSource = dt;

            //ml.connectHandler.Close();

            al = (ArrayList)ml.select(SQLQuery);

            foreach (object[] row in al) {

                string name = row[2].ToString() + " " + row[1].ToString() + " " + row[3].ToString();
                string uid = row[0].ToString();
                string tab = row[4].ToString();
                string chk = "";

                object[] rows = new object[] { false, uid, name, tab };
                //object[] rows = new object[] { row6 };

                dgMembers.Rows.Add(rows);
            }

            /*for (int i = 1; i < 6; i++ ) {
                ListViewItem lvi = new ListViewItem("");
                lvi.SubItems.Add("name0" + i.ToString());
                lvi.SubItems.Add("tabel0" + i.ToString());
                listView1.Items.Add(lvi);
            }*/
        }