private void CheckInPastOrders() { BPOrders bp = new BPOrders(); foreach (GridItem dgi in dgEquipmentOrdered.Items) { bp.UpdateCurrentStatusByInventoryID(Convert.ToInt32(dgi[12]), true); } }
private void btnReturnToStock_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) { // Add new Inventory Item InventoryItem = DSInventory.tbl_Inventory.Newtbl_InventoryRow(); } else { // Edit a Company DSInventory = bp.SelectInventoryByID(InventoryID); InventoryItem = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID); } //all content to be updated/inserted between here InventoryItem.InventoryInStock = 1; InventoryItem.SetJobNumberNull(); 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); // // BPInventory bpInv = new BPInventory(); // BEInventory ds = bpInv.SelectInventoryByID(InventoryID); // BEInventory.tbl_InventoryRow row = ds.tbl_Inventory.FindByInventoryID(InventoryID); // row.InventoryInStock = 1; // bpInv.Update(ds); BPOrders bpOrders = new BPOrders(); bpOrders.UpdateCurrentStatusByInventoryID(InventoryID, false); Response.Redirect("BrowseInventory.aspx"); } else { lblMessage.Text = message; pnlMessage.Visible = true; } }