private void AddToArchive(SingleBatch singleBatch) { var csv = new StringBuilder(); var newLine = String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},0", singleBatch.Material, singleBatch.BatchNum, singleBatch.ReceivedDate, singleBatch.TargetEndDate, singleBatch.StrengthStatus, singleBatch.StrengthDate, singleBatch.PSHardnessStatus, singleBatch.PSHardnessDate, singleBatch.DimensionStatus, singleBatch.DimensionDate, singleBatch.DTStatus, singleBatch.DTDate, singleBatch.ArchimedesStatus, singleBatch.ArchimedesDate, singleBatch.ShadeStatus, singleBatch.ShadeDate, singleBatch.HomogeneityStatus, singleBatch.HomogeneityDate, singleBatch.XRFStatus, singleBatch.XRFDate, singleBatch.XRDStatus, singleBatch.XRDDate, singleBatch.MinoltaStatus, singleBatch.MinoltaDate, singleBatch.ShearStatus, singleBatch.ShearDate, singleBatch.PackagingStatus, singleBatch.PackagingDate, singleBatch.FinalApprovalStatus, singleBatch.FinalApprovalDate, singleBatch.LeadTime, singleBatch.Comments, singleBatch.Quantity, singleBatch.SizeShade, singleBatch.PowderStatus, singleBatch.PowderDate, singleBatch.DiscRingStatus, singleBatch.DiscRingDate, "0"); csv.AppendLine(newLine); File.AppendAllText("G:\\QC\\QC Milling Ceramics\\QC Archive Orders.csv", csv.ToString()); }
static List <SingleBatch> PullList() { List <SingleBatch> fullList = new List <SingleBatch>(); File.Copy("G:\\QC\\QC Milling Ceramics\\Archive\\QC Open Orders.csv", "G:\\QC\\QC Milling Ceramics\\QC Open Orders_temp.csv", true); var column1 = new List <string>(); var column2 = new List <string>(); var column3 = new List <string>(); var column4 = new List <string>(); var column5 = new List <string>(); var column6 = new List <string>(); var column7 = new List <string>(); var column8 = new List <string>(); var column9 = new List <string>(); var column10 = new List <string>(); var column11 = new List <string>(); var column12 = new List <string>(); var column13 = new List <string>(); var column14 = new List <string>(); var column15 = new List <string>(); var column16 = new List <string>(); var column17 = new List <string>(); var column18 = new List <string>(); var column19 = new List <string>(); var column20 = new List <string>(); var column21 = new List <string>(); var column22 = new List <string>(); var column23 = new List <string>(); var column24 = new List <string>(); var column25 = new List <string>(); var column26 = new List <string>(); var column27 = new List <string>(); var column28 = new List <string>(); var column29 = new List <string>(); var column30 = new List <string>(); var column31 = new List <string>(); var column32 = new List <string>(); var column33 = new List <string>(); var column34 = new List <string>(); var column35 = new List <string>(); var column36 = new List <string>(); var column37 = new List <string>(); var column38 = new List <string>(); var column39 = new List <string>(); using (var rd = new StreamReader("G:\\QC\\QC Milling Ceramics\\QC Open Orders_temp.csv")) { while (!rd.EndOfStream) { string theNextLine = rd.ReadLine(); if (theNextLine == "") { break; } var splits = theNextLine.Split(','); column1.Add(splits[0]); column2.Add(splits[1]); column3.Add(splits[2]); column4.Add(splits[3]); column5.Add(splits[4]); column6.Add(splits[5]); column7.Add(splits[6]); column8.Add(splits[7]); column9.Add(splits[8]); column10.Add(splits[9]); column11.Add(splits[10]); column12.Add(splits[11]); column13.Add(splits[12]); column14.Add(splits[13]); column15.Add(splits[14]); column16.Add(splits[15]); column17.Add(splits[16]); column18.Add(splits[17]); column19.Add(splits[18]); column20.Add(splits[19]); column21.Add(splits[20]); column22.Add(splits[21]); column23.Add(splits[22]); column24.Add(splits[23]); column25.Add(splits[24]); column26.Add(splits[25]); column27.Add(splits[26]); column28.Add(splits[27]); column29.Add(splits[28]); column30.Add(splits[29]); column31.Add(splits[30]); column32.Add(splits[31]); column33.Add(splits[32]); column34.Add(splits[33]); column35.Add(splits[34]); column36.Add(splits[35]); column37.Add(splits[36]); column38.Add(splits[37]); column39.Add(splits[38]); } } File.Delete("G:\\QC\\QC Milling Ceramics\\QC Open Orders_temp.csv"); for (int i = 1; i < column31.Count; i++) { SingleBatch oneRow = new SingleBatch(); oneRow.Material = column1[i]; oneRow.BatchNum = column2[i]; oneRow.ReceivedDate = column3[i]; oneRow.TargetEndDate = column4[i]; oneRow.StrengthStatus = column5[i]; oneRow.StrengthDate = column6[i]; oneRow.PSHardnessStatus = column7[i]; oneRow.PSHardnessDate = column8[i]; oneRow.DimensionStatus = column9[i]; oneRow.DimensionDate = column10[i]; oneRow.DTStatus = column11[i]; oneRow.DTDate = column12[i]; oneRow.ArchimedesStatus = column13[i]; oneRow.ArchimedesDate = column14[i]; oneRow.ShadeStatus = column15[i]; oneRow.ShadeDate = column16[i]; oneRow.HomogeneityStatus = column17[i]; oneRow.HomogeneityDate = column18[i]; oneRow.XRFStatus = column19[i]; oneRow.XRFDate = column20[i]; oneRow.XRDStatus = column21[i]; oneRow.XRDDate = column22[i]; oneRow.MinoltaStatus = column23[i]; oneRow.MinoltaDate = column24[i]; oneRow.ShearStatus = column25[i]; oneRow.ShearDate = column26[i]; oneRow.PackagingStatus = column27[i]; oneRow.PackagingDate = column28[i]; oneRow.FinalApprovalStatus = column29[i]; oneRow.FinalApprovalDate = column30[i]; oneRow.LeadTime = column31[i]; oneRow.Comments = column32[i]; oneRow.Quantity = column33[i]; oneRow.SizeShade = column34[i]; oneRow.PowderStatus = column35[i]; oneRow.PowderDate = column36[i]; oneRow.DiscRingStatus = column37[i]; oneRow.DiscRingDate = column38[i]; fullList.Add(oneRow); } return(fullList); }