Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Parking.Core.Model.WF_FlowProcess DataRowToModel(DataRow row)
 {
     Parking.Core.Model.WF_FlowProcess model = new Parking.Core.Model.WF_FlowProcess();
     if (row != null)
     {
         if (row["ID"] != null)
         {
             model.ID = row["ID"].ToString();
         }
         if (row["FlowCode"] != null)
         {
             model.FlowCode = row["FlowCode"].ToString();
         }
         if (row["NodeCode"] != null)
         {
             model.NodeCode = row["NodeCode"].ToString();
         }
         if (row["RecordID"] != null)
         {
             model.RecordID = row["RecordID"].ToString();
         }
         if (row["CarNo"] != null)
         {
             model.CarNo = row["CarNo"].ToString();
         }
         if (row["UserID"] != null)
         {
             model.UserID = row["UserID"].ToString();
         }
         if (row["ExecutionTime"] != null && row["ExecutionTime"].ToString() != "")
         {
             model.ExecutionTime = DateTime.Parse(row["ExecutionTime"].ToString());
         }
         if (row["Result"] != null && row["Result"].ToString() != "")
         {
             if ((row["Result"].ToString() == "1") || (row["Result"].ToString().ToLower() == "true"))
             {
                 model.Result = true;
             }
             else
             {
                 model.Result = false;
             }
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Parking.Core.Model.WF_FlowProcess model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update WF_FlowProcess set ");
            strSql.Append("FlowCode=@FlowCode,");
            strSql.Append("NodeCode=@NodeCode,");
            strSql.Append("RecordID=@RecordID,");
            strSql.Append("CarNo=@CarNo,");
            strSql.Append("UserID=@UserID,");
            strSql.Append("ExecutionTime=@ExecutionTime,");
            strSql.Append("Result=@Result,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FlowCode",      SqlDbType.VarChar,   32),
                new SqlParameter("@NodeCode",      SqlDbType.VarChar,   32),
                new SqlParameter("@RecordID",      SqlDbType.VarChar,   32),
                new SqlParameter("@CarNo",         SqlDbType.VarChar,   20),
                new SqlParameter("@UserID",        SqlDbType.VarChar,   32),
                new SqlParameter("@ExecutionTime", SqlDbType.DateTime),
                new SqlParameter("@Result",        SqlDbType.Bit,        1),
                new SqlParameter("@Remark",        SqlDbType.VarChar,   32),
                new SqlParameter("@ID",            SqlDbType.VarChar, 32)
            };
            parameters[0].Value = model.FlowCode;
            parameters[1].Value = model.NodeCode;
            parameters[2].Value = model.RecordID;
            parameters[3].Value = model.CarNo;
            parameters[4].Value = model.UserID;
            parameters[5].Value = model.ExecutionTime;
            parameters[6].Value = model.Result;
            parameters[7].Value = model.Remark;
            parameters[8].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Parking.Core.Model.WF_FlowProcess model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into WF_FlowProcess(");
            strSql.Append("ID,FlowCode,NodeCode,RecordID,CarNo,UserID,ExecutionTime,Result,Remark)");
            strSql.Append(" values (");
            strSql.Append("@ID,@FlowCode,@NodeCode,@RecordID,@CarNo,@UserID,@ExecutionTime,@Result,@Remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",            SqlDbType.VarChar,   32),
                new SqlParameter("@FlowCode",      SqlDbType.VarChar,   32),
                new SqlParameter("@NodeCode",      SqlDbType.VarChar,   32),
                new SqlParameter("@RecordID",      SqlDbType.VarChar,   32),
                new SqlParameter("@CarNo",         SqlDbType.VarChar,   20),
                new SqlParameter("@UserID",        SqlDbType.VarChar,   32),
                new SqlParameter("@ExecutionTime", SqlDbType.DateTime),
                new SqlParameter("@Result",        SqlDbType.Bit,        1),
                new SqlParameter("@Remark",        SqlDbType.VarChar, 32)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.FlowCode;
            parameters[2].Value = model.NodeCode;
            parameters[3].Value = model.RecordID;
            parameters[4].Value = model.CarNo;
            parameters[5].Value = model.UserID;
            parameters[6].Value = model.ExecutionTime;
            parameters[7].Value = model.Result;
            parameters[8].Value = model.Remark;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Parking.Core.Model.WF_FlowProcess GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,FlowCode,NodeCode,RecordID,CarNo,UserID,ExecutionTime,Result,Remark from WF_FlowProcess ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.VarChar, 32)
            };
            parameters[0].Value = ID;

            Parking.Core.Model.WF_FlowProcess model = new Parking.Core.Model.WF_FlowProcess();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }