예제 #1
0
 /// <summary>
 /// Fill categories list to select from to be the categories of this series
 /// </summary>
 private void fillCatList()
 {
     try
     {
         if (DBC.IsConnected)
         {
             DBC.CommandText = "SELECT CatID,CatName FROM Category;";
             DataSet ds = DBC.ExecuteQuery();
             if (ds.Tables[0].Rows.Count > 0)
             {
                 mListCats.Items.Clear();
                 PureComponents.EntrySet.Lists.MultiListItem mli;
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     mli = new PureComponents.EntrySet.Lists.MultiListItem(
                         ds.Tables[0].Rows[i].ItemArray[1].ToString(),
                         ds.Tables[0].Rows[i].ItemArray[0].ToString());
                     mListCats.Items.Add(mli);
                 }
             }
         }
         else
         {
             throw new Exception("The database is not connected");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             ex.Message,
             "Error", MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void rbnBtnAddCat_Click(object sender, EventArgs e)
 {
     try
     {
         frmCatCtl frmCat = new frmCatCtl(DBC, "A");
         if (frmCat.ShowDialog() == DialogResult.OK)
         {
             MultiListItem mli = new PureComponents.EntrySet.Lists.MultiListItem(
                 frmCat.insertedCategory.Name, frmCat.insertedCategory.ID);
             mli.CheckState = CheckState.Checked;
             mListCats.Items.Add(mli);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             ex.Message,
             "Error Starting Category Insertion Process", MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
 }