示例#1
0
        private void dataGridView_Categories_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(dataGridView_Categories.Rows[e.RowIndex].Cells[0].Value);

            category = WarehouseBack.Classes.Category.GetCategory(id);
            textBoxCategoryName.Text = category.Name;
        }
示例#2
0
 private void button_SubmitCategory_Click(object sender, EventArgs e)
 {
     try
     {
         if (!IsEmtyStr(textBoxCategoryName.Text))
         {
             if (category == null)
             {
                 WarehouseBack.Classes.Category newCategory = new WarehouseBack.Classes.Category();
                 newCategory.Name     = textBoxCategoryName.Text;
                 newCategory.ParentID = Convert.ToInt32(comboBox.SelectedValue);
                 newCategory.Save();
             }
             else
             {
                 category.Name     = textBoxCategoryName.Text;
                 category.ParentID = Convert.ToInt32(comboBox.SelectedValue);
                 category.Save();
             }
             category = null;
             textBoxCategoryName.Text = "";
             comboBox.SelectedValue   = 1;
             MessageBoxOk1();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#3
0
 private void dataGridView_Categories_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         if (MessageBoxOk())
         {
             int id = Convert.ToInt32(dataGridView_Categories.Rows[e.RowIndex].Cells[0].Value);
             category = WarehouseBack.Classes.Category.GetCategory(id);
             category.Delete();
         }
     }
 }
示例#4
0
 private void button_CancelCategory_Click(object sender, EventArgs e)
 {
     category = null;
     textBoxCategoryName.Text = "";
 }