private bool isAllowedToReprocess(string jobNo) { bool isAllowedToReprocess = false; ProposalUploadController proposalUploadController = new ProposalUploadController(); string RENEWAL_ADDED = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_ADDED"].ToString(); string TAKEN_BY_BRANCH_RENEWAL_DOC_UPLD = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_BRANCH_RENEWAL_DOC_UPLD"].ToString(); string RENEWAL_DOCS_ADDED = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_DOCS_ADDED"].ToString(); string CANCELLATION_ADDED = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_ADDED"].ToString(); string TAKEN_BY_BRANCH_CANCELLATION_DOC_UPLD = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_BRANCH_CANCELLATION_DOC_UPLD"].ToString(); string CANCELLATION_DOCS_ADDED = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_DOCS_ADDED"].ToString(); string ENDORSEMENT_ADDED = System.Configuration.ConfigurationManager.AppSettings["ENDORSEMENT_ADDED"].ToString(); string INITIAL = System.Configuration.ConfigurationManager.AppSettings["INITIAL"].ToString(); string TAKEN_BY_SCRUTINIZING = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_SCRUTINIZING"].ToString(); string APPROVED_BY_SCRUTINIZING = System.Configuration.ConfigurationManager.AppSettings["APPROVED_BY_SCRUTINIZING"].ToString(); string TAKEN_BY_PROCESSING = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_PROCESSING"].ToString(); string COMPLETED_BY_PROCESSING = System.Configuration.ConfigurationManager.AppSettings["COMPLETED_BY_PROCESSING"].ToString(); string TAKEN_BY_VALIDATORS = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_VALIDATORS"].ToString(); string REJECTED_BY_SCRUTINIZING = System.Configuration.ConfigurationManager.AppSettings["REJECTED_BY_SCRUTINIZING"].ToString(); string APPROVED_BY_VALIDATORS = System.Configuration.ConfigurationManager.AppSettings["APPROVED_BY_VALIDATORS"].ToString(); string currentStatus = ""; currentStatus = proposalUploadController.getStatusOfJobFromJobNo(jobNo); if (currentStatus == null || currentStatus == "") { if (ddlJobType.SelectedValue.ToString() == "N") { if (proposalUploadController.validateQuotationNoFromDB(txtSearchQuotationNo.Text)) { return(true); } } } if (currentStatus == RENEWAL_ADDED || currentStatus == CANCELLATION_ADDED || currentStatus == RENEWAL_ADDED || currentStatus == ENDORSEMENT_ADDED || currentStatus == REJECTED_BY_SCRUTINIZING) { isAllowedToReprocess = true; } return(isAllowedToReprocess); }
private void SearchInQueuedLocationAndRename(string jobType, string jobNo) { string DOCUMENT_UPLOAD_PATH = ""; ProposalUploadController proposalUploadController = new ProposalUploadController(); string currentStatus = ""; currentStatus = proposalUploadController.getStatusOfJobFromJobNo(txtSearchQuotationNo.Text); string RENEWAL_ADDED = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_ADDED"].ToString(); string TAKEN_BY_BRANCH_RENEWAL_DOC_UPLD = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_BRANCH_RENEWAL_DOC_UPLD"].ToString(); string RENEWAL_DOCS_ADDED = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_DOCS_ADDED"].ToString(); string CANCELLATION_ADDED = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_ADDED"].ToString(); string TAKEN_BY_BRANCH_CANCELLATION_DOC_UPLD = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_BRANCH_CANCELLATION_DOC_UPLD"].ToString(); string CANCELLATION_DOCS_ADDED = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_DOCS_ADDED"].ToString(); string ENDORSEMENT_ADDED = System.Configuration.ConfigurationManager.AppSettings["ENDORSEMENT_ADDED"].ToString(); if (jobType == "N") { DOCUMENT_UPLOAD_PATH = System.Configuration.ConfigurationManager.AppSettings["DOCUMENT_UPLOAD_PATH"].ToString(); } else if (jobType == "E") { DOCUMENT_UPLOAD_PATH = System.Configuration.ConfigurationManager.AppSettings["ENDORSEMENT_DOC_UPLOAD_PATH"].ToString(); } else if (jobType == "R") { DOCUMENT_UPLOAD_PATH = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_QUEUED_DOC_UPLOAD_PATH"].ToString(); } else if (jobType == "C") { DOCUMENT_UPLOAD_PATH = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_QUEUED_DOC_UPLOAD_PATH"].ToString(); } string fileAvailableLocation = ""; if (!Directory.Exists(DOCUMENT_UPLOAD_PATH + jobNo)) { return; } fileAvailableLocation = checkIsFileExisted(DOCUMENT_UPLOAD_PATH + jobNo, jobNo); if (fileAvailableLocation != "") { if (checkIsFileLocked(fileAvailableLocation) == false) { if (currentStatus == null || currentStatus == "") { if (ddlJobType.SelectedValue.ToString() == "N") { if (proposalUploadController.validateQuotationNoFromDB(txtSearchQuotationNo.Text)) { System.IO.File.Move(fileAvailableLocation, fileAvailableLocation + "_"); } } } if (currentStatus == RENEWAL_ADDED || currentStatus == CANCELLATION_ADDED || currentStatus == RENEWAL_ADDED || currentStatus == ENDORSEMENT_ADDED) { System.IO.File.Move(fileAvailableLocation, fileAvailableLocation + "_"); } } } }
protected void btnSearch_Click(object sender, EventArgs e) { txtFilePath.Text = ""; txtJobNo.Text = ""; lblMsg.Text = ""; if (ddlJobType.SelectedValue.ToString() == "0") { lblMsg.Text = "Please select Job type"; return; } if (txtSearchQuotationNo.Text == "") { lblMsg.Text = "Please enter Job Number"; return; } SearchInQueuedLocationAndRename(ddlJobType.SelectedValue.ToString(), txtSearchQuotationNo.Text); SearchData(ddlJobType.SelectedValue.ToString(), txtSearchQuotationNo.Text); // ClearComponents(); if (txtFilePath.Text == "") { lblMsg.Text = "File not found"; return; } ProposalUploadController proposalUploadController = new ProposalUploadController(); string currentStatus = ""; string RENEWAL_ADDED = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_ADDED"].ToString(); string TAKEN_BY_BRANCH_RENEWAL_DOC_UPLD = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_BRANCH_RENEWAL_DOC_UPLD"].ToString(); string RENEWAL_DOCS_ADDED = System.Configuration.ConfigurationManager.AppSettings["RENEWAL_DOCS_ADDED"].ToString(); string CANCELLATION_ADDED = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_ADDED"].ToString(); string TAKEN_BY_BRANCH_CANCELLATION_DOC_UPLD = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_BRANCH_CANCELLATION_DOC_UPLD"].ToString(); string CANCELLATION_DOCS_ADDED = System.Configuration.ConfigurationManager.AppSettings["CANCELLATION_DOCS_ADDED"].ToString(); string ENDORSEMENT_ADDED = System.Configuration.ConfigurationManager.AppSettings["ENDORSEMENT_ADDED"].ToString(); string INITIAL = System.Configuration.ConfigurationManager.AppSettings["INITIAL"].ToString(); string TAKEN_BY_SCRUTINIZING = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_SCRUTINIZING"].ToString(); string APPROVED_BY_SCRUTINIZING = System.Configuration.ConfigurationManager.AppSettings["APPROVED_BY_SCRUTINIZING"].ToString(); string TAKEN_BY_PROCESSING = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_PROCESSING"].ToString(); string COMPLETED_BY_PROCESSING = System.Configuration.ConfigurationManager.AppSettings["COMPLETED_BY_PROCESSING"].ToString(); string TAKEN_BY_VALIDATORS = System.Configuration.ConfigurationManager.AppSettings["TAKEN_BY_VALIDATORS"].ToString(); string REJECTED_BY_SCRUTINIZING = System.Configuration.ConfigurationManager.AppSettings["REJECTED_BY_SCRUTINIZING"].ToString(); string APPROVED_BY_VALIDATORS = System.Configuration.ConfigurationManager.AppSettings["APPROVED_BY_VALIDATORS"].ToString(); currentStatus = proposalUploadController.getStatusOfJobFromJobNo(txtSearchQuotationNo.Text); if (currentStatus == null || currentStatus == "") { if (ddlJobType.SelectedValue.ToString() == "N") { if (proposalUploadController.validateQuotationNoFromDB(txtSearchQuotationNo.Text)) { btnReProcess.Enabled = true; lblMsg.Text = "Job file found and ready to re-process"; return; } } } if (currentStatus == RENEWAL_ADDED || currentStatus == CANCELLATION_ADDED || currentStatus == RENEWAL_ADDED || currentStatus == ENDORSEMENT_ADDED || currentStatus == REJECTED_BY_SCRUTINIZING) { btnReProcess.Enabled = true; lblMsg.Text = "Job file found and ready to re-process"; } else { if (currentStatus == null || currentStatus == "") { lblMsg.Text = "Invalid Job"; return; } lblMsg.Text = "Current status of the job is " + currentStatus + " and not allowed to re-process"; return; } }