コード例 #1
0
ファイル: TD_WeiXin_Member.cs プロジェクト: chensanze/ShiMiao
        public int Update(Model.TD_WeiXin_Member model)
        {
            StringBuilder          strSql     = new StringBuilder();
            List <string>          fields     = new List <string>();
            IList <MySqlParameter> parameters = new List <MySqlParameter>();

            strSql.Append("update TD_WeiXin_Member set ");

            if (model.FocusTime.HasValue)
            {
                fields.Add("FocusTime=@FocusTime");
                parameters.Add(new MySqlParameter("@FocusTime", model.FocusTime));
            }
            if (!string.IsNullOrEmpty(model.IsFocused))
            {
                fields.Add("IsFocused=@IsFocused");
                parameters.Add(new MySqlParameter("@IsFocused", model.IsFocused));
            }
            if (model.UnFocusTime.HasValue)
            {
                fields.Add("UnFocusTime=@UnFocusTime");
                parameters.Add(new MySqlParameter("@UnFocusTime", model.UnFocusTime));
            }
            strSql.Append(string.Join(",", fields));
            strSql.Append(" where MemberID=@MemberID  ");
            parameters.Add(new MySqlParameter("@MemberID", model.MemberID));
            return(MySqlHelperUtil.ExecuteNonQuery(strSql.ToString(), parameters.ToArray()));
        }
コード例 #2
0
ファイル: TD_Donation_Order.cs プロジェクト: chensanze/simiao
        public int Save(Model.TD_Donation_Order order)
        {
            string tranID = MySqlHelperUtil.BeginTran();

            try
            {
                string orderID = GetOrderID();
                order.OrderID   = orderID;
                order.PayNo     = orderID;
                order.IsPay     = "0";
                order.OrderTime = DateTime.Now;
                decimal result = dal.Add(order, tranID);
                if (result == 0)
                {
                    MySqlHelperUtil.RollbackTran(tranID);
                    return(0);
                }
                MySqlHelperUtil.CommitTran(tranID);
                return(1);
            }
            catch (Exception ex)
            {
                MySqlHelperUtil.RollbackTran(tranID);
                return(0);
            }
        }
