protected void btnProcess_Click(object sender, EventArgs e) { try { int idImport = default(int); Int32.TryParse(ProcessIdHdn.Value.ToString(), out idImport); ImportInitialBudget initialBudgetUpload = new ImportInitialBudget(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER)); try { int retVal = initialBudgetUpload.InsertToBudgetTable(idImport); if (retVal >= 0) { this.ShowError(new IndException(string.Format(ApplicationMessages.IMPORT_FILE_PROCESSED, idImport.ToString()))); TrackingActivityLog tkl = new TrackingActivityLog(SessionManager.GetConnectionManager(this)); tkl.InsertTrackingActivityLog(currentProject, currentUser, ETrackingActivity.UploadedInitialBudget); } } catch (Exception ex) { this.ShowError(new IndException(ex.Message.ToString())); } } catch (Exception ex) { ShowError(new IndException(ex)); return; } }
protected void btnReject_Click(object sender, EventArgs e) { try { TrackingActivityLog tkl = new TrackingActivityLog(SessionManager.GetConnectionManager(this.Page)); CurrentUser currentUser = SessionManager.GetSessionValueRedirect(this.Page, SessionStrings.CURRENT_USER) as CurrentUser; //if (currentUser.UserRole.Id == ApplicationConstants.ROLE_BUSINESS_ADMINISTATOR || currentUser.UserRole.Id == ApplicationConstants.ROLE_KEY_USER) //{ // currentUser.IdProjectFunctionImpersonated = ApplicationConstants.INT_NULL_VALUE; //} CurrentProject currentProject = SessionManager.GetSessionValueRedirect(this.Page, SessionStrings.CURRENT_PROJECT) as CurrentProject; bool isFake; string versionNo; switch (BudgetType) { case 0: RejectInitialBudget(); versionNo = "1"; break; case 1: RejectRevisedBudget(); RevisedBudget revBudget = new RevisedBudget(SessionManager.GetConnectionManager(this.Page)); revBudget.IdProject = currentProject.Id; versionNo = revBudget.GetVersionNumber(out isFake); break; case 2: RejectCompletionBudget(); ReforecastBudget refBudget = new ReforecastBudget(SessionManager.GetConnectionManager(this.Page)); refBudget.IdProject = currentProject.Id; versionNo = refBudget.GetVersionNumber(out isFake); break; default: throw new IndException("Unknown budget type: " + BudgetType.ToString()); } if (!string.IsNullOrEmpty(versionNo)) { currentProject.IdVersion = int.Parse(versionNo); } tkl.InsertTrackingActivityLog(currentProject, currentUser, ETrackingActivity.DisapprovedBudget); } catch (IndException ex) { ReportControlError(ex); return; } catch (Exception ex) { ReportControlError(new IndException(ex)); return; } //navigate back to followup ParentPage.ResponseRedirect("~/Pages/Budget/FollowUpBudget/FollowUpBudget.aspx?BudgetType=" + BudgetType + "&BudgetVersion=" + BudgetVersion); }
protected void btnProcess_Click(object sender, EventArgs e) { try { int idImport = default(int); Int32.TryParse(ProcessIdHdn.Value.ToString(), out idImport); ImportRevisedBudget revisedBudgetUpload = new ImportRevisedBudget(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER)); string cleanFileName = RevisedBudgetFileName; if (cleanFileName != null && !FilesWithSkipExistRevisedBudgetError.Contains(cleanFileName) && ExistsInProgressRevisedBudget()) { FilesWithSkipExistRevisedBudgetError.Add(cleanFileName); revisedBudgetUpload.SkipExistRevisedBudgetError = false; throw new IndException("There is a revised budget in-progress. Do you want to process to the replacement?"); } else { if (FilesWithSkipExistRevisedBudgetError.Contains(cleanFileName)) { FilesWithSkipExistRevisedBudgetError.Remove(cleanFileName); revisedBudgetUpload.SkipExistRevisedBudgetError = true; } } try { int retVal = revisedBudgetUpload.InsertToRevisedBudgetTable(idImport); if (retVal >= 0) { this.ShowError(new IndException(string.Format(ApplicationMessages.IMPORT_FILE_PROCESSED, idImport.ToString()))); bool isFake; string versionNo; RevisedBudget revBudget = new RevisedBudget(SessionManager.GetConnectionManager(this.Page)); revBudget.IdProject = currentProject.Id; versionNo = revBudget.GetVersionNumber(out isFake); if (!string.IsNullOrEmpty(versionNo)) { currentProject.IdVersion = int.Parse(versionNo); } TrackingActivityLog tkl = new TrackingActivityLog(SessionManager.GetConnectionManager(this)); tkl.InsertTrackingActivityLog(currentProject, currentUser, ETrackingActivity.UploadedRevisedBudget); } } catch (Exception ex) { this.ShowError(new IndException(ex.Message.ToString())); } } catch (Exception ex) { ShowError(new IndException(ex)); return; } }