Example #1
0
        public GraphModule(ICommandSender commandSender) : base("/cortex/graph")
        {
            this.Post("/regenerate", async(parameters) =>
            {
                Response result = null;

                try
                {
                    var command = new Regenerate();
                    await commandSender.Send(command);
                    result = new Response {
                        StatusCode = HttpStatusCode.OK
                    };
                }
                catch (Exception ex)
                {
                    var error = $"An error occurred during graph regeneration: {ex.Message}; Stack Trace: {ex.StackTrace}";
                    GraphModule.logger.Error(ex, error);
                    result = new Response {
                        StatusCode = HttpStatusCode.InternalServerError
                    };
                }

                return(result);
            }
                      );

            this.Post("/resumegeneration", async(parameters) =>
            {
                Response result = null;

                try
                {
                    var command = new ResumeGeneration();
                    await commandSender.Send(command);
                    result = new Response {
                        StatusCode = HttpStatusCode.OK
                    };
                }
                catch (Exception ex)
                {
                    GraphModule.logger.Error(ex, $"An error occurred while resuming graph generation: {ex.Message}; Stack Trace: {ex.StackTrace}");
                    result = new Response {
                        StatusCode = HttpStatusCode.InternalServerError
                    };
                }

                return(result);
            }
                      );
        }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     BasicMovement[] ListMovements = FindObjectsOfType <BasicMovement>();
     mSlider = GetComponent <Slider>();
     foreach (BasicMovement bm in ListMovements)
     {
         if (bm.IsCurrentPlayer)
         {
             regenerate = bm.gameObject.GetComponent <Regenerate>();
             Debug.Log(regenerate);
             return;
         }
     }
 }
Example #3
0
 public Step3 ClickRegenerate()
 {
     Regenerate.Click();
     return(this);
 }
Example #4
0
        void btnApply_Click(object sender, EventArgs e)
        {
            List <int> reject         = new List <int>();
            List <int> regenerate     = new List <int>();
            List <int> approve        = new List <int>();
            List <int> approveAndPost = new List <int>();

            // Persist Row Details
            SaveBatchChanges();

            // React to the user's options.
            foreach (GridDataItem row in gvPreInvoices.Items)
            {
                #region Retrieve User Options

                if (row.OwnerTableView.Name == PreInvoiceTableName && (row.ItemType == GridItemType.Item || row.ItemType == GridItemType.AlternatingItem))
                {
                    HtmlInputRadioButton rdoReject         = row.FindControl("rdoReject") as HtmlInputRadioButton;
                    HtmlInputRadioButton rdoApprove        = row.FindControl("rdoApprove") as HtmlInputRadioButton;
                    HtmlInputRadioButton rdoApproveAndPost = row.FindControl("rdoApproveAndPost") as HtmlInputRadioButton;
                    HtmlInputCheckBox    chkUseHeadedPaper = row.FindControl("chkUseHeadedPaper") as HtmlInputCheckBox;


                    HiddenField hidIsDirty = row.FindControl("hidIsDirty") as HiddenField;
                    bool        isDirty    = false;
                    bool.TryParse(hidIsDirty.Value, out isDirty);

                    if (!isDirty)
                    {
                        if (rdoReject.Checked)
                        {
                            reject.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["PreInvoiceID"]).ToString()));
                            Reject.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["InvoiceGenerationParametersID"]).ToString()));
                        }
                        else if (rdoApprove.Checked)
                        {
                            approve.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["PreInvoiceID"]).ToString()));
                            Approve.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["InvoiceGenerationParametersID"]).ToString()));
                        }
                        else if (rdoApproveAndPost.Checked)
                        {
                            approveAndPost.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["PreInvoiceID"]).ToString()));
                            ApproveAndPost.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["InvoiceGenerationParametersID"]).ToString()));
                        }
                        if (rdoApprove.Checked || rdoApproveAndPost.Checked)
                        {
                            if (chkUseHeadedPaper.Checked)
                            {
                                SetUseHeadedPaperParameter(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["PreInvoiceID"]).ToString()), chkUseHeadedPaper.Checked);
                            }
                        }
                    }
                    else
                    {
                        regenerate.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["PreInvoiceID"]).ToString()));
                        Regenerate.Add(int.Parse((gvPreInvoices.MasterTableView.DataKeyValues[row.ItemIndex]["InvoiceGenerationParametersID"]).ToString()));
                    }
                }

                #endregion
            }

            try
            {
                // Kick off the workflow (if there is anything to do).
                if (approveAndPost.Count + approve.Count + regenerate.Count + reject.Count > 0)
                {
                    LastActionDate = DateTime.Now;

                    List <Contracts.DataContracts.NotificationParty> notificationParties = new List <Contracts.DataContracts.NotificationParty>();

                    GenerateInvoiceClient gic = new GenerateInvoiceClient("Orchestrator.InvoiceService");
                    gic.VerifyInvoices(approveAndPost.ToArray(), approve.ToArray(), regenerate.ToArray(), reject.ToArray(), notificationParties.ToArray(), ((Entities.CustomPrincipal)Page.User).UserName);

                    if (ProcessActions != null)
                    {
                        ProcessActions(sender, e);
                    }

                    //gvPreInvoices.Rebind();
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException exc)
            {
                // Not possible to send message to workflow host - send email to support.
                //Utilities.SendSupportEmailHelper("GenerateInvoiceClient.VerifyInvoices(int[], int[], int[], int[], Orchestrator.Entities.NotificationParty[], string)", exc);
                // Redirect user to an appropriate page.
                //Server.Transfer("../../OfflineProcessInitiationFailed.aspx");
            }
        }