コード例 #3
0
ファイル: TD_Shop_Order.cs プロジェクト: chensanze/ShiMiao
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ShiMiao.Model.TD_Shop_Order model, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TD_Shop_Order(");
            strSql.Append("OrderID,PayNo,OrgID,OriPrice,RealPrice,Status,MemberID,NickName,HeaderImage,Mobile,OrderType,PayType,IsPay,IsMemberDeleted,OrderTime,PayTime,CompleteTime,Message,ExtraPrice");
            strSql.Append(") values (");
            strSql.Append("@OrderID,@PayNo,@OrgID,@OriPrice,@RealPrice,@Status,@MemberID,@NickName,@HeaderImage,@Mobile,@OrderType,@PayType,@IsPay,@IsMemberDeleted,@OrderTime,@PayTime,@CompleteTime,@Message,@ExtraPrice");
            strSql.Append(") ");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID",         model.OrderID),
                new MySqlParameter("@PayNo",           model.PayNo),
                new MySqlParameter("@OrgID",           model.OrgID),
                new MySqlParameter("@OriPrice",        model.OriPrice),
                new MySqlParameter("@RealPrice",       model.RealPrice),
                new MySqlParameter("@Status",          model.Status),
                new MySqlParameter("@MemberID",        model.MemberID),
                new MySqlParameter("@NickName",        model.NickName),
                new MySqlParameter("@HeaderImage",     model.HeaderImage),
                new MySqlParameter("@Mobile",          model.Mobile),
                new MySqlParameter("@OrderType",       model.OrderType),
                new MySqlParameter("@PayType",         model.PayType),
                new MySqlParameter("@IsPay",           model.IsPay),
                new MySqlParameter("@IsMemberDeleted", model.IsMemberDeleted),
                new MySqlParameter("@OrderTime",       model.OrderTime),
                new MySqlParameter("@PayTime",         model.PayTime),
                new MySqlParameter("@CompleteTime",    model.CompleteTime),
                new MySqlParameter("@Message",         model.Message),
                new MySqlParameter("@ExtraPrice",      model.ExtraPrice)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #4
0
ファイル: TD_WeiXin_Member.cs プロジェクト: chensanze/ShiMiao
        public int Add(Model.TD_WeiXin_Member model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TD_WeiXin_Member(");
            strSql.Append("MemberID,NickName,HeaderImage,OpenID,CreateTime,IsFocused,FocusTime,UnFocusTime,Sex,Country,Province,City,OrgID");
            strSql.Append(") values (");
            strSql.Append("@MemberID,@NickName,@HeaderImage,@OpenID,@CreateTime,@IsFocused,@FocusTime,@UnFocusTime,@Sex,@Country,@Province,@City,@OrgID");
            strSql.Append(") ");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@MemberID",    model.MemberID),
                new MySqlParameter("@NickName",    model.NickName),
                new MySqlParameter("@HeaderImage", model.HeaderImage),
                new MySqlParameter("@OpenID",      model.OpenID),
                new MySqlParameter("@CreateTime",  model.CreateTime),
                new MySqlParameter("@IsFocused",   model.IsFocused),
                new MySqlParameter("@FocusTime",   model.FocusTime),
                new MySqlParameter("@UnFocusTime", model.UnFocusTime),
                new MySqlParameter("@Sex",         model.Sex),
                new MySqlParameter("@Country",     model.Country),
                new MySqlParameter("@Province",    model.Province),
                new MySqlParameter("@City",        model.City),
                new MySqlParameter("@OrgID",       model.OrgID)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(strSql.ToString(), parameters));
        }
コード例 #5
0
ファイル: TD_Shop_Order.cs プロジェクト: chensanze/ShiMiao
        public IList <decimal> GetCount(string where)
        {
            IList <decimal> list = new List <decimal>();
            StringBuilder   sql  = new StringBuilder();

            sql.Append("SELECT COUNT(1),SUM(orders.realprice) FROM TD_Shop_Order as orders inner join TD_Shop_OrderGoods as goods on orders.OrderID=goods.OrderID");
            if (!string.IsNullOrEmpty(where))
            {
                sql.AppendFormat(" where {0}", where);
            }
            using (DbDataReader dr = MySqlHelperUtil.ExecuteReader(sql.ToString()))
            {
                if (dr.Read())
                {
                    if (dr[0] != DBNull.Value)
                    {
                        list.Add(dr.GetInt32(0));
                    }
                    else
                    {
                        list.Add(0);
                    }
                    if (dr[1] != DBNull.Value)
                    {
                        list.Add(dr.GetDecimal(1));
                    }
                    else
                    {
                        list.Add(0);
                    }
                }
            }
            return(list);
        }
コード例 #6
0
ファイル: TD_Shop_Order.cs プロジェクト: chensanze/ShiMiao
        public IList <Model.TD_Shop_Order> GetUnPayOrder()
        {
            string sql = "SELECT OrderID FROM TD_Shop_Order WHERE IsPay='0' and OrderTime<@Time";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Time", DateTime.Now.AddHours(-1))
            };
            IList <ShiMiao.Model.TD_Shop_Order> list = new List <ShiMiao.Model.TD_Shop_Order>();

            using (DbDataReader dr = MySqlHelperUtil.ExecuteReader(sql, parameters))
            {
                while (dr.Read())
                {
                    ShiMiao.Model.TD_Shop_Order model = new ShiMiao.Model.TD_Shop_Order();

                    if (dr[0] != DBNull.Value)
                    {
                        model.OrderID = dr.GetString(0);
                    }
                    list.Add(model);
                }
                return(list);
            }
        }
