Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public static yny_005.Model.LuckyMoney DataRowToModel(DataRow row)
 {
     yny_005.Model.LuckyMoney model = new yny_005.Model.LuckyMoney();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["MID"] != null)
         {
             model.MID = row["MID"].ToString();
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
         if (row["EditTime"] != null && row["EditTime"].ToString() != "")
         {
             model.EditTime = DateTime.Parse(row["EditTime"].ToString());
         }
         if (row["FHTimes"] != null && row["FHTimes"].ToString() != "")
         {
             model.FHTimes = int.Parse(row["FHTimes"].ToString());
         }
         if (row["FHMoney"] != null && row["FHMoney"].ToString() != "")
         {
             model.FHMoney = decimal.Parse(row["FHMoney"].ToString());
         }
         if (row["isValid"] != null && row["isValid"].ToString() != "")
         {
             model.isValid = int.Parse(row["isValid"].ToString());
         }
         if (row["Type"] != null && row["Type"].ToString() != "")
         {
             model.Type = int.Parse(row["Type"].ToString());
         }
         if (row["TotalMoney"] != null && row["TotalMoney"].ToString() != "")
         {
             model.TotalMoney = decimal.Parse(row["TotalMoney"].ToString());
         }
         if (row["ApplyMoney"] != null && row["ApplyMoney"].ToString() != "")
         {
             model.ApplyMoney = decimal.Parse(row["ApplyMoney"].ToString());
         }
         if (row["TakeOffmoney"] != null && row["TakeOffmoney"].ToString() != "")
         {
             model.TakeOffmoney = decimal.Parse(row["TakeOffmoney"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        public static Hashtable Update(yny_005.Model.LuckyMoney model, Hashtable MyHs)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update LuckyMoney set ");
            strSql.Append("MID=@MID,");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("FHTimes=@FHTimes,");
            strSql.Append("FHMoney=@FHMoney,");
            strSql.Append("isValid=@isValid,");
            strSql.Append("EditTime=@EditTime,");
            strSql.Append("ApplyMoney=@ApplyMoney,");
            strSql.Append("Type=@Type,");
            strSql.Append("TakeOffmoney=@TakeOffmoney,");
            strSql.Append("TotalMoney=@TotalMoney");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MID",          SqlDbType.VarChar,   20),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@FHTimes",      SqlDbType.Int,        4),
                new SqlParameter("@FHMoney",      SqlDbType.Decimal,    9),
                new SqlParameter("@isValid",      SqlDbType.Int,        4),
                new SqlParameter("@TotalMoney",   SqlDbType.Decimal,    9),
                new SqlParameter("@ID",           SqlDbType.Int,        4),
                new SqlParameter("@EditTime",     SqlDbType.DateTime),
                new SqlParameter("@ApplyMoney",   SqlDbType.Decimal,    9),
                new SqlParameter("@TakeOffmoney", SqlDbType.Decimal,    9),
                new SqlParameter("@Type",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.MID;
            parameters[1].Value  = model.CreateTime;
            parameters[2].Value  = model.FHTimes;
            parameters[3].Value  = model.FHMoney;
            parameters[4].Value  = model.isValid;
            parameters[5].Value  = model.TotalMoney;
            parameters[6].Value  = model.ID;
            parameters[7].Value  = model.EditTime;
            parameters[8].Value  = model.ApplyMoney;
            parameters[9].Value  = model.TakeOffmoney;
            parameters[10].Value = model.Type;
            strSql.AppendFormat(" ;select '{0}'", Guid.NewGuid().ToString());

            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Add(yny_005.Model.LuckyMoney model, Hashtable MyHs)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into LuckyMoney(");
            strSql.Append("MID,CreateTime,FHTimes,FHMoney,isValid,TotalMoney,EditTime,ApplyMoney,TakeOffmoney,Type)");
            strSql.Append(" values (");
            strSql.Append("@MID,@CreateTime,@FHTimes,@FHMoney,@isValid,@TotalMoney,@EditTime,@ApplyMoney,@TakeOffmoney,@Type)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MID",          SqlDbType.VarChar,   20),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@FHTimes",      SqlDbType.Int,        4),
                new SqlParameter("@FHMoney",      SqlDbType.Decimal,    9),
                new SqlParameter("@isValid",      SqlDbType.Int,        4),
                new SqlParameter("@TotalMoney",   SqlDbType.Decimal,    9),
                new SqlParameter("@EditTime",     SqlDbType.DateTime),
                new SqlParameter("@ApplyMoney",   SqlDbType.Decimal,    9),
                new SqlParameter("@TakeOffmoney", SqlDbType.Decimal,    9),
                new SqlParameter("@Type",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MID;
            parameters[1].Value = model.CreateTime;
            parameters[2].Value = model.FHTimes;
            parameters[3].Value = model.FHMoney;
            parameters[4].Value = model.isValid;
            parameters[5].Value = model.TotalMoney;
            parameters[6].Value = model.EditTime;
            parameters[7].Value = model.ApplyMoney;
            parameters[8].Value = model.TakeOffmoney;
            parameters[9].Value = model.Type;

            string guid = Guid.NewGuid().ToString();

            strSql.AppendFormat("; select '{0}'", guid);

            MyHs.Add(strSql.ToString(), parameters);

            return(MyHs);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static yny_005.Model.LuckyMoney GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from LuckyMoney");
            if (!string.IsNullOrEmpty(strWhere))
            {
                strSql.AppendFormat(" where {0} ", strWhere);
            }

            yny_005.Model.LuckyMoney model = new yny_005.Model.LuckyMoney();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static yny_005.Model.LuckyMoney GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from LuckyMoney");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
 public static bool Add(yny_005.Model.LuckyMoney model)
 {
     return(DAL.CommonBase.RunHashtable(Add(model, new Hashtable())));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(yny_005.Model.LuckyMoney model)
 {
     return(CommonBase.RunHashtable(Update(model, new Hashtable())));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static Hashtable Update(yny_005.Model.LuckyMoney model, Hashtable MyHs)
 {
     return(DAL.LuckyMoney.Update(model, MyHs));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(yny_005.Model.LuckyMoney model)
 {
     return(DAL.LuckyMoney.Update(model));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static Hashtable Add(yny_005.Model.LuckyMoney model, Hashtable MyHs)
 {
     return(DAL.LuckyMoney.Add(model, MyHs));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Add(yny_005.Model.LuckyMoney model)
 {
     return(DAL.LuckyMoney.Add(model));
 }