private void DataGridViewConsumbleCategories_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (updateFlag)
     {
         DataGridViewCellCollection collection = dataGridViewConsumbleCategories.Rows[e.RowIndex].Cells;
         ConsumbleCategorieCore.EditConsumbleCategorie(collection[0].Value.ToString(), collection[1].Value.ToString(), collection[2].Value.ToString() == GeneralConstants.YES ? "1" : "0", ConsumblesTypesCore.ConsumbleTypes.GetID(collection[3].Value.ToString()));
         dataGridViewConsumbleCategories.CellValueChanged -= DataGridViewConsumbleCategories_CellValueChanged;
         updateFlag   = false;
         selectColumn = e.ColumnIndex;
         selectedRow  = e.RowIndex;
         DownloadConsumbleCategories();
     }
 }
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxName.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME);
     }
     else
     {
         ConsumbleCategorieCore.AddConsumbleCategorie(textBoxName.Text, ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()));
         ConsumbleCategorieForm.instance.DownloadConsumbleCategories();
         this.Close();
     }
 }
Esempio n. 3
0
 private void ComboBoxType_SelectedIndexChanged(object sender, EventArgs e)
 {
     ConsumbleCategorieCore.GetConsumbleCategorie(ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()).ToString());
     try
     {
         comboBoxCategory.DataSource    = ConsumbleCategorieCore.consumbleCategories.ToList();
         comboBoxCategory.SelectedIndex = 0;
     }
     catch
     {
         comboBoxConsumbles.DataSource = null;
         comboBoxCategory.Text         = "";
         buttonOk.Enabled = false;
     }
 }
Esempio n. 4
0
 private void comboBoxType_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (comboBoxCategory.Items != null)
     {
         comboBoxCategory.Items.Clear();
     }
     ConsumbleCategorieCore.GetConsumbleCategorie(ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()).ToString());
     if (ConsumbleCategorieCore.consumbleCategories.items.Count > 0)
     {
         foreach (string category in ConsumbleCategorieCore.consumbleCategories.ToList())
         {
             comboBoxCategory.Items.Add(category);
         }
         comboBoxCategory.SelectedIndex = 0;
     }
     else
     {
         comboBoxCategory.Text    = "";
         comboBoxCategory.Enabled = false;
     }
     this.Refresh();
 }
        public void DownloadConsumbleCategories()
        {
            bool isOk   = true;
            long typeID = -1;

            try
            {
                typeID = ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxConsumbleTypes.SelectedItem.ToString());
            }
            catch
            {
                isOk = false;
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_TYPE_BEFORE);
            }
            if (isOk)
            {
                new Thread(() =>
                {
                    ConsumbleCategorieCore.GetConsumbleCategorie(typeID.ToString());
                    UpdateDataGridView(typeID);
                }).Start();
            }
        }