private void Save() { var model = new SupplyInventoryModel(); model.SupplyTypeID = supplyTypeID; model.SupplyClassID = supplyClassID; model.PurchaseQuantity = LocalUtils.ConvertToDouble(txtPurchaseQty.Text); // get id if (id != 0) { model.Date = dtDate.Value; if (!ValidateFields()) { LocalUtils.ShowValidationFailedMessage(this); return; } Factories.CreateSupplyInventory().Edit(id, model); LocalUtils.ShowSaveMessage(this); } else { model.Date = dtSearchDate.Value; Factories.CreateSupplyInventory().Add(model); id = model.ID; mainPage.SetPage(pageDetail); bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } }
void ComputeTotal() { var quantity = LocalUtils.ConvertToDouble(txtQuantity.Text); var unitPrice = LocalUtils.ConvertToDouble(txtUnitPrice.Text); var discount = LocalUtils.ConvertToDouble(txtDiscount.Text); double total = Factories.CreateProductSale().ComputeTotal(quantity, unitPrice, discount); txtTotal.Text = total.ToString(); }
private void Compute() { try { var quantity = LocalUtils.ConvertToInteger(txtQuantity.Text); var unitprice = LocalUtils.ConvertToDouble(txtUnitPrice.Text); var total = mainLogic.ComputeTotal(quantity, unitprice); txtTotal.Text = total.ToString(); } catch (Exception) { throw; } }
private void Compute() { try { var withdrawQty = LocalUtils.ConvertToDouble(txtWithdrawQty.Text); var purchaseQty = LocalUtils.ConvertToDouble(txtPurchaseQty.Text); var unitprice = LocalUtils.ConvertToDouble(txtUnitPrice.Text); var purchaseTotal = Factories.CreateSupplyInventory().Compute(purchaseQty, unitprice); var widthdrawTotal = Factories.CreateSupplyInventory().Compute(withdrawQty, unitprice); txtPurchaseTotal.Text = purchaseTotal.ToString(); txtWithdrawTotal.Text = widthdrawTotal.ToString(); } catch (Exception) { throw; } }
private void Save() { //id greater than zero = edit //id equal to zero = add if (milkUtilizeRecordID == 0) { // Add new record var model = new MilkUtilizeAddModel(); model.ActualDate = dtDateSelection.Value; //model.Analysis = LocalUtils.ConvertToDouble(txtAnalysis.Text); //model.Demo = LocalUtils.ConvertToInteger(txtDemo.Text); //model.Remarks = txtRemarks.Text; //model.Spillage = LocalUtils.ConvertToDouble(txtSpillage.Text); //model.SpoilageQty = LocalUtils.ConvertToDouble(txtSpoilageQty.Text); //model.SpoilageValue = LocalUtils.ConvertToDouble(txtSpoilageValue.Text); //model.WithdrawnByProcessor = txtWithdrawnByProcessor.Text; //model.Remarks = txtRemarks.Text; Factories.CreateMilkUtilize().Add(model); milkUtilizeRecordID = model.ID; } else { if (!ValidateFields()) { LocalUtils.ShowValidationFailedMessage(this); return; } // Edit record var model = new MilkUtilizeEditModel(); model.Analysis = LocalUtils.ConvertToDouble(txtAnalysis.Text); model.Demo = LocalUtils.ConvertToInteger(txtDemo.Text); model.Remarks = txtRemarks.Text; model.Spillage = LocalUtils.ConvertToDouble(txtSpillage.Text); model.SpoilageQty = LocalUtils.ConvertToDouble(txtSpoilageQty.Text); model.SpoilageValue = LocalUtils.ConvertToDouble(txtSpoilageValue.Text); model.WithdrawnByProcessor = txtWithdrawnByProcessor.Text; model.Remarks = txtRemarks.Text; Factories.CreateMilkUtilize().Edit(milkUtilizeRecordID, model); mainPage.SetPage(pageList); } LocalUtils.ShowSaveMessage(this); }
public void Save() { try { if (!ValidateFields(pnlUpdate)) { LocalUtils.ShowValidationFailedMessage(this); } else { var model = new ProductSaleModel(); model.CustomerName = txtCustomerName.Text; model.Date = dtDate.Value; model.Discount = LocalUtils.ConvertToDouble(txtDiscount.Text); model.IsBuyOneTakeOne = chkIsBuyOneTakeOne.Checked; model.Quantity = LocalUtils.ConvertToDouble(txtQuantity.Text); model.UnitPrice = LocalUtils.ConvertToDouble(txtUnitPrice.Text); model.OutletSaleName = cboOutletSaleName.Text; model.ProductID = int.Parse(((ItemX)cboProducts.SelectedItem).Value); // get id if (productSaleID != 0) { Factories.CreateProductSale().Edit(productSaleID, model); LocalUtils.ShowSaveMessage(this); } else { Factories.CreateProductSale().Add(model); productSaleID = model.ID; LocalUtils.ShowSaveMessage(this); } } } catch (ApplicationException ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void Compute() { try { var model = new MilkUtilizeComputeModel(); model.TotalMilkForUtilization = LocalUtils.ConvertToDouble(txtTotalMilkForUtilization.Text); model.TotalMilkSold = LocalUtils.ConvertToDouble(txtTotalRawMilkSold.Text); model.RawMilkProcess = LocalUtils.ConvertToDouble(txtRawMilkProcess.Text); model.Spillage = LocalUtils.ConvertToDouble(txtSpillage.Text); model.Analysis = LocalUtils.ConvertToDouble(txtAnalysis.Text); var result = Factories.CreateMilkUtilize().Compute(model); // Get the result txtTotalRawMilkWithdrawn.Text = result.TotalRawMilkWithdrawn.ToString(); txtEndingBalance.Text = result.EndingBalance.ToString(); } catch (Exception) { throw; } }
private void chkIsBuyOneTakeOne_CheckedChanged(object sender, BunifuCheckBox.CheckedChangedEventArgs e) { if (chkIsBuyOneTakeOne.Checked) { if (txtQuantity.Text != string.Empty) { txtAdditionalQuantity.Text = (LocalUtils.ConvertToDouble(txtQuantity.Text) * 2.0).ToString(); } else { LocalUtils.ShowErrorMessage(this, "Quantity cannot be empty!"); chkIsBuyOneTakeOne.Checked = false; txtQuantity.Text = "0"; } } else { txtAdditionalQuantity.Text = "0"; } }
private void SaveProduct() { try { if (!ValidateFields(pageUpdateProduct)) { LocalUtils.ShowValidationFailedMessage(this); } else { var model = new ProductModel(); model.Name = txtProductName.Text; model.UnitPrice = LocalUtils.ConvertToDouble(txtUnitPrice.Text); model.IsProduce = chkProduce.Checked; // get id if (productID != 0) { Factories.CreateProduct().Edit(productID, model); LoadProductsGridList(); LocalUtils.ShowSaveMessage(this); } else { Factories.CreateProduct().Add(model); productID = model.ID; LoadProductsGridList(); LocalUtils.ShowSaveMessage(this); } } } catch (ApplicationException ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
public void Save() { try { if (!ValidateFields()) { LocalUtils.ShowValidationFailedMessage(this); } else { var model = new DailySaleRecordModel(); model.Debtor = txtDebtor.Text; model.Date = dtDate.Value; model.ProcessingSale = LocalUtils.ConvertToDouble(txtProcessingSale.Text); model.SaleOnAccount = LocalUtils.ConvertToDouble(txtSalesOnAccount.Text); // get id if (dailySaleID != 0) { Factories.CreateDailySale().Edit(dailySaleID, model); LocalUtils.ShowSaveMessage(this); } else { Factories.CreateDailySale().Add(model); dailySaleID = model.ID; LocalUtils.ShowSaveMessage(this); } } } catch (ApplicationException ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void Compute() { try { var outletSale1 = LocalUtils.ConvertToDouble(txtOutletSale1.Text); var outletSale2 = LocalUtils.ConvertToDouble(txtOutletSale2.Text); var processingSale = LocalUtils.ConvertToDouble(txtProcessingSale.Text); var saleOnAccount = LocalUtils.ConvertToDouble(txtSalesOnAccount.Text); var rawMilkSale = LocalUtils.ConvertToDouble(txtRawMilkSales.Text); var totalSaleDairyProduct = LocalUtils.ConvertToDouble(txtTotalSaleDairyProducts.Text); var c_totalCashSale = Factories.CreateDailySale().ComputeTotalCashSale(outletSale1, outletSale2, processingSale); var c_totalSale = Factories.CreateDailySale().ComputeTotalSale(outletSale1, outletSale2, processingSale, saleOnAccount, rawMilkSale); var c_totalSaleDairyProduct = Factories.CreateDailySale().ComputeTotalSaleDairyProduct(outletSale1, outletSale2, processingSale, saleOnAccount); txtTotalSale.Text = c_totalSale.ToString(); txtTotalCashSale.Text = c_totalCashSale.ToString(); txtTotalSaleDairyProducts.Text = c_totalSaleDairyProduct.ToString(); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void SaveProductRawMaterial() { try { if (!ValidateFields(pageUpdateProductRawMaterials)) { LocalUtils.ShowValidationFailedMessage(this); } else { var model = new AddEditProductRawMaterialModel(); model.ProductID = productID; model.SupplyTypeID = int.Parse(((ItemX)cboSupplyTypes.SelectedItem).Value); model.Quantity = LocalUtils.ConvertToDouble(txtQuantity.Text); // get id if (productRawMaterialID != 0) { Factories.CreateProduct().EditProductRawMaterial(productRawMaterialID, model); } else { Factories.CreateProduct().AddProductRawMaterial(model); } LoadProductRawMaterialGridList(); LocalUtils.ShowSaveMessage(this); } page.SetPage(pageUpdateProduct); } catch (ApplicationException ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }