Пример #1
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;
			}
		}
Пример #2
0
		private void BindDSInventory()
		{
			int tmpID;
			tmpID = CompanyID;
			if (InventoryType == 1)
			{
				tmpID = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID"));
			}
			BPInventory BP = new BPInventory();
			DSInventory = BP.SelectUnavailableByInventoryCompanyIDAndCompanyID(tmpID, CompanyID);

			string filter = "";
			DSInventory.tbl_Inventory.DefaultView.RowFilter = "";
			if (SortFilter == "")
			{
				DSInventory.tbl_Inventory.DefaultView.Sort = dgInventory.Sort;
			}
			else
			{
				DSInventory.tbl_Inventory.DefaultView.Sort = SortFilter;
			}

			DSInventory.tbl_Inventory.DefaultView.RowFilter = RowFilter("", "InventoryRental");
			filter = DSInventory.tbl_Inventory.DefaultView.RowFilter;
			//Column Search
			if (ddlColumns.SelectedValue != "-1" && ddlColumns.SelectedValue != "" && SearchFilter == "")
			{
				if (filter.Length > 1)
				{
					filter = "(" + filter + ") and ";
				}
				filter += "[" + ddlColumns.SelectedValue + "] like '%" + txtSearchInventory.Text + "%'";
				dgInventory.Search = "";
			}
			else
			{
				string columnName;

				foreach (DataGridItem item in dgAdvancedSearch.Items)
				{
					columnName = ((Label) item.FindControl("lblTokenColumnMapping")).Text;
					if (item.Visible == true)
					{
						if (filter.Length > 1)
						{
							filter = "(" + filter + ") OR ";
						}
						filter += "[" + columnName + "] like '%" + txtSearchInventory.Text + "%'";
					}
				}
			}

			if (SearchFilter != "")
			{
				filter = DSInventory.tbl_Inventory.DefaultView.RowFilter;
				if (filter.Length >1)
				{
					filter = "(" + filter + ") and ";
				}
				filter += "(" + SearchFilter + ")";
			}

			DSInventory.tbl_Inventory.DefaultView.RowFilter = filter;

			if (dgInventory.GroupBy == "")
			{
				dgInventory.PageSize = Convert.ToInt32(ddlInventoryPageSize.SelectedValue);
				dgInventory.GroupingPageSize = dgInventory.PageSize;
				dgInventory.DataSource = CreateTable(DSInventory.tbl_Inventory.DefaultView, CurrentInventoryPage * Convert.ToInt32(ddlInventoryPageSize.SelectedValue),Convert.ToInt32(ddlInventoryPageSize.SelectedValue));
				dgInventory.ManualPaging = true;
				dgInventory.DataBind();
				dgInventory.RecordCount = DSInventory.tbl_Inventory.DefaultView.Count;
			}
			else
			{
				dgInventory.DataSource = DSInventory.tbl_Inventory.DefaultView;
				dgInventory.ManualPaging = false;
				dgInventory.DataBind();
			}
		}
Пример #3
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();
		}
Пример #4
0
		private void BindDSInventory()
		{
			dgInventory.UnCheckAll();  //prevents adding items from multiple tabs simultaneously when clicking the Add button
									   //(because an item can be both Buyable and Rentable but can only be ordered as one or the other)

			int HuntingCompanyID = Convert.ToInt32(ConfigurationSettings.AppSettings["OryxCompanyID"]);
			BPInventory BP = new BPInventory();

			if (InventoryType == Convert.ToInt32(InventoryTypes.Rental))
			{
				DSInventory = BP.SelectAvailableRentalInventory(HuntingCompanyID);
			}
			else if (InventoryType == Convert.ToInt32(InventoryTypes.Buy))
			{
				DSInventory = BP.SelectAvailableBuyInventory(HuntingCompanyID);
			}
			else if (InventoryType == Convert.ToInt32(InventoryTypes.Customer))
			{
				DSInventory = BP.SelectAvailableCustomerInventoryByCompanyID(CompanyID);
			}

			string filter = "";
			DSInventory.tbl_Inventory.DefaultView.RowFilter = "";

			if (SortFilter == "")
			{
				DSInventory.tbl_Inventory.DefaultView.Sort = dgInventory.Sort;
			}
			else
			{
				DSInventory.tbl_Inventory.DefaultView.Sort = SortFilter;
			}

			DSInventory.tbl_Inventory.DefaultView.RowFilter = RowFilter("", "InventoryRental");
			filter = DSInventory.tbl_Inventory.DefaultView.RowFilter;

			//Column Search
			if (ddlColumns.SelectedValue != "-1" && ddlColumns.SelectedValue != "" && SearchFilter == "")
			{
				if (filter.Length > 1)
				{
					filter = "(" + filter + ") and ";
				}
				filter += "[" + ddlColumns.SelectedValue + "] like '%" + txtSearchInventory.Text + "%'";
				dgInventory.Search = "";
			}
			else
			{
				string columnName;

				foreach (DataGridItem item in dgAdvancedSearch.Items)
				{
					columnName = ((Label) item.FindControl("lblTokenColumnMapping")).Text;
					if (item.Visible == true)
					{
						if (filter.Length > 1)
						{
							filter = "(" + filter + ") OR ";
						}
						filter += "[" + columnName + "] like '%" + txtSearchInventory.Text + "%'";
					}
				}
			}

			if (SearchFilter != "")
			{
				filter = DSInventory.tbl_Inventory.DefaultView.RowFilter;
				if (filter.Length >1)
				{
					filter = "(" + filter + ") and ";
				}
				filter += "(" + SearchFilter + ")";
			}

			DSInventory.tbl_Inventory.DefaultView.RowFilter = filter;

			if (dgInventory.GroupBy == "")
			{
				dgInventory.PageSize = Convert.ToInt32(ddlInventoryPageSize.SelectedValue);
				dgInventory.GroupingPageSize = dgInventory.PageSize;
				dgInventory.DataSource = CreateTable(DSInventory.tbl_Inventory.DefaultView, CurrentInventoryPage * Convert.ToInt32(ddlInventoryPageSize.SelectedValue),Convert.ToInt32(ddlInventoryPageSize.SelectedValue));
				dgInventory.ManualPaging = true;
				dgInventory.DataBind();
				dgInventory.RecordCount = DSInventory.tbl_Inventory.DefaultView.Count;
			}
			else
			{
				dgInventory.DataSource = DSInventory.tbl_Inventory.DefaultView;
				dgInventory.ManualPaging = false;
				dgInventory.DataBind();
			}

			//show or hide the New/Used column
			dgInventory.Levels[0].Columns[3].Visible = (InventoryType == Convert.ToInt32(InventoryTypes.Buy));
		}
Пример #5
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();
		}
Пример #6
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;
//			}
		}
Пример #7
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();
		}
Пример #8
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");
		}
Пример #9
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;
			}
		}
Пример #10
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");
		}