public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { HOUSE_WAYBILLS ds = new HOUSE_WAYBILLS(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public void LoadHouseWaybillsDatabaseData(string id) { logger.Debug("LoadHouseWaybillsDatabaseData begin id="+id); string Consolidate = ""; //fill boxList table //WAYBILL_ADDITION wayBillAddition = new WAYBILL_ADDITION(); HOUSE_WAYBILLS houseWaybillsList = new HOUSE_WAYBILLS(); logger.Debug("LoadHouseWaybillsDatabaseData [v_PAKComn] begin"); DataTable ConsolidateTable = EditsSqlProc.v_PAKComn__by__InternalID(id); logger.Debug("LoadHouseWaybillsDatabaseData [v_PAKComn] end"); ChkRowNotNull("WayBillXmlCreator id=" + id + ", v_PAKComn internalID=" + id, ConsolidateTable); Consolidate = ConsolidateTable.Rows[0]["CONSOL_INVOICE"].ToString().Trim(); string waybill_number = ConsolidateTable.Rows[0]["WAYBILL_NUMBER"].ToString().Trim(); string HAWB = waybill_number; if (string.IsNullOrEmpty(waybill_number)) { throw new Exception(id + " ªº WAYBILL_NUMBER ¬°ªÅ"); } /*if (Consolidate.Trim() != "") {*/ logger.Debug("LoadHouseWaybillsDatabaseData [v_WayBillList] begin"); DataTable packIDTable = EditsSqlProc.v_PAKComn__by__waybill_number(HAWB); //SQLText = "select distinct SUB_REGION, MASTER_WAYBILL_NUMBER, WAYBILL_NUMBER, INTL_CARRIER, ACTUAL_SHIPDATE from [v_WayBillList] where C46=@C46"; logger.Debug("LoadHouseWaybillsDatabaseData [v_WayBillList] end"); int index = 0; //foreach (DataRow readRow in packIDTable.Rows) if ((packIDTable != null) && (packIDTable.Rows.Count > 0)) { DataRow readRow = packIDTable.Rows[0]; HOUSE_WAYBILLS.HOUSE_WAYBILLRow newRow = houseWaybillsList.HOUSE_WAYBILL.NewHOUSE_WAYBILLRow(); //newRow.HOUSE_WAYBILL_Id = index; foreach (DataColumn column in houseWaybillsList.HOUSE_WAYBILL.Columns) { if (packIDTable.Columns.Contains(column.ColumnName) && (column.ColumnName != "BOX_UNIT_QTY")) { //if table contains name, then populate if (column.DataType != packIDTable.Columns[column.ColumnName].DataType) { if (column.DataType == typeof(Double)) { newRow[column] = Convert.ToDouble(readRow[column.ColumnName]); } else if (column.DataType == typeof(String)) { newRow[column] = Convert.ToString(readRow[column.ColumnName]); } } else newRow[column] = readRow[column.ColumnName]; } else { if (column.DataType == typeof(string)) newRow[column] = string.Empty; else if (column.DataType == typeof(Double)) newRow[column] = 0; else if (column.DataType == typeof(DateTime)) newRow[column] = DateTime.Today; } } DataTable hawbTable = null; /* logger.Debug("LoadHouseWaybillsDatabaseData [op_PAK_ShipmentWeight_FIS] begin"); DataTable hawbTable_ACT = EditsSqlProc.sp__op_PAK_ShipmentWeight_FIS(HAWB, "3"); logger.Debug("LoadHouseWaybillsDatabaseData [op_PAK_ShipmentWeight_FIS] end"); ChkRowNotNull("WayBillXmlCreator id=" + id + ", op_PAK_ShipmentWeight_FIS shipment=" + HAWB + ", tp=3", hawbTable_ACT); newRow.HAWB_ACT_WEIGHT = double.Parse(hawbTable_ACT.Rows[0]["Weight"].ToString()); */ newRow.HAWB_ACT_WEIGHT = 0; // logger.Debug("LoadHouseWaybillsDatabaseData [op_PAK_ShipmentWeight_FIS] begin"); hawbTable = EditsSqlProc.sp__op_PAK_ShipmentWeight_FIS(HAWB, "4"); logger.Debug("LoadHouseWaybillsDatabaseData [op_PAK_ShipmentWeight_FIS] end"); ChkRowNotNull("WayBillXmlCreator id=" + id + ", op_PAK_ShipmentWeight_FIS shipment=" + HAWB + ", tp=4", hawbTable); newRow.HAWB_GROSS_WEIGHT = double.Parse(hawbTable.Rows[0]["Weight"].ToString()); logger.Debug("LoadHouseWaybillsDatabaseData [v_WayBillList] begin"); string CONSOL_INVOICE = readRow["CONSOL_INVOICE"].ToString(); CONSOL_INVOICE = CONSOL_INVOICE.Substring(0, 10); hawbTable = EditsSqlProc.sum_DEST_CODE_BOX_QTY__from__v_WayBillList__by__CONSOL_INVOICE(CONSOL_INVOICE); logger.Debug("LoadHouseWaybillsDatabaseData [v_WayBillList] end"); ChkRowNotNull("WayBillXmlCreator id=" + id + ", v_WayBillList CONSOL_INVOICE=" + CONSOL_INVOICE, hawbTable); //add up PACK_ID_UNIT_QTY //newRow.HAWB_BOX_QTY = double.Parse(hawbTable.Rows[0]["DEST_CODE_BOX_QTY"].ToString()); logger.Debug("LoadHouseWaybillsDatabaseData [PAK.PAKPaltno] begin"); DataTable hawb2Table = EditsSqlProc.PALLET_ID__from__PAK_PAKPaltno__by__WAYBILL_NUMBER(HAWB); logger.Debug("LoadHouseWaybillsDatabaseData [PAK.PAKPaltno] end"); newRow.HAWB_PALLET_QTY = hawb2Table.Rows.Count; logger.Debug("LoadHouseWaybillsDatabaseData HAWB_BOX_QTY__by__WAYBILL_NUMBER WAYBILL_NUMBER begin"); hawbTable = EditsSqlProc.HAWB_BOX_QTY__by__WAYBILL_NUMBER(HAWB); logger.Debug("LoadHouseWaybillsDatabaseData HAWB_BOX_QTY__by__WAYBILL_NUMBER WAYBILL_NUMBER end"); double HAWB_BOX_QTY = Convert.ToDouble(hawbTable.Rows[0]["HAWB_BOX_QTY"].ToString()); newRow.HAWB_BOX_QTY = HAWB_BOX_QTY; logger.Debug("LoadHouseWaybillsDatabaseData HAWB_UNIT_QTY__by__WAYBILL_NUMBER WAYBILL_NUMBER begin"); hawbTable = EditsSqlProc.HAWB_UNIT_QTY__by__WAYBILL_NUMBER(HAWB); logger.Debug("LoadHouseWaybillsDatabaseData HAWB_UNIT_QTY__by__WAYBILL_NUMBER WAYBILL_NUMBER end"); double HAWB_UNIT_QTY = Convert.ToDouble(hawbTable.Rows[0]["HAWB_UNIT_QTY"].ToString()); newRow.HAWB_UNIT_QTY = HAWB_UNIT_QTY; //CUR DATA // newRow.CURRENT_DATE = DateTime.Today; newRow.CURRENT_DATE = DateTime.Today.ToString("yyyy-MM-dd"); // newRow.ACTUAL_SHIPDATE = Convert.ToDateTime(packIDTable.Rows[0]["ACTUAL_SHIPDATE"]); houseWaybillsList.HOUSE_WAYBILL.Rows.Add(newRow); logger.Debug("LoadHouseWaybillsDatabaseData bsam InternalID__from__v_PAKComn__by__waybill_number begin"); DataTable waybillTable = EditsSqlProc.InternalID__from__v_PAKComn__by__waybill_number(waybill_number); logger.Debug("LoadHouseWaybillsDatabaseData bsam InternalID__from__v_PAKComn__by__waybill_number end"); int indexInternalID = 0; foreach (DataRow w in waybillTable.Rows){ string tmpid = w["InternalID"].ToString(); logger.Debug("LoadHouseWaybillsDatabaseData bsam [v_PAKComn] begin"); DataTable dt = EditsSqlProc.v_PAKComn__by__InternalID(tmpid); logger.Debug("LoadHouseWaybillsDatabaseData bsam [v_PAKComn] end"); if ((dt==null) || (dt.Rows.Count==0)){ logger.Error("LoadHouseWaybillsDatabaseData bsam [v_PAKComn] InternalID , no data in PAK_PackkingData for InternalID "+tmpid); continue; } HOUSE_WAYBILLS.PACK_ID_LINE_ITEMRow newLineRow = houseWaybillsList.PACK_ID_LINE_ITEM.NewPACK_ID_LINE_ITEMRow(); //newLineRow.PACK_ID_LINE_ITEM_Id = indexInternalID; newLineRow.HOUSE_WAYBILL_Id = index; foreach (DataColumn column in houseWaybillsList.PACK_ID_LINE_ITEM.Columns) { if (dt.Columns.Contains(column.ColumnName)) { newLineRow[column] = dt.Rows[0][column.ColumnName]; } else { if (column.DataType == typeof(string)) newLineRow[column] = string.Empty; else if (column.DataType == typeof(Double)) newLineRow[column] = 0; else if (column.DataType == typeof(DateTime)) newLineRow[column] = string.Empty; } } indexInternalID++; houseWaybillsList.PACK_ID_LINE_ITEM.Rows.Add(newLineRow); } index++; } /*} else if (Consolidate.Trim() == "") { }*/ //populate mini tables //set this dataset to HouseWaybills so we can outputXML this.m_DataSet = houseWaybillsList; logger.Debug("LoadHouseWaybillsDatabaseData end"); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); HOUSE_WAYBILLS ds = new HOUSE_WAYBILLS(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "PACK_ID_LINE_ITEMDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }