private void btnAddFeedBack_Click(object sender, EventArgs e) { DialogResult result; Feedback mCF = new Feedback(); ShipmetDetail mSD = new ShipmetDetail(); //Initialize Feedback data to Feedback Table mCF.ISBN = txtISBN.Text; mCF.FeedbackDate = dateTimePickerFeedbackDate.Value; mCF.ShpID = int.Parse(lbldShpID.Text); mCF.ShipmentID = lbldShipment.Text; mCF.Remark = txtRemark.Text; mCF.FormatName = lbldFormat.Text; //Initialize Feedback data to Feedback Table mSD.ShpID = int.Parse(lbldShpID.Text); mSD.ShipmentID = lbldShipment.Text; mSD.ClientFeedback = 1; FeedbackMng mCFMng = new FeedbackMng(conn); ShipmentDetailMng mSDMng = new ShipmentDetailMng(conn); result = MessageBox.Show("Do you really want to add feedback?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (mCFMng.AddFeedback(mCF) > 0) { mSDMng.UpdateFeedbackStatusInShipment(mSD); MessageBox.Show("Client feedback sucessfully added.", "Feedback Added", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } } }
private void btnReturnFile_Click(object sender, EventArgs e) { try { int rowIndex = dataGridViewFeedbackFile.CurrentRow.Index; DialogResult result; Feedback mCF = new Feedback(); ShipmetDetail mSD = new ShipmetDetail(); ProductionStatus mPS = new ProductionStatus(); //Initialize Feedback data to Feedback Table mCF.ShpID = int.Parse(dataGridViewFeedbackFile.Rows[rowIndex].Cells[0].Value.ToString()); mCF.ShipmentID = dataGridViewFeedbackFile.Rows[rowIndex].Cells[1].Value.ToString(); mCF.ISBN = dataGridViewFeedbackFile.Rows[rowIndex].Cells[2].Value.ToString(); mCF.FormatName = dataGridViewFeedbackFile.Rows[rowIndex].Cells[3].Value.ToString(); //Initialize Feedback data to Shipment Detail Table mSD.ShpID = int.Parse(dataGridViewFeedbackFile.Rows[rowIndex].Cells[0].Value.ToString()); mSD.ShipmentID = dataGridViewFeedbackFile.Rows[rowIndex].Cells[1].Value.ToString(); mSD.TransmissionDone = 0; //Production Status Log Values Initialize mPS.ProductID = int.Parse(dataGridViewFeedbackFile.Rows[rowIndex].Cells[0].Value.ToString()); mPS.ShipmentID = dataGridViewFeedbackFile.Rows[rowIndex].Cells[1].Value.ToString(); mPS.ISBN = dataGridViewFeedbackFile.Rows[rowIndex].Cells[2].Value.ToString(); mPS.FormatName = dataGridViewFeedbackFile.Rows[rowIndex].Cells[3].Value.ToString(); mPS.UserID = lblUID.Text; mPS.StartDate = DateTime.Now; mPS.Status = "Feedback Removed by System Access User " + lblUID.Text; ShipmentDetailMng mSDMng = new ShipmentDetailMng(conn); FeedbackMng mCFMng = new FeedbackMng(conn); ProductionStatusLogMng mPSMng = new ProductionStatusLogMng(conn); result = MessageBox.Show("Do you really want to remove feedback?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { //Remove data from Feedback Table if (mCFMng.DeleteFeedback(mCF) > 0) { //Update Shipment Detail Table mSDMng.UpdateFeedbackStatusInShipment(mSD); MessageBox.Show("Client feedback sucessfully removed.", "Feedback Removed", MessageBoxButtons.OK, MessageBoxIcon.Information); //Production Status Log mPSMng.AddProdustionStatus(mPS); RefreshData(); } } } catch (Exception ex) { if (ex.HResult == -2147467261) { MessageBox.Show("There is no file selected to remove feedback.\n Please select a file from Feedback File list or Click Referesh button.", "Cannot Remove", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Error" + ex.Message); } } }