Пример #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);
        }
Пример #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);
        }
Пример #3
0
    public OrdersPayment()
    {
        //初始化ASP.NET内置对象
        Response    = System.Web.HttpContext.Current.Response;
        Request     = System.Web.HttpContext.Current.Request;
        Server      = System.Web.HttpContext.Current.Server;
        Session     = System.Web.HttpContext.Current.Session;
        Application = System.Web.HttpContext.Current.Application;

        tools    = ToolsFactory.CreateTools();
        MyBLL    = OrdersPaymentFactory.CreateOrdersPayment();
        Myorder  = OrdersFactory.CreateOrders();
        orderlog = new OrdersLog();
    }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
0
        public void Insert(DateTime? DateX,string Desc,int? IsCurrent,int? OrderId,string Voice,bool? IsPlay,int? FromUser,int? ToUser)
        {
            OrdersLog item = new OrdersLog();

            item.DateX = DateX;

            item.Desc = Desc;

            item.IsCurrent = IsCurrent;

            item.OrderId = OrderId;

            item.Voice = Voice;

            item.IsPlay = IsPlay;

            item.FromUser = FromUser;

            item.ToUser = ToUser;

            item.Save(UserName);
        }
Пример #7
0
 public static bool AddOrderTempLog(HttpContext context, Order order, out object tempLog, out string message)
 {
     int toUser = order.OrderMemberID;
     int fromUser = AppContextBase.CurrentUserID;
     tempLog = null;
     if (fromUser <= 0)
     {
         message = "你不允许使用此服务.";
         return false;
     }
     var desc = context.Request["m"];
     string voice = null;
     if (context.Request.Files.Count > 0)
     {
         var file = context.Request.Files[0];
         var fileRst = FileUpload.SaveUploadFile(file, FileType.Media, SaveType.Voice, out message, true, order.Id.ToString( ));
         if (fileRst == null)
             return false;
         voice = fileRst.FileName;
     }
     else if (string.IsNullOrEmpty(desc))
     {
         message = "请输入发送内容.";
         return false;
     }
     var log = new OrdersLog
     {
         DateX = DateTime.Now,
         Desc = desc,
         Voice = voice,
         FromUser = fromUser,
         ToUser = toUser,
         OrderId = order.Id,
         IsCurrent = 0,
         IsPlay = false
     };
     log.Save( );
     order.MsnType = 5;
     order.OrderUpdateOn = DateTime.Now;
     order.Save( );
     tempLog = ConvertLogToTemp(toUser, fromUser, null, log);
     message = "发送成功.";
     return true;
 }
Пример #8
0
 private static object ConvertLogToTemp(int user, int cUser, IDataReader dr = null, OrdersLog log = null)
 {
     if (dr != null)
         return new
         {
             type = Utilities.ToInt(dr[OrdersLog.Columns.FromUser]) == user ? 1 : 0,
             time = Utilities.ToDateTime(dr[OrdersLog.Columns.DateX]).ToString("HH:mm:ss"),
             voice = dr[OrdersLog.Columns.Voice],
             isplay = Utilities.ToInt(dr[OrdersLog.Columns.ToUser]) == cUser ? dr[OrdersLog.Columns.IsPlay] : (object)false,
             id = dr[OrdersLog.Columns.Id],
             desc = dr[OrdersLog.Columns.Desc]
         };
     else
         return new
         {
             type = log.FromUser == user ? 1 : 0,
             time = log.DateX.Value.ToString("HH:mm:ss"),
             voice = log.Voice,
             isplay = log.ToUser.HasValue && log.ToUser == cUser ? log.IsPlay : (bool?)false,
             id = log.Id,
             desc = log.Desc
         };
 }