Example #1
0
        /// <summary>
        /// 订单发货
        /// </summary>
        /// <param name="OrdersId"></param>
        /// <param name="OrdersState"></param>
        /// <param name="LogisticsCompanyNumber"></param>
        /// <param name="LogisticsNumber"></param>
        /// <returns></returns>
        public bool OrderDelivery(string OrdersId, int OrdersState, string LogisticsCompanyNumber, string LogisticsNumber, string UserName)
        {
            const string orders =
                @"UPDATE orders set OrdersState=@OrdersState,LogisticsCompanyNumber=@LogisticsCompanyNumber,
LogisticsNumber=@LogisticsNumber,OrderDelivery=getdate()  where OrderId=@OrdersId ";

            Factory.DBHelper.ExecSQL(SQLConString, orders.ToString(), new DynamicParameters(new
            {
                OrdersId,
                OrdersState,
                LogisticsCompanyNumber,
                LogisticsNumber
            }));
            const string OrdersLog =
                @"insert into OrdersLog(OrdersId,UserName,OrdersState)
        values(@OrdersId,@UserName,@OrdersState)";

            Factory.DBHelper.ExecSQL(SQLConString, OrdersLog.ToString(), new DynamicParameters(new
            {
                OrdersId,
                UserName,
                OrdersState
            }));
            return(true);
        }
Example #2
0
        /// <summary>
        /// 非事务订单
        /// </summary>
        /// <returns></returns>
        public bool InsertOrders(Model.Orders orders, List <Model.OrdersDetails> ordersDetailList, Model.OrdersLog ordersLog)
        {
            const string sql =
                @"insert into Orders (OrderId,SellingPrice,CostPrice,profit,UsersId,ConsigneeName,ConsigneePhone,ConsigneAaddress,OrdersState,GoodsSum) 
 values(@OrderId,@SellingPrice,@CostPrice,@profit,@UsersId,@ConsigneeName,@ConsigneePhone,@ConsigneAaddress,@OrdersState,@GoodsSum)";

            Factory.DBHelper.ExecSQL(SQLConString, sql.ToString(), new DynamicParameters(new
            {
                orders.OrderId,
                orders.SellingPrice,
                orders.CostPrice,
                orders.profit,
                orders.UsersId,
                orders.ConsigneeName,
                orders.ConsigneePhone,
                orders.ConsigneAaddress,
                orders.OrdersState,
                orders.GoodsSum,
            }));

            const string OrdersLog =
                @"insert into OrdersLog(OrdersId,UserName,OrdersState,Remark)  values(@OrdersId,@UserName,@OrdersState,@Remark)";

            Factory.DBHelper.ExecSQL(SQLConString, OrdersLog.ToString(), new DynamicParameters(new
            {
                ordersLog.OrdersId,
                ordersLog.UserName,
                ordersLog.OrdersState,
                ordersLog.Remark,
            }));
            //
            foreach (Model.OrdersDetails item in ordersDetailList)
            {
                const string OrdersDetail = @"insert into OrdersDetails(OrderId,FlowerWatchName,FlowerWatchPhoto,FlowerNumber,
                                         SellingPrice,CostPrice,profit,SellingNum) 
                                         values(@OrderId,@FlowerWatchName,@FlowerWatchPhoto,@FlowerNumber,@SellingPrice,
                                         @CostPrice,@profit,@SellingNum)";
                Factory.DBHelper.ExecSQL(SQLConString, OrdersDetail.ToString(), new DynamicParameters(new
                {
                    item.OrderId,
                    item.FlowerWatchName,
                    item.FlowerWatchPhoto,
                    item.FlowerNumber,
                    item.SellingPrice,
                    item.CostPrice,
                    item.profit,
                    item.SellingNum,
                }));
            }

            return(true);
        }
Example #3
0
        /// <summary>
        /// 订单支付
        /// </summary>
        /// <param name="OrdersId"></param>
        /// <returns></returns>
        public bool OrdersPay(string OrdersId, string PayOrdersNum, string UserName, int OrdersState)
        {
            const string Orders =
                @"UPDATE Orders SET OrdersState=2,PayTime=getdate(),profit=SellingPrice-CostPrice,PayOrdersNum=@PayOrdersNum  WHERE OrderId=@OrdersId";

            Factory.DBHelper.ExecSQL(SQLConString, Orders.ToString(), new DynamicParameters(new
            {
                OrdersId,
                PayOrdersNum
            }));
            const string OrdersDetails =
                @"UPDATE OrdersDetails SET profit=SellingPrice-CostPrice  WHERE OrderId=@OrdersId";

            Factory.DBHelper.ExecSQL(SQLConString, OrdersDetails.ToString(), new DynamicParameters(new
            {
                OrdersId,
            }));
            const string OrdersLog =
                @"insert into OrdersLog(OrdersId,UserName,OrdersState)
        values(@OrdersId,@UserName,@OrdersState)";

            Factory.DBHelper.ExecSQL(SQLConString, OrdersLog.ToString(), new DynamicParameters(new
            {
                OrdersId,
                UserName,
                OrdersState
            }));

            //int OrdersInfoSum = GetPayOrdersSum(OrdersId);
            //string sql = @"UPDATE Flower set FlowerStock=FlowerStock-" + OrdersInfoSum + "  WHERE OrderId=@OrdersId ";
            //Factory.DBHelper.ExecSQL(SQLConString, sql.ToString(), new DynamicParameters(new
            //{
            //    OrdersId,
            //}));
            #region 修改花卉数量
            IList <Model.OrdersDetails> ordersDetailList = GetPayOrdersSum(OrdersId);
            foreach (Model.OrdersDetails item in ordersDetailList)
            {
                string sql = @"UPDATE Flower set FlowerStock=FlowerStock-@SellingNum  WHERE FlowerNumber=@FlowerNumber ";
                Factory.DBHelper.ExecSQL(SQLConString, sql.ToString(), new DynamicParameters(new
                {
                    item.FlowerNumber,
                    item.SellingNum,
                }));
            }
            #endregion
            return(true);
        }
Example #4
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="OrdersId"></param>
        /// <param name="UserName"></param>
        /// <param name="OrdersState"></param>
        /// <returns></returns>
        public bool ClaceOrders(string OrdersId, string UserName, int OrdersState)
        {
            const string Orders =
                @"UPDATE Orders SET OrdersState=@OrdersState  WHERE OrderId=@OrdersId";

            Factory.DBHelper.ExecSQL(SQLConString, Orders.ToString(), new DynamicParameters(new
            {
                OrdersState,
                OrdersId,
            }));
            const string OrdersLog =
                @"insert into OrdersLog(OrdersId,UserName,OrdersState)
        values(@OrdersId,@UserName,@OrdersState)";

            Factory.DBHelper.ExecSQL(SQLConString, OrdersLog.ToString(), new DynamicParameters(new
            {
                OrdersId,
                UserName,
                OrdersState
            }));
            return
                (true);
        }