Example #1
0
        /// <summary>
        /// 更新偏好信息
        /// </summary>
        /// <param name="mode">模式</param>
        /// <param name="file_md5">图片MD5</param>
        /// <param name="prefer"></param>
        /// <returns></returns>
        public static int UpdatePrefer(Mode mode, string file_md5, Prefer prefer)
        {
            string commandText = string.Empty;
            List <SQLiteParameter> paramList = new List <SQLiteParameter>();

            if (prefer == Prefer.Normal)
            {
                commandText = string.Format("DELETE FROM {0} WHERE file_md5 = @file_md5", mode.ToString());
                paramList.Add(new SQLiteParameter("@file_md5", file_md5));
            }
            else
            {
                commandText = string.Format("DELETE FROM {0} WHERE file_md5 = @file_md5;INSERT INTO {0} VALUES (@file_md5,@prefer)", mode.ToString());
                paramList.Add(new SQLiteParameter("@file_md5", file_md5));
                paramList.Add(new SQLiteParameter("@prefer", prefer.ToString("d")));
            }

            SQLiteCommand command = SQLiteHelper.CreateCommand(DBConn.prefer, commandText, paramList.ToArray());

            return(SQLiteHelper.ExecuteNonQuery(command));
        }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Boolean Update(Member model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update members set ");
            strSql.Append("seller_id=@seller_id,");
            strSql.Append("user_id=@user_id,");
            strSql.Append("no=@no,");
            strSql.Append("real_no=@real_no,");
            strSql.Append("level_id=@level_id,");
            strSql.Append("score=@score,");
            strSql.Append("money=@money,");
            strSql.Append("gift_money=@gift_money,");
            strSql.Append("reg_from=@reg_from,");
            strSql.Append("remark=@remark,");
            strSql.Append("status=@status,");
            strSql.Append("is_new=@is_new,");
            strSql.Append("is_delete=@is_delete,");
            strSql.Append("recommend_id=@recommend_id,");
            strSql.Append("created_at=@created_at,");
            strSql.Append("updated_at=@updated_at,");
            strSql.Append("last_at=@last_at");
            strSql.Append(" where id=@id");
            List <SQLiteParameter> parameters = GetParameters(model);
            SQLiteParameter        idParams   = new SQLiteParameter("@id", DbType.Int32, 8);

            idParams.Value = model.Id;
            parameters.Add(idParams);

            int num = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters.ToArray <SQLiteParameter>());

            if (num > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Boolean Create(OrderDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into orders_details(");
            strSql.Append("order_id,goods_id,spec_id,price,num,size,color,set_meal,remark,use_flag,created_at,updated_at, last_updated_at)");
            strSql.Append(" values (");
            strSql.Append("@order_id,@goods_id,@spec_id,@price,@num,@size,@color,@set_meal,@remark,@use_flag,@created_at,@updated_at, @last_updated_at)");
            strSql.Append(";select LAST_INSERT_ROWID()");

            List <SQLiteParameter> parameters = GetParameters(model);
            int num = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters.ToArray <SQLiteParameter>());

            if (num > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        /// <summary>
        /// 创建一个订单
        /// </summary>
        /// <param name="model">订单数据</param>
        /// <returns></returns>
        public static Boolean Create(Order model)
        {
            Boolean flag = false;

            if (model == null)
            {
                return(flag);
            }
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into orders(");
            strSql.Append("order_no,order_name,order_body,order_url,payment_type,original_money,money,invoice_title,user_id,from_id,emp_id,order_type,order_status,feedback_status,transport_fee,remark,arrived_at,express_at,sign_at,close_at,refund_at,is_delete,created_at,updated_at,pay_at,feedback_at,buyer_id)");
            strSql.Append(" values (");
            strSql.Append("@order_no,@order_name,@order_body,@order_url,@payment_type,@original_money,@money,@invoice_title,@user_id,@from_id,@emp_id,@order_type,@order_status,@feedback_status,@transport_fee,@remark,@arrived_at,@express_at,@sign_at,@close_at,@refund_at,@is_delete,@created_at,@updated_at,@pay_at,@feedback_at,@buyer_id)");
            strSql.Append(";select LAST_INSERT_ROWID()");
            List <SQLiteParameter> parameters = GetParameters(model);

            int num = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters.ToArray <SQLiteParameter>());

            flag = num > 0;
            return(flag);
        }
Example #5
0
        /// <summary>
        /// 创建一个订单
        /// </summary>
        /// <param name="model">订单数据</param>
        /// <returns></returns>
        public static Boolean Create(People model)
        {
            Boolean flag = false;

            if (model == null)
            {
                return(flag);
            }
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into peoples(");
            strSql.Append("user_id,first_name,last_name,alias,gender,birthday,age,identity,photo,country_id,province_id,city_id,county_id,address,phone,tel,email,qq,msn,weight,height,hobby,interest,introduce,motto,created_at,updated_at)");
            strSql.Append(" values (");
            strSql.Append("@user_id,@first_name,@last_name,@alias,@gender,@birthday,@age,@identity,@photo,@country_id,@province_id,@city_id,@county_id,@address,@phone,@tel,@email,@qq,@msn,@weight,@height,@hobby,@interest,@introduce,@motto,@created_at,@updated_at)");
            strSql.Append(";select LAST_INSERT_ROWID()");
            List <SQLiteParameter> parameters = GetParameters(model);
            SQLiteParameter        idParams   = new SQLiteParameter("@id", DbType.Int32, 8);

            int num = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters.ToArray <SQLiteParameter>());

            flag = num > 0;
            return(flag);
        }
Example #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Boolean Update(OrderDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update orders_details set ");
            strSql.Append("order_id=@order_id,");
            strSql.Append("goods_id=@goods_id,");
            strSql.Append("spec_id=@spec_id,");
            strSql.Append("price=@price,");
            strSql.Append("num=@num,");
            strSql.Append("size=@size,");
            strSql.Append("color=@color,");
            strSql.Append("set_meal=@set_meal,");
            strSql.Append("remark=@remark,");
            strSql.Append("use_flag=@use_flag,");
            strSql.Append("created_at=@created_at,");
            strSql.Append("updated_at=@updated_at,");
            strSql.Append("last_updated_at=@last_updated_at");
            strSql.Append(" where id=@id");
            List <SQLiteParameter> parameters = GetParameters(model);
            SQLiteParameter        idParams   = new SQLiteParameter("@id", DbType.Int32, 8);

            idParams.Value = model.Id;
            parameters.Add(idParams);

            int num = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters.ToArray <SQLiteParameter>());

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