private void DeleteProductRawMaterial() { if (gridProductRawMaterials.SelectedRows.Count > 0) { productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString()); if (productRawMaterialID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateProduct().DeleteProductRawMaterial(productRawMaterialID); LocalUtils.ShowDeleteSuccessMessage(this); LoadProductRawMaterialGridList(); productRawMaterialID = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } }
private void Delete() { try { var grid = gridProducts; if (grid.SelectedRows.Count > 0) { var posTransactionProductID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString()); if (posTransactionProductID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateProducts().Delete(posTransactionProductID); LoadProducts(); } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { //LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void SetProductRawMaterialData() { if (gridProductRawMaterials.SelectedRows.Count > 0) { // get id productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString()); if (productRawMaterialID != 0) { //show and hide controls page.SetPage(pageUpdateProductRawMaterials); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); // populate data var obj = Factories.CreateProduct().GetProductRawMaterial(productRawMaterialID); cboSupplyClass.SelectedItem = LocalUtils.GetSelectedItemX(cboSupplyClass.Items, obj.SupplyClassID.ToString()); cboSupplyTypes.SelectedItem = LocalUtils.GetSelectedItemX(cboSupplyTypes.Items, obj.SupplyTypeID.ToString()); txtQuantity.Text = obj.Quantity.ToString(); } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (gridList.SelectedRows.Count > 0) { id = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (id != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateSupplyInventory().Delete(id); LocalUtils.ShowDeleteSuccessMessage(this); ShowMainGrid(); id = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
private void Delete() { try { if (gridList.SelectedRows.Count > 0) { userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (userID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateUser().Delete(userID); LocalUtils.ShowDeleteSuccessMessage(this); ShowMainGrid(); userID = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
private void Edit() { try { if (gridList.SelectedRows.Count > 0) { // get id userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (userID != 0) { //show and hide controls mainPage.SetPage(pageDetail); bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); ResetInputs(pnlAddEdit); SetData(); } else { LocalUtils.ShowNoRecordFoundMessage(this); mainPage.SetPage(pageGridMain); bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void gridProducts_CellClick(object sender, DataGridViewCellEventArgs e) { try { var grid = gridProductLogs; if (grid.SelectedRows.Count > 0) { var id = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString()); if (id != 0) { //var model = Factories.CreateProducts().Get(_productID); } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { //LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void SetProductData() { try { if (gridList.SelectedRows.Count > 0) { // get id productID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (productID != 0) { //show and hide controls page.SetPage(pageUpdateProduct); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); // populate data var model = Factories.CreateProduct().Get(productID); productID = model.ID; txtProductName.Text = model.Name; txtUnitPrice.Text = model.UnitPrice.ToString(); chkProduce.Checked = model.IsProduce; LoadProductRawMaterialGridList(); page.SetPage(pageUpdateProduct); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } else { LocalUtils.ShowNoRecordFoundMessage(this); page.SetPage(pageUpdateProduct); bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
private void SetProductionData() { try { if (gridProductionList.SelectedRows.Count > 0) { // get id productionID = int.Parse(gridProductionList.SelectedRows[0].Cells[0].Value.ToString()); if (productionID != 0) { //show and hide controls page.SetPage(pageUpdateProduction); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); // populate data var obj = Factories.CreateProduction().Get(productionID); dtDate.Value = obj.Date; cboProducts.SelectedItem = LocalUtils.GetSelectedItemX(cboProducts.Items, obj.ProductID.ToString()); txtQuantity.Text = obj.Quantity.ToString(); page.SetPage(pageUpdateProduction); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } else { LocalUtils.ShowNoRecordFoundMessage(this); page.SetPage(pageUpdateProduction); bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
private void SetMainData() { try { if (gridList.SelectedRows.Count > 0) { // get id expenseID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (expenseID != 0) { //show and hide controls mainPage.SetPage(tabMainData); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); var obj = mainLogic.GetBy(expenseID); dtDate.Value = obj.Date; txtParticulars.Text = obj.Particular; txtTotal.Text = obj.Total.ToString(); txtUnitPrice.Text = obj.UnitPrice.ToString(); txtQuantity.Text = obj.Quantity.ToString(); cboExpenseType.SelectedItem = LocalUtils.GetSelectedItemX(cboExpenseType.Items, obj.ExpenseTypeID.ToString()); } else { LocalUtils.ShowNoRecordFoundMessage(this); mainPage.SetPage(tabGridList); bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }