public string buildUpRCF(RcfEntity msgEntity, string msgType, string subType)
        {
            string strAWB = "";

            strAWB = base.buildUpBase(msgEntity, msgType, subType);


            //string rcfTime = msgEntity.arrCargoDate.ToString("dd") + transMonth(msgEntity.arrCargoDate.ToString("MM")) +
            //                msgEntity.arrCargoDate.ToString("HH") + msgEntity.arrCargoDate.ToString("mm");

            /*TIMEZONE. 2015-07-02  */
            /*Local Time added      */

            // --> removed time zone. it is already local time 2016-1-13
            //int timezone = getTimezone(msgEntity.Lcode, msgEntity.queueId);
            //msgEntity.arrCargoDate = msgEntity.arrCargoDate.AddHours(timezone);

            // chagned. 2017-7-6
            //string rcfTime = msgEntity.arrCargoDate.ToString("dd") + transMonth(msgEntity.arrCargoDate.ToString("MM")) +
            //                msgEntity.arrCargoDate.ToString("HH") + msgEntity.arrCargoDate.ToString("mm");


            // modified. 2017-7-6. use flight date with day change indicator.
            string rcfTime = msgEntity.arrFlightMasterDate.ToString("dd") + transMonth(msgEntity.arrFlightMasterDate.ToString("MM"));

            rcfTime += msgEntity.arrCargoDate.ToString("HH") + msgEntity.arrCargoDate.ToString("mm");

            try
            {
                if (msgEntity.arrCargoDate.Day != msgEntity.arrFlightMasterDate.Day)
                {
                    #region Added 2017-03-06. Indicating day changes
                    switch (msgEntity.arrCargoDate.Day - msgEntity.arrFlightMasterDate.Day)
                    {
                    case -1:
                        rcfTime = rcfTime + "-P";
                        break;

                    case 1:
                        rcfTime = rcfTime + "-N";
                        break;

                    case 2:
                        rcfTime = rcfTime + "-S";
                        break;

                    case 3:
                        rcfTime = rcfTime + "-T";
                        break;

                    case 4:
                        rcfTime = rcfTime + "-A";
                        break;

                    case 5:
                        rcfTime = rcfTime + "-B";
                        break;

                    case 6:
                        rcfTime = rcfTime + "-C";
                        break;

                    case 7:
                        rcfTime = rcfTime + "-D";
                        break;

                    case 8:
                        rcfTime = rcfTime + "-E";
                        break;

                    case 9:
                        rcfTime = rcfTime + "-F";
                        break;

                    case 10:
                        rcfTime = rcfTime + "-G";
                        break;

                    case 11:
                        rcfTime = rcfTime + "-H";
                        break;

                    case 12:
                        rcfTime = rcfTime + "-I";
                        break;

                    case 13:
                        rcfTime = rcfTime + "-J";
                        break;

                    case 14:
                        rcfTime = rcfTime + "-K";
                        break;

                    case 15:
                        rcfTime = rcfTime + "-L";
                        break;
                    }
                    #endregion
                }
            }
            catch { }

            string weightFormatted = string.Format("{0:0.0}", msgEntity.weightRCF);
            char   shipmentCode    = replaceShipmentIndicator(msgEntity.shipmentIndicatorRCF[0]);

            // added for Realtime RCF. 2018-1-11
            if (subType.ToUpper() == "RTF")
            {
                subType = "RCF";
                if (msgEntity.pcs != msgEntity.pcsRCF)
                {
                    shipmentCode = 'P';
                }

                try
                {
                    double tempWeight = msgEntity.weight / msgEntity.pcs;
                }
                catch
                {
                    throw new Exception("DIS: DIS type is not matched. QueueID: " + msgEntity.queueId);
                }
            }

            strAWB += subType.ToUpper() + "/" + msgEntity.flightNo + "/" + rcfTime + "/" + msgEntity.destFlight + "/" +
                      shipmentCode + msgEntity.pcsRCF + "K" + weightFormatted + "\r\n";

            return(strAWB);
        }
Beispiel #2
0
        public RcfEntity GetRCFfromReader(BaseEntity baseEntity, IDataReader reader)
        {
            if (!reader.IsClosed)
            {
                reader.Read();


                int pcs = 0;
                try
                {
                    pcs = Convert.ToInt32(reader["pcs"]);
                }
                catch
                {
                    RcfEntity rcfEntityEx = new RcfEntity();
                    return(rcfEntityEx);
                }
                double weight = 0.00;

                try
                {
                    weight = Convert.ToDouble(reader["weight"].ToString());
                }
                catch (Exception e)
                {
                    RcfEntity rcfEntityEx = new RcfEntity();
                    return(rcfEntityEx);
                }

                //int pcs = 0; try { pcs = (int)reader["Pcs"]; } catch { }
                //double weight = 0.00; try { weight = Convert.ToDouble(reader["Weight"].ToString()); }
                //catch (Exception e) { }

                try
                {
                    RcfEntity rcfEntity = new RcfEntity(
                        baseEntity,
                        reader["flightNo"].ToString().Trim(),
                        pcs,
                        weight,
                        reader["Partial"].ToString().Trim(),
                        Convert.ToDateTime(reader["arrDate"]),
                        Convert.ToDateTime(reader["arrFlightMasterDate"])
                        );

                    reader.Close();
                    reader.Dispose();
                    disConnect_dbcn_ExcuteReader();
                    return(rcfEntity);
                }
                catch
                {
                    RcfEntity rcfEntityEx = new RcfEntity();

                    reader.Close();
                    reader.Dispose();
                    disConnect_dbcn_ExcuteReader();
                    return(rcfEntityEx);
                }
            }
            else
            {
                RcfEntity rcfEntity = new RcfEntity();

                reader.Close();
                reader.Dispose();
                disConnect_dbcn_ExcuteReader();
                return(rcfEntity);
            }
        }