예제 #1
0
		private void btnAdd_Click(object sender, EventArgs e)
		{
			int InventoryID = 0;

			BPOrderDetails bp = new BPOrderDetails();
			BPInventory bpInventory = new BPInventory();
			DSInventory = new BEInventory();

			GridItemCollection CheckedCollection = new GridItemCollection();
			CheckedCollection = dgInventory.GetCheckedItems(dgInventory.Levels[0].Columns[1]);

			// if adding an item turn off '0 item' message from submit button
			if (CheckedCollection.Count > 0)
			{
				btnSubmit.MessageEnabled = false;
			}

			if (OrderID > 0 && OrderCompleted == false)
			{
				DSOrders = bp.SelectByOrderID(OrderID);

				foreach (GridItem item in CheckedCollection)
				{
					InventoryID = Convert.ToInt32(item[0]);
					DSOrders.tbl_OrderDetails.DefaultView.RowFilter = "InventoryID=" + InventoryID;
					if (DSOrders.tbl_OrderDetails.DefaultView.Count == 0)
					{
						BEOrders.tbl_OrderDetailsRow OrderDetails;
						OrderDetails = DSOrders.tbl_OrderDetails.Newtbl_OrderDetailsRow();
						OrderDetails.OrderID = OrderID;
						OrderDetails.InventoryID = InventoryID;
						OrderDetails.InventoryItemReturned = false;
						DSOrders.tbl_OrderDetails.Addtbl_OrderDetailsRow(OrderDetails);
					
						BEInventory.tbl_InventoryRow Inventory;
						DSInventory.Merge(bpInventory.SelectInventoryByID(InventoryID));
						Inventory = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID);	
						Inventory.InventoryInStock = 2;
					}
				}
				bp.Update(DSOrders);
				bpInventory.Update(DSInventory);
			}

			dgInventory.UnCheckAll();

			BindDSInventory();
			BindDSOrders();
		}
예제 #2
0
		private void dgEquipmentOrdered_ItemCommand(object sender, GridItemCommandEventArgs e)
		{
			int InventoryID = 0;
			LinkButton tmpLnk = (LinkButton) e.Control;
			int OrderDetailID = Convert.ToInt32(tmpLnk.CommandArgument);

			BPOrderDetails bp = new BPOrderDetails();
			BPInventory bpInventory = new BPInventory();

			if (OrderID > 0 && OrderCompleted == false)
			{
				DSOrders = bp.SelectOrderDetailsByID(OrderDetailID);
				BEOrders.tbl_OrderDetailsRow OrderDetails = DSOrders.tbl_OrderDetails.FindByOrderDetailID(OrderDetailID);

				if (OrderDetails != null)
				{
					InventoryID = OrderDetails.InventoryID;
					OrderDetails.Delete();
					
					BEInventory.tbl_InventoryRow Inventory;
					DSInventory = bpInventory.SelectInventoryByID(InventoryID);
					Inventory = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID);	
					Inventory.InventoryInStock = 0;
				}
				bp.Update(DSOrders);
				bpInventory.Update(DSInventory);
			}
			BindDSInventory();
			BindDSOrders();
			//check to see if there are any items left on the order and display the '0 item' message if there aren't any.
			if (dgEquipmentOrdered.Items.Count == 0)
			{
				btnSubmit.MessageEnabled = true;
			}
		}
예제 #3
0
		private void UpdateOrderItemJobNumbers(int orderID, string jobNumber)
		{
			BPInventory bpInventory = new BPInventory();
			BEInventory dsInventory = bpInventory.SelectItemsNotReturnedByOrderID(orderID);

			foreach(BEInventory.tbl_InventoryRow row in dsInventory.tbl_Inventory)
			{
				row.JobNumber = jobNumber;
			}

			bpInventory.Update(dsInventory);
		}
