private void fillGridView(DataGridView dgv, List <VendorOrder> orderList) { DataGridViewButtonColumn viewOrderDetailsColumn = new DataGridViewButtonColumn(); viewOrderDetailsColumn.Text = "View Order Details"; viewOrderDetailsColumn.Name = "View Order Details"; viewOrderDetailsColumn.HeaderText = "View Order Details"; viewOrderDetailsColumn.UseColumnTextForButtonValue = true; dgv.Columns.Clear(); dgv.Rows.Clear(); dgv.ColumnCount = 5; dgv.Columns[0].Name = "Vendor OrderID"; dgv.Columns[1].Name = "Vendor ID"; dgv.Columns[2].Name = "Vendor Name"; dgv.Columns[3].Name = "Date Ordered"; dgv.Columns[4].Name = "Number of Shipments"; foreach (var vendorOrder in orderList) { dgv.Rows.Add(vendorOrder.Id, vendorOrder.VendorID, _vendorManager.GetVendor(vendorOrder.VendorID).Name, vendorOrder.DateOrdered, vendorOrder.NumberOfShipments); } dgvOpenVendorOrders.Columns.Insert(5, viewOrderDetailsColumn); }
private void LoadVendor(int VendorId) { DataTable dtVendor = Vendor.GetVendor(VendorId); if (dtVendor.Rows.Count > 0) { txtVendorCode.Text = dtVendor.Rows[0]["Code"].ToString(); txtVendorName.Text = dtVendor.Rows[0]["VendorName"].ToString(); txtPhone.Text = dtVendor.Rows[0]["Phone"].ToString(); txtAddress.Text = dtVendor.Rows[0]["Address"].ToString(); txtContactPerson.Text = dtVendor.Rows[0]["ContactPerson"].ToString(); if (!string.IsNullOrEmpty(dtVendor.Rows[0]["COAId"].ToString())) { try { txtAccountCode.Text = manageAccount.GetChartOfAccounts(Convert.ToInt32(dtVendor.Rows[0]["COAId"])).Rows[0]["AccountCode"].ToString(); } catch (Exception eex) { txtAccountCode.Text = string.Empty; } } else { txtAccountCode.Text = string.Empty; } txtSTRegistration.Text = dtVendor.Rows[0]["STRegistration"].ToString(); txtNTN.Text = dtVendor.Rows[0]["NTN"].ToString(); bool IsActive = true; IsActive = (string.IsNullOrEmpty(dtVendor.Rows[0]["IsActive"].ToString()) ? true : Convert.ToBoolean(dtVendor.Rows[0]["IsActive"])); chkIsActive.Checked = IsActive; ButtonRights(false); } }
public frmReceiving(VendorOrder vendorOrder, AccessToken acctkn) { InitializeComponent(); _myAccessToken = acctkn; VendorManager _vendorManager = new VendorManager(); this.vendorOrder = vendorOrder; txtVendorOrderID.Text = vendorOrder.Id.ToString(); txtVendorName.Text = _vendorManager.GetVendor(vendorOrder.VendorID).Name.ToString(); txtVendorID.Text = _vendorManager.GetVendor(vendorOrder.VendorID).Id.ToString(); txtNumberofShipments.Text = _vendorOrderManager.getVendorOrder(vendorOrder.Id).NumberOfShipments.ToString(); txtDateOrdered.Text = _vendorOrderManager.getVendorOrder(vendorOrder.Id).DateOrdered.ToString(); vendorOrder = new VendorOrder(Int32.Parse(txtVendorOrderID.Text.ToString()), Int32.Parse(txtVendorID.Text.ToString())); populateListView(); //try //{ // lvReceiving.Clear(); // vendorOrderLineItemList = _receivingManager.GetAllLineItemsByVendorOrder(vendorOrder); // foreach (var vendorOrderLineItem in vendorOrderLineItemList) // { // var item = new ListViewItem(); // item.Text = vendorOrderLineItem.ProductID.ToString(); // item.SubItems.Add(_productManager.GetProduct(vendorOrderLineItem.ProductID).Name.ToString()); // item.SubItems.Add(vendorOrderLineItem.QtyOrdered.ToString()); // item.SubItems.Add(vendorOrderLineItem.QtyReceived.ToString()); // item.SubItems.Add(vendorOrderLineItem.QtyDamaged.ToString()); // item.SubItems.Add(vendorOrderLineItem.Note); // lvReceiving.Items.Add(item); // } // lvReceiving.Columns.Add("ProductID"); // lvReceiving.Columns.Add("Product Name"); // lvReceiving.Columns.Add("Quantity Ordered"); // lvReceiving.Columns.Add("Quantity Received"); // lvReceiving.Columns.Add("Quantity Damaged"); // lvReceiving.Columns.Add("Note"); // lvReceiving.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); //} //catch (Exception ex) //{ // MessageBox.Show("An error occured while loading the vendor listView. " + ex.ToString()); //} }
public ActionResult FireEmployee(int id) { VendorEmployeeModel vm = VendorEmployeeManager.GetVendorEmployee(id); EmployeeVendorViewModel evvm = new EmployeeVendorViewModel(); evvm.User = UserManager.GetUser(vm.UserID); evvm.Vendor = VendorManager.GetVendor(vm.VendorID); return(View(evvm)); }
private void LoadVendor(int VendorId) { DataTable dtVendor = Vendor.GetVendor(VendorId); if (dtVendor.Rows.Count > 0) { //txtAccCode.Text = dtVendor.Rows[0]["Code"].ToString(); //txtAccountName.Text = dtVendor.Rows[0]["VendorName"].ToString(); //txtBalance.Text = dtVendor.Rows[0]["Balance"].ToString(); } }
private void LoadVendor(int VendorId) { VendorManager manageVendor = new VendorManager(); DataTable dtVendor = manageVendor.GetVendor(VendorId); if (dtVendor.Rows.Count > 0) { txtVendorCode.Text = dtVendor.Rows[0]["Code"].ToString(); txtVendorName.Text = dtVendor.Rows[0]["VendorName"].ToString(); if (!string.IsNullOrEmpty(dtVendor.Rows[0]["COAId"].ToString())) { txtAccCode.Text = manageAccount.GetChartOfAccounts(Convert.ToInt32(dtVendor.Rows[0]["COAId"])).Rows[0]["AccountCode"].ToString(); } } }
private void btnUpdateVendor_Click(object sender, EventArgs e) { ListView.SelectedListViewItemCollection selectedVendor = this.lvVendors.SelectedItems; if (selectedVendor.Count > 0) { int vendorID = Convert.ToInt32(selectedVendor[0].SubItems[0].Text); Vendor thisVendor = _myVendorManager.GetVendor(vendorID); FrmVendorAddUpdate frm = new FrmVendorAddUpdate(_myAccessToken, thisVendor); frm.ShowDialog(); findActiveSelection(); } }
public FrmAddLineItemToVendorOrder(VendorOrder vendorOrder, AccessToken acctkn) { InitializeComponent(); _myAccessToken = acctkn; var RoleAccess = new RoleAccess(acctkn, this); this.vendorOrder = vendorOrder; txtVendorOrderID.Text = vendorOrder.Id.ToString(); VendorManager _vendorManager = new VendorManager(); var vendor = vendorOrder.VendorID; txtVendorName.Text = _vendorManager.GetVendor(vendorOrder.VendorID).Name; txtVendorID.Text = vendorOrder.VendorID.ToString(); txtVendorName.ReadOnly = true; txtVendorID.ReadOnly = true; fillProductDropDown(vendorOrder.VendorID); }
private void btSaveOrder_Click(object sender, EventArgs e) { try { List <VendorOrderLineItem> lineItemList = new List <VendorOrderLineItem>(); int index = comboVendor.SelectedItem.ToString().IndexOf(" "); int id = Convert.ToInt32(comboVendor.SelectedItem.ToString().Substring(0, index)); _myVendorManager = new VendorManager(); var vendorName = _myVendorManager.GetVendor(id).Name; //VendorOrder myVendorOrder = new VendorOrder(int.Parse(id)); VendorOrder myVendorOrder = new VendorOrder(id); myVendorOrder.NumberOfShipments = Convert.ToInt32(comboShipments.SelectedItem.ToString()); myVendorOrder.DateOrdered = Convert.ToDateTime(tbOrderDate.Text); myVendorOrder.Name = vendorName; for (int i = 0; i < lvOrderItems.Items.Count; i++) { Int32 productId = Int32.Parse(lvOrderItems.Items[i].SubItems[0].Text); VendorOrderLineItem item = new VendorOrderLineItem(id, productId); item.Name = lvOrderItems.Items[i].SubItems[1].Text; item.QtyOrdered = Int32.Parse(lvOrderItems.Items[i].SubItems[3].Text); lineItemList.Add(item); } myVendorOrder.LineItems = lineItemList; Boolean success = _myVendorOrderManager.AddVendorOrder(myVendorOrder); if (success == true) { MessageBox.Show("Order Added."); populateListView(); comboProduct.Items.Clear(); } else { MessageBox.Show("A field is not filled in. Please verify all fields are correct."); } } catch (Exception ex) { MessageBox.Show("A Generic error as occured. You should fix this message " + ex.ToString()); } }
public ActionResult VendorManagement(int id, bool?Confirm) { VendorModel vendor = VendorManager.GetVendor(id); if (Confirm != null && (Confirm == true || Confirm == false)) { try { vendor.Confirmed = (bool)Confirm; VendorManager.Update(vendor); return(RedirectToAction("Vendor")); } catch (Exception ex) { throw ex; } } return(View(vendor)); }
public ActionResult Details(int ID) { MenuModel menu = MenuManager.GetVendorMenu(ID); MenuSectionMenuItems msmi = new MenuSectionMenuItems(); msmi.MenuModel = menu; msmi.MenuSections = MenuSectionManager.GetMenuSections(menu.MenuID); msmi.MenuItems = MenuItemManager.GetMenuItems(menu.MenuID); foreach (var item in msmi.MenuItems) { OrderItemModel orderItemModel = new OrderItemModel { MenuItemID = item.ItemID, Quantity = 0 }; msmi.OrderItems.Add(orderItemModel); } msmi.VendorModel = VendorManager.GetVendor(ID); return(View(msmi)); }
public void Update() { VendorModel vendor = new VendorModel { VendorID = 2, OwnerID = 2, CompanyName = "100Tacos", CompanyEmail = "*****@*****.**", LicenseNumber = 1122334, InspectionDate = new DateTime(1950, 12, 31), Bio = "We love bring tacos to people (even if you dont like tacos)!", Website = "100Tacos.com", }; VendorManager.Update(vendor); VendorModel newVendor = VendorManager.GetVendor(2); Assert.AreEqual(vendor.VendorID, newVendor.VendorID); }