Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Library.Model.Base_Payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Base_Payment set ");
            strSql.Append("F_Name=@F_Name,");
            strSql.Append("F_Content=@F_Content,");
            strSql.Append("F_Money=@F_Money,");
            strSql.Append("F_Time=@F_Time,");
            strSql.Append("F_WF_StateID=@F_WF_StateID,");
            strSql.Append("F_UserID=@F_UserID");
            strSql.Append(" where F_ID=@F_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_Name",       SqlDbType.VarChar,   150),
                new SqlParameter("@F_Content",    SqlDbType.VarChar,   500),
                new SqlParameter("@F_Money",      SqlDbType.Float,       8),
                new SqlParameter("@F_Time",       SqlDbType.DateTime),
                new SqlParameter("@F_WF_StateID", SqlDbType.VarChar,    50),
                new SqlParameter("@F_UserID",     SqlDbType.Int,         4),
                new SqlParameter("@F_ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.F_Name;
            parameters[1].Value = model.F_Content;
            parameters[2].Value = model.F_Money;
            parameters[3].Value = model.F_Time;
            parameters[4].Value = model.F_WF_StateID;
            parameters[5].Value = model.F_UserID;
            parameters[6].Value = model.F_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Library.Model.Base_Payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Base_Payment(");
            strSql.Append("F_Name,F_Content,F_Money,F_Time,F_WF_StateID,F_UserID)");
            strSql.Append(" values (");
            strSql.Append("@F_Name,@F_Content,@F_Money,@F_Time,@F_WF_StateID,@F_UserID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_Name",       SqlDbType.VarChar,   150),
                new SqlParameter("@F_Content",    SqlDbType.VarChar,   500),
                new SqlParameter("@F_Money",      SqlDbType.Float,       8),
                new SqlParameter("@F_Time",       SqlDbType.DateTime),
                new SqlParameter("@F_WF_StateID", SqlDbType.VarChar,    50),
                new SqlParameter("@F_UserID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.F_Name;
            parameters[1].Value = model.F_Content;
            parameters[2].Value = model.F_Money;
            parameters[3].Value = model.F_Time;
            parameters[4].Value = model.F_WF_StateID;
            parameters[5].Value = model.F_UserID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Library.Model.Base_Payment DataRowToModel(DataRow row)
 {
     Library.Model.Base_Payment model = new Library.Model.Base_Payment();
     if (row != null)
     {
         if (row["F_ID"] != null && row["F_ID"].ToString() != "")
         {
             model.F_ID = int.Parse(row["F_ID"].ToString());
         }
         if (row["F_Name"] != null)
         {
             model.F_Name = row["F_Name"].ToString();
         }
         if (row["F_Content"] != null)
         {
             model.F_Content = row["F_Content"].ToString();
         }
         if (row["F_Money"] != null && row["F_Money"].ToString() != "")
         {
             model.F_Money = decimal.Parse(row["F_Money"].ToString());
         }
         if (row["F_Time"] != null && row["F_Time"].ToString() != "")
         {
             model.F_Time = DateTime.Parse(row["F_Time"].ToString());
         }
         if (row["F_WF_StateID"] != null)
         {
             model.F_WF_StateID = row["F_WF_StateID"].ToString();
         }
         if (row["F_UserID"] != null && row["F_UserID"].ToString() != "")
         {
             model.F_UserID = int.Parse(row["F_UserID"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Library.Model.Base_Payment GetModel(int F_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 F_ID,F_Name,F_Content,F_Money,F_Time,F_WF_StateID,F_UserID from T_Base_Payment ");
            strSql.Append(" where F_ID=@F_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = F_ID;

            Library.Model.Base_Payment model = new Library.Model.Base_Payment();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Library.Model.Base_Payment model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Library.Model.Base_Payment model)
 {
     return(dal.Add(model));
 }