예제 #4
0
		private void btnAdd_Click(object sender, EventArgs e)
		{
			int inventoryID = 0;
			string newUsed = "";
			string jobNumber = "";

			BPOrderDetails bpOrderDetails = new BPOrderDetails();
			BPOrders bpOrders = new BPOrders();
			BPInventory bpInventory = new BPInventory();
			DSInventory = new BEInventory();

			GridItemCollection CheckedCollection = new GridItemCollection();
			CheckedCollection = dgInventory.GetCheckedItems(dgInventory.Levels[0].Columns[1]);

			if (OrderID > 0 && OrderCompleted == false)
			{
				DSOrders = bpOrderDetails.SelectByOrderID(OrderID);
				DSOrders.Merge(bpOrders.SelectOrdersByID(OrderID));

				//for tracking JobNumber with inventory item
				if(DSOrders.tbl_Orders.Count > 0)
				{
					BEOrders.tbl_OrdersRow order = DSOrders.tbl_Orders[0];
					jobNumber = order.IsOrderJobNumberNull() ? "" : order.OrderJobNumber;
				}

				foreach (GridItem item in CheckedCollection)
				{
					inventoryID = Convert.ToInt32(item[0]);
					newUsed = item[3].ToString();

					DSOrders.tbl_OrderDetails.DefaultView.RowFilter = "InventoryID=" + inventoryID;

					if (DSOrders.tbl_OrderDetails.DefaultView.Count == 0)
					{
						BEOrders.tbl_OrderDetailsRow OrderDetails;
						OrderDetails = DSOrders.tbl_OrderDetails.Newtbl_OrderDetailsRow();
						OrderDetails.OrderID = OrderID;
						OrderDetails.InventoryID = inventoryID;
						OrderDetails.InventoryItemReturned = false;
						
						switch ((InventoryTypes)InventoryType)
						{
							case InventoryTypes.Buy:
								if(newUsed.ToLower() == "new")
									OrderDetails.BuyRentStatus = "Buy-N";
								else
									OrderDetails.BuyRentStatus = "Buy-U";
								break;
							case InventoryTypes.Rental:
								OrderDetails.BuyRentStatus = "Rent";
								break;
							default:
								OrderDetails.SetBuyRentStatusNull();
								break;
						}

						DSOrders.tbl_OrderDetails.Addtbl_OrderDetailsRow(OrderDetails);
					
						BEInventory.tbl_InventoryRow Inventory;
						DSInventory.Merge(bpInventory.SelectInventoryByID(inventoryID));
						Inventory = DSInventory.tbl_Inventory.FindByInventoryID(inventoryID);	
						Inventory.InventoryInStock = 2;

						//track order's JobNumber with inventory item
						if(jobNumber != "")
							Inventory.JobNumber = jobNumber;
						else
							Inventory.SetJobNumberNull();
					}
				}
				bpOrderDetails.Update(DSOrders);
				bpInventory.Update(DSInventory);
			}

			// reset or turn off warning message on submit button
//			if (CheckedCollection.Count > 0)
//			{
//				SetSubmitButtonWarningMessage(OrderID);
//			}

			dgInventory.UnCheckAll();

			BindDSInventory();
			BindDSOrders();
		}
예제 #5
0
		private void dgEquipmentOrdered_ItemCommand(object sender, GridItemCommandEventArgs e)
		{
			int inventoryID = 0;
			LinkButton tmpLnk = (LinkButton) e.Control;
			int OrderDetailID = Convert.ToInt32(tmpLnk.CommandArgument);

			BPOrderDetails bp = new BPOrderDetails();
			BPInventory bpInventory = new BPInventory();

			if (OrderID > 0 && OrderCompleted == false)
			{
				DSOrders = bp.SelectOrderDetailsByID(OrderDetailID);
				BEOrders.tbl_OrderDetailsRow OrderDetails = DSOrders.tbl_OrderDetails.FindByOrderDetailID(OrderDetailID);

				if (OrderDetails != null)
				{
					inventoryID = OrderDetails.InventoryID;
					OrderDetails.Delete();
					
					BEInventory.tbl_InventoryRow Inventory;
					DSInventory = bpInventory.SelectInventoryByID(inventoryID);
					Inventory = DSInventory.tbl_Inventory.FindByInventoryID(inventoryID);	
					Inventory.InventoryInStock = 1;
					Inventory.SetJobNumberNull();
				}
				bp.Update(DSOrders);
				bpInventory.Update(DSInventory);
			}
			BindDSInventory();
			BindDSOrders();

			//reset or turn on warning message on submit button
//			if (dgEquipmentOrdered.Items.Count == 0)
//			{
//				btnSubmit.Message = "WARNING:   You do not have any inventory items added to this order.  Please click cancel and add some items before continuing.";
//				btnSubmit.MessageEnabled = true;
//			}
//			else if(!bp.HasBuyRentItemsByOrderID(OrderID))
//			{
//				btnSubmit.MessageEnabled = false;
//			}
		}
