Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_LirunFenhong model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_LirunFenhong set ");
            strSql.Append("BonusMoney=@BonusMoney,");
            strSql.Append("FhRate=@FhRate,");
            strSql.Append("FhTime=@FhTime");
            strSql.Append(" where LrfhID=@LrfhID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BonusMoney", SqlDbType.Decimal,   9),
                new SqlParameter("@FhRate",     SqlDbType.Decimal,   9),
                new SqlParameter("@FhTime",     SqlDbType.DateTime),
                new SqlParameter("@LrfhID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.BonusMoney;
            parameters[1].Value = model.FhRate;
            parameters[2].Value = model.FhTime;
            parameters[3].Value = model.LrfhID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(lgk.Model.tb_LirunFenhong model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_LirunFenhong(");
            strSql.Append("BonusMoney,FhRate,FhTime)");
            strSql.Append(" values (");
            strSql.Append("@BonusMoney,@FhRate,@FhTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BonusMoney", SqlDbType.Decimal, 9),
                new SqlParameter("@FhRate",     SqlDbType.Decimal, 9),
                new SqlParameter("@FhTime",     SqlDbType.DateTime)
            };
            parameters[0].Value = model.BonusMoney;
            parameters[1].Value = model.FhRate;
            parameters[2].Value = model.FhTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public lgk.Model.tb_LirunFenhong DataRowToModel(DataRow row)
 {
     lgk.Model.tb_LirunFenhong model = new lgk.Model.tb_LirunFenhong();
     if (row != null)
     {
         if (row["LrfhID"] != null && row["LrfhID"].ToString() != "")
         {
             model.LrfhID = int.Parse(row["LrfhID"].ToString());
         }
         if (row["BonusMoney"] != null && row["BonusMoney"].ToString() != "")
         {
             model.BonusMoney = decimal.Parse(row["BonusMoney"].ToString());
         }
         if (row["FhRate"] != null && row["FhRate"].ToString() != "")
         {
             model.FhRate = decimal.Parse(row["FhRate"].ToString());
         }
         if (row["FhTime"] != null && row["FhTime"].ToString() != "")
         {
             model.FhTime = DateTime.Parse(row["FhTime"].ToString());
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.tb_LirunFenhong GetModel(int LrfhID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 LrfhID,BonusMoney,FhRate,FhTime from tb_LirunFenhong ");
            strSql.Append(" where LrfhID=@LrfhID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LrfhID", SqlDbType.Int, 4)
            };
            parameters[0].Value = LrfhID;

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

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