예제 #1
0
		public BEOrders SelectAllInactive()
		{
			BEOrders ds = new BEOrders();
			DAOrderDetails da = new DAOrderDetails();
			da.SelectAllInactive(ds.tbl_OrderDetails);
			return ds;
		}
예제 #2
0
		public BEOrders SelectOrderDetailsByID(int OrderDetailsID)
		{
			BEOrders ds = new BEOrders();
			DAOrderDetails da = new DAOrderDetails();

			da.SelectByID(OrderDetailsID.ToString(), ds.tbl_OrderDetails);
			return ds;
		}
예제 #3
0
		public BEOrders SelectOrderDetailsByInventoryID(int InventoryID)
		{
			BEOrders ds = new BEOrders();
			DAOrderDetails da = new DAOrderDetails();

			da.SelectOrderDetailsByInventoryID(InventoryID, ds.tbl_OrderDetails);
			return ds;
		}
예제 #4
0
		public BEOrders SelectByOrderID(int OrderID)
		{
			BEOrders ds = new BEOrders();
			DAOrderDetails da = new DAOrderDetails();

			da.SelectByOrderID(OrderID, ds.tbl_OrderDetails);
			return ds;
		}
예제 #5
0
		private void btnSubmit_Click(object sender, EventArgs e)
		{
			BPOrders bp = new BPOrders();
			BEOrders.tbl_OrdersRow Order;
			DSOrders = new BEOrders();
			if (OrderID == 0)
			{
				// Add new Order
				Order = DSOrders.tbl_Orders.Newtbl_OrdersRow();
				Order.OrderCompleted = false;
				Order.OrderCurrent = true;
			}
			else
			{
				// Edit a Order
				DSOrders = bp.SelectOrdersByID(OrderID);
				Order = DSOrders.tbl_Orders.FindByOrderID(OrderID);
				Order.OrderCompleted = true;
			}
			//all content to be updated/inserted between here
			Order.CompanyID = CompanyID;
			Order.CompanyUserID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID);
			Order.OrderRigNumber = txtOrderRigNumber.Text;
			Order.OrderJobNumber = txtOrderJobNumber.Text;
			if (dtOrderDateRequired.SelectedDate != DateTime.MinValue)
			{
				Order.OrderDateRequired = Convert.ToDateTime(dtOrderDateRequired.SelectedDate);
			}
			else
			{
				Order.OrderDateRequired = DateTime.Now;
			}
			Order.OrderTimeRequired = txtOrderTimeRequired.Text;
			Order.OrderRequestedBy = txtOrderRequestedBy.Text;
			Order.OrderShipVIA = txtOrderShipVIA.Text;
			Order.OrderLeaseNumber = txtOrderLeaseNumber.Text;
			Order.OrderShipTo = txtOrderShipTo.Text;
			Order.OrderComments = txtOrderComments.Text;
			Order.IsTransfer = true;
			if (OrderID == 0)
			{
				Order.OrderDate = DateTime.Now;
				DSOrders.tbl_Orders.Addtbl_OrdersRow(Order);
				bp.Update(DSOrders);
				Response.Redirect("EditTransfers.aspx?OrderID=" + Order.OrderID);
			}
			else
			{
				ChangeInventoryStatus(OrderID, 0);
				CheckInPastOrders();
				bp.Update(DSOrders);
				SendOrderEmail email = new SendOrderEmail("transfer");
				string pdfFilePath = Server.MapPath(ConfigurationSettings.AppSettings["PDFFilePath"]);
				email.CreateAndSendEmails(((BEOrders.tbl_OrdersRow) DSOrders.tbl_Orders.Rows[0]).OrderID, pdfFilePath);
				Response.Redirect("OrderConfirmation.aspx?OrderID=" + OrderID);
			}
		}
예제 #6
0
		private void BindDSOrders()
		{
			if (OrderID > 0)
			{
				BPOrderDetails BP = new BPOrderDetails();
				DSOrders = BP.SelectOrderDetailsWithInventoryByOrderID(OrderID);

				if (dgEquipmentOrdered.GroupBy == "")
				{
					dgEquipmentOrdered.PageSize = Convert.ToInt32(ddlEquipmentOrderedPageSize.SelectedValue);
					dgEquipmentOrdered.GroupingPageSize = dgEquipmentOrdered.PageSize;
					dgEquipmentOrdered.DataSource = CreateTable(DSOrders.tbl_OrderDetails.DefaultView, CurrentEquipmentOrderedPage * Convert.ToInt32(ddlEquipmentOrderedPageSize.SelectedValue),Convert.ToInt32(ddlEquipmentOrderedPageSize.SelectedValue));
					dgEquipmentOrdered.ManualPaging = true;
					dgEquipmentOrdered.DataBind();
					dgEquipmentOrdered.RecordCount = DSOrders.tbl_OrderDetails.DefaultView.Count;
				}
				else
				{
					dgEquipmentOrdered.DataSource = DSOrders.tbl_OrderDetails.DefaultView;
					dgEquipmentOrdered.ManualPaging = false;
					dgEquipmentOrdered.DataBind();
				}
				if (OrderCompleted)
				{
					dgEquipmentOrdered.Levels[0].Columns[1].Visible = false;
				}
				else
				{
					dgEquipmentOrdered.Levels[0].Columns[1].Visible = true;
				}
			}
		}