예제 #6
0
		private void btnAdd_Click(object sender, EventArgs e)
		{
			int InventoryID = 0;

			BPOrderDetails bp = new BPOrderDetails();
			BPInventory bpInventory = new BPInventory();
			DSInventory = new BEInventory();

			GridItemCollection CheckedCollection = new GridItemCollection();
			CheckedCollection = dgInventory.GetCheckedItems(dgInventory.Levels[0].Columns[1]);

			if (OrderID > 0 && OrderCompleted == false)
			{
				DSOrders = bp.SelectByOrderID(OrderID);

				foreach (GridItem item in CheckedCollection)
				{
					InventoryID = Convert.ToInt32(item[0]);
					DSOrders.tbl_OrderDetails.DefaultView.RowFilter = "InventoryID=" + InventoryID;

					if (DSOrders.tbl_OrderDetails.DefaultView.Count == 0)
					{
						BEOrders.tbl_OrderDetailsRow OrderDetails;
						OrderDetails = DSOrders.tbl_OrderDetails.Newtbl_OrderDetailsRow();
						OrderDetails.OrderID = OrderID;
						OrderDetails.InventoryID = InventoryID;
						OrderDetails.InventoryItemReturned = false;
						
						switch ((InventoryTypes)InventoryType)
						{
							case InventoryTypes.Buy:
								OrderDetails.BuyRentStatus = "Buy";
								break;
							case InventoryTypes.Rental:
								OrderDetails.BuyRentStatus = "Rent";
								break;
							default:
								OrderDetails.SetBuyRentStatusNull();
								break;
						}

						DSOrders.tbl_OrderDetails.Addtbl_OrderDetailsRow(OrderDetails);
					
						BEInventory.tbl_InventoryRow Inventory;
						DSInventory.Merge(bpInventory.SelectInventoryByID(InventoryID));
						Inventory = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID);	
						Inventory.InventoryInStock = 2;
						Inventory.SetJobNumberNull();
					}
				}
				bp.Update(DSOrders);
				bpInventory.Update(DSInventory);
			}

			// reset or turn off warning message on submit button
			if (CheckedCollection.Count > 0)
			{
				if(bp.HasBuyRentItemsByOrderID(OrderID))
				{
					btnSubmit.Message = "ATTENTION: This order includes items for Purchase and/or Rental. Click OK to continue or CANCEL to edit the order.";
					btnSubmit.MessageEnabled = true;
				}
				else
					btnSubmit.MessageEnabled = false;
			}

			dgInventory.UnCheckAll();

			BindDSInventory();
			BindDSOrders();
		}
