public int DeleteShipmentFromID(ShipmetDetail mISBN, ShipmetDetail mID) { //insert databse values SqlCommand deleteComm = new SqlCommand(); deleteComm.Connection = this.mConnectionUser; deleteComm.CommandType = CommandType.Text; deleteComm.Parameters.Add("@Sh_ISBN", SqlDbType.VarChar); deleteComm.Parameters.Add("@Sh_ID", SqlDbType.VarChar); deleteComm.Parameters["@Sh_ISBN"].Value = mISBN.ISBN; deleteComm.Parameters["@Sh_ID"].Value = mID.ID; deleteComm.CommandText = "delete from ShipmentDetail where ISBN=@Sh_ISBN AND ShipmentID=@Sh_ID"; int ans = deleteComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
public int UpdateFreshOnTATSipmentFile(ShipmetDetail mFile) { //insert databse values SqlCommand updateComm = new SqlCommand(); updateComm.Connection = this.mConnectionUser; updateComm.CommandType = CommandType.Text; updateComm.Parameters.Add("@Sh_ShipmentID", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_ISBN", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_Priority", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_TATDate", SqlDbType.Int); updateComm.Parameters["@Sh_ShipmentID"].Value = mFile.ShipmentID; updateComm.Parameters["@Sh_ISBN"].Value = mFile.ISBN; updateComm.Parameters["@Sh_Priority"].Value = mFile.Priority; updateComm.Parameters["@Sh_TATDate"].Value = mFile.TATDelivery; updateComm.CommandText = "update ShipmentDetail set TATDelivery=0, Priority=@Sh_Priority where ShipmentID=@Sh_ShipmentID AND ISBN=@Sh_ISBN AND TATDelivery=1"; int ans = updateComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
public int UpdateFeedbackStatusInShipment(ShipmetDetail mFile) { //update databse values SqlCommand updateComm = new SqlCommand(); updateComm.Connection = this.mConnectionUser; updateComm.CommandType = CommandType.Text; updateComm.Parameters.Add("@Sh_ShpID", SqlDbType.Int); updateComm.Parameters.Add("@Sh_ShipmentID", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_ClientFeedback", SqlDbType.Int); updateComm.Parameters["@Sh_ShpID"].Value = mFile.ShpID; updateComm.Parameters["@Sh_ShipmentID"].Value = mFile.ShipmentID; updateComm.Parameters["@Sh_ClientFeedback"].Value = mFile.ClientFeedback; updateComm.CommandText = "UPDATE ShipmentDetail SET ClientFeedback=@Sh_ClientFeedback WHERE ShipmentID=@Sh_ShipmentID AND ShpID=@Sh_ShpID"; int ans = updateComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
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(); } } }
public int UpdateShipment(ShipmetDetail mFile) { //insert databse values SqlCommand updateComm = new SqlCommand(); updateComm.Connection = this.mConnectionUser; updateComm.CommandType = CommandType.Text; updateComm.Parameters.Add("@Sh_ShpID", SqlDbType.Int); updateComm.Parameters.Add("@Sh_ShipmentID", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_ISBN", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_DISBN", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_BookTitle", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_Author", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_Author1", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_PageCount", SqlDbType.Int); updateComm.Parameters.Add("@Sh_PCPCode", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_Complexcity", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_PubDate", SqlDbType.DateTime); updateComm.Parameters.Add("@Sh_Publisher", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_Language", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_TeamName", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_Comment", SqlDbType.NVarChar); updateComm.Parameters["@Sh_ShpID"].Value = mFile.ShpID; updateComm.Parameters["@Sh_ShipmentID"].Value = mFile.ShipmentID; updateComm.Parameters["@Sh_ISBN"].Value = mFile.ISBN; updateComm.Parameters["@Sh_DISBN"].Value = mFile.DISBN; updateComm.Parameters["@Sh_BookTitle"].Value = mFile.Title; updateComm.Parameters["@Sh_Author"].Value = mFile.Author; updateComm.Parameters["@Sh_Author1"].Value = mFile.Author1; updateComm.Parameters["@Sh_PageCount"].Value = mFile.PageCount; updateComm.Parameters["@Sh_PCPCode"].Value = mFile.PCPCode; updateComm.Parameters["@Sh_Complexcity"].Value = mFile.Complexcity; updateComm.Parameters["@Sh_PubDate"].Value = mFile.PubDate; updateComm.Parameters["@Sh_Publisher"].Value = mFile.Publisher; updateComm.Parameters["@Sh_Language"].Value = mFile.Language; updateComm.Parameters["@Sh_TeamName"].Value = mFile.Team; updateComm.Parameters["@Sh_Comment"].Value = mFile.Comment; updateComm.CommandText = "UPDATE ShipmentDetail SET ISBN=@Sh_ISBN, DISBN=@Sh_DISBN, Title=@Sh_BookTitle, Author=@Sh_Author, Author1=@Sh_Author1, PageCount=@Sh_PageCount, PCPCode=@Sh_PCPCode, Complexcity=@Sh_Complexcity, PubDate=@Sh_PubDate, Publisher=@Sh_Publisher, Language=@Sh_Language, Team=@Sh_TeamName, Comment=@Sh_Comment WHERE ShipmentID=@Sh_ShipmentID AND ShpID=@Sh_ShpID"; int ans = updateComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
public String GetAllShpIDByISBN(ShipmetDetail mISBN) { //insert databse values SqlCommand selectComm = new SqlCommand(); selectComm.Connection = this.mConnectionUser; selectComm.CommandType = CommandType.Text; selectComm.Parameters.Add("@Sh_ISBN", SqlDbType.NVarChar); selectComm.Parameters["@Sh_ISBN"].Value = mISBN.ISBN; string a = mISBN.ISBN; return(a.ToString()); }
private void button1_Click(object sender, EventArgs e) { DialogResult result; result = MessageBox.Show("Are you sure want to update Transmission details?", "Update File Details", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (new ShipmentDetailMng(conn).ProductionDoneIsExist(int.Parse(lblTLbl.Text), lblShipment.Text) == true) { if (new ShipmentDetailMng(conn).QRDoneIsExist(int.Parse(lblTLbl.Text), lblShipment.Text) == true) { ShipmetDetail mShilmpent = new ShipmetDetail(); mShilmpent.ShpID = (int.Parse(lblTLbl.Text)); mShilmpent.ShipmentID = lblShipment.Text; mShilmpent.DollerFileName = txtDollarFileName.Text; mShilmpent.DollerUploadedDate = dateTimePickerDollarDate.Value; mShilmpent.FinalPrice = float.Parse(numericFinalPrice.Value.ToString()); mShilmpent.XmittedDate = dateTimePickerXmittedDate.Value; mShilmpent.TransmissionDone = 1; ShipmentDetailMng ShipDetailMng = new ShipmentDetailMng(conn); if (ShipDetailMng.UpdateTransmissioInShipment(mShilmpent) > 0) { MessageBox.Show("File details successfully updated..!", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("File is not QR done yet", "Cannot Update Trasmission", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("File is not Production done yet", "Cannot Update Trasmission", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnDone_Click(object sender, EventArgs e) { ShipmentDetailFormats mShFormats = new ShipmentDetailFormats(); DialogResult result; result = MessageBox.Show("Are you sure want to update file details?", "Update File Details", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { ShipmetDetail mShilmpent = new ShipmetDetail(); ShipmentDetailFormatsMng ShFormats = new ShipmentDetailFormatsMng(conn); mShilmpent.ShpID = (int.Parse(lblTLbl.Text)); mShilmpent.ShipmentID = lblShipment.Text; mShilmpent.ISBN = txtISBN.Text; mShilmpent.DISBN = txtdISBN.Text; mShilmpent.Title = txtBookTitle.Text; mShilmpent.Author = txtAuthor.Text; mShilmpent.Author1 = txtAuthor2.Text; mShilmpent.PageCount = int.Parse(txtPageCount.Text); mShilmpent.PCPCode = txtPCPCode.Text; mShilmpent.Complexcity = cmbComplexcity.Text; mShilmpent.PubDate = dateTimePickerPubDate.Value; mShilmpent.Publisher = cmbPublisher.Text; mShilmpent.Language = cmbLanguage.Text; mShilmpent.Team = cmbTeamName.Text; mShilmpent.Comment = txtComment.Text; ShipmentDetailMng ShipDetailMng = new ShipmentDetailMng(conn); if (ShipDetailMng.UpdateShipment(mShilmpent) > 0) { MessageBox.Show("File details successfully updated..!", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information); ShipDetailMng.GetAllShipmentByName(); } } }
private void btnPriceUpdate_Click(object sender, EventArgs e) { DialogResult result; result = MessageBox.Show("Are you sure want to update Audit details?", "Update File Details", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (new ShipmentDetailMng(conn).ProductionDoneIsExist(int.Parse(lblTLbl.Text), lblShipment.Text) == true) { if (new ShipmentDetailMng(conn).QRDoneIsExist(int.Parse(lblTLbl.Text), lblShipment.Text) == true) { ShipmetDetail mShilmpent = new ShipmetDetail(); mShilmpent.ShpID = (int.Parse(lblTLbl.Text)); mShilmpent.ShipmentID = lblShipment.Text; mShilmpent.AuditName = txtAuditName.Text; mShilmpent.AuditLoadedDate = dateTimePickerAuditLoadedDate.Value; mShilmpent.AuditCount = int.Parse(numericAuditCount.Value.ToString()); mShilmpent.AuditStatus = cmbAuditStatus.Text; ShipmentDetailMng ShipDetailMng = new ShipmentDetailMng(conn); if (ShipDetailMng.UpdateAuditInShipment(mShilmpent) > 0) { MessageBox.Show("File details successfully updated..!", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("File is not QR done yet", "Cannot Update Audit", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("File is not production done yet", "Cannot Update Audit", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public int UpdateTransmissioInShipment(ShipmetDetail mFile) { //insert databse values SqlCommand updateComm = new SqlCommand(); updateComm.Connection = this.mConnectionUser; updateComm.CommandType = CommandType.Text; updateComm.Parameters.Add("@Sh_ShpID", SqlDbType.Int); updateComm.Parameters.Add("@Sh_ShipmentID", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_DollarFileName", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_DollarFileUploadedDate", SqlDbType.DateTime); updateComm.Parameters.Add("@Sh_FinalPrice", SqlDbType.Float); updateComm.Parameters.Add("@Sh_XmittedDate", SqlDbType.DateTime); updateComm.Parameters.Add("@Sh_TransmissionStatus", SqlDbType.Int); updateComm.Parameters["@Sh_ShpID"].Value = mFile.ShpID; updateComm.Parameters["@Sh_ShipmentID"].Value = mFile.ShipmentID; updateComm.Parameters["@Sh_DollarFileName"].Value = mFile.DollerFileName; updateComm.Parameters["@Sh_DollarFileUploadedDate"].Value = mFile.DollerUploadedDate; updateComm.Parameters["@Sh_FinalPrice"].Value = mFile.FinalPrice; updateComm.Parameters["@Sh_XmittedDate"].Value = mFile.XmittedDate; updateComm.Parameters["@Sh_TransmissionStatus"].Value = mFile.TransmissionDone; updateComm.CommandText = "UPDATE ShipmentDetail SET DollerFileName=@Sh_DollarFileName, DollerUploadedDate=@Sh_DollarFileUploadedDate, FinalPrice=@Sh_FinalPrice, XmittedDate=@Sh_XmittedDate, TransmissionDone=@Sh_TransmissionStatus WHERE ShipmentID=@Sh_ShipmentID AND ShpID=@Sh_ShpID"; int ans = updateComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
public int UpdateAuditInShipment(ShipmetDetail mFile) { //insert databse values SqlCommand updateComm = new SqlCommand(); updateComm.Connection = this.mConnectionUser; updateComm.CommandType = CommandType.Text; updateComm.Parameters.Add("@Sh_ShpID", SqlDbType.Int); updateComm.Parameters.Add("@Sh_ShipmentID", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_AuditName", SqlDbType.NVarChar); updateComm.Parameters.Add("@Sh_AuditLoadedDate", SqlDbType.DateTime); updateComm.Parameters.Add("@Sh_AuditCount", SqlDbType.Int); updateComm.Parameters.Add("@Sh_AuditStatus", SqlDbType.NVarChar); updateComm.Parameters["@Sh_ShpID"].Value = mFile.ShpID; updateComm.Parameters["@Sh_ShipmentID"].Value = mFile.ShipmentID; updateComm.Parameters["@Sh_AuditName"].Value = mFile.AuditName; updateComm.Parameters["@Sh_AuditLoadedDate"].Value = mFile.AuditLoadedDate; updateComm.Parameters["@Sh_AuditCount"].Value = mFile.AuditCount; updateComm.Parameters["@Sh_AuditStatus"].Value = mFile.AuditStatus; updateComm.CommandText = "UPDATE ShipmentDetail SET AuditName=@Sh_AuditName, AuditLoadedDate=@Sh_AuditLoadedDate, AuditCount=@Sh_AuditCount, AuditStatus=@Sh_AuditStatus WHERE ShipmentID=@Sh_ShipmentID AND ShpID=@Sh_ShpID"; int ans = updateComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
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); } } }
private void button3_Click(object sender, EventArgs e) { try{ DialogResult result; result = MessageBox.Show("Do you really want to register this shipment?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (cmbShipmentName.Text != "") { if (cmbPDTeam.Text != "") { if (result == DialogResult.Yes) { if (dataGridViewDCDImport.DataSource != null) { //Create Object From User Object ShipmetDetail mShDetail = new ShipmetDetail(); ShipmentHeader mShHeader = new ShipmentHeader(); ShipmentDetailFormats mShFormats = new ShipmentDetailFormats(); ShipmentHeaderMng ShHeader = new ShipmentHeaderMng(conn); ShipmentDetailMng ShDetail = new ShipmentDetailMng(conn); ShipmentDetailFormatsMng ShFormats = new ShipmentDetailFormatsMng(conn); mShHeader.ShipmentID = cmbShipmentName.Text; mShHeader.DownloadedDate = dateTimePickerDCDImport.Value; mShHeader.FileCount = int.Parse(lblFileCount.Text.ToString()); if (ShHeader.AddShipmentHeader(mShHeader) > 0) { //Loop until total Shipment File Count Registerd into the ShipmentDetails Tabele for (int i = 0; i < dataGridViewDCDImport.Rows.Count; i++) { //Load Selected Grid Row to frm_EditImportedFile for Edit // int rowIndex = dataGridViewDCDImport.CurrentRow.Index; string sISBN = dataGridViewDCDImport.Rows[i].Cells[0].Value.ToString(); string sdISBN = dataGridViewDCDImport.Rows[i].Cells[1].Value.ToString(); string stxtBookTitle = dataGridViewDCDImport.Rows[i].Cells[2].Value.ToString(); string stxtAuthor = dataGridViewDCDImport.Rows[i].Cells[3].Value.ToString(); string stxtAuthor1 = dataGridViewDCDImport.Rows[i].Cells[4].Value.ToString(); int sPageCount = int.Parse(dataGridViewDCDImport.Rows[i].Cells[5].Value.ToString()); DateTime sPubDate = DateTime.Parse(dataGridViewDCDImport.Rows[i].Cells[6].Value.ToString()); string sPublisher = dataGridViewDCDImport.Rows[i].Cells[7].Value.ToString(); string sLanguage = dataGridViewDCDImport.Rows[i].Cells[8].Value.ToString(); string sFormat = dataGridViewDCDImport.Rows[i].Cells[9].Value.ToString(); string sComment = dataGridViewDCDImport.Rows[i].Cells[10].Value.ToString(); string sTeam = cmbPDTeam.Text; // Assign User Interface data to User Object mShDetail.DownloadedDate = dateTimePickerDCDImport.Value; mShDetail.ID = cmbShipmentName.Text; mShDetail.Publisher = sPublisher; mShDetail.ISBN = sISBN; mShDetail.DISBN = sdISBN; mShDetail.Title = stxtBookTitle; mShDetail.Author = stxtAuthor; mShDetail.Author1 = stxtAuthor1; mShDetail.PageCount = sPageCount; mShDetail.PubDate = sPubDate; mShDetail.Language = sLanguage; mShDetail.Format = sFormat; mShDetail.Comment = sComment; mShDetail.DateOfAllocation = dateTimePickerAllocatedDate.Value; mShDetail.Team = sTeam; mShDetail.TATDelivery = 0; mShDetail.ProductionDone = 0; mShDetail.QRDone = 0; mShDetail.TransmissionDone = 0; mShDetail.ClientFeedback = 0; if (ShDetail.AddSipmentFile(mShDetail) > 0) { // For each uutput formats dedicate a column //string fePub //string fMobi //string fWEB //string fDoc //string fAFF For Apple Fixed Book //string fKF8 For Kindle Fixed Book //string fKCC For Kindle Comic Book //string fePib For B&N Fixed Book mShFormats.ShipmentID = cmbShipmentName.Text; mShFormats.ShpID = ShDetail.GetLastID(); List <String> LFormat = ShFormats.GetAllFormats(); mShFormats.ProductionStatus = "Not Assigned"; var s1 = sFormat.Split('/'); for (int x = 0; x < s1.Length; x++) { for (int y = 0; y < LFormat.Count(); y++) { if (s1[x].ToString() == LFormat[y]) { mShFormats.FormatName = LFormat[y].ToString(); } } ShFormats.AddShimpentFormats(mShFormats); } } } MessageBox.Show("New Shipment been registered..!\n\nShipment Name: " + mShDetail.ID + "\nTotal File(s): " + (dataGridViewDCDImport.Rows.Count), "Shipment Registerd", MessageBoxButtons.OK, MessageBoxIcon.Information); //Clear Header Details registered after shipment dataGridViewDCDImport.DataSource = null; lblFileCount.Text = ""; lblImportPath.Text = ""; dataGridViewDCDInventory.Focus(); RefreshData(); cmbShipmentName.Text = ""; btnImport.Enabled = false; } } else { MessageBox.Show("There is no new Shipment to import! \nPlease import provided excel file.", "Empty Shipment", MessageBoxButtons.OK, MessageBoxIcon.Error); btnImport.Focus(); } } else { } } else { MessageBox.Show("Please select a Team to allocate shipment!", "Empty Team", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbPDTeam.Focus(); } } else { MessageBox.Show("There is no Shipment to import!.", "Empty Shipment", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbShipmentName.Focus(); } } catch (Exception ex) { if (ex.HResult == -2146232060) { MessageBox.Show("This shipment is already imported..!\n Please check shipment name again.", "Cannot Import", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Error" + ex.Message); } } }
public int AddSipmentFile(ShipmetDetail mFile) { //insert databse values SqlCommand insetComm = new SqlCommand(); insetComm.Connection = this.mConnectionUser; insetComm.CommandType = CommandType.Text; insetComm.Parameters.Add("@Sh_ShipmentID", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_DownloadedDate", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_ISBN", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_DISBN", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_Title", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_Author", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_Author1", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_PageCount", SqlDbType.Int); insetComm.Parameters.Add("@Sh_Language", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_PubDate", SqlDbType.DateTime); insetComm.Parameters.Add("@Sh_Publisher", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_Format", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_Comment", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_AllocatedDate", SqlDbType.DateTime); insetComm.Parameters.Add("@Sh_TeamName", SqlDbType.NVarChar); insetComm.Parameters.Add("@Sh_TATDate", SqlDbType.Int); insetComm.Parameters.Add("@Sh_ProductionStatus", SqlDbType.Int); insetComm.Parameters.Add("@Sh_QRDoneStatus", SqlDbType.Int); insetComm.Parameters.Add("@Sh_TransmissionStatus", SqlDbType.Int); insetComm.Parameters.Add("@Sh_ClientFeedback", SqlDbType.Int); insetComm.Parameters["@Sh_ShipmentID"].Value = mFile.ID; insetComm.Parameters["@Sh_DownloadedDate"].Value = mFile.DownloadedDate; insetComm.Parameters["@Sh_ISBN"].Value = mFile.ISBN; insetComm.Parameters["@Sh_DISBN"].Value = mFile.DISBN; insetComm.Parameters["@Sh_Title"].Value = mFile.Title; insetComm.Parameters["@Sh_Author"].Value = mFile.Author; insetComm.Parameters["@Sh_Author1"].Value = mFile.Author1; insetComm.Parameters["@Sh_PageCount"].Value = mFile.PageCount; insetComm.Parameters["@Sh_Language"].Value = mFile.Language; insetComm.Parameters["@Sh_PubDate"].Value = mFile.PubDate; insetComm.Parameters["@Sh_Publisher"].Value = mFile.Publisher; insetComm.Parameters["@Sh_Format"].Value = mFile.Format; insetComm.Parameters["@Sh_Comment"].Value = mFile.Comment; insetComm.Parameters["@Sh_AllocatedDate"].Value = mFile.DateOfAllocation; insetComm.Parameters["@Sh_TeamName"].Value = mFile.Team; insetComm.Parameters["@Sh_TATDate"].Value = mFile.TATDelivery; insetComm.Parameters["@Sh_ProductionStatus"].Value = mFile.ProductionDone; insetComm.Parameters["@Sh_QRDoneStatus"].Value = mFile.QRDone; insetComm.Parameters["@Sh_TransmissionStatus"].Value = mFile.TransmissionDone; insetComm.Parameters["@Sh_ClientFeedback"].Value = mFile.ClientFeedback; insetComm.CommandText = "insert into ShipmentDetail(ShipmentID,DownloadedDate,ISBN,DISBN,Title,Author,Author1,PageCount,Language,PubDate,Publisher,Format,Comment,Team,DateOfAllocation,TATDelivery,ProductionDone,QRDone,TransmissionDone,ClientFeedback)values(@Sh_ShipmentID,@Sh_DownloadedDate,@Sh_ISBN,@Sh_DISBN,@Sh_Title,@Sh_Author,@Sh_Author1,@Sh_PageCount,@Sh_Language,@Sh_PubDate,@Sh_Publisher,@Sh_Format,@Sh_Comment, @Sh_TeamName,@Sh_AllocatedDate,@Sh_TATDate,@Sh_ProductionStatus,@Sh_QRDoneStatus,@Sh_TransmissionStatus,@Sh_ClientFeedback)"; int ans = insetComm.ExecuteNonQuery(); if (ans > 0) { return(ans); } else { return(0); } }
private void btnRemove_Click(object sender, EventArgs e) { try{ //Message for Error when Shipment Fied is empty if (cmbShipment.Text.ToString() == "") { MessageBox.Show("Please select a Shipment", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (cbmSAllFiles.Checked == true && cmbShipment.Text.ToString() != "") { //Initialize Message Result DialogResult result; result = MessageBox.Show("Do you really want to delete \"" + cmbShipment.Text + "\"?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { //Create Object From ShipmetDetail Object ShipmetDetail mShipment = new ShipmetDetail(); ShipmentHeader mShipmentHeader = new ShipmentHeader(); ShipmentDetailFormats mShipmentDetailFormats = new ShipmentDetailFormats(); TATDelivery mTATDelivery = new TATDelivery(); ProductionManagementDetail mProductionManagementDetail = new ProductionManagementDetail(); ProductionManagementHeader mProductionManagementHeader = new ProductionManagementHeader(); // Assign Shipment Delete Interface data to mShipmentID String mShipmentID = cmbShipment.Text.ToString(); //Create Services ShipmentDetailMng mShipmentMng = new ShipmentDetailMng(conn); ShipmentHeaderMng mShipmentHeaderMng = new ShipmentHeaderMng(conn); ShipmentDetailFormatsMng mShipmentDetailFormatsMng = new ShipmentDetailFormatsMng(conn); TATDeliveryMng mTATDeliveryMng = new TATDeliveryMng(conn); ProductionManagementDetailMng mProductionManagementDetailMng = new ProductionManagementDetailMng(conn); ProductionManagementHeaderMng mProductionManagementHeaderMng = new ProductionManagementHeaderMng(conn); mShipmentDetailFormatsMng.DeleteShimpentFormats(mShipmentID); mShipmentMng.DeleteShipment(mShipmentID); mShipmentHeaderMng.DeleteShipmentHeader(mShipmentID); MessageBox.Show("\"" + cmbShipment.Text + "\" successfully deleted..!", " Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); frm_DCDImport DCDFrm = new frm_DCDImport(); RefreshData(); this.Dispose(); } else { this.Dispose(); } } else if (cmbISBN.Text != "" && cmbShipment.Text.ToString() != "") { //Initialize Message Result DialogResult result; result = MessageBox.Show("Do you really want to delete ISBN " + cmbISBN.Text + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { //Create Object From ShipmetDetail Object ShipmetDetail mShipmentISBN = new ShipmetDetail(); ShipmetDetail mShipment = new ShipmetDetail(); ShipmentDetailFormats mShipmentDetailFormats = new ShipmentDetailFormats(); // Assign Shipment Delete Interface data to mShipmentwithISBN Object mShipment.ID = cmbShipment.Text; mShipmentISBN.ISBN = cmbISBN.Text; ShipmentDetailMng mShipmentMng = new ShipmentDetailMng(conn); ShipmentDetailMng mShipmentMngShpID = new ShipmentDetailMng(conn); ShipmentDetailFormatsMng mShipmentDetailFormatsMng = new ShipmentDetailFormatsMng(conn); if (mShipmentMng.DeleteShipmentFromID(mShipmentISBN, mShipment) > 0) { MessageBox.Show("ISBN " + mShipmentISBN.ISBN + " successfully deleted..!", "ISBN Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshData(); this.Dispose(); } } else if (result == DialogResult.No) { this.Close(); } } } } catch (Exception ex) { if (ex.HResult == -2146232060) { MessageBox.Show("This shipment is already in production!", "Cannot Delete", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Error" + ex.Message); } } }