private static void InsertProduct() { try { using (SqlConnection con = new SqlConnection(connection)) { con.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "update tbl_abf_store_product set Category=@Category,Title=@Title,ProductDesc=@ProductDesc,Manufacture=@Manufacture,PartNo=@PartNo,MNP=@MNP,Spec=@Spec,image_url=@image_url where productid = @sourceid"; cmd.Parameters.AddWithValue("@Category", Dabfstore.Category != null ? ReplaceString.PutString(Dabfstore.Category) : ""); cmd.Parameters.AddWithValue("@Title", Dabfstore.Title != null ? ReplaceString.PutString(Dabfstore.Title) : ""); cmd.Parameters.AddWithValue("@ProductDesc", Dabfstore.ProductDesc != null ? ReplaceString.PutString(Dabfstore.ProductDesc) : ""); cmd.Parameters.AddWithValue("@Manufacture", Dabfstore.Manufacture != null ? ReplaceString.PutString(Dabfstore.Manufacture) : ""); cmd.Parameters.AddWithValue("@PartNo", Dabfstore.PartNo != null ? ReplaceString.PutString(Dabfstore.PartNo) : ""); cmd.Parameters.AddWithValue("@MNP", Dabfstore.MNP != null ? ReplaceString.PutString(Dabfstore.MNP) : ""); cmd.Parameters.AddWithValue("@Spec", Dabfstore.Spec != null ? ReplaceString.PutString(Dabfstore.Spec) : ""); cmd.Parameters.AddWithValue("@image_url", Dabfstore.image_url != null ? ReplaceString.PutString(Dabfstore.image_url) : ""); cmd.Parameters.AddWithValue("@sourceid", sourceid); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { Console.WriteLine("Error While Updating the Product"); } }
public void RemoveReplaceString(String refID, String oldValue, String newValue) { if (!this.Project.DataTypeReferences.Contains(refID)) { throw new BuildException(String.Format("The refid {0} is not defined.", refID)); } FilterChain RefFilterChain = (FilterChain)this.Project.DataTypeReferences[refID]; Boolean Found = false; ReplaceString ToRemove = null; foreach (Filter ReplacementFilter in RefFilterChain.Filters) { if (ReplacementFilter is ReplaceString && ((ReplaceString)ReplacementFilter).From == oldValue && ((ReplaceString)ReplacementFilter).To == newValue) { ToRemove = (ReplaceString)ReplacementFilter; Found = true; break; } } if (Found) { RefFilterChain.Filters.Remove(ToRemove); } }
private static void InsertProduct() { try { using (SqlConnection con = new SqlConnection(connection)) { con.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "update tbl_platt_product set Category=@Category,ProductTitle=@ProductTitle,mfr=@mfr,item=@item,UPC=@UPC,CAT=@CAT,Long_desc=@Long_desc,Price = @Price,UOM = @UOM,Spec = @Spec,image_link = @image_link,Catelog = @Catelog,AlsoKnowAs = @AlsoKnowAs where productid=@sourceid"; cmd.Parameters.AddWithValue(@"Category", platt.Category != null ? ReplaceString.PutString(platt.Category) : ""); cmd.Parameters.AddWithValue(@"ProductTitle", platt.ProductTitle != null ? ReplaceString.PutString(platt.ProductTitle) : ""); cmd.Parameters.AddWithValue(@"mfr", platt.mfr != null ? ReplaceString.PutString(platt.mfr) : ""); cmd.Parameters.AddWithValue(@"item", platt.item != null ? ReplaceString.PutString(platt.item) : ""); cmd.Parameters.AddWithValue(@"UPC", platt.UPC != null ? ReplaceString.PutString(platt.UPC) : ""); cmd.Parameters.AddWithValue(@"CAT", platt.CAT != null ? ReplaceString.PutString(platt.CAT) : ""); cmd.Parameters.AddWithValue(@"Long_desc", platt.Long_desc != null ? ReplaceString.PutString(platt.Long_desc) : ""); cmd.Parameters.AddWithValue(@"Price", platt.Price != null ? ReplaceString.PutString(platt.Price) : ""); cmd.Parameters.AddWithValue(@"UOM", platt.UOM != null ? ReplaceString.PutString(platt.UOM) : ""); cmd.Parameters.AddWithValue(@"Spec", platt.Spec != null ? ReplaceString.PutString(platt.Spec) : ""); cmd.Parameters.AddWithValue(@"image_link", platt.image_link != null ? ReplaceString.PutString(platt.image_link) : ""); cmd.Parameters.AddWithValue(@"Catelog", platt.Catelog != null ? ReplaceString.PutString(platt.Catelog) : ""); cmd.Parameters.AddWithValue(@"AlsoKnowAs", platt.AlsoKnowAs != null ? ReplaceString.PutString(platt.AlsoKnowAs) : ""); cmd.Parameters.AddWithValue("@sourceid", sourceid); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { Console.WriteLine("Error While Updating the Product"); } }
public static void UpdateSerializable() { ReplaceString[] replaceStrings = new ReplaceString[] { new ReplaceString("namespace table", "namespace Company.Cfg") }; GenerateCode(replaceStrings, "../TabToy/GenerateClass/ConfigFixed.cs"); }
public static void UpdateSerializable() { ReplaceString[] replaceStrings = new ReplaceString[] { new ReplaceString("namespace table", "namespace Company.Cfg") }; GenerateCode(replaceStrings, "../../Assets/ExcelBin/ConfigFixed.cs"); }
public void AddReplaceString(String refID, String oldValue, String newValue) { if (!this.Project.DataTypeReferences.Contains(refID)) { throw new BuildException(String.Format("The refid {0} is not defined.", refID)); } FilterChain RefFilterChain = (FilterChain)this.Project.DataTypeReferences[refID]; ReplaceString ReplaceStringFilter = new ReplaceString(); ReplaceStringFilter.From = oldValue; ReplaceStringFilter.To = newValue; RefFilterChain.Filters.Add(ReplaceStringFilter); }
static void Main(string[] args) { ReplaceString.ReadInput(); Console.Read(); }
private static void UpdateProductData() { try { Console.WriteLine("Update product data !!"); using (SqlConnection sqlConnection = new SqlConnection(connection)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("update tbl_turtle_ProductLink set Category=@Category, ProductTitle = @ProductTitle, ProductDescription = @ProductDescription, Manufacturers = @Manufacturers, BrandName = @BrandName, Part = @Part, MNP = @MNP, UPC = @UPC, Description = @Description, Specification = @Specification, Document = @Document, Features = @Features, UOM = @UOM, Price = @Price where ProductId = @ProductId", sqlConnection); sqlCommand.CommandType = CommandType.Text; sqlCommand.Parameters.AddWithValue(@"Category", (Turtle.Category == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Category))); sqlCommand.Parameters.AddWithValue(@"ProductTitle", (Turtle.ProductTitle == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.ProductTitle))); sqlCommand.Parameters.AddWithValue(@"ProductDescription", (Turtle.ProductDescription == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.ProductDescription))); sqlCommand.Parameters.AddWithValue(@"Manufacturers", (Turtle.Manufacturers == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Manufacturers))); sqlCommand.Parameters.AddWithValue(@"BrandName", (Turtle.BrandName == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.BrandName))); sqlCommand.Parameters.AddWithValue(@"Part", (Turtle.Part == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Part))); sqlCommand.Parameters.AddWithValue(@"MNP", (Turtle.MNP == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.MNP))); sqlCommand.Parameters.AddWithValue(@"UPC", (Turtle.UPC == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.UPC))); sqlCommand.Parameters.AddWithValue(@"Description", (Turtle.Description == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Description))); sqlCommand.Parameters.AddWithValue(@"Specification", (Turtle.Specification == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Specification))); sqlCommand.Parameters.AddWithValue(@"Document", (Turtle.Document == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Document))); sqlCommand.Parameters.AddWithValue(@"Features", (Turtle.Features == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Features))); sqlCommand.Parameters.AddWithValue(@"UOM", (Turtle.UOM == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.UOM))); sqlCommand.Parameters.AddWithValue(@"Price", (Turtle.Price == null) ? "" : Stringreplace(ReplaceString.PutString(Turtle.Price))); sqlCommand.Parameters.AddWithValue("@ProductId", sourceid); sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private static void GetProductData() { try { var data = ReplaceString.PutString(""); Turtle = new Turtle(); h1 = null; h1 = new HtmlDocument(); h1.LoadHtml(DownloadedString); try { var category = h1.DocumentNode.SelectSingleNode("//ul[@class='breadcrumb']").InnerHtml.ToString(); h2 = null; h2 = new HtmlDocument(); h2.LoadHtml(category); Turtle.Category = h2.DocumentNode.SelectNodes("//li").Select(s => s.InnerText.ToString().Replace("/n", "").Trim()).Aggregate((a, b) => a + "> " + b).ToString(); } catch { Turtle.Category = string.Empty; } try { Turtle.ProductTitle = h1.DocumentNode.SelectSingleNode("//h2[@class='cimm_prodDetailTitle']").InnerText.ToString().Trim(); } catch { Turtle.ProductTitle = string.Empty; } try { Turtle.ProductDescription = h1.DocumentNode.SelectSingleNode("//p[@class='cimm_itemShortDesc']").InnerText.ToString().Trim(); } catch { Turtle.ProductDescription = string.Empty; } try { //productDetailList var tabledata = h1.DocumentNode.SelectSingleNode("//table[@id='productDetailList']").InnerHtml.ToString(); h2 = null; h2 = new HtmlDocument(); h2.LoadHtml(tabledata); try { Turtle.Manufacturers = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("Manufacturers")).Select(s => s.InnerText.ToString().Replace("Manufacturers", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.Manufacturers = string.Empty; } try { Turtle.BrandName = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("Brand Name")).Select(s => s.InnerText.ToString().Replace("Brand Name", "").Replace("\n", "").Trim()).FirstOrDefault(); } catch { Turtle.BrandName = string.Empty; } try { Turtle.UPC = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("UPC")).Select(s => s.InnerText.ToString().Replace("UPC", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.UPC = string.Empty; } try { Turtle.MNP = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("MPN")).Select(s => s.InnerText.ToString().Replace("MPN", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.MNP = string.Empty; } try { Turtle.Part = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("Part #")).Select(s => s.InnerText.ToString().Replace("Part #:", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.Part = string.Empty; } } catch { } try { var specdata = h1.DocumentNode.SelectSingleNode("//div[@id='specificationSection']").InnerHtml.ToString(); h2 = null; h2 = new HtmlDocument(); h2.LoadHtml(specdata); Turtle.Specification = Stringreplace(h2.DocumentNode.SelectNodes("//tr").Select(s => s.InnerText.ToString().Replace(" ", "").Replace("\n", "").Trim()).Aggregate((a, b) => a + " | " + b).ToString()); } catch { Turtle.Specification = string.Empty; } try { Turtle.Description = h1.DocumentNode.SelectSingleNode("//div[@id='descriptionSection']").InnerText.ToString().Trim(); } catch { Turtle.Description = ""; } try { Turtle.Document = h1.DocumentNode.SelectNodes("//span[@class='cimm_pdfLink hideMe']").Select(s => s.InnerText.ToString().Trim()).Aggregate((a, b) => a + " | " + b).ToString(); } catch { Turtle.Document = ""; } try { Turtle.Features = h1.DocumentNode.SelectSingleNode("//div[@id='featureSection']").InnerText.ToString().Trim(); } catch { Turtle.Features = ""; } GetPriceString(); } catch { } finally { UpdateProductData(); Turtle = null; h1 = null; h2 = null; } }
public string ToJson() { TimeSpan timestamp = (_date.ToUniversalTime() - new DateTime(1970, 1, 1)); return(String.Format("{{\"timestamp\":{0:G},\"type\":\"{1}\",\"impotant\":{2},\"text\":\"{3}\"}}", (long)(timestamp.TotalMilliseconds), _type.ToString(), _important.ToString(), ReplaceString.ToLiteral(_message.ToString()))); }
public static void Main(string[] args) { Console.WriteLine(" 1. Replace String \n 2. FlipCoin \n 3. LeapYear \n 4. PowerOf2 \n 5. HarmonicNo." + " \n 6. PrimeFactor \n 7. WindChill Temperature \n 8. Euclidean distance \n 9. QuadraticEquation " + "\n 10. FindTriplets \n 11. Gambler \n 12. 2DArray \n 13. CouponNumber \n 14. StopWatch \n 15. TicTaeToe" + "\n 16. Vending Machine \n 17. Day of week \n 18. TemperatureConversion \n 19. MonthlyPayment \n 20. SquareRoot" + "\n 21. BinaryConversion \n 22. SwapNibbles \n 23. ResultantNo is Power of two \n 24. BinarySearch \n 25. BubbleSort" + "\n 26. Insertion Sort \n 27. Merge Sort \n 28. Anagram \n 29. Prime btw 1-1000 \n 30. Permutation Recursive \n 31. Permutation Iterartion "); int option = Utility.readInt(); switch (option) { case 1: ReplaceString.Replace(); break; case 2: FlipCoin.flipCoin(); break; case 3: LeapYear.LeapYears(); break; case 4: PowerOf2.PrintTable(); break; case 5: Harmonic.HarmonicNo(); break; case 6: PrimeFactor.Primefactor(); break; case 7: WindChill.Chill(); break; case 8: Distance.EuclideanDistance(); break; case 9: QuadraticEquation.Quadratic(); break; case 10: Sumof3No.SumZero(); break; case 11: Gambler.Gambling(); break; case 12: Array2D.IntegerArray(); break; case 13: CouponNumber.couponNumber(); break; case 14: StopWatch.Watch(); break; case 15: TicTacToe.TictaeToeGame(); break; case 16: VendingMachine.Atm(); break; case 17: DayOfWeek.checkday(); break; case 18: TemperatureConversion.Conversion(); break; case 19: MonthlyPayment.PaymentMonthly(); break; case 20: Sqrt.Root(); break; case 21: Binary.DecToBinary(); break; case 22: BinarySwaapNibble.SwapNibble(); break; case 23: ResultantPower2.Resultant(); break; case 24: BinarySearch.Search(); break; case 25: BubbleSort.Bubblesort(); break; case 26: Insertion.InsertionSorting(); break; case 27: MergeSort.Mergesorting(); break; case 28: Anagram.AnagramString(); break; case 29: PrimeNoRange.Range(); break; case 30: Permutation.Recursion(); break; case 31: permutationIterative.Iterative(); break; case 32: PlaindromePrimeNo.AnagramPrime(); //PlaindromePrimeNo.Palindrome(); break; } }
public static void UpdateProductData() { try { Console.WriteLine("Update product data !!"); using (SqlConnection sqlConnection = new SqlConnection(connection)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("update [dbo].[tbl_fastenal_productData] set Title=@Title ,ManuPartNo=@ManuPartNo ,ManuName=@ManuName ,FastePartNo=@FastePartNo ,WPrice=@WPrice ,Oprice=@Oprice ,UPrice=@UPrice ,UOM=@UOM ,Spec=@Spec ,Category=@Category ,ImageLink=@ImageLink ,UNSPSC=@UNSPSC where Productid=@Productid", sqlConnection); sqlCommand.CommandType = CommandType.Text; sqlCommand.Parameters.AddWithValue("@Category", (fastenal.Category == null) ? "" : ReplaceString.PutString(fastenal.Category)); sqlCommand.Parameters.AddWithValue("@Title", (fastenal.Title == null) ? "" : ReplaceString.PutString(fastenal.Title)); sqlCommand.Parameters.AddWithValue("@ManuPartNo", (fastenal.ManuPartNo == null) ? "" : ReplaceString.PutString(fastenal.ManuPartNo)); sqlCommand.Parameters.AddWithValue("@ManuName", (fastenal.ManuName == null) ? "" : ReplaceString.PutString(fastenal.ManuName)); sqlCommand.Parameters.AddWithValue("@FastePartNo", (fastenal.FastePartNo == null) ? "" : ReplaceString.PutString(fastenal.FastePartNo)); sqlCommand.Parameters.AddWithValue("@WPrice", (fastenal.WPrice == null) ? "" : ReplaceString.PutString(fastenal.WPrice)); sqlCommand.Parameters.AddWithValue("@Oprice", (fastenal.Oprice == null) ? "" : ReplaceString.PutString(fastenal.Oprice)); sqlCommand.Parameters.AddWithValue("@UPrice", (fastenal.UPrice == null) ? "" : ReplaceString.PutString(fastenal.UPrice)); sqlCommand.Parameters.AddWithValue("@UOM", (fastenal.UOM == null) ? "" : ReplaceString.PutString(fastenal.UOM)); sqlCommand.Parameters.AddWithValue("@Spec", (fastenal.Spec == null) ? "" : ReplaceString.PutString(fastenal.Spec)); sqlCommand.Parameters.AddWithValue("@ImageLink", (fastenal.ImageLink == null) ? "" : ReplaceString.PutString(fastenal.ImageLink)); sqlCommand.Parameters.AddWithValue("@UNSPSC", (fastenal.UNSPSC == null) ? "" : ReplaceString.PutString(fastenal.UNSPSC)); sqlCommand.Parameters.AddWithValue("@Productid", sourceid); sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine("updateing product data failed!!"); } }
public static void UpdateProductData() { try { Console.WriteLine("Update product data !!"); using (SqlConnection sqlConnection = new SqlConnection(connection)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("update [dbo].[tbl_supplyhouse_product] set category=@category,Title=@Title,SKU=@SKU,BrandName=@BrandName,Price=@Price,UOM=@UOM,Description=@Description,Specification=@Specification,ImageLink=@ImageLink where ProductID=@id", sqlConnection); sqlCommand.CommandType = CommandType.Text; sqlCommand.Parameters.AddWithValue("@category", (supplyhouse.category == null) ? "" :ReplaceString.PutString(supplyhouse.category)); sqlCommand.Parameters.AddWithValue("@Title", (supplyhouse.Title == null) ? "" : ReplaceString.PutString(supplyhouse.Title)); sqlCommand.Parameters.AddWithValue("@SKU", (supplyhouse.SKU == null) ? "" : ReplaceString.PutString(supplyhouse.SKU)); sqlCommand.Parameters.AddWithValue("@BrandName", (supplyhouse.BrandName == null) ? "" : ReplaceString.PutString(supplyhouse.BrandName)); sqlCommand.Parameters.AddWithValue("@Price", (supplyhouse.Price == null) ? "" : ReplaceString.PutString(supplyhouse.Price)); sqlCommand.Parameters.AddWithValue("@UOM", (supplyhouse.UOM == null) ? "" : ReplaceString.PutString(supplyhouse.UOM)); sqlCommand.Parameters.AddWithValue("@Description", (supplyhouse.Description == null) ? "" : ReplaceString.PutString(supplyhouse.Description)); sqlCommand.Parameters.AddWithValue("@Specification", (supplyhouse.Specification == null) ? "" : ReplaceString.PutString(supplyhouse.Specification)); sqlCommand.Parameters.AddWithValue("@ImageLink", (supplyhouse.ImageLink == null) ? "" : ReplaceString.PutString(supplyhouse.ImageLink)); sqlCommand.Parameters.AddWithValue("@id", sourceid); sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine("updateing product data failed!!"); } }
public static void UpdateProductData() { try { Console.WriteLine("Update product data !!"); using (SqlConnection sqlConnection = new SqlConnection(connection)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("update [dbo].[tbl_fishersci_product] set Image_Link=@Image_Link,Specfication=@Specfication,UOM=@UOM,Price=@Price,SDP=@SDP,Categlog=@Categlog,MFR_Num=@MFR_Num,Manu_Name=@Manu_Name,Feature=@Feature,Short_desc=@Short_desc,Title=@Title,category=@category,IsLink=@IsLink where Productid =@Productid", sqlConnection); sqlCommand.CommandType = CommandType.Text; sqlCommand.Parameters.AddWithValue("@category", (fishersci.category == null) ? "" : ReplaceString.PutString(fishersci.category)); sqlCommand.Parameters.AddWithValue("@Title", (fishersci.Title == null) ? "" : ReplaceString.PutString(fishersci.Title)); sqlCommand.Parameters.AddWithValue("@Short_desc", (fishersci.Short_desc == null) ? "" : ReplaceString.PutString(fishersci.Short_desc)); sqlCommand.Parameters.AddWithValue("@Feature", (fishersci.Feature == null) ? "" : ReplaceString.PutString(fishersci.Feature)); sqlCommand.Parameters.AddWithValue("@Manu_Name", (fishersci.Manu_Name == null) ? "" : ReplaceString.PutString(fishersci.Manu_Name)); sqlCommand.Parameters.AddWithValue("@MFR_Num", (fishersci.MFR_Num == null) ? "" : ReplaceString.PutString(fishersci.MFR_Num)); sqlCommand.Parameters.AddWithValue("@Categlog", (fishersci.Categlog == null) ? "" : ReplaceString.PutString(fishersci.Categlog)); sqlCommand.Parameters.AddWithValue("@SDP", (fishersci.SDP == null) ? "" : ReplaceString.PutString(fishersci.SDP)); sqlCommand.Parameters.AddWithValue("@Price", (fishersci.Price == null) ? "" : ReplaceString.PutString(fishersci.Price)); sqlCommand.Parameters.AddWithValue("@UOM", (fishersci.UOM == null) ? "" : ReplaceString.PutString(fishersci.UOM)); sqlCommand.Parameters.AddWithValue("@Specfication", (fishersci.Specfication == null) ? "" : ReplaceString.PutString(fishersci.Specfication)); sqlCommand.Parameters.AddWithValue("@Image_Link", (fishersci.Image_Link == null) ? "" : ReplaceString.PutString(fishersci.Image_Link)); sqlCommand.Parameters.AddWithValue("@IsLink", 1); sqlCommand.Parameters.AddWithValue("@Productid", sourceid); sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine("updateing product data failed!!"); } }
private static void InsertProduct() { try { using (SqlConnection con = new SqlConnection(connection)) { con.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "update tbl_columbiapipe_product set Category=@Category,ProTitle=@ProTitle,mfr=@mfr,item=@item,upc=@upc,brand=@brand,MOQ=@MOQ,QtyInter=@QtyInter,LongDesc=@LongDesc,Price=@Price,UOM=@UOM,Feature=@Feature,Spec=@Spec,img_Link=@img_Link where productid=@sourceid"; cmd.Parameters.AddWithValue(@"Category", columbiapipe.Category != null ? ReplaceString.PutString(columbiapipe.Category) : ""); cmd.Parameters.AddWithValue(@"ProTitle", columbiapipe.ProTitle != null ? ReplaceString.PutString(columbiapipe.ProTitle) : ""); cmd.Parameters.AddWithValue(@"mfr", columbiapipe.mfr != null ? ReplaceString.PutString(columbiapipe.mfr) : ""); cmd.Parameters.AddWithValue(@"item", columbiapipe.item != null ? ReplaceString.PutString(columbiapipe.item) : ""); cmd.Parameters.AddWithValue(@"upc", columbiapipe.upc != null ? ReplaceString.PutString(columbiapipe.upc) : ""); cmd.Parameters.AddWithValue(@"brand", columbiapipe.brand != null ? ReplaceString.PutString(columbiapipe.brand) : ""); cmd.Parameters.AddWithValue(@"MOQ", columbiapipe.MOQ != null ? ReplaceString.PutString(columbiapipe.MOQ) : ""); cmd.Parameters.AddWithValue(@"QtyInter", columbiapipe.QtyInter != null ? ReplaceString.PutString(columbiapipe.QtyInter) : ""); cmd.Parameters.AddWithValue(@"LongDesc", columbiapipe.LongDesc != null ? ReplaceString.PutString(columbiapipe.LongDesc) : ""); cmd.Parameters.AddWithValue(@"Price", columbiapipe.Price != null ? ReplaceString.PutString(columbiapipe.Price) : ""); cmd.Parameters.AddWithValue(@"UOM", columbiapipe.UOM != null ? ReplaceString.PutString(columbiapipe.UOM) : ""); cmd.Parameters.AddWithValue(@"Feature", columbiapipe.Feature != null ? ReplaceString.PutString(columbiapipe.Feature) : ""); cmd.Parameters.AddWithValue(@"Spec", columbiapipe.Spec != null ? ReplaceString.PutString(columbiapipe.Spec) : ""); cmd.Parameters.AddWithValue(@"img_Link", columbiapipe.img_Link != null ? ReplaceString.PutString(columbiapipe.img_Link) : ""); cmd.Parameters.AddWithValue("@sourceid", sourceid); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { Console.WriteLine("Error While Updating the Product"); } }
public void UpdateProductData(ArrowProduct ArrowProduct) { try { LabelLog("Update product data !!"); using (SqlConnection sqlConnection = new SqlConnection(connection)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("update [dbo].[tbl_Arrow_Product] set itemtitle=@itemtitle,Productdescription=@Productdescription,MPN=@MPN,Manufacturename=@Manufacturename,productcategory=@productcategory,UOM=@UOM,price=@price,imageurl=@imageurl,category=@category,techspec=@techspec where Productid=@id", sqlConnection); sqlCommand.CommandType = CommandType.Text; sqlCommand.Parameters.AddWithValue("@itemtitle", (ArrowProduct.itemtitle == null) ? "" :ReplaceString.PutString(ArrowProduct.itemtitle)); sqlCommand.Parameters.AddWithValue("@Productdescription", (ArrowProduct.Productdescription == null) ? "" : ReplaceString.PutString(ArrowProduct.Productdescription)); sqlCommand.Parameters.AddWithValue("@MPN", (ArrowProduct.MPN == null) ? "" : ReplaceString.PutString(ArrowProduct.MPN)); sqlCommand.Parameters.AddWithValue("@Manufacturename", (ArrowProduct.Manufacturename == null) ? "" : ReplaceString.PutString(ArrowProduct.Manufacturename)); sqlCommand.Parameters.AddWithValue("@productcategory", (ArrowProduct.productcategory == null) ? "" : ReplaceString.PutString(ArrowProduct.productcategory)); sqlCommand.Parameters.AddWithValue("@UOM", (ArrowProduct.UOM == null) ? "" : ReplaceString.PutString(ArrowProduct.UOM)); sqlCommand.Parameters.AddWithValue("@price", (ArrowProduct.price == null) ? "" : ReplaceString.PutString(ArrowProduct.price)); sqlCommand.Parameters.AddWithValue("@imageurl", (ArrowProduct.imageurl == null) ? "" : ReplaceString.PutString(ArrowProduct.imageurl)); sqlCommand.Parameters.AddWithValue("@category", (ArrowProduct.category == null) ? "" : ReplaceString.PutString(ArrowProduct.category)); sqlCommand.Parameters.AddWithValue("@techspec", (ArrowProduct.techspec == null) ? "" : ReplaceString.PutString(ArrowProduct.techspec)); //sqlCommand.Parameters.AddWithValue("@ProductURL", SourceLink); sqlCommand.Parameters.AddWithValue("@id", sourceid); sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { LabelLog("updateing product data failed!!"); } }
private static void InsertProduct() { try { using (SqlConnection con = new SqlConnection(connection)) { con.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "update tbl_pumpcatalog_product set Category=@Category , Title=@Title , Price=@Price , Manufacture=@Manufacture , PartNo=@PartNo , MPN=@MPN , UPC=@UPC , Description=@Description , Specification=@Specification , Image_URL=@Image_URL where id=@sourceid"; cmd.Parameters.AddWithValue(@"Category", DPumpCatelog.Category != null ? ReplaceString.PutString(DPumpCatelog.Category) : ""); cmd.Parameters.AddWithValue(@"Title", DPumpCatelog.Title != null ? ReplaceString.PutString(DPumpCatelog.Title) : ""); cmd.Parameters.AddWithValue(@"Price", DPumpCatelog.Price != null ? ReplaceString.PutString(DPumpCatelog.Price) : ""); cmd.Parameters.AddWithValue(@"Manufacture", DPumpCatelog.Manufacture != null ? ReplaceString.PutString(DPumpCatelog.Manufacture) : ""); cmd.Parameters.AddWithValue(@"PartNo", DPumpCatelog.PartNo != null ? ReplaceString.PutString(DPumpCatelog.PartNo) : ""); cmd.Parameters.AddWithValue(@"MPN", DPumpCatelog.MPN != null ? ReplaceString.PutString(DPumpCatelog.MPN) : ""); cmd.Parameters.AddWithValue(@"UPC", DPumpCatelog.UPC != null ? ReplaceString.PutString(DPumpCatelog.UPC) : ""); cmd.Parameters.AddWithValue(@"Description", DPumpCatelog.Description != null ? ReplaceString.PutString(DPumpCatelog.Description) : ""); cmd.Parameters.AddWithValue(@"Specification", DPumpCatelog.Specification != null ? ReplaceString.PutString(DPumpCatelog.Specification) : ""); cmd.Parameters.AddWithValue(@"Image_URL", DPumpCatelog.Image_URL != null ? ReplaceString.PutString(DPumpCatelog.Image_URL) : ""); cmd.Parameters.AddWithValue("@sourceid", sourceid); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { Console.WriteLine("Error While Updating the Product"); } }