Beispiel #1
0
        public static UserOrderCommonInfo GetDownloadInfo(string userName, int orderItemId)
        {
            UserOrderCommonInfo downloadInfo = dal.GetDownloadInfo(userName, orderItemId);

            if (string.IsNullOrEmpty(downloadInfo.TableName))
            {
                PresentInfo presentById = Present.GetPresentById(downloadInfo.ProductId);
                downloadInfo.DownloadUrl = presentById.DownloadUrl;
                downloadInfo.Remark      = presentById.Remark;
                return(downloadInfo);
            }
            ProductInfo productById = Product.GetProductById(downloadInfo.ProductId);

            downloadInfo.DownloadUrl = productById.DownloadUrl;
            downloadInfo.Remark      = productById.Remark;
            return(downloadInfo);
        }
Beispiel #2
0
        public UserOrderCommonInfo GetDownloadInfo(string userName, int orderItemId)
        {
            UserOrderCommonInfo info = new UserOrderCommonInfo();
            string     strSql        = "SELECT I.* FROM PE_Orders O INNER JOIN PE_OrderItem I ON O.OrderID = I.OrderID WHERE O.UserName = @UserName AND EnableDownload = 1 AND I.ItemID = @ItemID";
            Parameters cmdParams     = new Parameters();

            cmdParams.AddInParameter("@UserName", DbType.String, userName);
            cmdParams.AddInParameter("@ItemID", DbType.Int32, orderItemId);
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql(strSql, cmdParams))
            {
                if (reader.Read())
                {
                    return(GetUserOrderCommonInfo(reader));
                }
                return(new UserOrderCommonInfo(true));
            }
        }
Beispiel #3
0
        private static UserOrderCommonInfo GetUserOrderCommonInfo(NullableDataReader rdr)
        {
            UserOrderCommonInfo info = new UserOrderCommonInfo();

            info.ProductId       = rdr.GetInt32("ProductId");
            info.TableName       = rdr.GetString("TableName");
            info.ProductName     = rdr.GetString("ProductName");
            info.Unit            = rdr.GetString("Unit");
            info.Amount          = rdr.GetInt32("Amount");
            info.BeginDate       = rdr.GetDateTime("BeginDate");
            info.Price           = rdr.GetDecimal("Price");
            info.TruePrice       = rdr.GetDecimal("TruePrice");
            info.ServiceTerm     = rdr.GetInt32("ServiceTerm");
            info.Remark          = rdr.GetString("Remark");
            info.ServiceTermUnit = (ServiceTermUnit)rdr.GetInt32("ServiceTermUnit");
            info.OrderItemId     = rdr.GetInt32("ItemId");
            return(info);
        }