protected void btnDelete_Click(object sender, EventArgs e) { var requestToDelete = new Requisition { Id = RequestId }; _requisitionManager.Delete(requestToDelete); divMessageBox.Attributes.Add("class", "notify warning"); divMessageBox.Visible = true; btnDelete.Visible = false; btnSubmitEntry.Visible = false; lnkButtonAdd.Visible = false; btnProcess.Visible = false; lnkButtonAdd.Visible = false; ltrlMessage.Text = "Requisition entry has been deleted!"; }
protected void btnSubmitEntry_Click(object sender, EventArgs e) { if (Mode==Transaction.TransactionMode.UpdateEntry) { var request = new Requisition { ItemId = int.Parse(DDLProducts.SelectedValue), BarCode = txtBarCode.Text.Trim(), ItemClassificationId = int.Parse(DDLClassifications.SelectedValue), DepartmentId = int.Parse(DDLRequestTo.SelectedValue), DateCreated = DateTime.Now, ReferenceNumber = Requisition.ReferenceNumber, UniqueId = Guid.NewGuid(), Id = RequestId, QuantityIssued = int.Parse(txtQuantityIssue.Text), QuantityReceived = 0, RequisitionDate = DateTime.Parse(txtDateRequested.Text), Status = Transaction.TransactionStatus.Submitted.ToString(), SubmittedTo = DDLRequestTo.SelectedItem.Text, UnitId = int.Parse(DDLUnits.SelectedValue) }; _requisitionManager.Save(request); divMessageBox.Attributes.Add("class", "notify success"); divMessageBox.Visible = true; ltrlMessage.Text = "Requisition entry has been updated!"; } else { var requests = new List<Requisition>(); if (RequestItems().Count <= 0) return; requests.AddRange(RequestItems().Select(ri => new Requisition { UnitId = ri.UnitId, BarCode = ri.Barcode, DateCreated = DateTime.Now, DepartmentId = ri.DepartmentId, ItemClassificationId = ri.ClassificationId, ItemId = ri.ItemId, QuantityIssued = int.Parse(txtQuantityIssue.Text), SubmittedTo = DDLRequestTo.SelectedItem.Text, ReferenceNumber = txtReferenceNumber.Text.Trim(), RequisitionDate = DateTime.Parse(txtDateRequested.Text), Status = Transaction.TransactionStatus.Submitted.ToString(), UniqueId = Guid.NewGuid(), QuantityReceived = 0, })); _requisitionManager.Save(requests); divMessageBox.Attributes.Add("class", "notify success"); divMessageBox.Visible = true; ltrlMessage.Text = "New Requisition/s entry has been saved!"; } btnSubmitEntry.Enabled = false; }