コード例 #1
0
        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);
        }
コード例 #2
0
        /// <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("_");
        }