
using System;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Collections;
using System.Collections.Generic;

using Legalsoft.Workflow.Application;

public partial class _Include_Forward_Process : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/html;charset=UTF-8";
        int id = 0;
        CommandInfo cmd = new CommandInfo();
        if (Request["Id"] != null) id = Int32.Parse(Request["Id"].ToString());
        if (Request["FlowName"] != null) cmd.FlowName = Baby.U(Request["FlowName"].ToString());
        if (Request["FlowId"] != null) cmd.FlowId = Int32.Parse(Request["FlowId"].ToString());
        if (Request["NodeName"] != null) cmd.NodeName = Baby.U(Request["NodeName"].ToString());
        if (Request["NodeId"] != null) cmd.NodeId = Int32.Parse(Request["NodeId"].ToString());
        if (Request["Role"] != null) cmd.Role = Baby.U(Request["Role"].ToString());
        if (Request["MemberId"] != null) cmd.MemberId = Int32.Parse(Request["MemberId"].ToString());
        if (Request["MemberName"] != null) cmd.MemberName = Baby.U(Request["MemberName"].ToString());

        ParaInfo pv = new ParaInfo();
        if (Request["ParaValue"] != null)
        {
            pv.Name = Baby.U(Request["ParaName"].ToString());
            pv.Value = Baby.U(Request["ParaValue"].ToString());
            cmd.Paras = new List<ParaInfo>();
            cmd.Paras.Add(pv);
        }

        if (Request["Decision"].ToString() == "yes") cmd.Operation = "forward";
        if (Request["Decision"].ToString() == "no") cmd.Operation = Baby.U(Request["Operation"].ToString());
        cmd.TimeStamp = DateTime.Now + "";
        cmd.LocalUrl = Baby.LocalUrl;
        cmd.RemoteUrl = Baby.RemoteUrl;

        Commands.Send(cmd);
        Commands.Save();

        Commands.Dequeue(id);

        Response.Write("FORWARD OK");
    }
}
