private void button1_Click(object sender, EventArgs e) { Stock stock = new Stock(); stock.Barcode = Convert.ToInt32(tbbarcode.Text); stock.Category = (int)cbCategory.SelectedValue; if (cbexchangeRate.SelectedIndex == 0) { stock.ExchangeRate = "USD"; } if (cbexchangeRate.SelectedIndex == 1) { stock.ExchangeRate = "EUR"; } stock.ExchangeRateValue = Convert.ToDecimal(tbexchangeRateValue.Text); stock.Kdv = Convert.ToInt32(tbkdv.Text); stock.MeasurementUnit = cbmeasurementUnit.SelectedValue.ToString(); stock.Piece = Convert.ToInt32(tbpiece.Text); stock.StockCode = 3; stock.StockName = tbstockName.Text; stock.SubCategory = (int)cbSubCategory.SelectedValue; stock.TotalPrice = Convert.ToDecimal(tbtotalPrice.Text); stock.UnitPrice = Convert.ToDecimal(tbunitPrice.Text); stock.Warehouse = cbwarehouse.SelectedValue.ToString(); StockRepository r1 = new StockRepository(); r1.Add(stock); MessageBox.Show("Stok Eklendi"); }
public HttpResponseMessage UpsertItem(HttpRequestMessage request, tbItem tbItem) { ItemRepository itemRepo = new ItemRepository(); StockRepository stockRepo = new StockRepository(); tbItem UpdatedEntity = null; tbStock tbstock = new tbStock(); if (tbItem.ID > 0) { UpdatedEntity = itemRepo.update(tbItem); } else { tbItem.UniqueID = Guid.NewGuid(); tbItem.IsDeleted = false; tbItem.Accesstime = DateTime.UtcNow.ToLocalTime(); UpdatedEntity = itemRepo.Add(tbItem); tbstock.ItemGUID = tbItem.UniqueID; tbstock.CinemaID = 0; tbstock.IsDeleted = false; tbstock.Accesstime = DateTime.UtcNow.ToLocalTime(); tbstock.StockStatus = "Stock Register"; tbstock.StockQty = 0; tbstock.ThresholdQty = 0; stockRepo.Add(tbstock); } return(request.CreateResponse <tbItem>(HttpStatusCode.OK, UpdatedEntity)); }
private void btnSave_Click(object sender, EventArgs e) { try { Stock stock = new Stock(); stock.MainProductID = Convert.ToInt32(lblid.Text); if (radioGram.Checked == true) { stock.UnitTypesID = 1; stock.Value = Convert.ToDecimal(txtMaskedGram.Text); } else if (radioPiece.Checked == true) { stock.UnitTypesID = 2; stock.Value = Convert.ToDecimal(nmrPiece.Value); } StockRepository sr = new StockRepository(); sr.Add(stock); MessageBox.Show("Kayıt Başarılı Bir Şekilde Oluşturuldu."); } catch { MessageBox.Show("Lütfen Bilgileri Doğru Giriniz!"); } }
protected void add_stock(object sender, EventArgs e) { try { string user = Session["username"].ToString(); var itemCode = ProductList.SelectedItem.Value; if (!string.IsNullOrEmpty(user)) { var stockItem = stockRepository.Find(x => x.BR_ID == itemCode).FirstOrDefault(); if (stockItem == null) { stockRepository.Add(new STOCK() { BR_ID = itemCode, Quantity = qtyUpdate.Text, Supplier = supplier.Text, SupplierNotes = notes.Text, UserID = user }); } else { int stockCount = 0; int.TryParse(stockItem.Quantity, out stockCount); int newQty = 0; int.TryParse(qtyUpdate.Text, out newQty); stockItem.Quantity = (newQty + stockCount).ToString(); stockItem.Supplier = supplier.Text; stockItem.SupplierNotes = notes.Text; stockItem.UserID = user; stockRepository.SetState(stockItem); } stockRepository.SaveChanges(); ProductList.Items.Clear(); GetAllProducts(); ProductList.SelectedValue = itemCode; qty.Text = stockItem.Quantity; ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Stock Added');", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error:" + ex.Message + "');", true); throw; } }
public ActionResult Create([Bind(Include = "SID, IDSTOCK, STOCKNAME, STOCKGROUP, PARTNUMBER, UOM, ITEMTYPE, MINIMUMSTOCK, MAXIMUMSTOCK, DESCRIPTION, POSCODE, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE")] Stock Stock) { if (ModelState.IsValid) { STK.Add(Stock, Session["userid"].ToString()); TempData["successmessage"] = "Saved successfully"; return(RedirectToAction("Create")); } else { Stock.GetSelectListStockGroup = GetSelectListStockGroup(); Stock.GetSelectListUnitOfMeasure = GetSelectListUnitOfMeasure(); Stock.GetSelectListItemType = GetSelectListItemType(); return(View(Stock)); } }
public HttpResponseMessage UpsertStock(HttpRequestMessage request, tbStock tbStock) { StockRepository stockRepo = new StockRepository(); tbStock UpdatedEntity = null; if (tbStock.ID > 0) { UpdatedEntity = stockRepo.update(tbStock); } else { tbStock.IsDeleted = false; tbStock.Accesstime = DateTime.UtcNow.ToLocalTime(); UpdatedEntity = stockRepo.Add(tbStock); } return(request.CreateResponse <tbStock>(HttpStatusCode.OK, UpdatedEntity)); }
public Element Add(Element entity) { if (ElementExist(entity)) { throw new ValidationException("There is an element with the same name and type."); } var elementType = new ElementType(); if (entity.Type == null || !elementType.ElementExist(entity.Type)) { throw new ValidationException("The element type does not exist."); } entity.NotifyDeletedStatus = ElementStatus.Active; entity.NotifyExpiredStatus = ElementStatus.Active; entity.Enabled = true; entity.ModifyBy = "user"; entity.ModifyDate = DateTime.Now; entity = inventoryRepository.Add(entity); return(entity); }