Advertisement
Advertisement
| 07.02.2008 at 01:33PM PDT, ID: 23535033 |
|
[x]
Attachment Details
|
||
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: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: |
public static void ProduceADVPriceListLoad(string _fileName, string _priceListHeaderID, string _effectDTM, string _sctPriceListName)
{
System.Data.DataSet DSNew = new DataSet();
// Create the CSV file to which data will be exported.
StreamWriter sw = new StreamWriter(_fileName, false);
// First we will write the headers.
// Get Ottawa Grades
InitialPriceReporting.InitialPriceReportingServiceWS.InitialPriceReportingService WS = new InitialPriceReporting.InitialPriceReportingServiceWS.InitialPriceReportingService();
string Status = null;
sw.Write("Price List Name");
sw.Write(",");
sw.WriteLine(_sctPriceListName);
sw.Write ("Price List");
sw.Write (",");
sw.WriteLine("Y");
sw.WriteLine("");
sw.WriteLine("");
sw.WriteLine(Header);
DSNew = WS.GetQPOPMGrades(_priceListHeaderID, ref Status);
DataTable dt = DSNew.Tables[0];
int iColCount = dt.Columns.Count;
// Now write all the rows.
foreach (DataRow dr in dt.Rows)
{
sw.Write("Item"); //ProductContext
sw.Write(",");
sw.Write("Item Number"); // ProductAttribute
sw.Write(",");
sw.Write(dr.ItemArray[3].ToString());
sw.Write(",");
sw.Write(dr.ItemArray[1].ToString().TrimEnd());
sw.Write(",");
sw.Write("MT"); // UOM
sw.Write(",");
sw.Write("");// PrimaryUOM
sw.Write(",");
sw.Write("Price List Line");// LineType
sw.Write(",");
sw.Write(""); // PriceBreakType
sw.Write(",");
sw.Write("Unit Price"); // ApplicationMethod
sw.Write(",");
sw.Write(""); // BreakUOM
sw.Write(",");
sw.Write(""); // BreakUOMAttibute
sw.Write(",");
sw.Write((Convert.ToDecimal(dr.ItemArray[2]).ToString("#,##0.000"))); // Straight Price
sw.Write(",");
sw.Write(""); // DynamicFormula
sw.Write(",");
sw.Write(""); // StaticFormula
sw.Write(",");
sw.Write(_effectDTM); // SCTEffdtm
sw.Write(",");
sw.Write(""); // EndDate
sw.Write(",");
sw.Write("220"); // Precedence
sw.Write(",");
sw.Write("CWB"); // Context
sw.Write(",");
sw.Write("0"); // Attribute1
sw.Write(sw.NewLine);
}
sw.Close();
}
}
|