public StockController(IConfiguration iConfig) { this.configuration = iConfig; string table_name = this.configuration.GetValue <string>("StockTableName"); this.bLL = new StockBLL(table_name); }
public async void TestGetAll_ASX300() { StockBLL bll = new StockBLL(tableName); var result = await bll.GetAll(); Console.WriteLine(ObjectHelper.ToJson(result)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentEncoding = Encoding.UTF8; context.Response.ContentType = "application/json"; string idCode = context.Request.QueryString["IDCode"]; StockBLL bll = BLLFactory.CreateBLL <StockBLL>(); WHMatAmount mat = null; if (string.IsNullOrEmpty(idCode) == false) { //根据识别码 mat = bll.GetStockByBarCode(idCode); if (mat == null || mat.ProductAmount == 0) { mat = new WHMatAmount(); mat.MatCode = "none"; mat.MatBarCode = "none"; } } context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(mat)); }
private void itemNamecomboBox_SelectedIndexChanged(object sender, EventArgs e) { try { if (Convert.ToInt32(itemNamecomboBox.SelectedValue) > 0) { InventoryItem aItem = new InventoryItem(); aItem = (InventoryItem)itemNamecomboBox.SelectedItem; unittypelabel.Text = aItem.UnitName; string transactiontype = transactionTypecomboBox.SelectedItem.ToString(); if (transactiontype == "Send_to_Kitchen" || transactiontype == "Damage_in_Stock") { if (transactiontype == "Damage_in_Stock") { ShowDamageField(); } else if (transactiontype == "Send_to_Kitchen") { HideDamageField(); } aItem = (InventoryItem)itemNamecomboBox.SelectedItem; Stock aStock = new Stock(); StockBLL aStockBll = new StockBLL(); aStock = aStockBll.GetStockByItemid(aItem.ItemId); stocklabel.Visible = true; stocklabel.Text = "Now Current Stocks are " + aStock.Stocks + " " + unittypelabel.Text; } if (transactiontype == "Return_from_Kitchen" || transactiontype == "Damage_in_kitchen" || transactiontype == "Stock In") { if (transactiontype == "Damage_in_kitchen") { ShowDamageField(); } else if (transactiontype == "Return_from_Kitchen") { HideDamageField(); } else if (transactiontype == "Stock In") { HideDamageField(); } aItem = (InventoryItem)itemNamecomboBox.SelectedItem; Stock aStock = new Stock(); StockBLL aStockBll = new StockBLL(); aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); stocklabel.Visible = true; stocklabel.Text = "Now Current Kitchen Stocks are " + aStock.Stocks + " " + unittypelabel.Text; } } } catch { } }
public void ProcessRequest(HttpContext context) { context.Response.ContentEncoding = Encoding.UTF8; context.Response.ContentType = "application/json"; string idCode = context.Request.QueryString["IDCode"]; string matCode = context.Request.QueryString["MatCode"]; WHMatBLL bll = BLLFactory.CreateBLL <WHMatBLL>(); WHMat mat = null; bool exists = false; if (string.IsNullOrEmpty(idCode) == false) { //根据识别码 mat = bll.GetMatByIDCode(idCode); if (mat != null) { mat.BarCode = idCode; //判断条码是否已入库 WHMatAmount amount = new StockBLL().GetStockByBarCode(idCode); exists = amount != null ? true : false; if (amount != null) { mat.Warehouse = amount.Warehouse; mat.SaveSite = amount.SaveSite; } } } else { //根据货品编号 mat = bll.GetMatByMatCode(matCode); if (mat != null) { mat.BarCode = ""; } } if (mat == null) { mat = new WHMat(); if (mat != null) { mat.MatCode = "none"; } } MatGetResult result = LAF.Common.Util.BindHelper.CopyToModel <MatGetResult, WHMat>(mat); result.CheckResult = exists == true?"该条码已入库,无需再次操作":""; context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(result)); }
public frmStock() { productBLL = new ProductBLL(dbHelper); stockBLL = new StockBLL(dbHelper); invoiceBLL = new InvoiceBLL(dbHelper); InitializeComponent(); FillCombo(); FillGrid(); this.dvStock.AllowUserToAddRows = false; }
//observer design pattern // observer // update status by observer public void ReceiveAndNotify(object obj) { StockBLL sbp = obj as StockBLL; if (sbp != null) { labelNotify.Text += sbp.StockID.ToString() + "is empty now, need to restore.\n"; labelNotify.Visible = true; } }
public frmStockReport() { this.prnDialog = new System.Windows.Forms.PrintDialog(); this.prnPreview = new System.Windows.Forms.PrintPreviewDialog(); this.prnDocument = new System.Drawing.Printing.PrintDocument(); // The Event of 'PrintPage' prnDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(prnDocument_PrintPage); stockBLL = new StockBLL(dbHelper); // inventoryBLL = new InventoryBLL(dbHelper); // productBLL = new ProductBLL(dbHelper); InitializeComponent(); }
private void FrmReleaseOrder_Load(object sender, EventArgs e) { //Traducciones SessionHelper.RegisterForTranslation(this, Codes.MNU_GE016); SessionHelper.RegisterForTranslation(cmdAccept, Codes.BTN_ACCEPT); SessionHelper.RegisterForTranslation(cmdClose, Codes.BTN_CLOSE); SessionHelper.RegisterForTranslation(lblBeneficiary, Codes.LBL_BENEFICIARY); SessionHelper.RegisterForTranslation(lblStock, Codes.LBL_STOCK); SessionHelper.RegisterForTranslation(lblQuantity, Codes.LBL_QUANTITY); SessionHelper.RegisterForTranslation(lblComment, Codes.LBL_OBSERVATION); try { BeneficiaryBLL beneficiaryBll = new BeneficiaryBLL(); ResultBM beneficiaryResult = beneficiaryBll.GetBeneficiaries(); cmbBeneficiary.DataSource = beneficiaryResult.GetValue <List <BeneficiaryBM> >(); cmbBeneficiary.DisplayMember = "FullName"; StockBLL stockBll = new StockBLL(); ResultBM stockResult = stockBll.GetAvailableStocks(); lstStock.DataSource = stockResult.GetValue <List <StockBM> >(); lstStock.DisplayMember = "Name"; if (IsUpdate) { bool found = false; for (int i = 0; i < cmbBeneficiary.Items.Count && !found; ++i) { found = ((BeneficiaryBM)cmbBeneficiary.Items[i]).id == this.Entity.beneficiary.id; if (found) { cmbBeneficiary.SelectedIndex = i; } } lstAdded = this.Entity.detail; dgRelease.DataSource = lstAdded; txtComment.Text = this.Entity.Comment; } else { entity = new ReleaseOrderBM(); } } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void BindData() { StockBLL bll = null; DataPage dp = new DataPage(); WHMatAmount condition = new WHMatAmount(); try { bll = BLLFactory.CreateBLL <StockBLL>(); condition.Warehouse = this.Warehouse.SelectedValue; condition.ProductType = this.ProductType.SelectedValue; condition.MatID = this.MatID.SelectedValue; condition.IsDetail = this.CbxDetail.Checked; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); if (condition.IsDetail == false) { this.GvList.Columns[1].Visible = false; this.GvList.Columns[2].Visible = false; this.GvList.Columns[8].Visible = false; this.GvList.Columns[9].Visible = false; this.GvList.Columns[10].Visible = false; this.GvList.Columns[12].Visible = false; this.GvList.Columns[13].Visible = false; } else { this.GvList.Columns[1].Visible = true; this.GvList.Columns[2].Visible = true; this.GvList.Columns[8].Visible = true; this.GvList.Columns[9].Visible = true; this.GvList.Columns[10].Visible = true; this.GvList.Columns[12].Visible = true; this.GvList.Columns[13].Visible = true; } List <WHMatAmount> list = dp.Result as List <WHMatAmount>; this.GvList.DataSource = list; this.GvList.DataBind(); PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
private void cmdAccept_Click(object sender, EventArgs e) { DialogResult pressed = MessageBox.Show(SessionHelper.GetTranslation("SAVE_CHANGES_QUESTION"), "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (pressed == DialogResult.No) { return; } try { StockBLL stockBll = new StockBLL(); ResultBM stockResult; this.Entity.Name = txtName.Text; this.Entity.Quantity = int.Parse(numericQuantity.Value.ToString()); this.Entity.itemType = (ItemTypeBM)cmbItemType.SelectedItem; this.Entity.donation = (DonationBM)cmbDonation.SelectedItem; this.Entity.depot = (DepotBM)cmbDepot.SelectedItem; this.Entity.DueDate = dtDueDate.Value; this.Entity.Location = txtLocation.Text; if (isUpdate) { stockResult = stockBll.UpdateStock(this.Entity); } else { stockResult = stockBll.SaveStock(this.Entity); } if (stockResult.IsValid()) { Close(); } else { MessageBox.Show(stockResult.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public async void TestMigrateExistingTickersToDb() { string tempTickerFolder = "/tmp/screen3_temp_files/localticker/"; string tableName = "stevenjiangnz-screen3-tickers"; TickerBLL bll = new TickerBLL(this.s3_bucket_name, tempTickerFolder); TickerDbBLL dbBll = new TickerDbBLL(tableName); string stock_tableName = "stevenjiangnz-screen3-asx300"; StockBLL stockbll = new StockBLL(stock_tableName); var stockList = await stockbll.GetAll(); Console.WriteLine("stocklist: " + ObjectHelper.ToJson(stockList.Count)); foreach (var stock in stockList) { var tickerList = await bll.GetDailyTickerEntityList(stock.Code); await dbBll.AppendTickerRange(tickerList); Console.WriteLine($"updated ticker count: {tickerList.Count}, {stock.Code}"); } }
private void TransactionWhenBusinessPackageIsActive() { InventoryItem aItem = new InventoryItem(); aItem = (InventoryItem)itemNamecomboBox.SelectedItem; InventoryCategory aInventoryCategory = new InventoryCategory(); aInventoryCategory = (InventoryCategory)categoryNamecomboBox.SelectedItem; Stock aStock = new Stock(); StockBLL aStockBll = new StockBLL(); string transactiontype = transactionTypecomboBox.SelectedItem.ToString(); Transaction aTransaction = new Transaction(); aTransaction.TransactionDate = DateTime.Now; aTransaction.Item = aItem; aTransaction.Category = aInventoryCategory; aTransaction.TransactionType = transactiontype; CUserInfo aUserInfo = new CUserInfo(); aUserInfo.UserName = RMSGlobal.LogInUserName; aTransaction.UserInfo = aUserInfo; string sr = string.Empty; if (transactiontype == "Stock In") { // aStock = aStockBll.GetStockByItemid(aItem.ItemId); if ((Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; TransactionBLL aBll = new TransactionBLL(); sr = aBll.SendToKitchen(aTransaction); ShowAndClear(sr); } else { MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } } //aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); if (transactiontype == "Damage_in_kitchen") { if (danmagetextBox.Text.Length > 0) { aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''"); TransactionBLL aBll = new TransactionBLL(); sr = aBll.DamageInKitchen(aTransaction); ShowAndClear(sr); } else { MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } } else { MessageBox.Show("Please Check Your Damage Report Field It's Never Empty"); } } }
private void savePurchasebutton_Click(object sender, EventArgs e) { try { if (expiredateTimePicker.Value.Date == DateTime.Now.Date) { DialogResult result = MessageBox.Show("Do you want to Empty Expire Date?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { } else if (result == DialogResult.No) { return; } } if (pricetextBox.Text.Length != 0 && paidPricetextBox.Text.Length != 0 && quantitytextBox.Text.Length != 0) { InventoryPurchase aInventoryPurchase = new InventoryPurchase(); InventoryCategory aCategory = new InventoryCategory(); InventoryItem aItem = new InventoryItem(); Supplier aSupplier = new Supplier(); Supplier aaSupplier = new Supplier(); Unit aUnit = new Unit(); //Add for purchase record aCategory = (InventoryCategory)categoryNamecomboBox.Items[categoryNamecomboBox.SelectedIndex]; SupplierBLL aSupplierBll = new SupplierBLL(); aSupplier = aSupplierBll.GetSupplierByid(Convert.ToInt32(supplierNamecomboBox.SelectedValue)); // aSupplier = (Supplier) supplierNamecomboBox.Items[supplierNamecomboBox.SelectedIndex]; if (aSupplier.PaidAmount > aSupplier.TotalAmount) { aSupplier.AdvanceAmount = aSupplier.PaidAmount - aSupplier.TotalAmount; } else { aSupplier.DueAmount = aSupplier.TotalAmount - aSupplier.PaidAmount; } aItem = (InventoryItem)itemNamecomboBox.Items[itemNamecomboBox.SelectedIndex]; aInventoryPurchase.Quantity = Convert.ToDouble(quantitytextBox.Text); aInventoryPurchase.Price = Convert.ToDouble(pricetextBox.Text); aInventoryPurchase.Date = DateTime.Now; aInventoryPurchase.Category = aCategory; aInventoryPurchase.Item = aItem; aaSupplier.PaidAmount = Convert.ToDouble(paidPricetextBox.Text); aInventoryPurchase.Supplier = aaSupplier; if (((aSupplier.DueAmount + Convert.ToDouble(pricetextBox.Text) - (Convert.ToDouble(paidPricetextBox.Text) + aSupplier.AdvanceAmount))) >= 0) { aInventoryPurchase.Supplier.DueAmount = aSupplier.DueAmount + Convert.ToDouble(pricetextBox.Text) - (Convert.ToDouble(paidPricetextBox.Text) + aSupplier.AdvanceAmount); } else { aInventoryPurchase.Supplier.DueAmount = 0.0; } if (((Convert.ToDouble(paidPricetextBox.Text) + aSupplier.AdvanceAmount) - (aSupplier.DueAmount + Convert.ToDouble(pricetextBox.Text))) >= 0) { aInventoryPurchase.Supplier.AdvanceAmount = (Convert.ToDouble(paidPricetextBox.Text) + aSupplier.AdvanceAmount) - (aSupplier.DueAmount + Convert.ToDouble(pricetextBox.Text)); } else { aInventoryPurchase.Supplier.AdvanceAmount = 0.0; } aInventoryPurchase.Supplier.Name = aSupplier.Name; aInventoryPurchase.Supplier.SupplierId = aSupplier.SupplierId; aUnit.UnitName = unittypelabel.Text; aInventoryPurchase.Unit = aUnit; CUserInfo aUserInfo = new CUserInfo(); aUserInfo.UserName = RMSGlobal.LogInUserName; aInventoryPurchase.PaymentType = paymentTypecomboBox.SelectedItem.ToString(); aInventoryPurchase.CUserInfo = aUserInfo; if (expiredateTimePicker.Value.Date == DateTime.Now.Date) { } else { aInventoryPurchase.ExpireDate = expiredateTimePicker.Value.Date; } string res = string.Empty; InventoryPurchaseBLL aInventoryPurchaseBll = new InventoryPurchaseBLL(); res = aInventoryPurchaseBll.InsertPurchase(aInventoryPurchase); if (res == "Purchase Insert Sucessfully") { //Add for Supplier Update aSupplier.TotalAmount += Convert.ToDouble(pricetextBox.Text); aSupplier.PaidAmount += Convert.ToDouble(paidPricetextBox.Text); aSupplierBll.UpdateSupplierForPurchase(aSupplier); //Add for Supplier payment report Supplier paymentSupplier = new Supplier(); paymentSupplier.PaidAmount = Convert.ToDouble(paidPricetextBox.Text); paymentSupplier.TotalAmount = Convert.ToDouble(pricetextBox.Text); paymentSupplier.SupplierId = aSupplier.SupplierId; paymentSupplier.PaymentType = paymentTypecomboBox.SelectedItem.ToString(); aSupplierBll.InsertIntosupplier_payment_reportForSupplierPaymentTrack(paymentSupplier); //Add for stock update Stock aStock = new Stock(); aStock.Category = aCategory; aStock.Item = aItem; aStock.Unit = aUnit; aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.UnitPrice = Convert.ToDouble(pricetextBox.Text) / aStock.Stocks; StockBLL aStockBll = new StockBLL(); aStockBll.InsertStockOrUpdate(aStock); purchaseActionlabel.Visible = true; purchaseActionlabel.Text = res; Clear(); } else { purchaseActionlabel.Visible = true; purchaseActionlabel.Text = res; } } else { purchaseActionlabel.Visible = true; purchaseActionlabel.Text = "Please Check Your Input"; } } catch { MessageBox.Show("Try Again May Be Your Given Input Format Not Correct Please Given Again "); } }
private void FrmStock_Load(object sender, EventArgs e) { try { if (this.Entity != null && this.Entity.donation != null && this.Entity.donation.IsStored()) { MessageBox.Show("El ítem que está intentando editar pertenece a una donación ya almacenada.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); groupBox1.Enabled = false; cmdAccept.Enabled = false; } //Traducciones SessionHelper.RegisterForTranslation(this, Codes.MNU_GE013); SessionHelper.RegisterForTranslation(cmdAccept, Codes.BTN_ACCEPT); SessionHelper.RegisterForTranslation(cmdClose, Codes.BTN_CLOSE); SessionHelper.RegisterForTranslation(lblLot, Codes.LBL_LOT); SessionHelper.RegisterForTranslation(lblDepot, Codes.LBL_DEPOT); SessionHelper.RegisterForTranslation(lblDescription, Codes.LBL_DESCRIPTION); SessionHelper.RegisterForTranslation(lblType, Codes.LBL_ITEM_TYPE); SessionHelper.RegisterForTranslation(lblItemQuantity, Codes.LBL_QUANTITY); SessionHelper.RegisterForTranslation(lblDuedate, Codes.LBL_DUEDATE); SessionHelper.RegisterForTranslation(lblLocation, Codes.LBL_LOCATION); LoadDonations(); LoadDepots(); LoadItemTypes(); if (this.IsUpdate) { cmbDonation.Enabled = false; StockBLL stockBll = new StockBLL(); ResultBM stockResult = stockBll.GetStock(this.Entity.id); if (!stockResult.IsValid()) { MessageBox.Show(stockResult.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.Entity = stockResult.GetValue <StockBM>(); this.availableStock = this.Entity.GetAmountItemsToStockWithoutThis(); numericQuantity.Maximum = this.availableStock; numericQuantity.Value = this.Entity.Quantity; txtName.Text = this.Entity.Name; dtDueDate.Value = this.Entity.DueDate; txtLocation.Text = this.Entity.Location; //Posicionar donador bool found = false; for (int i = 0; i < cmbItemType.Items.Count && !found; ++i) { found = ((ItemTypeBM)cmbItemType.Items[i]).id == this.Entity.itemType.id; if (found) { cmbItemType.SelectedIndex = i; } } found = false; for (int i = 0; i < cmbDonation.Items.Count && !found; ++i) { found = ((DonationBM)cmbDonation.Items[i]).id == this.Entity.donation.id; if (found) { cmbDonation.SelectedIndex = i; } } found = false; for (int i = 0; i < cmbDepot.Items.Count && !found; ++i) { found = ((DepotBM)cmbDepot.Items[i]).id == this.Entity.depot.id; if (found) { cmbDepot.SelectedIndex = i; } } } else { this.Entity = new StockBM(); //Cuando es nuevo, se toma el valor del elemento seleccionado del combo de donación como valores inicializadores. //En dicho caso, el máximo disponible es el máximo asignable y el número que se sugiere stockear DonationBM donationBm = (DonationBM)cmbDonation.SelectedItem; if (donationBm != null) { this.availableStock = donationBm.Items - donationBm.stocked; numericQuantity.Maximum = this.availableStock; numericQuantity.Value = this.availableStock; } } CalculateMaxStockLeft((DonationBM)cmbDonation.SelectedItem, (int)numericQuantity.Value); } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "EXCEPCIÓN", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Constructor para el controlador de la entidad Product /// </summary> /// <param name="context">DbContext</param> public StockController(StockDBContext context) { this._context = context; this._negocioBLL = new StockBLL(new StockDAL(this._context)); }