// Returns null if no record corresponds to itemID; public static EbayActiveListingType GetOneActiveListing(String itemID) { if (itemID == null || itemID.Trim().Length == 0) { return(null); } String sql_getOneActiveListing = String.Format("select * from [ActiveListing] where ItemID='{0}'", itemID); DataTable dt = DataFactory.ExecuteSqlReturnTable(sql_getOneActiveListing); if (dt.Rows.Count == 0) { return(null); } DataRow dr = dt.Rows[0]; EbayActiveListingType activeListing = new EbayActiveListingType(); activeListing.ListId = StringUtil.GetSafeInt(dr["ListId"]); activeListing.SellerName = StringUtil.GetSafeString(dr["SellerName"]); activeListing.ItemID = itemID; activeListing.Title = StringUtil.GetSafeString(dr["Title"]); activeListing.ListingType = StringUtil.GetSafeString(dr["ListingType"]); activeListing.GalleryURL = StringUtil.GetSafeString(dr["GalleryURL"]); activeListing.QuantityBid = StringUtil.GetSafeInt(dr["QuantityBid"]); activeListing.MaxBid = StringUtil.GetSafeDouble(dr["MaxBid"]); activeListing.StartPrice = StringUtil.GetSafeDouble(dr["StartPrice"]); activeListing.BuyItNowPrice = StringUtil.GetSafeDouble(dr["BuyItNowPrice"]); activeListing.CurrencyID = StringUtil.GetSafeString(dr["CurrencyID"]); activeListing.StartTime = StringUtil.GetSafeDateTime(dr["StartTime"]); activeListing.EndTime = StringUtil.GetSafeDateTime(dr["EndTime"]); activeListing.ViewItemURL = StringUtil.GetSafeString(dr["ViewItemURL"]); activeListing.ListDuration = StringUtil.GetSafeInt(dr["ListDuration"]); activeListing.PrivateListing = StringUtil.GetSafeBool(dr["PrivateListing"]); activeListing.Quantity = StringUtil.GetSafeInt(dr["Quantity"]); activeListing.QuantityAvailable = StringUtil.GetSafeInt(dr["QuantityAvailable"]); activeListing.SellingStatus = StringUtil.GetSafeString(dr["SellingStatus"]); activeListing.SKU = StringUtil.GetSafeString(dr["SKU"]); activeListing.TimeLeft = StringUtil.GetSafeString(dr["TimeLeft"]); activeListing.WatchCount = StringUtil.GetSafeInt(dr["WatchCount"]); activeListing.BidCount = StringUtil.GetSafeInt(dr["BidCount"]); activeListing.BidderCount = StringUtil.GetSafeInt(dr["BidCount"]); activeListing.CurrentPrice = StringUtil.GetSafeDouble(dr["BidCount"]); activeListing.FVF = StringUtil.GetSafeDouble(dr["BidCount"]); activeListing.ImagePath = StringUtil.GetSafeString(dr["ImagePath"]); return(activeListing); }
public static TransactionMessageStatus GetTransactionMessageStatus(String buyerId, String sellerId, String itemId) { TransactionMessageStatus messageType = TransactionMessageStatus.Invalid; DataTable dtMsg = GetAllTransactionMessagesCompact(buyerId, sellerId, itemId); if (dtMsg.Rows.Count == 0) { messageType = TransactionMessageStatus.NoMessage; return(messageType); } bool buyerReplied = false; foreach (DataRow dr in dtMsg.Rows) { bool buyerSentMsg = false; String sender = dr["Sender"].ToString(); if (sender == buyerId) { buyerSentMsg = true; buyerReplied = true; } bool isRead = StringUtil.GetSafeBool(dr["IsRead"]); bool isReplied = StringUtil.GetSafeBool(dr["IsReplied"]); if (buyerSentMsg) { if (!isReplied) { return(TransactionMessageStatus.BuyerRepliedSellerNotReplied); } } } if (buyerReplied) { messageType = TransactionMessageStatus.BuyerRepliedSellerReplied; } else { messageType = TransactionMessageStatus.SellerInquired; } return(messageType); }
public static EbayMessageType GetOneMessage(String ebayMessageId) { String sql_getAllMessages = String.Format("select * from [Message] where EbayMessageId='{0}'", ebayMessageId); DataTable dt = DbAccess.ExecuteSqlReturnTable(sql_getAllMessages); if (dt.Rows.Count == 0) { return(null); } DataRow dr = dt.Rows[0]; EbayMessageType msg = new EbayMessageType(); msg.MessageId = StringUtil.GetSafeInt(dr["MessageId"]); msg.SellerName = StringUtil.GetSafeString(dr["SellerName"]); msg.EbayMessageId = StringUtil.GetSafeString(dr["EbayMessageId"]); msg.MessageType = StringUtil.GetSafeString(dr["MessageType"]); msg.QuestionType = StringUtil.GetSafeString(dr["QuestionType"]); msg.IsRead = StringUtil.GetSafeBool(dr["IsRead"]); msg.IsReplied = StringUtil.GetSafeBool(dr["IsReplied"]); msg.IsResponseEnabled = StringUtil.GetSafeBool(dr["IsResponseEnabled"]); msg.ResponseURL = StringUtil.GetSafeString(dr["ResponseURL"]); msg.UserResponseDate = StringUtil.GetSafeDateTime(dr["UserResponseDate"]); msg.ReceiveDate = StringUtil.GetSafeDateTime(dr["ReceiveDate"]); msg.Sender = StringUtil.GetSafeString(dr["Sender"]); msg.RecipientUserId = StringUtil.GetSafeString(dr["RecipientUserId"]); msg.Subject = StringUtil.GetSafeString(dr["Subject"]); msg.Content = StringUtil.GetSafeString(dr["MessageContent"]); msg.Text = StringUtil.GetSafeString(dr["MessageText"]); msg.ExternalMessageId = StringUtil.GetSafeString(dr["ExternalMessageId"]); msg.FolderId = StringUtil.GetSafeInt(dr["FolderId"]); msg.ItemID = StringUtil.GetSafeString(dr["ItemID"]); msg.ItemTitle = StringUtil.GetSafeString(dr["ItemTitle"]); // ZHI_TODO: return(msg); } // GetOneMessage
private void dataGridViewPostSale_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { if (e.ListChangedType == ListChangedType.ItemChanged) { return; } for (int rowIdx = 0; rowIdx < this.dataGridViewPostSale.Rows.Count; rowIdx++) { DataGridViewCell orderLineItemIdCell = this.dataGridViewPostSale.Rows[rowIdx].Cells[PostSaleDgv_OrderLineItemIdIdx]; if (orderLineItemIdCell.Value == null) { continue; } String orderLineItemId = orderLineItemIdCell.Value.ToString(); DataRow dr = getPostSaleOrderLocally(orderLineItemId); if (dr == null) { continue; } int transId = StringUtil.GetSafeInt(dr["TransactionId"]); String buyerId = StringUtil.GetSafeString(dr["BuyerId"]); String sellerName = StringUtil.GetSafeString(dr["SellerName"]); String itemId = StringUtil.GetSafeString(dr["ItemId"]); if (buyerId == "" || sellerName == "" || itemId == "") { continue; } TransactionMessageStatus messageStatus = (TransactionMessageStatus)StringUtil.GetSafeInt(dr["MessageStatus"]); if (messageStatus == TransactionMessageStatus.BuyerRepliedSellerNotReplied) { TransactionMessageStatus messageStatusComputed = EbayMessageDAL.GetTransactionMessageStatus(buyerId, sellerName, itemId); if (messageStatus != messageStatusComputed) { EbayTransactionDAL.UpdateTransactionMessageStatus(transId, messageStatusComputed); messageStatus = messageStatusComputed; } } Color rowBkColor = Color.White; if (messageStatus == TransactionMessageStatus.SellerInquired) { rowBkColor = ColorTranslator.FromHtml("#90EE90"); } else if (messageStatus == TransactionMessageStatus.BuyerRepliedSellerNotReplied) { rowBkColor = ColorTranslator.FromHtml("#FFFF00"); } else if (messageStatus == TransactionMessageStatus.BuyerRepliedSellerReplied) { rowBkColor = ColorTranslator.FromHtml("#DAA520"); } if (!StringUtil.GetSafeBool(dr["IsPaid"])) { rowBkColor = ColorTranslator.FromHtml("#808080"); } this.dataGridViewPostSale.Rows[rowIdx].DefaultCellStyle.BackColor = rowBkColor; } }
private void dataGridViewAllOrders_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { if (e.ListChangedType == ListChangedType.ItemChanged) { return; } for (int rowIdx = 0; rowIdx < this.dataGridViewAllOrders.Rows.Count; rowIdx++) { DataGridViewCell orderLineItemIdCell = this.dataGridViewAllOrders.Rows[rowIdx].Cells[OrderDgv_OrderLineItemIndex]; if (orderLineItemIdCell.Value == null) { continue; } String orderLineItemId = orderLineItemIdCell.Value.ToString(); DataRow dr = getEbayTransactionLocally(orderLineItemId); if (dr == null) { continue; } String orderId = StringUtil.GetSafeString(this.dataGridViewAllOrders.Rows[rowIdx].Cells[OrderDgv_OrderIdIndex].Value); bool subtrans = false; if (orderId.IndexOf("-") < 0) { // An order with multiple transactions. bool imageSpecified = false; if (rowIdx > 0) { String prevOrderId = StringUtil.GetSafeString(this.dataGridViewAllOrders.Rows[rowIdx - 1].Cells[OrderDgv_OrderIdIndex].Value); if (prevOrderId == orderId) { this.dataGridViewAllOrders.Rows[rowIdx].Cells[OrderDgv_ImageIndex].Value = blankImage; //this.dataGridViewAllOrders.Rows[rowIdx].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#DBADDA"); imageSpecified = true; subtrans = true; } } if (!imageSpecified) { this.dataGridViewAllOrders.Rows[rowIdx].Cells[OrderDgv_ImageIndex].Value = minusImage; } if (subtrans) { this.dataGridViewAllOrders.Rows[rowIdx].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#DBADDA"); } //subtrans = true; } else { this.dataGridViewAllOrders.Rows[rowIdx].Cells[OrderDgv_ImageIndex].Value = normalImage; } //if (StringUtil.GetSafeBool(dr["IsSellerLeftFeedback"])) // this.dataGridViewAllOrders.Rows[rowIdx].Cells[OrderDgv_SellerLeftFeedbackIndex].Value = yesImage; bool isShipped = StringUtil.GetSafeBool(dr["IsShipped"]); bool isPaid = StringUtil.GetSafeBool(dr["IsPaid"]); // http://www.phpx.com/man/dhtmlcn/colors/colors.html if (isShipped == true && !subtrans) { this.dataGridViewAllOrders.Rows[rowIdx].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#90EE90"); } if (isPaid == false && !subtrans) { this.dataGridViewAllOrders.Rows[rowIdx].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#808080"); } } }
// // GetMyeBaySelling // Use this call to return information from the All Selling section of the authenticated user's My eBay account. // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMyeBaySelling.html // public static List <EbayActiveListingType> GetMyActiveListing(AccountType account) { if (account.SellerApiContext == null) { Logger.WriteSystemLog("Invalid API context in GetMyActiveListing."); return(null); } GetMyeBaySellingCall getMyeBaySellingApiCall = new GetMyeBaySellingCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getMyeBaySellingApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyeBaySellingApiCall.SellingSummary = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.SellingSummary.Include = true; getMyeBaySellingApiCall.ActiveList = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.ActiveList.Include = true; getMyeBaySellingApiCall.ActiveList.IncludeNotes = true; //getMyeBaySellingApiCall.ActiveList.ListingType = ListingTypeCodeType.FixedPriceItem; getMyeBaySellingApiCall.ActiveList.Pagination = new PaginationType(); getMyeBaySellingApiCall.ActiveList.Pagination.EntriesPerPage = 25; // max 200 default 25 getMyeBaySellingApiCall.ActiveList.Pagination.PageNumber = 1; //getMyeBaySellingApiCall.BidList = new ItemListCustomizationType(); //getMyeBaySellingApiCall.BidList.Include = true; //getMyeBaySellingApiCall.BidList.Pagination = new PaginationType(); //getMyeBaySellingApiCall.BidList.Pagination.EntriesPerPage = 25; //getMyeBaySellingApiCall.BidList.Pagination.PageNumber = 1; getMyeBaySellingApiCall.GetMyeBaySelling(); AmountType amountLimitRemaining = getMyeBaySellingApiCall.Summary.AmountLimitRemaining; long quantityLimitRemaining = getMyeBaySellingApiCall.Summary.QuantityLimitRemaining; PaginatedItemArrayType paginatedItemArray = getMyeBaySellingApiCall.ActiveListReturn; if (paginatedItemArray == null || paginatedItemArray.ItemArray == null) { return(null); } List <EbayActiveListingType> activeListings = new List <EbayActiveListingType>(); foreach (ItemType item in paginatedItemArray.ItemArray) { EbayActiveListingType activeListing = new EbayActiveListingType(); activeListing.ListId = 0; // to be set activeListing.SellerName = account.ebayAccount; activeListing.ItemID = StringUtil.GetSafeString(item.ItemID); activeListing.Title = StringUtil.GetSafeString(item.Title); if (item.ListingTypeSpecified) { if (ListingTypeCodeType.FixedPriceItem == item.ListingType) { activeListing.ListingType = "FixedPriceItem"; } else if (ListingTypeCodeType.Auction == item.ListingType || ListingTypeCodeType.Chinese == item.ListingType) { activeListing.ListingType = "Auction"; } else { activeListing.ListingType = "Unknown"; } } else { activeListing.ListingType = "Unknown"; } if (item.PictureDetails != null) { activeListing.GalleryURL = StringUtil.GetSafeString(item.PictureDetails.GalleryURL); } else { activeListing.GalleryURL = ""; } if (item.BiddingDetails != null) { activeListing.QuantityBid = StringUtil.GetSafeInt(item.BiddingDetails.QuantityBid); if (item.BiddingDetails.MaxBid != null) { activeListing.MaxBid = StringUtil.GetSafeDouble(item.BiddingDetails.MaxBid.Value); } else { activeListing.MaxBid = 0.0; } } else { activeListing.QuantityBid = 0; activeListing.MaxBid = 0.0; } if (item.StartPrice != null) { activeListing.StartPrice = StringUtil.GetSafeDouble(item.StartPrice.Value); } else { activeListing.StartPrice = 0.0; } if (item.BuyItNowPrice != null) { activeListing.BuyItNowPrice = StringUtil.GetSafeDouble(item.BuyItNowPrice.Value); activeListing.CurrencyID = StringUtil.GetSafeString(item.BuyItNowPrice.currencyID); } else { activeListing.BuyItNowPrice = 0.0; activeListing.CurrencyID = ""; } if (item.ListingDetails != null) { activeListing.StartTime = StringUtil.GetSafeDateTime(item.ListingDetails.StartTime); activeListing.EndTime = StringUtil.GetSafeDateTime(item.ListingDetails.EndTime); activeListing.ViewItemURL = StringUtil.GetSafeString(item.ListingDetails.ViewItemURL); } activeListing.ListDuration = StringUtil.GetSafeInt(StringUtil.GetSafeListDurationDays(item.ListingDuration)); activeListing.PrivateListing = StringUtil.GetSafeBool(item.PrivateListing); activeListing.Quantity = StringUtil.GetSafeInt(item.Quantity); activeListing.QuantityAvailable = StringUtil.GetSafeInt(item.QuantityAvailable); if (item.SellingStatus != null) { if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Active) { activeListing.SellingStatus = "Active"; } else if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Completed) { activeListing.SellingStatus = "Completed"; } else if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Ended) { activeListing.SellingStatus = "Ended"; } else { activeListing.SellingStatus = "Unknown"; } if (item.SellingStatus.BidCountSpecified) { activeListing.BidCount = item.SellingStatus.BidCount; } else { activeListing.BidCount = 0; } if (item.SellingStatus.BidderCountSpecified) { activeListing.BidderCount = (int)item.SellingStatus.BidderCount; } else { activeListing.BidderCount = 0; } if (item.SellingStatus.CurrentPrice != null) { activeListing.CurrentPrice = item.SellingStatus.CurrentPrice.Value; } else { activeListing.CurrentPrice = 0.0; } } else { activeListing.SellingStatus = "Unknown"; } activeListing.SKU = StringUtil.GetSafeString(item.SKU); activeListing.TimeLeft = StringUtil.GetSafeString(item.TimeLeft); activeListing.WatchCount = StringUtil.GetSafeInt(item.WatchCount); activeListings.Add(activeListing); } Logger.WriteSystemLog(string.Format("Successfully called GetMyActiveListing, returns {0} entries", activeListings.Count)); return(activeListings); } // GetMyActiveListing
public static bool InsertOneActiveListing(EbayActiveListingType activeListing) { EbayActiveListingType existedActiveListing = GetOneActiveListing(activeListing.ItemID); if (existedActiveListing != null) { Logger.WriteSystemLog(string.Format("Active listing with itemId={0} alreay exists.", activeListing.ItemID)); return(false); } IDbCommand cmd = DataFactory.CreateCommand(null); cmd.CommandText = @"insert into [ActiveListing] (ItemID, SellerName, Title, ListingType, GalleryURL, QuantityBid,MaxBid," + "StartPrice, BuyItNowPrice, CurrencyID, StartTime, EndTime, ViewItemURL, ListDuration, PrivateListing," + "Quantity, QuantityAvailable, SellingStatus, SKU, TimeLeft, WatchCount, BidCount, BidderCount, CurrentPrice, FVF, ImagePath) values (" + "@ItemID, @SellerName, @Title, @ListingType, @GalleryURL, @QuantityBid, @MaxBid, @StartPrice, @BuyItNowPrice," + "@CurrencyID, @StartTime, @EndTime, @ViewItemURL, @ListDuration, @PrivateListing," + "@Quantity, @QuantityAvailable, @SellingStatus, @SKU, @TimeLeft, @WatchCount, @BidCount, @BidderCount, @CurrentPrice, @FVF, @ImagePath)"; DataFactory.AddCommandParam(cmd, "@ItemID", DbType.String, StringUtil.GetSafeString(activeListing.ItemID)); DataFactory.AddCommandParam(cmd, "@SellerName", DbType.String, StringUtil.GetSafeString(activeListing.SellerName)); DataFactory.AddCommandParam(cmd, "@Title", DbType.String, StringUtil.GetSafeString(activeListing.Title)); DataFactory.AddCommandParam(cmd, "@ListingType", DbType.String, StringUtil.GetSafeString(activeListing.ListingType)); DataFactory.AddCommandParam(cmd, "@GalleryURL", DbType.String, StringUtil.GetSafeString(activeListing.GalleryURL)); DataFactory.AddCommandParam(cmd, "@QuantityBid", DbType.Int32, StringUtil.GetSafeInt(activeListing.QuantityBid)); DataFactory.AddCommandParam(cmd, "@MaxBid", DbType.Double, StringUtil.GetSafeDouble(activeListing.MaxBid)); DataFactory.AddCommandParam(cmd, "@StartPrice", DbType.Double, StringUtil.GetSafeDouble(activeListing.StartPrice)); DataFactory.AddCommandParam(cmd, "@BuyItNowPrice", DbType.Double, StringUtil.GetSafeDouble(activeListing.BuyItNowPrice)); DataFactory.AddCommandParam(cmd, "@CurrencyID", DbType.String, StringUtil.GetSafeString(activeListing.CurrencyID)); DataFactory.AddCommandParam(cmd, "@StartTime", DbType.DateTime, StringUtil.GetSafeDateTime(activeListing.StartTime)); DataFactory.AddCommandParam(cmd, "@EndTime", DbType.DateTime, StringUtil.GetSafeDateTime(activeListing.EndTime)); DataFactory.AddCommandParam(cmd, "@ViewItemURL", DbType.String, StringUtil.GetSafeString(activeListing.ViewItemURL)); DataFactory.AddCommandParam(cmd, "@ListDuration", DbType.Int32, StringUtil.GetSafeInt(activeListing.ListDuration)); DataFactory.AddCommandParam(cmd, "@PrivateListing", DbType.Boolean, StringUtil.GetSafeBool(activeListing.PrivateListing)); DataFactory.AddCommandParam(cmd, "@Quantity", DbType.Int32, StringUtil.GetSafeInt(activeListing.Quantity)); DataFactory.AddCommandParam(cmd, "@QuantityAvailable", DbType.Int32, StringUtil.GetSafeInt(activeListing.QuantityAvailable)); DataFactory.AddCommandParam(cmd, "@SellingStatus", DbType.String, StringUtil.GetSafeString(activeListing.SellingStatus)); DataFactory.AddCommandParam(cmd, "@SKU", DbType.String, StringUtil.GetSafeString(activeListing.SKU)); DataFactory.AddCommandParam(cmd, "@TimeLeft", DbType.String, StringUtil.GetSafeString(activeListing.TimeLeft)); DataFactory.AddCommandParam(cmd, "@WatchCount", DbType.Int32, StringUtil.GetSafeInt(activeListing.WatchCount)); DataFactory.AddCommandParam(cmd, "@BidCount", DbType.Int32, StringUtil.GetSafeInt(activeListing.BidCount)); DataFactory.AddCommandParam(cmd, "@BidderCount", DbType.Int32, StringUtil.GetSafeInt(activeListing.BidderCount)); DataFactory.AddCommandParam(cmd, "@CurrentPrice", DbType.Double, StringUtil.GetSafeDouble(activeListing.CurrentPrice)); DataFactory.AddCommandParam(cmd, "@FVF", DbType.Double, StringUtil.GetSafeDouble(activeListing.FVF)); DataFactory.AddCommandParam(cmd, "@ImagePath", DbType.String, StringUtil.GetSafeString(activeListing.ImagePath)); bool result = false; int newItemId = 0; try { if (DataFactory.DbConnection.State == ConnectionState.Closed) { DataFactory.DbConnection.Open(); } cmd.ExecuteNonQuery(); IDbCommand cmdNewID = DataFactory.CreateCommand("SELECT @@IDENTITY"); // Retrieve the Auto number and store it in the CategoryID column. object obj = cmdNewID.ExecuteScalar(); Int32.TryParse(obj.ToString(), out newItemId); result = newItemId > 0; } catch (DataException ex) { // Write to log here. Logger.WriteSystemLog(string.Format("Error inserting new active listing, itemID={0}, errorMsg={1}", activeListing.ItemID, ex.Message)); result = false; } finally { if (DataFactory.DbConnection.State == ConnectionState.Open) { DataFactory.DbConnection.Close(); } } return(result); } // InsertOneActiveListing
public static bool UpdateOneActiveListing(int listId, EbayActiveListingType activeListing) { bool result = false; IDbCommand cmd = DataFactory.CreateCommand(null); cmd.CommandText = @"Update [ActiveListing] set ItemID=@ItemID, Title=@Title, ListingType=@ListingType," + "GalleryURL=@GalleryURL, QuantityBid=@QuantityBid, MaxBid=@MaxBid, StartPrice=@StartPrice," + "BuyItNowPrice=@BuyItNowPrice, CurrencyID=@CurrencyID, StartTime=@StartTime, EndTime=@EndTime," + "ViewItemURL=@ViewItemURL, ListDuration=@ListDuration, PrivateListing=@PrivateListing," + "Quantity=@Quantity, QuantityAvailable=@QuantityAvailable, SellingStatus=@SellingStatus," + "SKU=@SKU, TimeLeft=@TimeLeft, WatchCount=@WatchCount, BidCount=@BidCount, BidderCount=@BidderCount," + "CurrentPrice=@CurrentPrice, FVF=@FVF, ImagePath=@ImagePath where ListId=@ListId"; DataFactory.AddCommandParam(cmd, "@ItemID", DbType.String, StringUtil.GetSafeString(activeListing.ItemID)); DataFactory.AddCommandParam(cmd, "@Title", DbType.String, StringUtil.GetSafeString(activeListing.Title)); DataFactory.AddCommandParam(cmd, "@ListingType", DbType.String, StringUtil.GetSafeString(activeListing.ListingType)); DataFactory.AddCommandParam(cmd, "@GalleryURL", DbType.String, StringUtil.GetSafeString(activeListing.GalleryURL)); DataFactory.AddCommandParam(cmd, "@QuantityBid", DbType.Int32, StringUtil.GetSafeInt(activeListing.QuantityBid)); DataFactory.AddCommandParam(cmd, "@MaxBid", DbType.Double, StringUtil.GetSafeDouble(activeListing.MaxBid)); DataFactory.AddCommandParam(cmd, "@StartPrice", DbType.Double, StringUtil.GetSafeDouble(activeListing.StartPrice)); DataFactory.AddCommandParam(cmd, "@BuyItNowPrice", DbType.Double, StringUtil.GetSafeDouble(activeListing.BuyItNowPrice)); DataFactory.AddCommandParam(cmd, "@CurrencyID", DbType.String, StringUtil.GetSafeString(activeListing.CurrencyID)); DataFactory.AddCommandParam(cmd, "@StartTime", DbType.DateTime, StringUtil.GetSafeDateTime(activeListing.StartTime)); DataFactory.AddCommandParam(cmd, "@EndTime", DbType.DateTime, StringUtil.GetSafeDateTime(activeListing.EndTime)); DataFactory.AddCommandParam(cmd, "@ViewItemURL", DbType.String, StringUtil.GetSafeString(activeListing.ViewItemURL)); DataFactory.AddCommandParam(cmd, "@ListDuration", DbType.Int32, StringUtil.GetSafeInt(activeListing.ListDuration)); DataFactory.AddCommandParam(cmd, "@PrivateListing", DbType.Boolean, StringUtil.GetSafeBool(activeListing.PrivateListing)); DataFactory.AddCommandParam(cmd, "@Quantity", DbType.Int32, StringUtil.GetSafeInt(activeListing.Quantity)); DataFactory.AddCommandParam(cmd, "@QuantityAvailable", DbType.Int32, StringUtil.GetSafeInt(activeListing.QuantityAvailable)); DataFactory.AddCommandParam(cmd, "@SellingStatus", DbType.String, StringUtil.GetSafeString(activeListing.SellingStatus)); DataFactory.AddCommandParam(cmd, "@SKU", DbType.String, StringUtil.GetSafeString(activeListing.SKU)); DataFactory.AddCommandParam(cmd, "@TimeLeft", DbType.String, StringUtil.GetSafeString(activeListing.TimeLeft)); DataFactory.AddCommandParam(cmd, "@WatchCount", DbType.Int32, StringUtil.GetSafeInt(activeListing.WatchCount)); DataFactory.AddCommandParam(cmd, "@BidCount", DbType.Int32, StringUtil.GetSafeInt(activeListing.BidCount)); DataFactory.AddCommandParam(cmd, "@BidderCount", DbType.Int32, StringUtil.GetSafeInt(activeListing.BidderCount)); DataFactory.AddCommandParam(cmd, "@CurrentPrice", DbType.Double, StringUtil.GetSafeDouble(activeListing.CurrentPrice)); DataFactory.AddCommandParam(cmd, "@FVF", DbType.Double, StringUtil.GetSafeDouble(activeListing.FVF)); DataFactory.AddCommandParam(cmd, "@ImagePath", DbType.String, StringUtil.GetSafeString(activeListing.ImagePath)); DataFactory.AddCommandParam(cmd, "@ListId", DbType.Int32, listId); try { if (DataFactory.DbConnection.State == ConnectionState.Closed) { DataFactory.DbConnection.Open(); } cmd.ExecuteNonQuery(); result = true; } catch (DataException) { // Write to log here. result = false; } finally { if (DataFactory.DbConnection.State == ConnectionState.Open) { DataFactory.DbConnection.Close(); } } return(result); }
private static EbayTransactionType GetTransactionTypeFromDataRow(DataRow dr) { if (dr == null) { return(null); } EbayTransactionType trans = new EbayTransactionType(); trans.TransactionId = StringUtil.GetSafeInt(dr["TransactionId"]); trans.SellerName = StringUtil.GetSafeString(dr["SellerName"]); trans.OrderId = StringUtil.GetSafeString(dr["OrderId"]); trans.OrderLineItemId = StringUtil.GetSafeString(dr["OrderLineItemId"]); trans.EbayTransactionId = StringUtil.GetSafeString(dr["EbayTransactionId"]); trans.EbayRecordId = StringUtil.GetSafeInt(dr["EbayRecordId"]); trans.BuyerId = StringUtil.GetSafeString(dr["BuyerId"]); trans.BuyerRating = StringUtil.GetSafeInt(dr["BuyerRating"]); trans.BuyerCountryEbayCode = StringUtil.GetSafeString(dr["BuyerCountryEbayCode"]); trans.BuyerCountry4PXCode = StringUtil.GetSafeString(dr["BuyerCountry4PXCode"]); trans.BuyerCountry = StringUtil.GetSafeString(dr["BuyerCountry"]); trans.BuyerCompanyName = StringUtil.GetSafeString(dr["BuyerCompanyName"]); trans.BuyerName = StringUtil.GetSafeString(dr["BuyerName"]); trans.BuyerStateOrProvince = StringUtil.GetSafeString(dr["BuyerStateOrProvince"]); trans.BuyerCity = StringUtil.GetSafeString(dr["BuyerCity"]); trans.BuyerTel = StringUtil.GetSafeString(dr["BuyerTel"]); trans.BuyerMail = StringUtil.GetSafeString(dr["BuyerMail"]); trans.BuyerPostalCode = StringUtil.GetSafeString(dr["BuyerPostalCode"]); trans.BuyerAddress = StringUtil.GetSafeString(dr["BuyerAddress"]); trans.BuyerAddressCompact = StringUtil.GetSafeString(dr["BuyerAddressCompact"]); trans.BuyerAddressLine1 = StringUtil.GetSafeString(dr["BuyerAddressLine1"]); trans.BuyerAddressLine2 = StringUtil.GetSafeString(dr["BuyerAddressLine2"]); trans.BuyerPayPal = StringUtil.GetSafeString(dr["BuyerPayPal"]); trans.ItemId = StringUtil.GetSafeString(dr["ItemId"]); trans.ItemTitle = StringUtil.GetSafeString(dr["ItemTitle"]); trans.ItemSKU = StringUtil.GetSafeString(dr["ItemSKU"]); trans.ItemPrice = StringUtil.GetSafeDouble(dr["ItemPrice"]); trans.SaleQuantity = StringUtil.GetSafeInt(dr["SaleQuantity"]); trans.TotalPrice = StringUtil.GetSafeDouble(dr["TotalPrice"]); trans.CurrencyId = StringUtil.GetSafeString(dr["CurrencyId"]); trans.SaleDate = StringUtil.GetSafeDateTime(dr["SaleDate"]); trans.SaleDateCN = StringUtil.GetSafeDateTime(dr["SaleDateCN"]); trans.IsPaid = StringUtil.GetSafeBool(dr["IsPaid"]); trans.PaidDate = StringUtil.GetSafeDateTime(dr["PaidDate"]); trans.IsShipped = StringUtil.GetSafeBool(dr["IsShipped"]); trans.ShippedDate = StringUtil.GetSafeDateTime(dr["ShippedDate"]); trans.ShippingServiceCode = StringUtil.GetSafeString(dr["ShippingServiceCode"]); trans.ShippingService = StringUtil.GetSafeString(dr["ShippingService"]); trans.ShippingTrackingNo = StringUtil.GetSafeString(dr["ShippingTrackingNo"]); trans.ShippingCost = StringUtil.GetSafeDouble(dr["ShippingCost"]); trans.FinalValueFee = StringUtil.GetSafeDouble(dr["FinalValueFee"]); trans.PayPalFee = StringUtil.GetSafeDouble(dr["PayPalFee"]); trans.IsReceived = StringUtil.GetSafeBool(dr["IsReceived"]); trans.IsBuyerLeftFeedback = StringUtil.GetSafeBool(dr["IsBuyerLeftFeedback"]); trans.IsSellerLeftFeedback = StringUtil.GetSafeBool(dr["IsSellerLeftFeedback"]); trans.IsNeedAttention = StringUtil.GetSafeBool(dr["IsNeedAttention"]); trans.MessageStatus = (TransactionMessageStatus)StringUtil.GetSafeInt(dr["MessageStatus"]); trans.IsContactedBuyer = StringUtil.GetSafeBool(dr["IsContactedBuyer"]); trans.LastContactedBuyerDate = StringUtil.GetSafeDateTime(dr["LastContactedBuyerDate"]); trans.IsResendReplacement = StringUtil.GetSafeBool(dr["IsResendReplacement"]); trans.UserComment = StringUtil.GetSafeString(dr["UserComment"]); trans.IsDelivered = StringUtil.GetSafeBool(dr["IsDelivered"]); trans.DeliveryNoteId = StringUtil.GetSafeInt(dr["DeliveryNoteId"]); return(trans); } // GetTransactionTypeFromDataRow