コード例 #7
0
ファイル: TD_Donation_Info.cs プロジェクト: chensanze/ShiMiao
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ShiMiao.Model.TD_Donation_Info model, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TD_Donation_Info(");
            strSql.Append("DonationID,Title,ImageURL,Content,ReadCount,IsImage,IsDeleted,CreateTime,CreatorID,CreatorName,UpdateTime,UpdaterID,UpdaterName,PublishOrgID,PublishOrgName");
            strSql.Append(") values (");
            strSql.Append("@DonationID,@Title,@ImageURL,@Content,@ReadCount,@IsImage,@IsDeleted,@CreateTime,@CreatorID,@CreatorName,@UpdateTime,@UpdaterID,@UpdaterName,@PublishOrgID,@PublishOrgName");
            strSql.Append(") ");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DonationID",     model.DonationID),
                new MySqlParameter("@Title",          model.Title),
                new MySqlParameter("@ImageURL",       model.ImageURL),
                new MySqlParameter("@Content",        model.Content),
                new MySqlParameter("@ReadCount",      model.ReadCount),
                new MySqlParameter("@IsImage",        model.IsImage),
                new MySqlParameter("@IsDeleted",      model.IsDeleted),
                new MySqlParameter("@CreateTime",     model.CreateTime),
                new MySqlParameter("@CreatorID",      model.CreatorID),
                new MySqlParameter("@CreatorName",    model.CreatorName),
                new MySqlParameter("@UpdateTime",     model.UpdateTime),
                new MySqlParameter("@UpdaterID",      model.UpdaterID),
                new MySqlParameter("@UpdaterName",    model.UpdaterName),
                new MySqlParameter("@PublishOrgID",   model.PublishOrgID),
                new MySqlParameter("@PublishOrgName", model.PublishOrgName)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #8
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ShiMiao.Model.TD_Donation_Order model, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TD_Donation_Order(");
            strSql.Append("OrderID,PayNo,DonationID,OpenID,Name,Mobile,NickName,HeaderImage,OrderTime,Fee,IsPay,PayType,PayTime,DonationType,MemberID,OrgID,Message,IsAnonymous");
            strSql.Append(") values (");
            strSql.Append("@OrderID,@PayNo,@DonationID,@OpenID,@Name,@Mobile,@NickName,@HeaderImage,@OrderTime,@Fee,@IsPay,@PayType,@PayTime,@DonationType,@MemberID,@OrgID,@Message,@IsAnonymous");
            strSql.Append(") ");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID",      model.OrderID),
                new MySqlParameter("@PayNo",        model.PayNo),
                new MySqlParameter("@DonationID",   model.DonationID),
                new MySqlParameter("@OpenID",       model.OpenID),
                new MySqlParameter("@Name",         model.Name),
                new MySqlParameter("@Mobile",       model.Mobile),
                new MySqlParameter("@NickName",     model.NickName),
                new MySqlParameter("@HeaderImage",  model.HeaderImage),
                new MySqlParameter("@OrderTime",    model.OrderTime),
                new MySqlParameter("@Fee",          model.Fee),
                new MySqlParameter("@IsPay",        model.IsPay),
                new MySqlParameter("@PayType",      model.PayType),
                new MySqlParameter("@PayTime",      model.PayTime),
                new MySqlParameter("@DonationType", model.DonationType),
                new MySqlParameter("@MemberID",     model.MemberID),
                new MySqlParameter("@OrgID",        model.OrgID),
                new MySqlParameter("@Message",      model.Message),
                new MySqlParameter("@IsAnonymous",  model.IsAnonymous)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ShiMiao.Model.TD_Order_WeiXinPay model, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TD_Order_WeiXinPay(");
            strSql.Append("OrderID,NonceStr,Timestamp,OrgID,WeiXinOrderID,OrderFee,CashFee,Package,Status,PayTime,CallBackTime");
            strSql.Append(") values (");
            strSql.Append("@OrderID,@NonceStr,@Timestamp,@OrgID,@WeiXinOrderID,@OrderFee,@CashFee,@Package,@Status,@PayTime,@CallBackTime");
            strSql.Append(") ");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID",       model.OrderID),
                new MySqlParameter("@NonceStr",      model.NonceStr),
                new MySqlParameter("@Timestamp",     model.Timestamp),
                new MySqlParameter("@OrgID",         model.OrgID),
                new MySqlParameter("@WeiXinOrderID", model.WeiXinOrderID),
                new MySqlParameter("@OrderFee",      model.OrderFee),
                new MySqlParameter("@CashFee",       model.CashFee),
                new MySqlParameter("@Package",       model.Package),
                new MySqlParameter("@Status",        model.Status),
                new MySqlParameter("@PayTime",       model.PayTime),
                new MySqlParameter("@CallBackTime",  model.CallBackTime)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #10
0
        public IList <Model.TD_Shop_OrderGoods> GetListByOrderID(string orderID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT OrderGoodsID,OrderID,GoodsID,Title,Amount,OrgID,OriPrice,RealPrice,OrderTime FROM TD_Shop_OrderGoods");
            strSql.Append(" where OrderID=@OrderID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID", orderID)
            };
            IList <ShiMiao.Model.TD_Shop_OrderGoods> list = new List <ShiMiao.Model.TD_Shop_OrderGoods>();

            using (DbDataReader dr = MySqlHelperUtil.ExecuteReader(strSql.ToString(), parameters))
            {
                while (dr.Read())
                {
                    ShiMiao.Model.TD_Shop_OrderGoods model = new ShiMiao.Model.TD_Shop_OrderGoods();

                    if (dr[0] != DBNull.Value)
                    {
                        model.OrderGoodsID = dr.GetString(0);
                    }
                    if (dr[1] != DBNull.Value)
                    {
                        model.OrderID = dr.GetString(1);
                    }
                    if (dr[2] != DBNull.Value)
                    {
                        model.GoodsID = dr.GetString(2);
                    }
                    if (dr[3] != DBNull.Value)
                    {
                        model.Title = dr.GetString(3);
                    }
                    if (dr[4] != DBNull.Value)
                    {
                        model.Amount = dr.GetInt32(4);
                    }
                    if (dr[5] != DBNull.Value)
                    {
                        model.OrgID = dr.GetInt32(5);
                    }
                    if (dr[6] != DBNull.Value)
                    {
                        model.OriPrice = dr.GetDecimal(6);
                    }
                    if (dr[7] != DBNull.Value)
                    {
                        model.RealPrice = dr.GetDecimal(7);
                    }
                    if (dr[8] != DBNull.Value)
                    {
                        model.OrderTime = dr.GetDateTime(8);
                    }
                    list.Add(model);
                }
                return(list);
            }
        }
コード例 #11
0
ファイル: TD_Donation_Info.cs プロジェクト: chensanze/ShiMiao
        /// <summary>
        /// 增加阅读数
        /// </summary>
        public int AddReadCount(Guid id)
        {
            string sql = "UPDATE TD_Donation_Info SET ReadCount=ReadCount+1 WHERE DonationID=@ID";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", id)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(sql, parameters));
        }
コード例 #12
0
ファイル: TD_Shop_Order.cs プロジェクト: chensanze/simiao
        public IList <Model.OrderDetailEx> GetListByPage2(string where, string orderField, int startIndex, int pageSize)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT orders.NickName,orders.OrderTime,orders.RealPrice,orderGoods.Amount,orderGoods.Title,HeaderImage");
            strSql.Append(" FROM TD_Shop_Order as orders");
            strSql.Append(" inner join TD_Shop_OrderGoods as orderGoods on orders.OrderID=orderGoods.OrderID");
            if (!string.IsNullOrEmpty(where))
            {
                strSql.Append(" WHERE " + where);
            }
            if (!string.IsNullOrEmpty(orderField))
            {
                strSql.AppendFormat(" order by {0}", orderField);
            }
            strSql.AppendFormat(" limit {0}, {1}", startIndex, pageSize);
            List <MySqlParameter> parameters         = new List <MySqlParameter>();
            IList <ShiMiao.Model.OrderDetailEx> list = new List <ShiMiao.Model.OrderDetailEx>();

            using (DbDataReader dr = MySqlHelperUtil.ExecuteReader(strSql.ToString(), parameters.ToArray()))
            {
                while (dr.Read())
                {
                    ShiMiao.Model.OrderDetailEx model = new ShiMiao.Model.OrderDetailEx();

                    if (dr[0] != DBNull.Value)
                    {
                        model.NickName = dr.GetString(0);
                    }
                    if (dr[1] != DBNull.Value)
                    {
                        model.OrderTime = dr.GetDateTime(1);
                    }
                    if (dr[2] != DBNull.Value)
                    {
                        model.RealPrice = dr.GetDecimal(2);
                    }
                    if (dr[3] != DBNull.Value)
                    {
                        model.Amount = dr.GetInt32(3);
                    }
                    if (dr[4] != DBNull.Value)
                    {
                        model.Title = dr.GetString(4);
                    }
                    if (dr[5] != DBNull.Value)
                    {
                        model.HeaderImage = dr.GetString(5);
                    }
                    list.Add(model);
                }
                parameters.Clear();
                return(list);
            }
        }
コード例 #13
0
ファイル: TD_Shop_Goods.cs プロジェクト: chensanze/simiao
        public int Frozen(string goodsID, int amount, string tranID)
        {
            string sql = "UPDATE TD_Shop_Goods SET Balance=Balance-@Amount,Frozen=Frozen+@Amount WHERE GoodsID=@GoodsID and Balance>@Amount";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@GoodsID", goodsID),
                new MySqlParameter("@Amount",  amount)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, sql, parameters));
        }
