private void btnApprove_Click(object sender, EventArgs e) { try { SMRNDB smrnhdb = new SMRNDB(); DialogResult dialog = MessageBox.Show("Are you sure to Approve the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { //prevsh.TrackingNo = DocumentNumberDB.getNewNumber(docID, 2); if (smrnhdb.ApproveSMRN(prevsh)) { MessageBox.Show("SMRN Approved"); if (!updateDashBoard(prevsh, 2)) { MessageBox.Show("DashBoard Fail to update"); } closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse } } } catch (Exception) { } }
private void btnReverse_Click(object sender, EventArgs e) { try { DialogResult dialog = MessageBox.Show("Are you sure to Reverse the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { string reverseStr = getReverseString(prevsh.ForwarderList); //do forward activities //prevpopi.CommentStatus = DocCommenterDB.removeUnapprovedCommentStatus(prevpopi.CommentStatus); SMRNDB smrnhdb = new SMRNDB(); if (reverseStr.Trim().Length > 0) { int ind = reverseStr.IndexOf("!@#"); prevsh.ForwarderList = reverseStr.Substring(0, ind); prevsh.ForwardUser = reverseStr.Substring(ind + 3); prevsh.DocumentStatus = prevsh.DocumentStatus - 1; } else { prevsh.ForwarderList = ""; prevsh.ForwardUser = ""; prevsh.DocumentStatus = 1; } if (smrnhdb.reverseSMRN(prevsh)) { MessageBox.Show(" SMRN Document Reversed"); closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse } } } catch (Exception ex) { } }
private void lvForwardOK_Click(object sender, EventArgs e) { try { { int kount = 0; string approverUID = ""; string approverUName = ""; foreach (ListViewItem itemRow in lvApprover.Items) { if (itemRow.Checked) { approverUID = itemRow.SubItems[2].Text; approverUName = itemRow.SubItems[1].Text; kount++; } } if (kount == 0) { MessageBox.Show("Select one approver"); return; } if (kount > 1) { MessageBox.Show("Select only one approver"); return; } else { DialogResult dialog = MessageBox.Show("Are you sure to forward the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { //do forward activities SMRNDB smrnhDB = new SMRNDB(); prevsh.ForwardUser = approverUID; prevsh.ForwarderList = prevsh.ForwarderList + approverUName + Main.delimiter1 + approverUID + Main.delimiter1 + Main.delimiter2; if (smrnhDB.forwardSMRN(prevsh)) { frmPopup.Close(); frmPopup.Dispose(); MessageBox.Show("Document Forwarded"); if (!updateDashBoard(prevsh, 1)) { MessageBox.Show("DashBoard Fail to update"); } pnlForwarder.Controls.Remove(lvApprover); pnlForwarder.Visible = false; closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse } } } } } catch (Exception ex) { } }
private void ListFilteredSMRN(int option) { try { grdList.Rows.Clear(); SMRNDB smrnhdb = new SMRNDB(); forwarderList = demDB.getForwarders(docID, Login.empLoggedIn); approverList = demDB.getApprovers(docID, Login.empLoggedIn); List <smrn> SMRNList = smrnhdb.getFilteredSMRNHeader(userString, option); if (option == 1) { lblActionHeader.Text = "List of Action Pending Documents"; } if (option == 2) { lblActionHeader.Text = "List of In-Process Documents"; } else if (option == 3) { lblActionHeader.Text = "List of Approved Documents"; } foreach (smrn smrnh in SMRNList) { if (option == 1) { if (smrnh.DocumentStatus == 99) { continue; } } else { } grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["DocumentID"].Value = smrnh.DocumentID; grdList.Rows[grdList.RowCount - 1].Cells["DocumentName"].Value = smrnh.DocumentName; grdList.Rows[grdList.RowCount - 1].Cells["SMRNNo"].Value = smrnh.SMRNNo; grdList.Rows[grdList.RowCount - 1].Cells["SMRNDate"].Value = smrnh.SMRNDate; grdList.Rows[grdList.RowCount - 1].Cells["CustomerID"].Value = smrnh.CustomerID; grdList.Rows[grdList.RowCount - 1].Cells["CustomerName"].Value = smrnh.CustomerName; grdList.Rows[grdList.RowCount - 1].Cells["CustomerDocumentNo"].Value = smrnh.CustomerDocumentNo; grdList.Rows[grdList.RowCount - 1].Cells["CustomerDocumentDate"].Value = smrnh.CustomerDocumentDate; grdList.Rows[grdList.RowCount - 1].Cells["CourierID"].Value = smrnh.CourierID; grdList.Rows[grdList.RowCount - 1].Cells["CourierName"].Value = smrnh.CourierName; grdList.Rows[grdList.RowCount - 1].Cells["NoOfPacket"].Value = smrnh.NoOfPackets; grdList.Rows[grdList.RowCount - 1].Cells["Remarks"].Value = smrnh.Remarks; grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value = smrnh.Status; grdList.Rows[grdList.RowCount - 1].Cells["DocumentStatus"].Value = smrnh.DocumentStatus; grdList.Rows[grdList.RowCount - 1].Cells["CreateTime"].Value = smrnh.CreateTime; grdList.Rows[grdList.RowCount - 1].Cells["CreateUser"].Value = smrnh.CreateUser; grdList.Rows[grdList.RowCount - 1].Cells["ForwardUser"].Value = smrnh.ForwardUser; grdList.Rows[grdList.RowCount - 1].Cells["ApproveUser"].Value = smrnh.ApproveUser; grdList.Rows[grdList.RowCount - 1].Cells["Approver"].Value = smrnh.ApproverName; grdList.Rows[grdList.RowCount - 1].Cells["Creator"].Value = smrnh.CreatorName; grdList.Rows[grdList.RowCount - 1].Cells["Forwarder"].Value = smrnh.ForwarderName; grdList.Rows[grdList.RowCount - 1].Cells["Forwarders"].Value = smrnh.ForwarderList; } } catch (Exception ex) { MessageBox.Show("Error in SMRN Header listing"); } setButtonVisibility("init"); pnlList.Visible = true; grdList.Columns["Creator"].Visible = true; grdList.Columns["Forwarder"].Visible = true; grdList.Columns["Approver"].Visible = true; }
private void btnSave_Click_1(object sender, EventArgs e) { Boolean status = true; try { SMRNDB smrnhDB = new SMRNDB(); smrn smrnh = new smrn(); try { ////////smrnh.CourierID = cmbCourierID.SelectedItem.ToString().Trim().Substring(0,cmbCourierID.SelectedItem.ToString().Trim().IndexOf('-')); smrnh.CourierID = ((Structures.ComboBoxItem)cmbCourierID.SelectedItem).HiddenValue; //////////smrnh.CustomerID = cmbCustomer.SelectedItem.ToString().Trim().Substring(0, cmbCustomer.SelectedItem.ToString().Trim().IndexOf('-')); smrnh.CustomerID = ((Structures.ComboBoxItem)cmbCustomer.SelectedItem).HiddenValue; } catch (Exception) { smrnh.CustomerID = ""; smrnh.CustomerName = ""; } smrnh.DocumentID = docID; smrnh.SMRNDate = dtSMRNDate.Value; smrnh.CustomerDocumentDate = dtCustomerDocDate.Value; smrnh.Remarks = txtRemarks.Text; smrnh.NoOfPackets = Convert.ToInt32(txtNoOfPacket.Text); smrnh.CustomerDocumentNo = txtCuxtomerDocNo.Text; string btnText = btnSave.Text; if (btnText.Equals("Update")) { smrnh.ForwarderList = prevsh.ForwarderList; smrnh.SMRNNo = Convert.ToInt32(txtSMRNNo.Text); if (smrnhDB.validateSMRN(smrnh)) { if (smrnhDB.updateSMRN(smrnh, prevsh)) { MessageBox.Show("SMRN updated"); closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); } else { status = false; MessageBox.Show("Failed to update SMRN"); } } else { status = false; MessageBox.Show("Smrn DEtail Entered Wrong"); } } else if (btnText.Equals("Save")) { smrnh.DocumentStatus = 1;//created smrnh.SMRNDate = UpdateTable.getSQLDateTime(); smrnh.SMRNNo = DocumentNumberDB.getNewNumber(docID, 1); if (smrnhDB.validateSMRN(smrnh)) { if (smrnhDB.insertSMRN(smrnh)) { MessageBox.Show("SMRN Added"); closeAllPanels(); listOption = 1; ListFilteredSMRN(listOption); } else { MessageBox.Show("Failed to Insert SMRN"); status = false; } } else { status = false; MessageBox.Show("Smrn DEtail Entered Wrong"); } } else { status = false; MessageBox.Show("SMRN Data Operation failed"); } } catch (Exception ex) { MessageBox.Show("Failed Adding / Editing SMRN"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }