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(); }
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; } }
private DataSet BuildGridData() { BPOrders bp = new BPOrders(); BPInventory bpInv = new BPInventory(); if (ddlCompanies.SelectedValue == "-1") { DSOrders = bp.SelectWithCompanyByCompanyID(0); DSOrders.tbl_Orders.DefaultView.Sort = "OrderDate DESC"; DSOrders.Merge(bpInv.SelectOrderDetailsWithInventoryByCompanyID(0)); } else { DSOrders = bp.SelectWithCompanyByCompanyID(Convert.ToInt32(ddlCompanies.SelectedValue)); DSOrders.tbl_Orders.DefaultView.Sort = "OrderDate DESC"; DSOrders.Merge(bpInv.SelectOrderDetailsWithInventoryByCompanyID(Convert.ToInt32(ddlCompanies.SelectedValue))); } DSOrders.Relations.Add(DSOrders.Tables["tbl_Orders"].Columns["OrderId"], DSOrders.Tables["tbl_OrderDetails"].Columns["OrderId"]); rptLetters.Visible = false; DSOrders.tbl_Orders.DefaultView.RowFilter = RowFilter("", "OrderCurrent"); string filter; if (AdvancedSearchFilter != "") { filter = DSOrders.tbl_Orders.DefaultView.RowFilter; if (filter.Length >1) { filter = "(" + filter + ") and "; } filter += AdvancedSearchFilter; DSOrders.tbl_Orders.DefaultView.RowFilter = filter; } return DSOrders; }
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(); } }
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); }
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(); }
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; // } }
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)); }
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(); }
private void FillTextBoxes() { BPInventory bp = new BPInventory(); BEInventory ds = bp.SelectInventoryByID(InventoryID); BEInventory.tbl_InventoryRow item = ds.tbl_Inventory.FindByInventoryID(InventoryID); lblTitle.Text = "View Inventory Item - " + item.ItemNumber; CompanyID = item.CompanyID; txtItemNumber.Text = item.ItemNumber; if (! item.IsDescriptionNull()) txtDescription.Text = item.Description; if (! item.IsBoxNull()) txtBox.Text = item.Box; if (! item.IsPinNull()) txtPin.Text = item.Pin; if (! item.IsBox2Null()) txtBox2.Text = item.Box2; if (! item.IsMajorODNull()) txtMajorOD.Text = item.MajorOD; if (! item.IsMinorODNull()) txtMinorOD.Text = item.MinorOD; if (! item.IsInsideDiameterNull()) txtInsideDiameter.Text = item.InsideDiameter; if (! item.IsSealtoSealLengthNull()) txtSealToSeal.Text = item.SealtoSealLength; if (! item.IsFloatBoreNull()) txtFloatBore.Text = item.FloatBore; if (! item.IsGeneralCommentsNull()) txtComments.Text = item.GeneralComments; if (! item.IsExtraColumn1Null()) txtExtraColumn1.Text = item.ExtraColumn1; if (! item.IsExtraColumn2Null()) txtExtraColumn2.Text = item.ExtraColumn2; if (! item.IsExtraColumn3Null()) txtExtraColumn3.Text = item.ExtraColumn3; if (! item.IsExtraColumn4Null()) txtExtraColumn4.Text = item.ExtraColumn4; if (! item.IsExtraColumn5Null()) txtExtraColumn5.Text = item.ExtraColumn5; if (! item.IsExtraColumn6Null()) txtExtraColumn6.Text = item.ExtraColumn6; if (! item.IsExtraColumn7Null()) txtExtraColumn7.Text = item.ExtraColumn7; if (! item.IsExtraColumn8Null()) txtExtraColumn8.Text = item.ExtraColumn8; if (! item.IsExtraColumn9Null()) txtExtraColumn9.Text = item.ExtraColumn9; if (! item.IsExtraColumn10Null()) txtExtraColumn10.Text = item.ExtraColumn10; }
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"); }
private void FillTextBoxes() { BPInventory bp = new BPInventory(); BEInventory ds = bp.SelectInventoryByID(InventoryID); BEInventory.tbl_InventoryRow item = ds.tbl_Inventory.FindByInventoryID(InventoryID); lblTitle.Text = "Edit Inventory Item - " + item.ItemNumber; ddlCompanies.Items.FindByValue(item.CompanyID.ToString()).Selected = true; txtItemNumber.Text = item.ItemNumber; if (! item.IsDescriptionNull()) txtDescription.Text = item.Description; if (! item.IsBoxNull()) txtBox.Text = item.Box; if (! item.IsPinNull()) txtPin.Text = item.Pin; if (! item.IsBox2Null()) txtBox2.Text = item.Box2; if (! item.IsMajorODNull()) txtMajorOD.Text = item.MajorOD; if (! item.IsMinorODNull()) txtMinorOD.Text = item.MinorOD; if (! item.IsInsideDiameterNull()) txtInsideDiameter.Text = item.InsideDiameter; if (! item.IsSealtoSealLengthNull()) txtSealToSeal.Text = item.SealtoSealLength; if (! item.IsFloatBoreNull()) txtFloatBore.Text = item.FloatBore; if (! item.IsGeneralCommentsNull()) txtComments.Text = item.GeneralComments; if (! item.IsExtraColumn1Null()) txtExtraColumn1.Text = item.ExtraColumn1; if (! item.IsExtraColumn2Null()) txtExtraColumn2.Text = item.ExtraColumn2; if (! item.IsExtraColumn3Null()) txtExtraColumn3.Text = item.ExtraColumn3; if (! item.IsExtraColumn4Null()) txtExtraColumn4.Text = item.ExtraColumn4; if (! item.IsExtraColumn5Null()) txtExtraColumn5.Text = item.ExtraColumn5; if (! item.IsExtraColumn6Null()) txtExtraColumn6.Text = item.ExtraColumn6; if (! item.IsExtraColumn7Null()) txtExtraColumn7.Text = item.ExtraColumn7; if (! item.IsExtraColumn8Null()) txtExtraColumn8.Text = item.ExtraColumn8; if (! item.IsExtraColumn9Null()) txtExtraColumn9.Text = item.ExtraColumn9; if (! item.IsExtraColumn10Null()) txtExtraColumn10.Text = item.ExtraColumn10; if(plcBuyRent.Visible) { chkInventoryRent.Checked = item.InventoryRental; chkInventoryBuy.Checked = item.InventoryBuy; rblNewUsed.SelectedValue = item.IsInventoryNewUsedNull() ? "New" : item.InventoryNewUsed; txtRentalPrice.Text = item.IsRentalPriceNull() ? "" : item.RentalPrice; txtSalePriceNew.Text = item.IsSalePriceNewNull() ? "" : item.SalePriceNew; txtSalePriceUsed.Text = item.IsSalePriceUsedNull() ? "" : item.SalePriceUsed; } chkInventoryActive.Checked = item.InventoryActive; btnReturnToStock.Visible = (item.InventoryInStock == 0 || item.InventoryInStock == 3); //On Job OR In Process btnInProcess.Visible = (item.InventoryInStock == 0); //On Job }
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; } }
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"); }
//private void ChangeColumnNames() //{ // BPCompanyAliases bp = new BPCompanyAliases(); // Hashtable ht = bp.SelectColumnMappings(GlobalCompanyID); // if (ht.Count > 0) // { // foreach (GridColumn column in dgInventory.Levels[1].Columns) // { // if (ht.ContainsKey(column.DataField) && ht[column.DataField] != null && ht[column.DataField].ToString() != "") // { // column.HeadingText = ht[column.DataField].ToString(); // } // } // } //} private DataSet BuildGridData() { BPInventory bp = new BPInventory(); //BPInventory bpInv = new BPInventory(); if (ddlCompanies.SelectedValue == "-1") { DSInventory = bp.SelectInventoryByCompanyID(1); //DSInventory.tbl_Inventory.DefaultView.Sort = "OrderDate DESC"; //DSInventory.Merge(bpInv.SelectOrderDetailsWithInventoryByCompanyID(0)); } else { DSInventory = bp.SelectInventoryByCompanyID(Convert.ToInt32(ddlCompanies.SelectedValue)); //DSInventory.tbl_Inventory.DefaultView.Sort = "OrderDate DESC"; //DSInventory.Merge(bpInv.SelectOrderDetailsWithInventoryByCompanyID(Convert.ToInt32(ddlCompanies.SelectedValue))); } //DSInventory.Relations.Add(DSInventory.Tables["tbl_Inventory"].Columns["OrderId"], DSInventory.Tables["tbl_OrderDetails"].Columns["OrderId"]); rptLetters.Visible = false; DSInventory.tbl_Inventory.DefaultView.RowFilter = RowFilter("", "OrderCurrent"); string filter; if (SearchFilter != "") { filter = DSInventory.tbl_Inventory.DefaultView.RowFilter; if (filter.Length > 1) { filter = "(" + filter + ") and "; } filter += SearchFilter; DSInventory.tbl_Inventory.DefaultView.RowFilter = filter; } filter = DSInventory.tbl_Inventory.DefaultView.RowFilter; if (filter.Length > 1) { filter = "(" + filter + ") and "; } //filter += "IsTransfer=0"; DSInventory.tbl_Inventory.DefaultView.RowFilter = filter; return DSInventory; }