コード例 #14
0
        public int PayOrder(string goodsID, int amount, string tranID)
        {
            string sql = "UPDATE td_sel_goods SET Frozen=Frozen-@Amount WHERE GoodsID=@GoodsID";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@GoodsID", goodsID),
                new MySqlParameter("@Amount",  amount)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, sql, parameters));
        }
コード例 #15
0
        private int SyncShop(Model.TD_Order_WeiXinPay model, string orderID)
        {
            Model.TD_Shop_Order order = shopOrderBLL.GetModel(orderID);
            if (order == null)
            {
                return(0);
            }
            if (order.IsPay == "1")
            {
                return(0);
            }
            DateTime now = DateTime.Now;

            order.PayTime = now;
            order.IsPay   = "1";

            IList <Model.TD_Shop_OrderGoods> orderGoodsList = orderGoodsBLL.GetListByOrderID(orderID);
            string tranID = MySqlHelperUtil.BeginTran();

            try
            {
                decimal result = dal.Sync(model, tranID);
                if (result == 0)
                {
                    MySqlHelperUtil.RollbackTran(tranID);
                    return(0);
                }
                result = goodsBLL.PayOrder(orderID, orderGoodsList, tranID);
                if (result == 0)
                {
                    //商品中不存在  去sell中找
                    result = sellGoods.PayOrderNoFrozen(orderID, orderGoodsList, tranID);
                    if (result == 0)
                    {
                        MySqlHelperUtil.RollbackTran(tranID);
                        return(0);
                    }
                }
                result = shopOrderBLL.PayOrder(order, tranID);
                if (result == 0)
                {
                    MySqlHelperUtil.RollbackTran(tranID);
                    return(0);
                }
                MySqlHelperUtil.CommitTran(tranID);
                return(1);
            }
            catch
            {
                MySqlHelperUtil.RollbackTran(tranID);
                return(0);
            }
        }
