private void codeTextBox_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { string productCode = codeTextBox.Text; ProductModel productModel = ProductManagement.SelectProductByCode(productCode); if (!SearchDuplicates(productCode)) { SubCategoryModel subCategoryModel = SubCategoryManagement.SelectSubCategoryById(productModel.IdSubCategory.ToString()); string tax = "0,13"; decimal taxes = (productModel.NormalPrice * decimal.Parse(tax)); dgvAparts.Rows.Add(productModel.IdProduct.ToString(), productModel.Code, productModel.Description, subCategoryModel.Name, 1, productModel.NormalPrice, productModel.NormalPrice, 0, taxes.ToString("##,##0.00")); } codeTextBox.Focus(); codeTextBox.Text = string.Empty; setInformation(); } } catch (Exception) { throw; } }
private void updateSubCategoryButton_Click(object sender, EventArgs e) { string id = subCategoryGridView.CurrentRow.Cells[0].Value.ToString(); string category = cmbCategory.Text; string subcategory = txtNameSub.Text; try { if (SubCategoryManagement.UpdateSubCategoryById(id, category, subcategory)) { FrmMain.Instance.ToolStripLabel.Text = "Se modificó la subcategoría de manera correcta."; Clear(); subCategoryModels = SubCategoryManagement.SelectAllSubCategories(); WireUpSubCategoryGridView(); } else { FrmMain.Instance.ToolStripLabel.Text = "Ha ocurrido un error al modificar la subcategoría, inténtelo nuevamente."; } } catch (Exception) { throw; } }
private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e) { CategoryModel categoryModel = (CategoryModel)cmbCategory.SelectedItem; int id = categoryModel.IdCategory; cmbSubcategory.DataSource = SubCategoryManagement.SelectCatWithSub(id); cmbSubcategory.DisplayMember = "Name"; }
private List <SelectListItem> getSubCategoryDropDownData() { SubCategoryManagement subCategoryManagement = new SubCategoryManagement(); var query = from cat in subCategoryManagement.GetAllSubCategory() select new SelectListItem { Value = cat.SubCategory_ID.ToString(), Text = cat.SubCategory_Name }; return(query.ToList()); }
private void UcProduct_Load(object sender, EventArgs e) { categoryModels = CategoryManagement.SelectAllCategories(); subCategoryModels = SubCategoryManagement.SelectAllSubCategories(); dgvProduct.DataSource = ProductManagement.SelectAllProducts(); cmbBrand.DataSource = BrandManagement.SelectAllBrands(); cmbBrand.DisplayMember = "Name"; WireUpCategoryComboBox(); WireUpSubCategoryComboBox(); }
public ActionResult getSubCategory(int Category_ID) { SubCategoryManagement subCategoryManagement = new SubCategoryManagement(); var query = from subCategory in subCategoryManagement.GetSubCategoryByCategoryID(Category_ID) select new SelectListItem { Value = subCategory.SubCategory_ID.ToString(), Text = subCategory.SubCategory_Name }; List <SelectListItem> SubCategories = query.ToList(); return(Json(SubCategories, JsonRequestBehavior.AllowGet)); }
private void subcategoryTextBox_KeyUp(object sender, KeyEventArgs e) { string subcategory = subcategoryTextBox.Text; if (e.KeyCode == Keys.Enter) { if (subcategory != " ") { foreach (SubCategoryModel subCategoryModel in SubCategoryManagement.SelectSubCategoryByNames(subcategory)) { dgvSearchProduct.DataSource = ProductManagement.SelectProductByIdSubCategory(subCategoryModel.IdsubCategory.ToString()); } } } }
private void codeTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string productCode = codeTextBox.Text; ProductModel productModel = ProductManagement.SelectProductByCode(productCode); if (!SearchDuplicates(productCode)) { SubCategoryModel subCategoryModel = SubCategoryManagement.SelectSubCategoryById(productModel.IdSubCategory.ToString()); dgvInputExitProduct.Rows.Add(productModel.IdProduct.ToString(), productModel.Code, productModel.Description, subCategoryModel.Name, 1, productModel.NormalPrice); } codeTextBox.Focus(); codeTextBox.Text = string.Empty; } }
private void UcCategory_Load(object sender, EventArgs e) { try { if (CategoryManagement.SelectAllCategories() != null && SubCategoryManagement.SelectAllSubCategories() != null) { categoryModels = CategoryManagement.SelectAllCategories(); FrmMain.Instance.ToolStripLabel.Text = "Los registros de la base de datos fueron cargados."; WireUpCategoryGridView(); WireUpSubCategoryGridView(); WireUpCategoryComboBox(); } } catch (Exception ex) { throw; } }
//---------CRUD---------// private void createSubCategoryButton_Click(object sender, EventArgs e) { CategoryModel categoryModel = (CategoryModel)cmbCategory.SelectedItem; string subcategory = txtNameSub.Text; try { if (SubCategoryManagement.InsertSubCategory(subcategory, categoryModel.IdCategory.ToString())) { FrmMain.Instance.ToolStripLabel.Text = "Se agregó la subcategoría de manera correcta."; Clear(); subCategoryModels = SubCategoryManagement.SelectAllSubCategories(); WireUpSubCategoryGridView(); } else { FrmMain.Instance.ToolStripLabel.Text = "Ha ocurrido un error al agregar la subcategoría, inténtelo nuevamente."; } } catch (Exception) { throw; } }