Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(LingLong.Admin.Model.t_consumption model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_consumption(");
            strSql.Append("RecordType,StoreId,CustomerId,BusinessId,BoxNumber,Money,ConsumeTime,IsDeleted,DeleterUserId,LastModificationTime,LastModifierUserId,CreationTime,CreatorUserId)");
            strSql.Append(" values (");
            strSql.Append("@RecordType,@StoreId,@CustomerId,@BusinessId,@BoxNumber,@Money,@ConsumeTime,@IsDeleted,@DeleterUserId,@LastModificationTime,@LastModifierUserId,@CreationTime,@CreatorUserId)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@RecordType",           MySqlDbType.Int16,      4),
                new MySqlParameter("@StoreId",              MySqlDbType.Int32,     11),
                new MySqlParameter("@CustomerId",           MySqlDbType.Int32,     11),
                new MySqlParameter("@BusinessId",           MySqlDbType.Int32,     11),
                new MySqlParameter("@BoxNumber",            MySqlDbType.VarChar,   20),
                new MySqlParameter("@Money",                MySqlDbType.Decimal,   10),
                new MySqlParameter("@ConsumeTime",          MySqlDbType.DateTime),
                new MySqlParameter("@IsDeleted",            MySqlDbType.Int16,      4),
                new MySqlParameter("@DeleterUserId",        MySqlDbType.Int64,     20),
                new MySqlParameter("@LastModificationTime", MySqlDbType.DateTime),
                new MySqlParameter("@LastModifierUserId",   MySqlDbType.Int64,     20),
                new MySqlParameter("@CreationTime",         MySqlDbType.DateTime),
                new MySqlParameter("@CreatorUserId",        MySqlDbType.Int64, 20)
            };
            parameters[0].Value  = model.RecordType;
            parameters[1].Value  = model.StoreId;
            parameters[2].Value  = model.CustomerId;
            parameters[3].Value  = model.BusinessId;
            parameters[4].Value  = model.BoxNumber;
            parameters[5].Value  = model.Money;
            parameters[6].Value  = model.ConsumeTime;
            parameters[7].Value  = model.IsDeleted;
            parameters[8].Value  = model.DeleterUserId;
            parameters[9].Value  = model.LastModificationTime;
            parameters[10].Value = model.LastModifierUserId;
            parameters[11].Value = model.CreationTime;
            parameters[12].Value = model.CreatorUserId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LingLong.Admin.Model.t_consumption GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,RecordType,StoreId,CustomerId,BusinessId,BoxNumber,Money,ConsumeTime,IsDeleted,DeleterUserId,LastModificationTime,LastModifierUserId,CreationTime,CreatorUserId from t_consumption ");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", MySqlDbType.Int32)
            };
            parameters[0].Value = ID;

            LingLong.Admin.Model.t_consumption model = new LingLong.Admin.Model.t_consumption();
            DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LingLong.Admin.Model.t_consumption model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(LingLong.Admin.Model.t_consumption model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public LingLong.Admin.Model.t_consumption DataRowToModel(DataRow row)
 {
     LingLong.Admin.Model.t_consumption model = new LingLong.Admin.Model.t_consumption();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["RecordType"] != null && row["RecordType"].ToString() != "")
         {
             model.RecordType = int.Parse(row["RecordType"].ToString());
         }
         if (row["StoreId"] != null && row["StoreId"].ToString() != "")
         {
             model.StoreId = int.Parse(row["StoreId"].ToString());
         }
         if (row["CustomerId"] != null && row["CustomerId"].ToString() != "")
         {
             model.CustomerId = int.Parse(row["CustomerId"].ToString());
         }
         if (row["BusinessId"] != null && row["BusinessId"].ToString() != "")
         {
             model.BusinessId = int.Parse(row["BusinessId"].ToString());
         }
         if (row["BoxNumber"] != null)
         {
             model.BoxNumber = row["BoxNumber"].ToString();
         }
         if (row["Money"] != null && row["Money"].ToString() != "")
         {
             model.Money = decimal.Parse(row["Money"].ToString());
         }
         if (row["ConsumeTime"] != null && row["ConsumeTime"].ToString() != "")
         {
             model.ConsumeTime = DateTime.Parse(row["ConsumeTime"].ToString());
         }
         if (row["IsDeleted"] != null && row["IsDeleted"].ToString() != "")
         {
             model.IsDeleted = int.Parse(row["IsDeleted"].ToString());
         }
         if (row["DeleterUserId"] != null && row["DeleterUserId"].ToString() != "")
         {
             model.DeleterUserId = long.Parse(row["DeleterUserId"].ToString());
         }
         if (row["LastModificationTime"] != null && row["LastModificationTime"].ToString() != "")
         {
             model.LastModificationTime = DateTime.Parse(row["LastModificationTime"].ToString());
         }
         if (row["LastModifierUserId"] != null && row["LastModifierUserId"].ToString() != "")
         {
             model.LastModifierUserId = long.Parse(row["LastModifierUserId"].ToString());
         }
         if (row["CreationTime"] != null && row["CreationTime"].ToString() != "")
         {
             model.CreationTime = DateTime.Parse(row["CreationTime"].ToString());
         }
         if (row["CreatorUserId"] != null && row["CreatorUserId"].ToString() != "")
         {
             model.CreatorUserId = long.Parse(row["CreatorUserId"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LingLong.Admin.Model.t_consumption model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_consumption set ");
            strSql.Append("RecordType=@RecordType,");
            strSql.Append("StoreId=@StoreId,");
            strSql.Append("CustomerId=@CustomerId,");
            strSql.Append("BusinessId=@BusinessId,");
            strSql.Append("BoxNumber=@BoxNumber,");
            strSql.Append("Money=@Money,");
            strSql.Append("ConsumeTime=@ConsumeTime,");
            strSql.Append("IsDeleted=@IsDeleted,");
            strSql.Append("DeleterUserId=@DeleterUserId,");
            strSql.Append("LastModificationTime=@LastModificationTime,");
            strSql.Append("LastModifierUserId=@LastModifierUserId,");
            strSql.Append("CreationTime=@CreationTime,");
            strSql.Append("CreatorUserId=@CreatorUserId");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@RecordType",           MySqlDbType.Int16,      4),
                new MySqlParameter("@StoreId",              MySqlDbType.Int32,     11),
                new MySqlParameter("@CustomerId",           MySqlDbType.Int32,     11),
                new MySqlParameter("@BusinessId",           MySqlDbType.Int32,     11),
                new MySqlParameter("@BoxNumber",            MySqlDbType.VarChar,   20),
                new MySqlParameter("@Money",                MySqlDbType.Decimal,   10),
                new MySqlParameter("@ConsumeTime",          MySqlDbType.DateTime),
                new MySqlParameter("@IsDeleted",            MySqlDbType.Int16,      4),
                new MySqlParameter("@DeleterUserId",        MySqlDbType.Int64,     20),
                new MySqlParameter("@LastModificationTime", MySqlDbType.DateTime),
                new MySqlParameter("@LastModifierUserId",   MySqlDbType.Int64,     20),
                new MySqlParameter("@CreationTime",         MySqlDbType.DateTime),
                new MySqlParameter("@CreatorUserId",        MySqlDbType.Int64,     20),
                new MySqlParameter("@ID",                   MySqlDbType.Int32, 11)
            };
            parameters[0].Value  = model.RecordType;
            parameters[1].Value  = model.StoreId;
            parameters[2].Value  = model.CustomerId;
            parameters[3].Value  = model.BusinessId;
            parameters[4].Value  = model.BoxNumber;
            parameters[5].Value  = model.Money;
            parameters[6].Value  = model.ConsumeTime;
            parameters[7].Value  = model.IsDeleted;
            parameters[8].Value  = model.DeleterUserId;
            parameters[9].Value  = model.LastModificationTime;
            parameters[10].Value = model.LastModifierUserId;
            parameters[11].Value = model.CreationTime;
            parameters[12].Value = model.CreatorUserId;
            parameters[13].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }