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); }
void LoadVersionCombo(string crtveriosn) { cmbVersion.Items.Clear(); if (cmbSource.SelectedItem.Text == ApplicationConstants.BUDGET_TYPE_TOCOMPLETION.ToLower()) { ReforecastBudget reforecastBug = new ReforecastBudget(SessionManager.GetConnectionManager(this)); reforecastBug.IdProject = currentProject.Id; reforecastBug.Version = ApplicationConstants.BUDGET_VERSION_RELEASED_CODE; DataSet versionsDS = reforecastBug.GetVersions(); foreach (DataRow r in versionsDS.Tables[0].Rows) { cmbVersion.Items.Add(new Telerik.Web.UI.RadComboBoxItem(r["IdGeneration"].ToString(), r["IdGeneration"].ToString())); } } if (cmbSource.SelectedItem.Text == ApplicationConstants.BUDGET_TYPE_REVISED.ToLower()) { RevisedBudget revisedBug = new RevisedBudget(SessionManager.GetConnectionManager(this)); revisedBug.IdProject = currentProject.Id; revisedBug.Version = ApplicationConstants.BUDGET_VERSION_RELEASED_CODE; DataSet versionsDS = revisedBug.GetVersions(); foreach (DataRow r in versionsDS.Tables[0].Rows) { cmbVersion.Items.Add(new Telerik.Web.UI.RadComboBoxItem(r["IdGeneration"].ToString(), r["IdGeneration"].ToString())); } } cmbVersion.SelectedValue = crtveriosn; }
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; } }
/// <summary> /// Method that returns current version of selected budget only for Revised or Reforcast /// </summary> /// <returns>version number or empty for revised or Reforcast, _ character for initial and actual</returns> private string GetSourceCurrentVersion() { string versionNo = string.Empty; bool bIsFake; if (cmbSource.SelectedItem.Text == ApplicationConstants.BUDGET_TYPE_REVISED.ToLower()) { RevisedBudget revisedBug = new RevisedBudget(SessionManager.GetConnectionManager(this)); revisedBug.IdProject = currentProject.Id; revisedBug.Version = ApplicationConstants.BUDGET_VERSION_RELEASED_CODE; return(revisedBug.GetVersionNumber(out bIsFake)); } if (cmbSource.SelectedItem.Text == ApplicationConstants.BUDGET_TYPE_TOCOMPLETION.ToLower()) { ReforecastBudget reforecastBug = new ReforecastBudget(SessionManager.GetConnectionManager(this)); reforecastBug.IdProject = currentProject.Id; reforecastBug.Version = ApplicationConstants.BUDGET_VERSION_RELEASED_CODE; return(reforecastBug.GetVersionNumber(out bIsFake)); } //if ends here there another type of budget(initial or actual) return("_"); }
private void MoveBudgetRows_Revised() { int moveReleased = 0; RevisedBudget revisedBudget = new RevisedBudget(SessionManager.GetConnectionManager(this)); revisedBudget.IdProject = currentProject.Id; object lastRevisedValidatedVersion = revisedBudget.GetLastValidatedVersion(); if (lastRevisedValidatedVersion != null && int.Parse(lastRevisedValidatedVersion.ToString()) > 0) { moveReleased = 1; } GridTableView grdTableVw = grdMoveBudget.MasterTableView; GridDataItemCollection itemCollection = grdTableVw.Items; foreach (GridItem gridItem in itemCollection) { int idAssociateNM = GetIdAssociateNM(gridItem); if (idAssociateNM != ApplicationConstants.INT_NULL_VALUE) { FollowUpRevisedBudget followUpRevisedBudget = new FollowUpRevisedBudget(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER)); if (moveReleased == 0) { followUpRevisedBudget.MoveRevisedBudget(currentProject.Id, GetIdAssociateLM(), idAssociateNM, SessionManager.GetCurrentUser(this).IdAssociate); } else { followUpRevisedBudget.MoveRevisedBudgetReleasedVersion(currentProject.Id, GetIdAssociateLM(), idAssociateNM, SessionManager.GetCurrentUser(this).IdAssociate); } btnMoveBudget.Visible = false; } } }