예제 #7
0
		private void CheckForIncompleteOrder()
		{
			BPOrders bp = new BPOrders();
			BEOrders ds = new BEOrders();
			ds = bp.SelectIncompleteByCompanyUserID(OryxUser.OryxIdentity.MemberID);
			ds.tbl_Orders.DefaultView.RowFilter = "IsTransfer=1";
			if (ds.tbl_Orders.DefaultView.Count > 0)
			{
				OrderID = Convert.ToInt32(ds.tbl_Orders.DefaultView[0]["OrderID"]);
			}
		}
예제 #8
0
		private bool CheckForOrders()
		{
			BPOrders bp = new BPOrders();
			if (CompanyID == Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
			{
				DSOrders = bp.SelectByRentalCompanies();
			}
			else
			{
				DSOrders = bp.SelectOrderByCompanyID(CompanyID);
			}
			if (DSOrders.tbl_Orders.Count > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
예제 #9
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();
		}
예제 #10
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();
		}
예제 #11
0
		private void DeleteOrder(int someOrderID)
		{
			if (someOrderID > 0)
			{
				UpdateOrderItemJobNumbers(someOrderID, string.Empty );
				BPOrders bp = new BPOrders();
				BPOrderDetails bpOD = new BPOrderDetails();
				BEOrders.tbl_OrdersRow Order;
				DSOrders = bp.SelectOrdersByID(someOrderID);
				Order = DSOrders.tbl_Orders.FindByOrderID(someOrderID);
				
				if (!Order.OrderCompleted)
					ChangeInventoryStatus(someOrderID, 0);

				Order.Delete();
				DSOrders.Merge(bpOD.SelectOrderDetailsWithInventoryByOrderID(someOrderID));
				foreach (BEOrders.tbl_OrderDetailsRow row in DSOrders.tbl_OrderDetails.Rows)
				{
					row.Delete();
				}
				bp.Update(DSOrders);
				bpOD.Update(DSOrders);
			}
		}
예제 #12
0
		private void CheckForIncompleteOrder()
		{
			BPOrders bp = new BPOrders();
			BEOrders ds = new BEOrders();
			ds = bp.SelectIncompleteByAdminID(OryxUser.OryxIdentity.MemberID);
			ds.tbl_Orders.DefaultView.RowFilter = "IsTransfer=1";
			if (ds.tbl_Orders.DefaultView.Count > 0)
			{
				if (ddlCompanies.Items.FindByValue(ds.tbl_Orders.DefaultView[0]["CompanyID"].ToString()) != null)
				{
					OrderID = Convert.ToInt32(ds.tbl_Orders.DefaultView[0]["OrderID"]);
				}
			}
		}
예제 #13
0
		public void Update(BEOrders ds)
		{
			DAOrderDetails da = new DAOrderDetails();
			da.Update(ds.tbl_OrderDetails);
		}
예제 #14
0
		private void CheckOldOrders()
		{
			BPOrders bp = new BPOrders();
			DSOrders = bp.SelectOldOrders();
			foreach (BEOrders.tbl_OrdersRow oldOrder in DSOrders.tbl_Orders)
			{
				DeleteOrder(oldOrder.OrderID);
			}
		}
예제 #15
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();
		}
예제 #16
0
		private void DeleteOrder(int someOrderID)
		{
			if (someOrderID > 0)
			{
				BPOrders bp = new BPOrders();
				BPOrderDetails bpOD = new BPOrderDetails();
				BEOrders.tbl_OrdersRow Order;
				DSOrders = bp.SelectOrdersByID(someOrderID);
				Order = DSOrders.tbl_Orders.FindByOrderID(someOrderID);
				
				if (!Order.OrderCompleted)
					ChangeInventoryStatus(someOrderID, Convert.ToInt32(!Order.IsTransfer));

				Order.Delete();
				DSOrders.Merge(bpOD.SelectOrderDetailsWithInventoryByOrderID(someOrderID));
				foreach (BEOrders.tbl_OrderDetailsRow row in DSOrders.tbl_OrderDetails.Rows)
				{
					row.Delete();
				}
				bp.Update(DSOrders);
				bpOD.Update(DSOrders);
			}
		}
예제 #17
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;
//			}
		}
예제 #18
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;
			}
		}
예제 #19
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");
		}