Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(CardCenter.Entity.Flow model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Flow set ");
            strSql.Append("JobType=@JobType,");
            strSql.Append("FlowOrder=@FlowOrder,");
            strSql.Append("FlowStatus=@FlowStatus,");
            strSql.Append("IsSend=@IsSend,");
            strSql.Append("SendTxt=@SendTxt");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@JobType",    SqlDbType.NVarChar,   16),
                new SqlParameter("@FlowOrder",  SqlDbType.Int,         4),
                new SqlParameter("@FlowStatus", SqlDbType.Int,         4),
                new SqlParameter("@IsSend",     SqlDbType.Bit,         1),
                new SqlParameter("@SendTxt",    SqlDbType.NVarChar, 1024),
                new SqlParameter("@ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.JobType;
            parameters[1].Value = model.FlowOrder;
            parameters[2].Value = model.FlowStatus;
            parameters[3].Value = model.IsSend;
            parameters[4].Value = model.SendTxt;
            parameters[5].Value = model.ID;

            TranHelper.AddTran(strSql, parameters);
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(CardCenter.Entity.Flow model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Flow(");
            strSql.Append("JobType,FlowOrder,FlowStatus,IsSend,SendTxt)");
            strSql.Append(" values (");
            strSql.Append("@JobType,@FlowOrder,@FlowStatus,@IsSend,@SendTxt)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@JobType",    SqlDbType.NVarChar, 16),
                new SqlParameter("@FlowOrder",  SqlDbType.Int,       4),
                new SqlParameter("@FlowStatus", SqlDbType.Int,       4),
                new SqlParameter("@IsSend",     SqlDbType.Bit,       1),
                new SqlParameter("@SendTxt",    SqlDbType.NVarChar, 1024)
            };
            parameters[0].Value = model.JobType;
            parameters[1].Value = model.FlowOrder;
            parameters[2].Value = model.FlowStatus;
            parameters[3].Value = model.IsSend;
            parameters[4].Value = model.SendTxt;

            TranHelper.AddTran(strSql, parameters);
        }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CardCenter.Entity.Flow DataRowToModel(DataRow row)
 {
     CardCenter.Entity.Flow model = new CardCenter.Entity.Flow();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["JobType"] != null)
         {
             model.JobType = row["JobType"].ToString();
         }
         if (row["FlowOrder"] != null && row["FlowOrder"].ToString() != "")
         {
             model.FlowOrder = int.Parse(row["FlowOrder"].ToString());
         }
         if (row["FlowStatus"] != null && row["FlowStatus"].ToString() != "")
         {
             model.FlowStatus = int.Parse(row["FlowStatus"].ToString());
         }
         if (row["IsSend"] != null && row["IsSend"].ToString() != "")
         {
             if ((row["IsSend"].ToString() == "1") || (row["IsSend"].ToString().ToLower() == "true"))
             {
                 model.IsSend = true;
             }
             else
             {
                 model.IsSend = false;
             }
         }
         if (row["SendTxt"] != null)
         {
             model.SendTxt = row["SendTxt"].ToString();
         }
     }
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CardCenter.Entity.Flow GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,JobType,FlowOrder,FlowStatus,IsSend,SendTxt from Flow ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            CardCenter.Entity.Flow model = new CardCenter.Entity.Flow();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

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