コード例 #16
0
ファイル: TD_Shop_Order.cs プロジェクト: chensanze/ShiMiao
        public int PayOrder(Model.TD_Shop_Order model, string tranID)
        {
            string sql = "UPDATE TD_Shop_Order SET PayTime=@PayTime,IsPay=@IsPay WHERE OrderID=@OrderID";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@PayTime", model.PayTime),
                new MySqlParameter("@IsPay",   model.IsPay),
                new MySqlParameter("@OrderID", model.OrderID)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, sql, parameters));
        }
コード例 #17
0
ファイル: TD_Donation_Info.cs プロジェクト: chensanze/ShiMiao
        /// <summary>
        /// 软删除一条数据
        /// </summary>
        public int DeleteLogic(Guid DonationID, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TD_Donation_Info set IsDeleted='1'");
            strSql.Append(" where DonationID=@DonationID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DonationID", DonationID)
            };

            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #18
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(Guid OrderID, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TD_Donation_Order ");
            strSql.Append(" where OrderID=@OrderID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID", OrderID)
            };

            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #19
0
ファイル: TD_Donation_Info.cs プロジェクト: chensanze/ShiMiao
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(Guid DonationID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TD_Donation_Info ");
            strSql.Append(" where DonationID=@DonationID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DonationID", DonationID)
            };

            return(MySqlHelperUtil.ExecuteNonQuery(strSql.ToString(), parameters));
        }
コード例 #20
0
        public bool OrderIsPay(string orderID, int status)
        {
            string sql = "SELECT 1 FROM TD_Order_WeiXinPay WHERE OrderID=@OrderID and Status=@Status";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID", orderID),
                new MySqlParameter("@Status",  status)
            };
            object result = MySqlHelperUtil.ExecuteScalar(sql, parameters);

            return(result != null);
        }
コード例 #21
0
        /// <summary>
        /// 软删除一条数据
        /// </summary>
        public int DeleteLogic(string OrderID, string NonceStr, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TD_Order_WeiXinPay set IsDeleted='1'");
            strSql.Append(" where OrderID=@OrderID and NonceStr=@NonceStr ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID",  OrderID),

                new MySqlParameter("@NonceStr", NonceStr)
            };

            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }
