public void CategoryArrToForm(CategoryProduct curCategoryProduct, ComboBox comboBox, bool isMustChoose) { //ממירה את הטנ"מ אוסף ישובים לטופס CategoryProductArr catrgoryProductArr = new CategoryProductArr(); CategoryProduct categoryProductDefault = new CategoryProduct(); categoryProductDefault.ID = -1; if (isMustChoose) { categoryProductDefault.CategoryProductName = "Choose category"; } else { categoryProductDefault.CategoryProductName = "Every category"; } catrgoryProductArr.Add(categoryProductDefault); catrgoryProductArr.Fill(); comboBox.DataSource = catrgoryProductArr; comboBox.ValueMember = "ID"; comboBox.DisplayMember = "CategoryProductName"; if (curCategoryProduct != null) { comboBox.SelectedValue = curCategoryProduct.ID; } }
private void CategoryProductArrToForm() { //ממירה את הטנ"מ אוסף למוצרים לטופס CategoryProductArr categoryProductArr = new CategoryProductArr(); categoryProductArr.Fill(); listBox_category_potential.DataSource = categoryProductArr; }
private void CategoryProductArrToForm(CategoryProductArr categoryProductArr, ListBox listBox) { listBox.DataSource = null; if (categoryProductArr == null) { categoryProductArr = new CategoryProductArr(); categoryProductArr.Fill(); } listBox.DataSource = categoryProductArr; }
private void Save(object sender, EventArgs e) { if (!CheckGood()) { MessageBox.Show("You didn't write right", "TRY AGAIN", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); All_White(); } else { CategoryProduct categoryProduct = FormToCategoryProduct(); if (categoryProduct.ID == 0) { CategoryProductArr oldCategoryProductArr = new CategoryProductArr(); oldCategoryProductArr.Fill(); if (!oldCategoryProductArr.IsContains(categoryProduct)) { if (categoryProduct.Insert()) { MessageBox.Show("CategoryProduct Details Saved"); Clean_Form(); CategoryProductArr categoryProductArr = new CategoryProductArr(); categoryProductArr.Fill(); categoryProduct = categoryProductArr.GetCategoryRoonWithMaxId(); CategoryProductArrToForm(categoryProduct); Close(); } else { MessageBox.Show("Cannot Save CategoryProduct Details"); } } else { MessageBox.Show("CategoryProduct already existing"); } } else { if (categoryProduct.Update()) { MessageBox.Show("CategoryProduct Details UPDATED"); Clean_Form(); CategoryProductArrToForm(null); } else { MessageBox.Show("Cannot UPDATE CategoryProduct Details"); } } } }
private void CategoryProductArrToForm(CategoryProduct curCategoryProduct) { //ממירה את הטנ"מ אוסף לקוחות לטופס CategoryProductArr CategoryProductArr = new CategoryProductArr(); CategoryProductArr.Fill(); listBox_Category.DataSource = CategoryProductArr; listBox_Category.ValueMember = "ID"; listBox_Category.DisplayMember = "CategoryProductName"; //אם נשלח לפעולה ישוב ,הצבתו בתיבת הבחירה של ישובים בטופס if (curCategoryProduct != null) { listBox_Category.SelectedValue = curCategoryProduct.ID; } }
private void listBox_Clients_DoubleClick(object sender, EventArgs e) { ProductToForm(listBox_product.SelectedItem as Product); CategoryProductArr categoryProductArrChoosed = new CategoryProductArr(); ProductDetailsArr productDetailsArr = new ProductDetailsArr(); productDetailsArr.Fill(); productDetailsArr = productDetailsArr.Filter((listBox_product.SelectedItem as Product)); categoryProductArrChoosed = productDetailsArr.GetCategoryProductArr(); CategoryProductArrToForm(categoryProductArrChoosed, listBox_category_choosed); CategoryProductArr categoryProductArrNotChoosed = new CategoryProductArr(); categoryProductArrNotChoosed.Fill(); categoryProductArrNotChoosed.Remove(categoryProductArrChoosed); CategoryProductArrToForm(categoryProductArrNotChoosed, listBox_category_potential); }