/// <summary> /// Create a new SellerItemFile object. /// </summary> /// <param name="file_Item_Code">Initial value of the File_Item_Code property.</param> public static SellerItemFile CreateSellerItemFile(global::System.Int32 file_Item_Code) { SellerItemFile sellerItemFile = new SellerItemFile(); sellerItemFile.File_Item_Code = file_Item_Code; return sellerItemFile; }
public string UpdatePricingItems(string editedSellerItems, bool isSavetoFile, int itemCodeFile) { try { int userKey = new Base().UserKey; if (userKey == 0) { return "{\"login\": false}"; } SellerItem item = (SellerItem)Common.Deserialize(editedSellerItems, typeof(SellerItem)); DataModelEntities context = new DataModelEntities(); if (item != null) { SellerItem sellerItem = context.SellerItems.Single(s => s.Item_Code == item.Item_Code); sellerItem.Is_Automated = item.Is_Automated; sellerItem.Ceiling_Price = item.Ceiling_Price; sellerItem.Floor_Price = item.Floor_Price; sellerItem.Algo = item.Algo; sellerItem.Keywords = item.Keywords; sellerItem.Keywords = item.Keywords; sellerItem.Minimum_Feedback = item.Minimum_Feedback; sellerItem.Maximum_Feedback = item.Maximum_Feedback; sellerItem.Minimum_Price = item.Minimum_Price; sellerItem.Maximum_Price = item.Maximum_Price; sellerItem.Minimum_Quantity = item.Minimum_Quantity; sellerItem.Maximum_Quantity = item.Maximum_Quantity; sellerItem.Inclued_Sellers = item.Inclued_Sellers; sellerItem.Exclude_Sellers = item.Exclude_Sellers; sellerItem.Maximum_Handling_Time = item.Maximum_Handling_Time; sellerItem.Is_Fixed_Price = item.Is_Fixed_Price; sellerItem.Is_Auctions = item.Is_Auctions; sellerItem.Is_Returns_Accepted = item.Is_Returns_Accepted; sellerItem.Is_Location_AU = item.Is_Location_AU; sellerItem.Is_Hide_Duplicates = item.Is_Hide_Duplicates; sellerItem.Is_Top_Rated_Only = item.Is_Top_Rated_Only; sellerItem.Exclude_Category_Codes = item.Exclude_Category_Codes; sellerItem.Include_Condtion_Codes = item.Include_Condtion_Codes; sellerItem.Less_To_Lowest_Price = item.Less_To_Lowest_Price; sellerItem.Ignore_Words = item.Ignore_Words; sellerItem.Is_Round_To_Nearest = item.Is_Round_To_Nearest; sellerItem.File_Item_Code = itemCodeFile; sellerItem.Country_Code = item.Country_Code; sellerItem.LocatedIn = item.LocatedIn; if (isSavetoFile == true) { SellerItemFile sellerItemFile = null; //if (itemCodeFile == 0) // sellerItemFile = new SellerItemFile(); //else // sellerItemFile = context.SellerItemFiles.Single(w => w.File_Item_Code == itemCodeFile); sellerItemFile = new SellerItemFile(); if (sellerItemFile != null) { sellerItemFile.Item_Code = sellerItem.Item_Code; sellerItemFile.Is_Automated = item.Is_Automated; sellerItemFile.Ceiling_Price = item.Ceiling_Price; sellerItemFile.Floor_Price = item.Floor_Price; sellerItemFile.Algo = item.Algo; sellerItemFile.Keywords = item.Keywords; sellerItemFile.Keywords = item.Keywords; sellerItemFile.Minimum_Feedback = item.Minimum_Feedback; sellerItemFile.Maximum_Feedback = item.Maximum_Feedback; sellerItemFile.Minimum_Price = item.Minimum_Price; sellerItemFile.Maximum_Price = item.Maximum_Price; sellerItemFile.Minimum_Quantity = item.Minimum_Quantity; sellerItemFile.Maximum_Quantity = item.Maximum_Quantity; sellerItemFile.Inclued_Sellers = item.Inclued_Sellers; sellerItemFile.Exclude_Sellers = item.Exclude_Sellers; sellerItemFile.Maximum_Handling_Time = item.Maximum_Handling_Time; sellerItemFile.Is_Fixed_Price = item.Is_Fixed_Price; sellerItemFile.Is_Auctions = item.Is_Auctions; sellerItemFile.Is_Returns_Accepted = item.Is_Returns_Accepted; sellerItemFile.Is_Location_AU = item.Is_Location_AU; sellerItemFile.Is_Hide_Duplicates = item.Is_Hide_Duplicates; sellerItemFile.Is_Top_Rated_Only = item.Is_Top_Rated_Only; sellerItemFile.Exclude_Category_Codes = item.Exclude_Category_Codes; sellerItemFile.Include_Condtion_Codes = item.Include_Condtion_Codes; sellerItemFile.Less_To_Lowest_Price = item.Less_To_Lowest_Price; sellerItemFile.Ignore_Words = item.Ignore_Words; sellerItemFile.Is_Round_To_Nearest = item.Is_Round_To_Nearest; sellerItemFile.Is_Active = true; sellerItemFile.Created_Date = System.DateTime.Now; sellerItemFile.Country_Code = item.Country_Code; sellerItemFile.LocatedIn = item.LocatedIn; //if (itemCodeFile == 0) // context.SellerItemFiles.AddObject(sellerItemFile); context.SellerItemFiles.AddObject(sellerItemFile); context.SaveChanges(); sellerItem.File_Item_Code = sellerItemFile.File_Item_Code; } } context.SaveChanges(); string sellerItemJson = GetPricingItems(item.Item_Code, null, null, null, null, null, null); if (sellerItem.Is_Automated == true) { System.Threading.Thread t = new System.Threading.Thread(() => UpdateProductPrice(editedSellerItems, sellerItem, userKey)); t.Start(); } return sellerItemJson; } else return null; } catch (Exception ex) { Logging.WriteLog(LogType.Error, ex.ToString()); return null; } }
/// <summary> /// Deprecated Method for adding a new object to the SellerItemFiles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSellerItemFiles(SellerItemFile sellerItemFile) { base.AddObject("SellerItemFiles", sellerItemFile); }