コード例 #22
0
        public int Sync(Model.TD_Order_WeiXinPay model, string tranID)
        {
            string sql = "UPDATE TD_Order_WeiXinPay SET Status=@Status,OrderFee=@OrderFee,CashFee=@CashFee,CallBackTime=@CallBackTime WHERE OrderID=@OrderID and NonceStr=@NonceStr and Status=0";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Status",       model.Status),
                new MySqlParameter("@OrderFee",     model.OrderFee),
                new MySqlParameter("@CashFee",      model.CashFee),
                new MySqlParameter("@CallBackTime", model.CallBackTime),
                new MySqlParameter("@OrderID",      model.OrderID),
                new MySqlParameter("@NonceStr",     model.NonceStr)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(tranID, sql, parameters));
        }
コード例 #23
0
ファイル: TD_Shop_Goods.cs プロジェクト: chensanze/simiao
        public int ClearFrozenGoods(DateTime time, int orderStatus)
        {
            string sql = @"UPDATE td_shop_order as orders
                                    inner join td_shop_ordergoods as ordergoods on orders.OrderID=ordergoods.OrderID
                                    inner join td_shop_goods as goods on ordergoods.GoodsID=goods.goodsid
                                    set orders.Status=@OrderStatus, goods.balance=goods.balance+ordergoods.Amount,goods.frozen=goods.frozen-ordergoods.Amount
                                    where orders.IsPay='0' and orders.OrderTime<@time and goods.frozen>ordergoods.Amount";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Time",        time),
                new MySqlParameter("@OrderStatus", orderStatus)
            };
            return(MySqlHelperUtil.ExecuteNonQuery(sql, parameters));
        }
コード例 #24
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(string OrderID, string NonceStr)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TD_Order_WeiXinPay ");
            strSql.Append(" where OrderID=@OrderID and NonceStr=@NonceStr ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID",  OrderID),

                new MySqlParameter("@NonceStr", NonceStr)
            };

            return(MySqlHelperUtil.ExecuteNonQuery(strSql.ToString(), parameters));
        }
コード例 #25
0
        public bool Exists(string OrderID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select 1 from TD_Order_Consignee");
            strSql.Append(" where ");
            strSql.Append(" OrderID = @OrderID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID", OrderID)
            };
            object result = MySqlHelperUtil.ExecuteScalar(strSql.ToString(), parameters);

            return(result != null);
        }
コード例 #26
0
        public bool Exists(string OrderID, string NonceStr, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select 1 from TD_Order_WeiXinPay");
            strSql.Append(" where ");
            strSql.Append(" OrderID = @OrderID and  "); strSql.Append(" NonceStr = @NonceStr ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@OrderID", OrderID), new MySqlParameter("@NonceStr", NonceStr)
            };
            object result = MySqlHelperUtil.ExecuteScalar(tranID, strSql.ToString(), parameters);

            return(result != null);
        }
コード例 #27
0
ファイル: TD_Donation_Info.cs プロジェクト: chensanze/ShiMiao
        public bool Exists(Guid DonationID, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select 1 from TD_Donation_Info");
            strSql.Append(" where ");
            strSql.Append(" DonationID = @DonationID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DonationID", DonationID)
            };
            object result = MySqlHelperUtil.ExecuteScalar(tranID, strSql.ToString(), parameters);

            return(result != null);
        }
コード例 #28
0
ファイル: TD_Shop_Order.cs プロジェクト: chensanze/ShiMiao
        public int Save(Model.TD_Shop_Order order, Model.TD_Shop_Order_Consignee consignee, IList <Model.TD_Shop_OrderGoods> ordderGoodsList)
        {
            string tranID = MySqlHelperUtil.BeginTran();

            try
            {
                string orderID = GetOrderID();
                order.OrderID         = orderID;
                order.PayNo           = orderID;
                order.IsMemberDeleted = "0";
                order.IsPay           = "0";
                order.OrderTime       = DateTime.Now;
                int result = dal.Add(order, tranID);
                if (result == 0)
                {
                    MySqlHelperUtil.RollbackTran(tranID);
                    return(0);
                }
                foreach (var orderGoods in ordderGoodsList)
                {
                    orderGoods.OrderID      = orderID;
                    orderGoods.OrderTime    = order.OrderTime;
                    orderGoods.OrderGoodsID = Guid.NewGuid().ToString();
                    result = orderGoodsBLL.Add(orderGoods, tranID);
                    if (result == 0)
                    {
                        MySqlHelperUtil.RollbackTran(tranID);
                        return(0);
                    }
                    result = goodsBLL.Frozen(orderGoods.GoodsID, orderGoods.Amount.Value, tranID);
                    if (result == 0)
                    {
                        MySqlHelperUtil.RollbackTran(tranID);
                        return(0);
                    }
                }
                MySqlHelperUtil.CommitTran(tranID);
                return(1);
            }
            catch (Exception ex)
            {
                MySqlHelperUtil.RollbackTran(tranID);
                return(0);
            }
        }