예제 #7
0
		private void Save()
		{
			BPInventory bp = new BPInventory();
			BEInventory.tbl_InventoryRow InventoryItem;
			BEInventory DSInventory = new BEInventory();
			if (InventoryID == 0)
			{
				// Add new Inventory Item
				InventoryItem = DSInventory.tbl_Inventory.Newtbl_InventoryRow();
				InventoryItem.InventoryInStock = 1;
			}
			else
			{
				// Edit a Company
				DSInventory = bp.SelectInventoryByID(InventoryID);
				InventoryItem = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID);
			}
			//all content to be updated/inserted between here
			InventoryItem.CompanyID = Convert.ToInt32(ddlCompanies.SelectedValue);
			InventoryItem.ItemNumber = txtItemNumber.Text;
			InventoryItem.Description = WriteNullableField(txtDescription.Text);
			InventoryItem.Box = WriteNullableField(txtBox.Text);
			InventoryItem.Pin = WriteNullableField(txtPin.Text);
			InventoryItem.Box2 = WriteNullableField(txtBox2.Text);
			InventoryItem.MajorOD = WriteNullableField(txtMajorOD.Text);
			InventoryItem.MinorOD = WriteNullableField(txtMinorOD.Text);
			InventoryItem.InsideDiameter =  WriteNullableField(txtInsideDiameter.Text);
			InventoryItem.SealtoSealLength =  WriteNullableField(txtSealToSeal.Text);
			InventoryItem.FloatBore =  WriteNullableField(txtFloatBore.Text);
			InventoryItem.GeneralComments = WriteNullableField(txtComments.Text);

			InventoryItem.ExtraColumn1 =  WriteNullableField(txtExtraColumn1.Text);
			InventoryItem.ExtraColumn2 =  WriteNullableField(txtExtraColumn2.Text);
			InventoryItem.ExtraColumn3 =  WriteNullableField(txtExtraColumn3.Text);
			InventoryItem.ExtraColumn4 =  WriteNullableField(txtExtraColumn4.Text);
			InventoryItem.ExtraColumn5 =  WriteNullableField(txtExtraColumn5.Text);
			InventoryItem.ExtraColumn6 =  WriteNullableField(txtExtraColumn6.Text);
			InventoryItem.ExtraColumn7 =  WriteNullableField(txtExtraColumn7.Text);
			InventoryItem.ExtraColumn8 =  WriteNullableField(txtExtraColumn8.Text);
			InventoryItem.ExtraColumn9 =  WriteNullableField(txtExtraColumn9.Text);
			InventoryItem.ExtraColumn10 =  WriteNullableField(txtExtraColumn10.Text);

			if (Convert.ToInt32(ddlCompanies.SelectedValue) == Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
			{
				InventoryItem.InventoryRental = chkInventoryRent.Checked;
				if(txtRentalPrice.Text.Trim() != "")
					InventoryItem.RentalPrice = txtRentalPrice.Text.Trim();
				else
					InventoryItem.SetRentalPriceNull();

				InventoryItem.InventoryBuy = chkInventoryBuy.Checked;
				if(txtSalePriceNew.Text.Trim() != "")
					InventoryItem.SalePriceNew = txtSalePriceNew.Text.Trim();
				else
					InventoryItem.SetSalePriceNewNull();

				if(txtSalePriceUsed.Text.Trim() != "")
					InventoryItem.SalePriceUsed = txtSalePriceUsed.Text.Trim();
				else
					InventoryItem.SetSalePriceUsedNull();

				InventoryItem.InventoryNewUsed = rblNewUsed.SelectedValue;
			}
			else
			{
				InventoryItem.InventoryRental = false;
				InventoryItem.SetRentalPriceNull();
				InventoryItem.InventoryBuy = false;
				InventoryItem.SetSalePriceNewNull();
				InventoryItem.SetSalePriceUsedNull();
				InventoryItem.SetInventoryNewUsedNull();
			}

			InventoryItem.DateModified = DateTime.Now;
			InventoryItem.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID);
			InventoryItem.InventoryActive = chkInventoryActive.Checked;
			if (InventoryID == 0)
			{
				//Add new Application Category
				InventoryItem.DateCreated = DateTime.Now;
				DSInventory.tbl_Inventory.Addtbl_InventoryRow(InventoryItem);
			}
			bp.Update(DSInventory);
			Response.Redirect("BrowseInventory.aspx");
		}
