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); } }
private void SaveProduction() { if (!ValidateFields(pageUpdateProduction)) { LocalUtils.ShowValidationFailedMessage(this); } else { var model = new AddEditProductionModel(); model.Date = dtDate.Value; model.ProductID = int.Parse(((ItemX)cboProducts.SelectedItem).Value); model.Quantity = LocalUtils.ConvertToInteger(txtQuantity.Text); // get id if (productionID != 0) { Factories.CreateProduction().Edit(productionID, model); } else { Factories.CreateProduction().Add(model); productionID = model.ID; } LoadProductionGridList(); LocalUtils.ShowSaveMessage(this); } }
private void Save() { try { var model = new MemberModel(); model.Address = txtAddress.Text; model.ContactNumber = txtContactNumber.Text; model.FullName = txtFullName.Text; ValidatedFields(model); if (memberID > 0) { Factories.CreateMember().Edit(memberID, model); } else { Factories.CreateMember().Add(model); } LocalUtils.ShowSaveMessage(this); LoadList(); page.SetPage(pageList); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } }
private void Save() { try { if (!ValidatedFields()) { return; } using (var uow = new UnitOfWork(new DataContext())) { if (_productID == 0) { var product = new Product(); product.CreateTimeStamp = DateTime.Now; product.Description = txtDescription.Text; product.Remarks = txtRemarks.Text; product.Limit = Utils.ConvertToInteger(txtLimit.Text); product.Quantity = Utils.ConvertToInteger(txtQuantity.Text); product.Price = Utils.ConvertToInteger(txtPrice.Text); product.SupplierID = int.Parse(((ItemX)cboSupplier.SelectedItem).Value); uow.Products.Add(product); uow.Complete(); _productID = product.ProductID; } else { var product = uow.Products.Get(_productID); product.CreateTimeStamp = DateTime.Now; product.Description = txtDescription.Text; product.Remarks = txtRemarks.Text; product.Limit = Utils.ConvertToInteger(txtLimit.Text); product.Quantity = Utils.ConvertToInteger(txtQuantity.Text); product.Price = Utils.ConvertToInteger(txtPrice.Text); product.SupplierID = int.Parse(((ItemX)cboSupplier.SelectedItem).Value); uow.Products.Edit(product); uow.Complete(); } //page.SetPage(pageProductList); LocalUtils.ShowSaveMessage(this); LoadProducts(); } } catch (Exception ex) { throw; } }
private async void Save() { if (!ValidatedFields()) { return; } var dto = new UserDTO(); dto.Password = txtPassword.Text; dto.RetypePassword = txtRetypePassword.Text; await Task.Run(() => Factories.CreateUser().Edit(userID, dto)); LocalUtils.ShowSaveMessage(this); this.Close(); }
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 SaveMainData() { try { if (!ValidateFields()) { LocalUtils.ShowValidationFailedMessage(this); } else { // get id if (expenseID != 0) { var model = new ExpenseModel(); model.Date = dtDate.Value; model.Particular = txtParticulars.Text; model.ExpenseTypeID = int.Parse(((ItemX)cboExpenseType.SelectedItem).Value); model.UnitPrice = double.Parse(txtUnitPrice.Text); model.Quantity = int.Parse(txtQuantity.Text); mainLogic.Edit(expenseID, model); LocalUtils.ShowSaveMessage(this); } else { var model = new ExpenseModel(); model.Date = dtDate.Value; model.Particular = txtParticulars.Text; model.ExpenseTypeID = int.Parse(((ItemX)cboExpenseType.SelectedItem).Value); model.UnitPrice = double.Parse(txtUnitPrice.Text); model.Quantity = int.Parse(txtQuantity.Text); mainLogic.Add(model); expenseID = model.ID; LocalUtils.ShowSaveMessage(this); } } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
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 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()); } }
private void txtQuantity_TextChange(object sender, EventArgs e) { LocalUtils.ShowSaveMessage(this); }