コード例 #29
0
        public IList <decimal> GetCount(string where, IDictionary <string, object> dictParams)
        {
            IList <decimal> list   = new List <decimal>();
            StringBuilder   strSql = new StringBuilder();

            strSql.Append("select count(1),sum(Fee) from TD_Donation_Order");
            if (!string.IsNullOrEmpty(where))
            {
                strSql.Append(" where " + where);
            }
            List <MySqlParameter> parameters = new List <MySqlParameter>();

            if (dictParams != null)
            {
                foreach (var pair in dictParams)
                {
                    MySqlParameter parameter = new MySqlParameter("@" + pair.Key, pair.Value);
                    parameters.Add(parameter);
                }
            }
            using (DbDataReader dr = MySqlHelperUtil.ExecuteReader(strSql.ToString(), parameters.ToArray()))
            {
                if (dr.Read())
                {
                    if (dr[0] != DBNull.Value)
                    {
                        list.Add(dr.GetInt32(0));
                    }
                    else
                    {
                        list.Add(0);
                    }
                    if (dr[1] != DBNull.Value)
                    {
                        list.Add(dr.GetDecimal(1));
                    }
                    else
                    {
                        list.Add(0);
                    }
                }
            }
            parameters.Clear();
            return(list);
        }
コード例 #30
0
ファイル: TD_Donation_Info.cs プロジェクト: chensanze/ShiMiao
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(ShiMiao.Model.TD_Donation_Info model, string tranID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TD_Donation_Info set ");

            strSql.Append(" DonationID = @DonationID , ");
            strSql.Append(" Title = @Title , ");
            strSql.Append(" ImageURL = @ImageURL , ");
            strSql.Append(" Content = @Content , ");
            strSql.Append(" ReadCount = @ReadCount , ");
            strSql.Append(" IsImage = @IsImage , ");
            strSql.Append(" IsDeleted = @IsDeleted , ");
            strSql.Append(" CreateTime = @CreateTime , ");
            strSql.Append(" CreatorID = @CreatorID , ");
            strSql.Append(" CreatorName = @CreatorName , ");
            strSql.Append(" UpdateTime = @UpdateTime , ");
            strSql.Append(" UpdaterID = @UpdaterID , ");
            strSql.Append(" UpdaterName = @UpdaterName , ");
            strSql.Append(" PublishOrgID = @PublishOrgID , ");
            strSql.Append(" PublishOrgName = @PublishOrgName  ");
            strSql.Append(" where DonationID=@DonationID  ");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@DonationID",     model.DonationID),
                new MySqlParameter("@Title",          model.Title),
                new MySqlParameter("@ImageURL",       model.ImageURL),
                new MySqlParameter("@Content",        model.Content),
                new MySqlParameter("@ReadCount",      model.ReadCount),
                new MySqlParameter("@IsImage",        model.IsImage),
                new MySqlParameter("@IsDeleted",      model.IsDeleted),
                new MySqlParameter("@CreateTime",     model.CreateTime),
                new MySqlParameter("@CreatorID",      model.CreatorID),
                new MySqlParameter("@CreatorName",    model.CreatorName),
                new MySqlParameter("@UpdateTime",     model.UpdateTime),
                new MySqlParameter("@UpdaterID",      model.UpdaterID),
                new MySqlParameter("@UpdaterName",    model.UpdaterName),
                new MySqlParameter("@PublishOrgID",   model.PublishOrgID),
                new MySqlParameter("@PublishOrgName", model.PublishOrgName)
            };

            return(MySqlHelperUtil.ExecuteNonQuery(tranID, strSql.ToString(), parameters));
        }