Пример #1
0
 private Workflow_NodeLinkEntity GetWorkflow_NodeLinkFromIDataReader(DbDataReader dr)
 {
     Workflow_NodeLinkEntity dt = new Workflow_NodeLinkEntity();
     if (dr.FieldCount > 0)
     {
         if (dr["LinkID"].ToString() != "" || dr["LinkID"] != null) dt.LinkID = Int32.Parse(dr["LinkID"].ToString());
         dt.LinkName = dr["LinkName"].ToString();
         if (dr["WorkflowID"].ToString() != "" || dr["WorkflowID"] != null) dt.WorkflowID = Int32.Parse(dr["WorkflowID"].ToString());
         if (dr["StartNodeID"].ToString() != "" || dr["StartNodeID"] != null) dt.StartNodeID = Int32.Parse(dr["StartNodeID"].ToString());
         if (dr["TargetNodeID"].ToString() != "" || dr["TargetNodeID"] != null) dt.TargetNodeID = Int32.Parse(dr["TargetNodeID"].ToString());
         if (dr["IsRejected"].ToString() != "" || dr["IsRejected"] != null) dt.IsRejected = Int32.Parse(dr["IsRejected"].ToString());
         dt.Creator = dr["Creator"].ToString();
         dt.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
         dt.lastModifier = dr["lastModifier"].ToString();
         dt.lastModifyDate = Convert.ToDateTime(dr["lastModifyDate"]);
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Пример #2
0
        /// <summary>
        /// 新增信息
        /// </summary>
        /// <param name="_Workflow_NodeLinkEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string AddWorkflow_NodeLink(Workflow_NodeLinkEntity _Workflow_NodeLinkEntity)
        {
            //判断该记录是否已经存在

            DbParameter[] prams = {
                                       MakeInParam("@LinkName",(DbType)SqlDbType.VarChar,50,_Workflow_NodeLinkEntity.LinkName),
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.WorkflowID ),
                                   };
            string sql = " select * from [dbo].[Workflow_NodeLink] where LinkName=@LinkName and WorkflowID=@WorkflowID ";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该记录已经存在

            }
            else
            {
                DbParameter[] pramsInsert = {
                                       MakeInParam("@LinkName",(DbType)SqlDbType.VarChar,50,_Workflow_NodeLinkEntity.LinkName ),
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.WorkflowID ),
                                       MakeInParam("@StartNodeID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.StartNodeID ),
                                       MakeInParam("@TargetNodeID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.TargetNodeID ),
                                       MakeInParam("@IsRejected",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.IsRejected ),
                                       MakeInParam("@Creator",(DbType)SqlDbType.VarChar,50,_Workflow_NodeLinkEntity.Creator ),
                                       MakeInParam("@CreateDate",(DbType)SqlDbType.DateTime,23,_Workflow_NodeLinkEntity.CreateDate ),
                                       MakeInParam("@lastModifier",(DbType)SqlDbType.VarChar,50,_Workflow_NodeLinkEntity.lastModifier ),
                                       MakeInParam("@lastModifyDate",(DbType)SqlDbType.DateTime,23,_Workflow_NodeLinkEntity.lastModifyDate ),
                                             };
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO [dbo].[Workflow_NodeLink]");
                sb.Append("(");
                sb.Append(" [LinkName]");
                sb.Append(",[WorkflowID]");
                sb.Append(",[StartNodeID]");
                sb.Append(",[TargetNodeID]");
                sb.Append(",[IsRejected]");
                sb.Append(",[Creator]");
                sb.Append(",[CreateDate]");
                sb.Append(",[lastModifier]");
                sb.Append(",[lastModifyDate]");
                sb.Append(") ");
                sb.Append(" VALUES (");
                sb.Append("@LinkName,");
                sb.Append("@WorkflowID,");
                sb.Append("@StartNodeID,");
                sb.Append("@TargetNodeID,");
                sb.Append("@IsRejected,");
                sb.Append("@Creator,");
                sb.Append("@CreateDate,");
                sb.Append("@lastModifier,");
                sb.Append("@lastModifyDate )");
                sb.Append("select @@identity;");
                return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
            }
        }
Пример #3
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="_Workflow_NodeLinkEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public string UpdateWorkflow_NodeLink(Workflow_NodeLinkEntity _Workflow_NodeLinkEntity)
 {
     DbParameter[] pramsUpdate = {
                                     MakeInParam("@LinkID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.LinkID ),
                                     MakeInParam("@LinkName",(DbType)SqlDbType.VarChar,50,_Workflow_NodeLinkEntity.LinkName ),
                                     MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.WorkflowID ),
                                     MakeInParam("@StartNodeID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.StartNodeID ),
                                     MakeInParam("@TargetNodeID",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.TargetNodeID ),
                                     MakeInParam("@IsRejected",(DbType)SqlDbType.Int,4,_Workflow_NodeLinkEntity.IsRejected ),
                                     MakeInParam("@lastModifier",(DbType)SqlDbType.VarChar,50,_Workflow_NodeLinkEntity.lastModifier ),
                                     MakeInParam("@lastModifyDate",(DbType)SqlDbType.DateTime,23,_Workflow_NodeLinkEntity.lastModifyDate ),
                                 };
     StringBuilder sb = new StringBuilder();
     sb.Append("Update [dbo].[Workflow_NodeLink]");
     sb.Append(" set ");
     sb.Append(" [LinkName]=@LinkName,");
     sb.Append(" [WorkflowID]=@WorkflowID,");
     sb.Append(" [StartNodeID]=@StartNodeID,");
     sb.Append(" [TargetNodeID]=@TargetNodeID,");
     sb.Append(" [IsRejected]=@IsRejected,");
     sb.Append(" [lastModifier]=@lastModifier,");
     sb.Append(" [lastModifyDate]=@lastModifyDate ");
     sb.Append(" where [LinkID]=@LinkID ");
     return ExecuteNonQuery(CommandType.Text, sb.ToString(), pramsUpdate).ToString();
 }
Пример #4
0
        private string SaveData()
        {
            Workflow_NodeLinkEntity _Workflow_NodeLinkEntity = new Workflow_NodeLinkEntity();
            _Workflow_NodeLinkEntity.LinkID = txtLinkID.Value != string.Empty ? Convert.ToInt32(txtLinkID.Value) : 0;
            _Workflow_NodeLinkEntity.LinkName = txtLinkName.Text;
            _Workflow_NodeLinkEntity.WorkflowID = DNTRequest.GetInt("id", 0);
            _Workflow_NodeLinkEntity.IsRejected = chkIsRejected.Checked ? 1 : 0;
            _Workflow_NodeLinkEntity.StartNodeID = Convert.ToInt32(ddlStartNodeID.SelectedValue);
            _Workflow_NodeLinkEntity.TargetNodeID = Convert.ToInt32(ddlTargetNodeID.SelectedValue);
            _Workflow_NodeLinkEntity.Creator = userEntity.UserID;
            _Workflow_NodeLinkEntity.CreateDate = DateTime.Now;
            _Workflow_NodeLinkEntity.lastModifier = userEntity.UserID;
            _Workflow_NodeLinkEntity.lastModifyDate = DateTime.Now;

            string sResult = "-1";
            if (strOperationState == "Add")
                sResult = DbHelper.GetInstance().AddWorkflow_NodeLink(_Workflow_NodeLinkEntity);
            else if (strOperationState == "Update")
                sResult = DbHelper.GetInstance().UpdateWorkflow_NodeLink(_Workflow_NodeLinkEntity);
            return sResult;
        }