public string buildUpDIS(DisEntity msgEntity, string msgType, string subType) { string strAWB = ""; strAWB = base.buildUpBase(msgEntity, msgType, subType); string disTime = msgEntity.arrFlightMasterDate.ToString("dd") + transMonth(msgEntity.arrFlightMasterDate.ToString("MM")); disTime += msgEntity.arrCargoDate.ToString("HH") + msgEntity.arrCargoDate.ToString("mm"); string weightFormatted = string.Format("{0:0.0}", msgEntity.weightRCF); char shipmentCode = replaceShipmentIndicator(msgEntity.shipmentIndicatorRCF[0]); strAWB += msgEntity.prefix + "-" + msgEntity.awb + msgEntity.origin + msgEntity.dest + "/" + msgEntity.pcsRCF + "\r\n"; strAWB += subType.ToUpper() + "/" + msgEntity.flightNo + "/" + disTime + "/" + msgEntity.destFlight + "/" + msgEntity.disType + "/" + shipmentCode + msgEntity.pcsRCF + "K" + weightFormatted + "\r\n"; if (msgEntity.disOsi != null && msgEntity.disOsi != string.Empty) { strAWB += "OSI/"; if (msgEntity.disOsi.Length > 65) { strAWB += msgEntity.disOsi.Substring(0, 65) + "\r\n"; strAWB += "/" + msgEntity.disOsi.Substring(65, msgEntity.disOsi.Length > 130 ? 130 : msgEntity.disOsi.Length); } else { strAWB += msgEntity.disOsi; } } return(strAWB); }
public string buildUpDIS(DisEntity msgEntity, string msgType, string subType) { if (msgEntity.weightRCF == 0) throw new Exception("DIS: weight is 0. QueueID: " + msgEntity.queueId); string strAWB = ""; strAWB = base.buildUpBase(msgEntity, msgType, subType); char shipmentCode = replaceShipmentIndicator(msgEntity.shipmentIndicatorRCF[0]); string disTime = msgEntity.arrFlightMasterDate.ToString("dd") + transMonth(msgEntity.arrFlightMasterDate.ToString("MM")); disTime += msgEntity.arrCargoDate.ToString("HH") + msgEntity.arrCargoDate.ToString("mm"); strAWB += msgEntity.disPrefix + "-" + msgEntity.disAWB + msgEntity.origin + msgEntity.dest + "/T" + msgEntity.manPcs + "\r\n"; strAWB += subType.ToUpper() + "/" + msgEntity.flightNo + "/" + disTime + "/" + msgEntity.destFlight + "/" + msgEntity.disType + "/"; if(msgEntity.disType == "FDAW" || msgEntity.disType == "MDAW") { strAWB += "T" + msgEntity.manPcs + "K" + string.Format("{0:0.0}", msgEntity.weightRCF) + "\r\n"; } else if(msgEntity.disType == "MSCA") { int tempPCs = msgEntity.manPcs - msgEntity.locPcs; if(tempPCs < 0) throw new Exception("DIS: Missing Pc is less than zero. QueueID: " + msgEntity.queueId); double tempWeight = (msgEntity.weightRCF / msgEntity.manPcs) * tempPCs; strAWB += "P" + msgEntity.locPcs+ "K" + string.Format("{0:0.0}", tempWeight) + "\r\n"; } else if (msgEntity.disType == "FDCA") { int tempPCs = msgEntity.locPcs - msgEntity.manPcs; if (tempPCs < 0) throw new Exception("DIS: Found Pc is less than zero. QueueID: " + msgEntity.queueId); double tempWeight = (msgEntity.weightRCF / msgEntity.manPcs) * tempPCs; strAWB += "P" + msgEntity.locPcs + "K" + string.Format("{0:0.0}", tempWeight) + "\r\n"; } else { if(msgEntity.locPcs == 0) } if (msgEntity.disOsi != null && msgEntity.disOsi != string.Empty) { strAWB += "OSI/"; if (msgEntity.disOsi.Length > 65) { strAWB += msgEntity.disOsi.Substring(0, 65) + "\r\n"; strAWB += "/" + msgEntity.disOsi.Substring(65, msgEntity.disOsi.Length > 130 ? 130 : msgEntity.disOsi.Length); } else { strAWB += msgEntity.disOsi; } } return strAWB; }
public string buildUpDIS(DisEntity msgEntity, string msgType, string subType) { string strAWB = ""; if (msgEntity.weightRCF == 0) { throw new Exception("No Message recipient is present msg QueueID: " + msgEntity.queueId); } strAWB = base.buildUpBase(msgEntity, msgType, subType); string disTime = msgEntity.arrFlightMasterDate.ToString("dd") + transMonth(msgEntity.arrFlightMasterDate.ToString("MM")); disTime += msgEntity.arrCargoDate.ToString("HH") + msgEntity.arrCargoDate.ToString("mm"); char shipmentCode = replaceShipmentIndicator(msgEntity.shipmentIndicatorRCF[0]); strAWB += msgEntity.disPrefix + "-" + msgEntity.disAWB + msgEntity.origin + msgEntity.dest + "/T" + msgEntity.manPcs + "\r\n"; strAWB += subType.ToUpper() + "/" + msgEntity.flightNo + "/" + disTime + "/" + msgEntity.destFlight + "/" + msgEntity.disType + "/"; if (msgEntity.disType == "FDAW" || msgEntity.disType == "MDAW") { strAWB += "T" + msgEntity.manPcs + "K" + string.Format("{0:0.0}", msgEntity.weightRCF) + "\r\n"; } else if (msgEntity.disType == "MSCA") { int missingPCs = msgEntity.manPcs - msgEntity.locPcs; } else if (msgEntity.disType == "FDCA") { } else { } if (msgEntity.disOsi != null && msgEntity.disOsi != string.Empty) { strAWB += "OSI/"; if (msgEntity.disOsi.Length > 65) { strAWB += msgEntity.disOsi.Substring(0, 65) + "\r\n"; strAWB += "/" + msgEntity.disOsi.Substring(65, msgEntity.disOsi.Length > 130 ? 130 : msgEntity.disOsi.Length); } else { strAWB += msgEntity.disOsi; } } return(strAWB); }
public DisEntity GetDISfromReader(BaseEntity baseEntity, IDataReader reader) { if (!reader.IsClosed) { reader.Read(); int manPcs = 0; try { pcs = Convert.ToInt32(reader["ManPcs"]); } catch { DisEntity disEntityEx = new DisEntity(); return(disEntityEx); } int locPcs = 0; try { pcs = Convert.ToInt32(reader["LocPcs"]); } catch { DisEntity disEntityEx = new DisEntity(); return(disEntityEx); } double weight = 0.00; try { weight = Convert.ToDouble(reader["weight"].ToString()); } catch (Exception e) { DisEntity disEntityEx = new DisEntity(); return(disEntityEx); } //int pcs = 0; try { pcs = (int)reader["Pcs"]; } catch { } //double weight = 0.00; try { weight = Convert.ToDouble(reader["Weight"].ToString()); } //catch (Exception e) { } try { DisEntity disEntity = new DisEntity( baseEntity, reader["flightNo"].ToString().Trim(), reader["Prefix"].ToString().Trim(), reader["AWB"].ToString().Trim(), manPcs, locPcs, weight, reader["Partial"].ToString().Trim(), Convert.ToDateTime(reader["arrDate"]), Convert.ToDateTime(reader["arrFlightMasterDate"]), reader["disType"].ToString().Trim(), reader["disOsi"].ToString().Trim() ); reader.Close(); reader.Dispose(); disConnect_dbcn_ExcuteReader(); return(disEntity); } catch (Exception ex) { DisEntity disEntityEx = new DisEntity(); reader.Close(); reader.Dispose(); disConnect_dbcn_ExcuteReader(); return(disEntityEx); } } else { DisEntity disEntityEx = new DisEntity(); reader.Close(); reader.Dispose(); disConnect_dbcn_ExcuteReader(); return(disEntityEx); } }