示例#1
0
        // This is the same as above, except with the addition of a comment to the WF
        protected void cbModal_Callback(object sender, CallbackEventArgsBase e)
        {
            // Create the comment
            eCAR3Entities pContext = new eCAR3Entities();
            CARComment    pComment = new CARComment();

            pComment.Comments       = memoComments.Text;
            pComment.UserId         = User.UserId;
            pComment.CARId          = CAR.CARId;
            pComment.Flags          = 0;
            pComment.Recommendation = 0;

            int wfAssignID = 0;

            if (Assignment != null)
            {
                wfAssignID = Assignment.WFAssignId;
            }
            else
            {
                //Find the associated WFAssign Id for admin
                wfAssignID = FindAdminAssignmentID();
            }

            pComment.WFAssignId = wfAssignID;
            pContext.CARComments.Add(pComment);
            pComment.Timestmp = DateTime.Now;
            pContext.SaveChanges();

            memoComments.Text = ""; //Clear the memo text
        }
示例#2
0
        // This is the same as above, except with the addition of a comment to the WF
        protected void cbComments_Callback(object sender, CallbackEventArgsBase e)
        {
            String sAction = e.Parameter;

            //Updating the default comments
            string mainComments = "";

            switch (sAction)
            {
            case "Approve":
                mainComments = "Approved.";
                break;

            case "Revise/Hold":
                mainComments = "Sending to creator for revision because - " + txtComments.Text;
                break;

            case "Decline":
                mainComments = "This was declined because - " + txtComments.Text;
                break;

            default:
                mainComments = "n/a";
                break;
            }

            // Add the comment to the CAR - we'll also add it to the assignment
            // For now - find the workflow item
            if (Assignment != null)
            {
                eCAR3Entities pContext = new eCAR3Entities();
                CARComment    pComment = new CARComment();

                pComment.Comments       = mainComments;
                pComment.UserId         = User.UserId;
                pComment.CARId          = CAR.CARId;
                pComment.Flags          = 0;
                pComment.Recommendation = 0;

                pComment.WFAssignId = Assignment.WFAssignId;
                pContext.CARComments.Add(pComment);
                pComment.Timestmp = DateTime.Now;
                pContext.SaveChanges();

                // We found a winner!
                // OK - we should now have the assignment ID right in the workflow item!
                WFEngine pWFEngine = GetWFEngine();

                // Handle item with the specified action
                pWFEngine.HandleItemAsync(Assignment.WFAssignId, sAction, mainComments);

                // Change to this if we put this in a callback!
                ASPxWebControl.RedirectOnCallback("/Default.aspx");
            }
        }
示例#3
0
        protected void cbCreateCAR_Callback(object source, CallbackEventArgs e)
        {
            // Create a new CAR here and redirect to its page...
            eCAR3Entities pContext = new eCAR3Entities();
            CARMaster     pCAR     = new CARMaster();

            string[] parameters = e.Parameter.Split(';');

            string orgInformation   = parameters[0]; // orgId + '|' + locName + '|' + orgPath;
            string orgId            = orgInformation.Split('|')[0];
            string orgLocationName  = orgInformation.Split('|')[1];
            string orgPath          = orgInformation.Split('|')[2];
            var    divisonCharacter = orgPath.Substring(0, 1).ToUpper();

            //var threeCharacterLocation = orgLocationName.Replace(/\s +/ g, '').replace(/\./ g, '').substring(0, 3).toUpperCase();
            var threeCharacterLocation   = orgLocationName.Substring(0, 3).ToUpper();
            var twoDigitYear             = DateTime.Now.Year.ToString().Substring(2, 2); // produces two digit year -- Ex. 2019 = "19"
            var threeDigitUniqueSequence = "XXX";                                        // The database trigger will make this a unique sequential number.
            var projectNumber            = divisonCharacter + '-' + threeCharacterLocation + '-' + twoDigitYear + '-' + threeDigitUniqueSequence;

            string pillarInformation = parameters[1]; // pillarId + '|' + pillarName + '|' + decr;
            string pillarId          = pillarInformation.Split('|')[0];
            string pillarName        = pillarInformation.Split('|')[1];
            string pillarDescr       = pillarInformation.Split('|')[2];

            pCAR.OrgId           = orgId;
            pCAR.ProjectNumber   = projectNumber;
            pCAR.CreatedByUserId = UserId;
            pCAR.CreatedByName   = UserDisplayName;
            pCAR.ProjectTitle    = txtTitle.Text;
            pCAR.CreateTime      = DateTime.Now;
            pCAR.ProjectTypeId   = cbProjectType.Value.ToString(); // Set the dropdown ProjectTypeId
            pCAR.InterestRate    = 0.000;                          // Updated Interest Rate to 0.000
            pCAR.ExchangeRate    = 0;                              // Updated Exchange Rate to 0
            pCAR.UsefulLifeYears = 0;                              // Updated Useful Life Years to 0
            pCAR.LeaseTermYears  = 0;                              // Updated Lease Term Years to 0
            pCAR.NPV             = 0;                              // Updated NPV to 0
            pCAR.IRR             = 0;                              // Updated IRR to 0
            pCAR.CurrencyTypeId  = 1;                              // Updated Currency Type to U.S. Dollar

            //Set Desc fields to empty
            pCAR.ProjectDesc          = "";
            pCAR.ProjectReason        = "";
            pCAR.ProjectJustification = "";
            pCAR.FiscalYear           = DateTime.Now.Year;      // Updated Fiscal Year to current year
            pCAR.PillarId             = pillarId;               // Set the dropdown PillarId
            pCAR.Status = "Active";

            pContext.CARMasters.Add(pCAR);
            pContext.SaveChanges(); // TODD: If we could remove this it may speed things up a bit.

            // We now have the CAR Id
            AddCostSheet(pContext, pCAR.CARId, 1);
            AddCostSheet(pContext, pCAR.CARId, 2);
            AddCostSheet(pContext, pCAR.CARId, 3);
            AddCostSheet(pContext, pCAR.CARId, 4);

            // Bootstrap the workflow process
            // This should probably not be here
            // This should be a function in the workflow engine!
            WFEngine pEngine = GetWFEngine();

            WF pWF = pEngine.CreateWorkflow(pCAR.CARId);

            // This call assigns the workflow to an individual user
            string sURL = pEngine.Assign(pWF, "Create", "CREATE", UserId, null, pCAR.CARId.ToString());

            // Redirect the users browser to the newly create CAR.
            //ASPxWebControl.RedirectOnCallback(sURL); // I removed this because the line below may be a tiny bit faster.
            cbCreateCAR.JSProperties ["cp_result"] = sURL; // Return to the client side where the JavaScript redirects to this CAR page.
        }