/// <summary>
 /// Create a new Flows object.
 /// </summary>
 /// <param name="flowId">Initial value of the FlowId property.</param>
 /// <param name="flowName">Initial value of the FlowName property.</param>
 public static Flows CreateFlows(global::System.Int32 flowId, global::System.String flowName)
 {
     Flows flows = new Flows();
     flows.FlowId = flowId;
     flows.FlowName = flowName;
     return flows;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Flows EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFlows(Flows flows)
 {
     base.AddObject("Flows", flows);
 }
示例#3
0
        private Flows SaveFlow()
        {
            if (dt.Rows.Count <= 0)
            {
                return null;
            }
            dbHelper helper = new dbHelper();
            bool isUpdate = true;
            FlowActionOptions fao;
            FlowActionInputs faIn;
            FlowActionOutputs faOut;
            FlowMultiOptions fmo;
            ActionOptions actOpt;
            ActionInputs actInput;
            ActionOutputs actOutput;
            Users flowUser = helper.GetUserbyName(_user.UserName);
            Flows myflow = helper.GetFlowByName(TextBox1.Text, flowUser);
            if (myflow == null)
            {
                myflow = new Flows();
                myflow.FlowName = TextBox1.Text;
                myflow.Users = flowUser;
                myflow.FlowUseCaseNumber = _useCaseNumber;
                myflow.FlowStartTime = _useCaseStartTime;
                myflow.FlowEndTime = DateTime.Now;
                isUpdate = false;
            }
            else
            {
                myflow.FlowEndTime = DateTime.Now;
                helper.DeleteFlowDetailsById(myflow.FlowId);
            }

            int rowCount = 0;

            FlowActions flowAction;
            Actions curAction;
            foreach (DataRow gridRow in dt.Rows)
            {
                rowCount++;
                curAction = helper.GetActionById(gridRow["Id"].ToString());
                flowAction = new FlowActions();
                flowAction.Actions = curAction;
                flowAction.Position = rowCount;
                myflow.FlowActions.Add(flowAction);
            }

            SaveActionOptions(dt.Rows.Count);
            foreach (FlowActionOptions itemFlowActOpt in _listFlowActOpt)
            {
                fao = new FlowActionOptions();
                actOpt = helper.GetActionOptionById(itemFlowActOpt.ActionOptions.ActionOptionId);
                fao.ActionOptions = actOpt;
                fao.FlowPosition = itemFlowActOpt.FlowPosition;
                fao.Value = itemFlowActOpt.Value;
                myflow.FlowActionOptions.Add(fao);
            }
            foreach (FlowActionInputs itemFlowActIn in _listFlowActInput)
            {
                faIn = new FlowActionInputs();
                actInput = helper.GetActionInputById(itemFlowActIn.ActionInputs.InputId);
                faIn.ActionInputs = actInput;
                faIn.FlowPosition = itemFlowActIn.FlowPosition;
                faIn.Value = itemFlowActIn.Value;
                myflow.FlowActionInputs.Add(faIn);
            }
            foreach (FlowActionOutputs itemFlowActOut in _listFlowActOutput)
            {
                faOut = new FlowActionOutputs();
                actOutput = helper.GetActionOutputById(itemFlowActOut.ActionOutputs.OutputId);
                faOut.ActionOutputs = actOutput;
                faOut.FlowPosition = itemFlowActOut.FlowPosition;
                faOut.Value = itemFlowActOut.Value;
                myflow.FlowActionOutputs.Add(faOut);
            }

            foreach (FlowMultiOptions itemFlowMultiOpt in _listFlowMultiOpt)
            {
                fmo = new FlowMultiOptions();
                fmo.FlowPosition = itemFlowMultiOpt.FlowPosition;
                fmo.OptionValue = itemFlowMultiOpt.OptionValue;
                myflow.FlowMultiOptions.Add(fmo);
            }
            if (isUpdate)
            {
                helper.UpdateChanges();
            }
            else
            {
                helper.AddToModel(myflow);
            }

            return myflow;
        }