Exemplo n.º 1
0
        private Workflow_NodeTriggerWorkflowEntity GetWorkflow_NodeTriggerWorkflowFromIDataReader(DbDataReader dr)
        {
            Workflow_NodeTriggerWorkflowEntity dt = new Workflow_NodeTriggerWorkflowEntity();
            if (dr.FieldCount > 0)
            {
                if (dr["TriggerID"].ToString() != "" || dr["TriggerID"] != null) dt.TriggerID = Int32.Parse(dr["TriggerID"].ToString());
                if (dr["WorkflowID"].ToString() != "" || dr["WorkflowID"] != null) dt.WorkflowID = Int32.Parse(dr["WorkflowID"].ToString());
                if (dr["NodeID"].ToString() != "" || dr["NodeID"] != null) dt.NodeID = Int32.Parse(dr["NodeID"].ToString());
                if (dr["OPTime"].ToString() != "" || dr["OPTime"] != null) dt.OPTime = Int32.Parse(dr["OPTime"].ToString());
                dt.OPCondition = dr["OPCondition"].ToString();
                if (dr["TriggerWFID"].ToString() != "" || dr["TriggerWFID"] != null) dt.TriggerWFID = Int32.Parse(dr["TriggerWFID"].ToString());
                if (dr["TriggerWFCreator"].ToString() != "" || dr["TriggerWFCreator"] != null) dt.TriggerWFCreator = Int32.Parse(dr["TriggerWFCreator"].ToString());
                if (dr["WFCreateNode"].ToString() != "" || dr["WFCreateNode"] != null) dt.WFCreateNode = Int32.Parse(dr["WFCreateNode"].ToString());
                if (dr["WFCreateFieldID"].ToString() != "" || dr["WFCreateFieldID"] != null) dt.WFCreateFieldID = Int32.Parse(dr["WFCreateFieldID"].ToString());
                dt.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
                if (dr["CreateSID"].ToString() != "" || dr["CreateSID"] != null) dt.CreateSID = Int32.Parse(dr["CreateSID"].ToString());
                if (dr["IsCancel"].ToString() != "" || dr["IsCancel"] != null) dt.IsCancel = Int32.Parse(dr["IsCancel"].ToString());
                if (dr["CancelDate"].ToString() != "" || dr["CancelDate"] != null) dt.CancelDate = Convert.ToDateTime(dr["CancelDate"]);
                if (dr["CancelSID"].ToString() != "" || dr["CancelSID"] != null) dt.CancelSID = Int32.Parse(dr["CancelSID"].ToString());

                dr.Close();
                return dt;
            }
            dr.Close();
            return null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增信息
        /// </summary>
        /// <param name="_Workflow_NodeTriggerWorkflowEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string AddWorkflow_NodeTriggerWorkflow(Workflow_NodeTriggerWorkflowEntity _Workflow_NodeTriggerWorkflowEntity)
        {
            //判断该记录是否已经存在

            DbParameter[] prams = { MakeInParam("@TriggerID", (DbType)SqlDbType.Int, 4, _Workflow_NodeTriggerWorkflowEntity.TriggerID) };

            string sql = "select * from  Workflow_NodeTriggerWorkflow where IsCancel=0 and  TriggerID=@TriggerID";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该记录已经存在

            }
            else
            {
                DbParameter[] pramsInsert = {
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.WorkflowID ),
                                       MakeInParam("@NodeID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.NodeID ),
                                       MakeInParam("@OPTime",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.OPTime ),
                                       MakeInParam("@OPCondition",(DbType)SqlDbType.VarChar,2000,_Workflow_NodeTriggerWorkflowEntity.OPCondition ),
                                       MakeInParam("@TriggerWFID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.TriggerWFID ),
                                       MakeInParam("@TriggerWFCreator",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.TriggerWFCreator ),
                                       MakeInParam("@WFCreateNode",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.WFCreateNode ),
                                       MakeInParam("@WFCreateFieldID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.WFCreateFieldID ),
                                      MakeInParam("@CreateSID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.CreateSID )

                                             };
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO [dbo].[Workflow_NodeTriggerWorkflow]");
                sb.Append("(");
                sb.Append("[WorkflowID]");
                sb.Append(",[NodeID]");
                sb.Append(",[OPTime]");
                sb.Append(",[OPCondition]");
                sb.Append(",[TriggerWFID]");
                sb.Append(",[TriggerWFCreator]");
                sb.Append(",[WFCreateNode]");
                sb.Append(",[WFCreateFieldID]");
                sb.Append(",[CreateSID]");
                sb.Append(") ");
                sb.Append(" VALUES (");
                sb.Append("@WorkflowID,");
                sb.Append("@NodeID,");
                sb.Append("@OPTime,");
                sb.Append("@OPCondition,");
                sb.Append("@TriggerWFID,");
                sb.Append("@TriggerWFCreator,");
                sb.Append("@WFCreateNode,");
                sb.Append("@WFCreateFieldID");
                sb.Append(",@CreateSID");
                sb.Append(") ;");
                sb.Append("select @@identity;");
                return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 修改信息
        /// </summary>
        /// <param name="_Workflow_NodeTriggerWorkflowEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string UpdateWorkflow_NodeTriggerWorkflow(Workflow_NodeTriggerWorkflowEntity _Workflow_NodeTriggerWorkflowEntity)
        {
            DbParameter[] pramsUpdate = {
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.WorkflowID ),
                                       MakeInParam("@NodeID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.NodeID ),
                                       MakeInParam("@OPTime",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.OPTime ),
                                       MakeInParam("@TriggerWFID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.TriggerWFID ),
                                       MakeInParam("@TriggerWFCreator",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.TriggerWFCreator ),
                                       MakeInParam("@WFCreateNode",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.WFCreateNode ),
                                       MakeInParam("@WFCreateFieldID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.WFCreateFieldID ),
                                       MakeInParam("@TriggerID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerWorkflowEntity.TriggerID )
                                         };
            StringBuilder sb = new StringBuilder();
            sb.Append("Update [dbo].[Workflow_NodeTriggerWorkflow]");
            sb.Append(" set ");
            sb.Append(" [WorkflowID]=@WorkflowID,");
            sb.Append(" [NodeID]=@NodeID,");
            sb.Append(" [OPTime]=@OPTime,");
            sb.Append(" [TriggerWFID]=@TriggerWFID,");
            sb.Append(" [TriggerWFCreator]=@TriggerWFCreator,");
            sb.Append(" [WFCreateNode]=@WFCreateNode,");
            sb.Append(" [WFCreateFieldID]=@WFCreateFieldID");
            sb.Append(" where ");
            sb.Append(" [TriggerID]=@TriggerID;select @@rowcount");

            return ExecuteScalar(CommandType.Text, sb.ToString(), pramsUpdate).ToString();
        }
Exemplo n.º 4
0
        private string SaveData()
        {
            Workflow_NodeTriggerWorkflowEntity _NT = new Workflow_NodeTriggerWorkflowEntity();
            _NT.TriggerID = txtTriggerID.Value != string.Empty ? Convert.ToInt32(txtTriggerID.Value) : 0;
            _NT.WorkflowID = DNTRequest.GetInt("id", 0);
            _NT.NodeID = Int32.Parse(ddlNodeID.SelectedValue);
            // _NT.OPCycleType  = Int32.Parse(ddlOPCycleType.SelectedValue);
            _NT.OPTime = Int32.Parse(ddlOPTime.SelectedValue);
            _NT.TriggerWFCreator = Int32.Parse(ddlTriggerCreator.SelectedValue);
            _NT.TriggerWFID = Int32.Parse(txtTriggerWFID.Value);
            _NT.WFCreateFieldID = (ddlTriggerCreator.SelectedValue == "2") ? Int32.Parse(ddlWFCreateFieldName.SelectedValue) : 0;
            _NT.WFCreateNode = (ddlTriggerCreator.SelectedValue == "1") ? Int32.Parse(ddlWFCreateNode.SelectedValue) : 0;
            _NT.OPCondition = "(1=1)";

            string sResult = "-1";
            if (strOperationState == "Add")
            {
                _NT.CreateSID = userEntity.UserSerialID;
                sResult = DbHelper.GetInstance().AddWorkflow_NodeTriggerWorkflow(_NT);
            }
            else if (strOperationState == "Update")
                sResult = DbHelper.GetInstance().UpdateWorkflow_NodeTriggerWorkflow(_NT);
            return sResult;
        }