예제 #8
0
		private void btnInProcess_Click(object sender, EventArgs e)
		{
			string message = "";

			if(ddlCompanies.SelectedValue == ConfigurationSettings.AppSettings["OryxCompanyID"])
				message = ValidateOryxItems();

			if(message == "")
			{

				BPInventory bp = new BPInventory();
				BEInventory.tbl_InventoryRow InventoryItem;
				BEInventory DSInventory = new BEInventory();
				if (InventoryID == 0)
				{
					return;			
				}
				else
				{
					// Edit
					DSInventory = bp.SelectInventoryByID(InventoryID);
					InventoryItem = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID);
				}
				//all content to be updated/inserted between here
				InventoryItem.InventoryInStock = 3;

				InventoryItem.CompanyID = Convert.ToInt32(ddlCompanies.SelectedValue);
				InventoryItem.ItemNumber = txtItemNumber.Text;
				InventoryItem.Description = WriteNullableField(txtDescription.Text);
				InventoryItem.Box = WriteNullableField(txtBox.Text);
				InventoryItem.Pin = WriteNullableField(txtPin.Text);
				InventoryItem.Box2 = WriteNullableField(txtBox2.Text);
				InventoryItem.MajorOD = WriteNullableField(txtMajorOD.Text);
				InventoryItem.MinorOD = WriteNullableField(txtMinorOD.Text);
				InventoryItem.InsideDiameter = WriteNullableField(txtInsideDiameter.Text);
				InventoryItem.SealtoSealLength = WriteNullableField(txtSealToSeal.Text);
				InventoryItem.FloatBore = WriteNullableField(txtFloatBore.Text);
				InventoryItem.GeneralComments = WriteNullableField(txtComments.Text);

				InventoryItem.ExtraColumn1 = WriteNullableField(txtExtraColumn1.Text);
				InventoryItem.ExtraColumn2 = WriteNullableField(txtExtraColumn2.Text);
				InventoryItem.ExtraColumn3 = WriteNullableField(txtExtraColumn3.Text);
				InventoryItem.ExtraColumn4 = WriteNullableField(txtExtraColumn4.Text);
				InventoryItem.ExtraColumn5 = WriteNullableField(txtExtraColumn5.Text);
				InventoryItem.ExtraColumn6 = WriteNullableField(txtExtraColumn6.Text);
				InventoryItem.ExtraColumn7 = WriteNullableField(txtExtraColumn7.Text);
				InventoryItem.ExtraColumn8 = WriteNullableField(txtExtraColumn8.Text);
				InventoryItem.ExtraColumn9 = WriteNullableField(txtExtraColumn9.Text);
				InventoryItem.ExtraColumn10 = WriteNullableField(txtExtraColumn10.Text);

				if (Convert.ToInt32(ddlCompanies.SelectedValue) == Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
				{
					InventoryItem.InventoryRental = chkInventoryRent.Checked;
					if(txtRentalPrice.Text.Trim() != "")
						InventoryItem.RentalPrice = txtRentalPrice.Text.Trim();
					else
						InventoryItem.SetRentalPriceNull();

					InventoryItem.InventoryBuy = chkInventoryBuy.Checked;
					if(txtSalePriceNew.Text.Trim() != "")
						InventoryItem.SalePriceNew = txtSalePriceNew.Text.Trim();
					else
						InventoryItem.SetSalePriceNewNull();

					if(txtSalePriceUsed.Text.Trim() != "")
						InventoryItem.SalePriceUsed = txtSalePriceUsed.Text.Trim();
					else
						InventoryItem.SetSalePriceUsedNull();

					InventoryItem.InventoryNewUsed = rblNewUsed.SelectedValue;
				}
				else
				{
					InventoryItem.InventoryRental = false;
					InventoryItem.SetRentalPriceNull();
					InventoryItem.InventoryBuy = false;
					InventoryItem.SetSalePriceNewNull();
					InventoryItem.SetSalePriceUsedNull();
					InventoryItem.SetInventoryNewUsedNull();
				}

				InventoryItem.DateModified = DateTime.Now;
				InventoryItem.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID);
				InventoryItem.InventoryActive = chkInventoryActive.Checked;

				bp.Update(DSInventory);
				Response.Redirect("BrowseInventory.aspx");

			}
			else
			{
				lblMessage.Text = message;
				pnlMessage.Visible = true;
			}
		}
예제 #9
0
		private void btnDelete_Click(object sender, EventArgs e)
		{
			BPOrderDetails bpOrderDetails = new BPOrderDetails();
			BEOrders DSOrders = new BEOrders();
			DSOrders = bpOrderDetails.SelectOrderDetailsByInventoryID(InventoryID);
			foreach (BEOrders.tbl_OrderDetailsRow orderDetailsRow in DSOrders.tbl_OrderDetails)
			{
				orderDetailsRow.Delete();
				bpOrderDetails.Update(DSOrders);
			}

			BPInventory bp = new BPInventory();
			BEInventory DSInventory = new BEInventory();
			DSInventory = bp.SelectInventoryByID(InventoryID);
			BEInventory.tbl_InventoryRow inventoryRow = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID);
			inventoryRow.Delete();
			bp.Update(DSInventory);

			Response.Redirect("BrowseInventory.aspx");
		}