Пример #1
0
        /// <summary>
        /// 生成订单
        /// </summary>
        /// <param name="orInfo">订单信息实体</param>
        /// <returns>true 成功 false 失败</returns>
        public Boolean GenerOrder(OrderInfo orInfo)
        {
            lock (obj)
               {
               orInfo.OrderID = 1232;
               orInfo.OrderStateID = 0;
               orInfo.PayMentStatusID = 0;

               return orInfoDal.AddOrderInfo(orInfo) > 0;
               }
        }
Пример #2
0
        public ContentResult GenerOrderPost(decimal totalMoney,int orBuisnessID)
        {
            if (totalMoney <= 0 && orBuisnessID <= 0)
            {
                return Content("-1");
            }
            OrderInfo orInfo = new OrderInfo();

            orInfo.TotalMoney = totalMoney;
            orInfo.OrderBuinessID = orBuisnessID;
            bool resultBool = orInfoBll.GenerOrder(orInfo);
            return Content(resultBool?"1":"0");
        }
Пример #3
0
        /// <summary>
        /// 添加订单信息
        /// </summary>
        /// <param name="orInfo">订单信息实体</param>
        /// <returns>-1 失败 1成功</returns>
        public int AddOrderInfo(OrderInfo orInfo)
        {
            int resultInt = -1;

              #region - sql qy-
              string insertOrInfoQy = @"INSERT INTO  `order`.`orderinfo`(
                                     `OrderID`,
                                     `OrderBusinessID`,
                                     `TotalMoney`,
                                     `MeberID`,
                                     `OrderStateID`,
                                     `PaymentStatusID`,
                                     `OrderDate`,
                                     `OrderUpdateDate`,
                                     `avg1`,
                                     `avg2`)
                                    VALUES (
                                            @OrderID,
                                            @OrderBusinessID,
                                            @TotalMoney,
                                            @MeberID,
                                            @OrderStateID,
                                            @PaymentStatusID,
                                            @OrderDate,
                                            @OrderUpdateDate,
                                            @avg1,
                                            @avg2);";
              #endregion

              #region  - paras -
              MySqlParameter[] paras =
               {
               new MySqlParameter("@OrderID",orInfo.OrderID),
               new MySqlParameter("@OrderBusinessID",orInfo.OrderID),
               new MySqlParameter("@TotalMoney",orInfo.TotalMoney),
               new MySqlParameter("@MeberID",orInfo.MemberID),
               new MySqlParameter("@OrderStateID",orInfo.OrderStateID),
               new MySqlParameter("@PaymentStatusID",orInfo.PayMentStatusID),
               new MySqlParameter("@OrderDate",DateTime.Now),
               new MySqlParameter("@OrderUpdateDate",DateTime.Now),
               new MySqlParameter("@avg1",string.Empty),
               new MySqlParameter("@avg2",string.Empty),

               };
              #endregion

              #region - excute -
              try
              {
              resultInt = Convert.ToInt32(DbHelperMySql.ExecuteNonQuery(DbHelperMySql.connectionStringManager, System.Data.CommandType.Text, insertOrInfoQy, paras));
              }
              catch (Exception ex)
              {
              //记录生成订单错误信息

              throw;
              }
              #endregion

              return resultInt;
        }