public static void ExportProductUpdate(String AID_PART) { String ConnStr = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=True", Settings.GetValue("FinalTable")); OleDbConnection OleConn = new OleDbConnection(ConnStr); UpdateFinalTableManager finalTableManager = new UpdateFinalTableManager(ConnStr); AdiChildManager adiChildManager = new AdiChildManager(ConnStr); String DateFormat = Settings.GetValue("DateFormat"); List<AdiProduct> productList = adiProductManager.GetDataByPartNum(AID_PART); foreach (var p in productList) finalTableManager.SaveAdiPart(0, "", p.PartNumber, p.ProductDescription, p.ProductImagePath , p.ProductID, p.AdiNumber, (decimal)(p.Price == null ? 0 : p.Price), p.BigImage, p.SmallImage, p.VendorName, "0", p.LastUpdateDatetime.ToString(DateFormat)); //List<WebSpider.Objects.AdiGlobal.ADIChild> productSpecification = adiProductSpecificationManager.GetDataByPartNumber(AID_PART); //foreach (var ps in productSpecification) //{ // var child = new WebSpider.Objects.AdiExport.ADI_Child() // { // PART_NUM = ps.PART_NUM, // PropertyName = ps.PropertyName, // PropertyValue = ps.PropertyValue // }; // adiChildManager.Save(child); //} #region [ Product Specification] adiProductSpecificationManager.Delete(AID_PART); #region [ Bulk Insert ] DataTable prdSpecs = adiProductSpecificationManager.GetDataTableByPartNumber(AID_PART); string SQLps = "SELECT * FROM ADIChild WHERE ID IS NULL"; string INSERTps = "INSERT INTO ADIChild (PART_NUM, PropertyName, PropertyValue)" + " VALUES (@PART_NUM, @PropertyName, @PropertyValue)"; OleDbDataAdapter OleAdpPs = new OleDbDataAdapter(SQLps, OleConn); DataTable dtPs = new DataTable(); OleAdpPs.Fill(dtPs); foreach (DataRow dRow in prdSpecs.Rows) { dtPs.Rows.Add(dtPs.NewRow().ItemArray = dRow.ItemArray); } OleAdpPs.InsertCommand = new OleDbCommand(INSERTps); OleAdpPs.InsertCommand.Parameters.Add("@PART_NUM", OleDbType.VarChar, 255, "PART_NUM"); OleAdpPs.InsertCommand.Parameters.Add("@PropertyName", OleDbType.VarChar, 255, "PropertyName"); OleAdpPs.InsertCommand.Parameters.Add("@PropertyValue", OleDbType.VarChar, 255, "PropertyValue"); OleAdpPs.InsertCommand.Connection = OleConn; OleAdpPs.InsertCommand.Connection.Open(); OleAdpPs.Update(dtPs); OleAdpPs.InsertCommand.Connection.Close(); #endregion #endregion //List<ADIInventoryDetails> inventoryDetails = adiInventoryDetailsManager.GetDataByPartNumber(AID_PART); //ADIInventoryExport inventoryExport = adiInventoryExportManager.GetDataByProduct(AID_PART); }
public static List<AdiProduct> GetAllUpdateProducts() { List<AdiProduct> updateAdiProducts = new List<AdiProduct>(); //FinalTableManager finalTableTableAdapter = new FinalTableManager(finalcon); ////finalTableTableAdapter.Connection = finalcon; //var oDataTable = finalTableTableAdapter.GetAllAdiProducts(); List<WebSpider.AdiGlobal.Objects.AdiExport.Final_Table> updateProducts = new List<WebSpider.AdiGlobal.Objects.AdiExport.Final_Table>(); String ConnStr = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=True", Settings.GetValue("FinalTable")); UpdateFinalTableManager ftManager = new UpdateFinalTableManager(ConnStr); updateProducts = ftManager.GetAllAdiProducts(); updateAdiProducts = updateProducts.Select(x => new AdiProduct() { VendorModel = x.VDR_PART, ProductDescription = x.VDR_IT_DSC, AdiNumber = x.AID_PART, Price = x.AID_COST, SmallImage = x.AID_IMG1, BigImage = x.AID_IMG2, VendorName = x.AID_VENDOR }).ToList(); return updateAdiProducts; }
public static List<WebSpider.AdiGlobal.Objects.AdiExport.Final_Table> GetUpdateProducts() { List<WebSpider.AdiGlobal.Objects.AdiExport.Final_Table> updateProducts = new List<WebSpider.AdiGlobal.Objects.AdiExport.Final_Table>(); String ConnStr = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=True", Settings.GetValue("FinalTable")); UpdateFinalTableManager ftManager = new UpdateFinalTableManager(ConnStr); updateProducts = ftManager.GetAllAdiProducts(); return updateProducts; }