コード例 #1
0
ファイル: frmSeachBook.cs プロジェクト: foxZhong/smartken-kia
        private void frmSeachBook_Load(object sender, EventArgs e)
        {
            sb = new StringBuilder(BASESQL);
            using (MySqlConnection con = DBHelper.getCon())
            {
                adapter = new MySqlDataAdapter(sb.ToString(), con);
                adapter.Fill(ds, "books");
                dgvBooks.DataSource = ds.Tables["books"];
                lbSearchInfo.Text   = string.Format("当前库存的书籍共有 {0} 本", ds.Tables["books"].Rows.Count.ToString());
            }
            cobCategories.DisplayMember = "Title";
            foreach (Categorie cat in BookManage.getAllCategories())
            {
                cobCategories.Items.Add(cat);
            }
            cobCategories.Items.Add(new Categorie());

            cobGenres.DisplayMember = "Title";
            cobGenres.Items.Add(new Genre());

            cobPubshers.DisplayMember = "Name";
            foreach (Publisher pub in BookManage.getAllPublishers())
            {
                cobPubshers.Items.Add(pub);
            }
            cobPubshers.Items.Add(new Publisher());
        }
コード例 #2
0
 private void loadPubliser()
 {
     foreach (Publisher pub in BookManage.getAllPublishers())
     {
         cobPub.Items.Add(pub);
     }
 }
コード例 #3
0
        private void frmSaleAccount_Load(object sender, EventArgs e)
        {
            using (MySqlConnection con = DBHelper.getCon())
            {
                adapter = new MySqlDataAdapter(sb.ToString(), con);
                adapter.Fill(ds, "saleitems");
                dgSaleClassify.DataSource = ds.Tables["saleitems"];
                float sum   = 0;
                int   count = 0;
                for (int i = 0; i < ds.Tables["saleitems"].Rows.Count; i++)
                {
                    sum = sum + float.Parse(ds.Tables["saleitems"].Rows[i]["sumprice"].ToString());
                }
                lbInfo.Text = string.Format("目前共有{0}条件记录,销售总额为{1}", ds.Tables["saleitems"].Rows.Count.ToString(), sum.ToString());
            }

            cobCategories.DisplayMember = "Title";
            foreach (Categorie cat in BookManage.getAllCategories())
            {
                cobCategories.Items.Add(cat);
            }
            cobCategories.Items.Add(new Categorie());

            cobGenres.DisplayMember = "Title";
            cobGenres.Items.Add(new Genre());

            cobPubshers.DisplayMember = "Name";
            foreach (Publisher pub in BookManage.getAllPublishers())
            {
                cobPubshers.Items.Add(pub);
            }
            cobPubshers.Items.Add(new Publisher());
        }
コード例 #4
0
ファイル: frmAddBook.cs プロジェクト: foxZhong/smartken-kia
 private void loadPublisher()
 {
     foreach (Publisher pub in BookManage.getAllPublishers())
     {
         cobPub.Items.Add(pub);
     }
     cobPub.DisplayMember = "Name";
     cobPub.SelectedItem  = cobPub.Items[0];
 }