public ActionResult Index(Product product) { try { ProductTableData.updateProduct(product.ID, (int)product.Quantity_Available, (int)product.Unit_Price, (int)product.Selling_Price, product.Barcodes.ToArray(), product.Unique_Barcode, DateTime.Now); Supplier supplier = SupplierTableData.getSupplier(product.Model);//supplier name is saved in product model Product_Supplier product_Supplier = new Product_Supplier() { Date = DateTime.Now, Quantity = product.Quantity_Available, Supplier = supplier, Ref_Number = product.Type, Product_ID = product.ID, Unit_Price = product.Unit_Price }; Journal journal = new Journal(); journal.Date = product.Date_Updated; journal.Sub_Account_ID = 10; ///purchase account journal.Type = 0; /// 0 means Debit journal.Status = 1; ///posted journal.PreparedBy = 1; journal.AuthenticatedBy = 1; //Product_SupplierTableData.addNewProduct_Supplier() return(Json(new { msg = "Successfully added " + product.ID + " " + product.Quantity_Available + " " + product.Selling_Price + " " + product.Barcodes.First().Barcode_Serial })); } catch (Exception ex) { throw ex; } }
// GET: Purchase public ActionResult Index() { ViewBag.test = ProductTableData.getAllProducts(); string[] supplier = SupplierTableData.getAllSupplierName().ToArray(); string[] types = ProductTableData.getAllProductTypes().ToArray(); ViewData["supplierList"] = supplier; ViewData["typeList"] = types; ViewData["modelList"] = new string[] { "Select" }; ViewData["selectedType"] = "Select"; ViewData["selectedSupplier"] = "Select"; return(View()); }
public ActionResult Index(FormCollection collection) { string[] supplier = SupplierTableData.getAllSupplierName().ToArray(); string[] types = ProductTableData.getAllProductTypes().ToArray(); ViewData["supplierList"] = supplier; ViewData["typeList"] = types; string selected = collection["type"]; ViewData["selectedType"] = selected; ViewData["selectedSupplier"] = collection["supplier"].ToString(); ViewData["selectedModel"] = "Select"; ViewData["modelList"] = ProductTableData.getAllTypeMachedModels(selected).ToArray(); return(View()); }
// GET: PurchaseTest public ActionResult Index() { ViewBag.test = ProductTableData.getAllProducts(); string[] supplier = SupplierTableData.getAllSupplierName().ToArray(); string[] types = ProductTableData.getAllProductTypes().ToArray(); string[] colors = FileManagement.getAllColor().ToArray(); ViewBag.supplierList = supplier; ViewData["supplierList"] = supplier; ViewData["typeList"] = types; ViewData["colorList"] = colors; ViewData["selectedSupplier"] = "Select"; ViewData["selectedType"] = "Select"; ViewData["selectedModel"] = "Select"; ViewData["modelList"] = new string[] { "Select" }; ViewData["selectedColor"] = "None"; return(View()); }
private void Save_Button_Click(object sender, RoutedEventArgs e) { if (companyName.Text.Trim() == "") { MessageBox.Show("Company name is required"); return; } else if (contactName.Text.Trim() == "") { MessageBox.Show("Contact name is required"); return; } else if (city.Text.Trim() == "") { MessageBox.Show("City is required"); return; } Address address = new Address { City = city.Text, AddressLine = addressLine.Text, Country = country.Text.Trim(), Fax = fax.Text.Trim(), Postal_Code = postalCode.Text.Trim(), Phone1 = phone1.Text.Trim(), Phone2 = phone2.Text.Trim(), Website = website.Text.Trim() }; Supplier supplier = new Supplier { Company_Name = companyName.Text.Trim(), Contact_Designation = designation.Text.Trim(), Contact_Name = contactName.Text.Trim(), Email = email.Text.Trim() }; supplier.Address = address; if (SupplierTableData.addNewSupplier(supplier) == false) { MessageBox.Show(CustomMessage.Message + "\n\nDetailed Error: " + CustomMessage.StackTrace); return; } this.supplier.ItemsSource = SupplierTableData.getAllSupplierName(); this.supplier.SelectedItem = string.Format("{0} - {1}", contactName.Text, companyName.Text); this.Close(); }
public Stock() { InitializeComponent(); DB.resetConnString(); this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; date.Text = DateTime.Now.ToString(); paymentDate.Text = DateTime.Now.ToString("dd/MM/yyyy hh:mm tt"); color.AddHandler(System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent, new TextChangedEventHandler(Color_ComboBox_TextChanged)); supplier.AddHandler(System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent, new TextChangedEventHandler(Supplier_Combobox_TextChanged)); productType.AddHandler(System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent, new TextChangedEventHandler(ProductType_ComboBox_TextChanged)); productModel.AddHandler(System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent, new TextChangedEventHandler(ProductModel_ComboBox_TextChanged)); try { productType.ItemsSource = ProductTableData.getAllProductTypes(); color.ItemsSource = FileManagement.getAllColor(); supplier.ItemsSource = SupplierTableData.getAllSupplierName(); } catch (Exception ex) { MessageBox.Show(ex.Message); } paymentCheckBox.IsChecked = false; barcodeType.IsEnabled = false; referenceNo.Focus(); addDatagridColumns(); addDatagridPaymentColumns(); }
private void AddProduct_Button_Click(object sender, RoutedEventArgs e) { if (DateTime.TryParse(date.ToString(), out datetime) == false)//parsing date for bill { datetime = DateTime.Now; } //checking trial subscription if (DateTime.Compare(datetime, Register.SubscriptionDateEnd) > 0) { Xceed.Wpf.Toolkit.MessageBox.Show("Hey Contact to the developer.", " Subscription Error:", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (checkErrors() == false) { return; } int supplierID = SupplierTableData.getIDBySupplier(supplier.Text); Product pro = new Product { ID = product.ID, Type = productType.Text, Model = productModel.Text, Quantity_Available = quan, Unit_Price = unitP, Selling_Price = SellingP, Unique_Barcode = product.Unique_Barcode, Date_Updated = datetime }; Product_Supplier pro_supp = new Product_Supplier { Product_ID = product.ID, Quantity = quan, Unit_Price = pro.Unit_Price, Ref_Number = referenceNo.Text, Supplier_ID = supplierID, Date = datetime }; foreach (ListViewItems obj in listView.Items) { Barcode b = new Barcode { Product_ID = pro.ID, Barcode_Serial = obj.IMEI, Color = obj.Color, Date = datetime }; pro.Barcodes.Add(b); } grandTotalDouble += (int)pro.Unit_Price * quan;///calculation total amount grandTotal.Content = grandTotalDouble; ///checked means he will pay through cash, cheque or card if (paymentCheckBox.IsChecked == true) { paymentDueDouble = grandTotalDouble - totalPaymentDouble; paymentDue.Content = paymentDueDouble; payment.Text = paymentDueDouble.ToString(); } else { paymentDueDouble = 0; paymentDue.Content = "0.0"; totalPaymentDouble = grandTotalDouble; totalPayment.Content = totalPaymentDouble; } totalQuantityInt += quan;///calculation total amount totalQuantity.Content = totalQuantityInt; DataGridItems DGItems = new DataGridItems(serial++, pro); DGItems.SubTotal = (int)pro.Unit_Price * quan; dataGrid.Items.Add(DGItems); listProduct.Add(pro); listProduct_Supplier.Add(pro_supp); productModel.SelectedIndex = -1; productType.SelectedIndex = -1; quantity.Clear(); unitPrice.Clear(); sellingPrice.Clear(); listView.Items.Clear(); description.Clear(); color.SelectedIndex = -1; uniqBarcode.IsChecked = true; productType.Focus(); supplier.IsEnabled = false; addSupplier_Button.IsEnabled = false; }