Exemple #1
0
        public string AddWorkflow_FlowNode2(Workflow_FlowNodeEntity2 _Workflow_FlowNodeEntity)
        {
            //判断该记录是否已经存在

            DbParameter[] prams = {
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.WorkflowID ),
                                       MakeInParam("@NodeName",(DbType)SqlDbType.VarChar,200,_Workflow_FlowNodeEntity.NodeName),
                                   };
            string sql = " select * from [dbo].[Workflow_FlowNode] where WorkflowID=@WorkflowID and NodeName=@NodeName ";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该记录已经存在
            }
            else
            {
                DbParameter[] pramsInsert = {
                                       MakeInParam("@NodeName",(DbType)SqlDbType.VarChar,200,_Workflow_FlowNodeEntity.NodeName ),
                                       MakeInParam("@NodeDesc",(DbType)SqlDbType.VarChar,2000,_Workflow_FlowNodeEntity.NodeDesc ),
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.WorkflowID ),
                                       MakeInParam("@NodeTypeID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.NodeTypeID ),
                                       MakeInParam("@IsOverTime",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.IsOverTime ),
                                       MakeInParam("@OverTimeLen",(DbType)SqlDbType.Float,8,_Workflow_FlowNodeEntity.OverTimeLen ),
                                       MakeInParam("@SignType",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.SignType ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.DisplayOrder ),
                                      MakeInParam("@x",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.X ),
                                      MakeInParam("@y",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.Y ),
                                      MakeInParam("@width",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.Width ),
                                      MakeInParam("@height",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.Height ),
                                      };
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO [dbo].[Workflow_FlowNode]");
                sb.Append("(");
                sb.Append(" [NodeName]");
                sb.Append(",[NodeDesc]");
                sb.Append(",[WorkflowID]");
                sb.Append(",[NodeTypeID]");
                sb.Append(",[IsOverTime]");
                sb.Append(",[OverTimeLen]");
                sb.Append(",[SignType]");
                sb.Append(",[DisplayOrder]");
                sb.Append(",[x]");
                sb.Append(",[y]");
                sb.Append(",[width]");
                sb.Append(",[height]");
                sb.Append(") ");
                sb.Append(" VALUES (");
                sb.Append("@NodeName,");
                sb.Append("@NodeDesc,");
                sb.Append("@WorkflowID,");
                sb.Append("@NodeTypeID,");
                sb.Append("@IsOverTime,");
                sb.Append("@OverTimeLen,");
                sb.Append("@SignType,");
                sb.Append("@DisplayOrder,");
                sb.Append("@x,");
                sb.Append("@y,");
                sb.Append("@width,");
                sb.Append("@height )");

                sb.Append("select @@identity;");

                //ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert);

                _Workflow_FlowNodeEntity.NodeID = Convert.ToInt32(ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString());

                ArrayList arlst = new ArrayList();
                arlst.Add("Workflow_FlowNode");
                arlst.Add(_Workflow_FlowNodeEntity.WorkflowID);
                arlst.Add("");
                return sp_ReDisplayOrder(arlst);
            }
        }
Exemple #2
0
        private int SaveFlowNode(Workflow_FlowNodeEntity2 wfn,string operationState)
        {
            Workflow_FlowNodeEntity2 _Workflow_FlowNodeEntity = wfn;

            string sResult = "-1";
            if (operationState == "Add")
                sResult =DbHelper.GetInstance().AddWorkflow_FlowNode2(_Workflow_FlowNodeEntity);
            else if (operationState == "Update")
                sResult =DbHelper.GetInstance().UpdateWorkflow_FlowNode(_Workflow_FlowNodeEntity);

            int wfnid = _Workflow_FlowNodeEntity.NodeID;
            return wfnid;
        }