/********************************* * Manipulate Each Stock *********************************/ private void lvDataIngredient_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Ingredient ingredient = (Ingredient)lvDataIngredient.SelectedItem; if (ingredient == null) { return; } ReceiptNoteDetail r = new ReceiptNoteDetail(); var foundIteminReceipt = ReceiptDetailsList.FirstOrDefault(c => c.IgdId.Equals(ingredient.IgdId)); if (foundIteminReceipt == null) { r.IgdId = ingredient.IgdId; r.Quan = 1; r.ItemPrice = ingredient.StandardPrice; ReceiptDetailsList.Add(r); } else { if (ingredient.IgdId.Equals(ORTHER_PERCHAGSE_ID)) // only allow input the Orther Perchagse once per Receipt Note { return; } foundIteminReceipt.Quan++; } lvDataReceipt.Items.Refresh(); LoadReceiptData(); }
private void btnLuuLai_Click(object sender, EventArgs e) { try { int soLuongNhap = int.Parse(txtSoLuongNhap.Text); float price = float.Parse(txtDonGia.Text); DateTime mfg_date = Convert.ToDateTime(dpkNgaySanXuat.Value); DateTime exp_date = Convert.ToDateTime(dpkNgayHetHan.Value); if (idPhieuNhap == 0) { int id_employee = 1; GoodReceiptNoteBus.Instance.InsertReceiptNote(id_employee); } idPhieuNhap = GoodReceiptNoteBus.Instance.getGoodsReceiptNoteByDate(); ReceiptNoteDetail receiptNoteDetail = new ReceiptNoteDetail( price, soLuongNhap, idPhieuNhap, id_product, mfg_date, exp_date, 1 ); ReceiptNoteDetailBus.Instance.InsertReceiptNoteDetail(receiptNoteDetail); XtraMessageBox.Show("Nhập hàng thành công!", "Nhập hàng "); } catch (Exception ex) { XtraMessageBox.Show("Error: " + ex); } loadPhieuNhapTheoNgay(); resetInput(); }
private void BntEdit_OnClick(object sender, RoutedEventArgs e) { int index; ReceiptNoteDetail r = new ReceiptNoteDetail(); DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } index = lvDataReceipt.ItemContainerGenerator.IndexFromContainer(dep); InputNote inputNote = new InputNote(ReceiptDetailsList[index].Note); if ((ReceiptDetailsList[index].Note == null || ReceiptDetailsList[index].Note.Equals("") || ReceiptDetailsList[index].Note.Equals(inputNote.Note))) { if (inputNote.ShowDialog() == true) { r.Note = inputNote.Note; r.IgdId = ReceiptDetailsList[index].IgdId; r.Quan = ReceiptDetailsList[index].Quan; r.ItemPrice = ReceiptDetailsList[index].ItemPrice; ReceiptDetailsList[index] = r; } } else { inputNote.ShowDialog(); } lvDataReceipt.Items.Refresh(); }
public bool InsertReceiptNoteDetail(ReceiptNoteDetail receiptNoteDetail) { try { return(ProccessReceiptNoteDetail.Instance.InsertDeliveryNodeDetail(receiptNoteDetail)); } catch (Exception ex) { throw ex; } }
/********************************* * Manipulate Each StockInDetails *********************************/ private void TxtItemPrice_OnTextChanged(object sender, TextChangedEventArgs e) { TextBox textboxItemPrice = sender as TextBox; int index; ReceiptNoteDetail r = new ReceiptNoteDetail(); DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } index = lvDataReceipt.ItemContainerGenerator.IndexFromContainer(dep); try { if (textboxItemPrice.Text == null || textboxItemPrice.Text.Length == 0) { MessageBox.Show("The Price of Input Ingredients can not be blank!"); if (!ErrorDetailsItem.Contains(index)) { ErrorDetailsItem.Add(index); } return; } ReceiptDetailsList[index].ItemPrice = decimal.Parse(textboxItemPrice.Text); LoadReceiptData(); if (ErrorDetailsItem.Contains(index)) { ErrorDetailsItem.Remove(index); } } catch (Exception ex) { MessageBox.Show("Something went wrong when try to calculate the input data. Please check your input"); if (!ErrorDetailsItem.Contains(index)) { ErrorDetailsItem.Add(index); } } }
public bool InsertDeliveryNodeDetail(ReceiptNoteDetail receiptNoteDetail) { string query = string.Format("SP_Insert_ReceiptNoteDetail @Id_GoodsReceiptNote , @Id_product , @Price , @Amount , @MFG_date , @EXP_date , @Id_supplier"); int result; try { result = DataProvider.Instance.ExecuteNonQuery(query, new object[] { receiptNoteDetail.Id_goodReceiptNote, receiptNoteDetail.Id_product, receiptNoteDetail.Price, receiptNoteDetail.Amount, receiptNoteDetail.MFG_date, receiptNoteDetail.EXP_date, receiptNoteDetail.Id_supplier }); } catch (Exception ex) { throw ex; } return(result > 0); }
//private DataTable dt; public frmtest() { InitializeComponent(); //Load += (sender, e) => //{ // dt = new DataTable(); // dt.Columns.Add("ProduceId"); // dt.Columns.Add("Quantity"); // dt.Columns.Add("Price"); // gcProduce.DataSource = dt; cbxProduce.Properties.DisplayMember = "Name"; cbxProduce.Properties.ValueMember = "ProduceId"; cbxProduce.Properties.DataSource = unitOfWork.ProduceService.GetAllForCombobox().ToList(); //}; //btnProduceAdd.Click += (sender, e) => //{ // DataRow dr = dt.NewRow(); // dr["ProduceId"] = cbxProduce.EditValue; // dr["Quantity"] = txtQuantity.Text; // dr["Price"] = txtPrice.Text; // dt.Rows.Add(dr); //}; ucActionResultButton1.SaveButtonClick += (sender, e) => { var list = new List <ReceiptNoteDetail>(); foreach (ListViewItem item in listView1.Items) { var r = new ReceiptNoteDetail(); r.ProduceId = Convert.ToInt32(item.SubItems[0].Text); r.Quantity = Convert.ToInt32(item.SubItems[1].Text); r.Price = Convert.ToDecimal(item.SubItems[2].Text); list.Add(r); } }; }
private void BntDelete_OnClick(object sender, RoutedEventArgs e) { int index; ReceiptNoteDetail r = new ReceiptNoteDetail(); DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } index = lvDataReceipt.ItemContainerGenerator.IndexFromContainer(dep); if (ReceiptDetailsList[index].Quan > 1 && !ErrorDetailsItem.Contains(index)) { r.Quan = ReceiptDetailsList[index].Quan - 1; r.IgdId = ReceiptDetailsList[index].IgdId; r.ItemPrice = ReceiptDetailsList[index].ItemPrice; ReceiptDetailsList[index] = r; } else { ReceiptDetailsList.RemoveAt(index); if (ErrorDetailsItem.Contains(index)) { ErrorDetailsItem.Remove(index); } } lvDataReceipt.Items.Refresh(); LoadReceiptData(); }
public void Update(ReceiptNoteDetail entity) { _receiptNoteDetailRepository.Update(entity); _cacheManager.Set(PRODUCT_ALL_KEY, _productRepository.GetAll(), 1200000); }
public void Insert(ReceiptNoteDetail entity) { _receiptNoteDetailRepository.Insert(entity); }