Beispiel #1
0
 private void Activity_Reset_Click(object sender, EventArgs e)//活动申请重置
 {
     Activity_Name.Clear();
     Activity_Place.Clear();
     Activity_Description.Clear();
     Activity_Budget.Clear();
     Activity_FuzerenID.Clear();
     Activity_Start.Checked  = false;
     Activity_Finish.Checked = false;
 }
Beispiel #2
0
        private Container UpdateR4(Container container, int msg_idnum)
        {
            bool   isLocationIdentifierExist = false;
            bool   isPortNameExist           = false;
            string logMsg = "";

            foreach (R4 r4 in r4_list)
            {
                switch (r4.port_terminal_function_code)
                {
                case "R":
                    //If location qualifier presents, location identifier must be present also.
                    container.place_of_receipt_location_qualifier = r4.location_qualifier;

                    if (r4.location_identifier != null)
                    {
                        container.place_of_receipt_location_identifier = r4.location_identifier;
                        isLocationIdentifierExist = true;
                    }
                    if (r4.port_name != null)
                    {
                        container.place_of_receipt_portname = r4.port_name;
                        isPortNameExist = true;
                    }

                    //Either one of these or both must exist; Otherwise invalid format
                    if (isLocationIdentifierExist == false && isPortNameExist == false)
                    {
                        logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                                  "Both location identification and port name do not exist");
                        util.insertLog_text(logMsg);
                        break;
                    }

                    container.place_of_receipt_country  = r4.country_code;
                    container.place_of_receipt_datetime = util.changeDateTimeFormat(r4.dtm.date, r4.dtm.time);
                    break;

                case "L":
                    //If location qualifier presents, location identifier must be present also.
                    container.port_of_loading_location_qualifier = r4.location_qualifier;

                    if (r4.location_identifier != null)
                    {
                        container.port_of_loading_location_identifier = r4.location_identifier;
                        isLocationIdentifierExist = true;
                    }
                    if (r4.port_name != null)
                    {
                        container.port_of_loading_portname = r4.port_name;
                        isPortNameExist = true;
                    }

                    //Either one of these or both must exist; Otherwise invalid format
                    if (isLocationIdentifierExist == false && isPortNameExist == false)
                    {
                        logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                                  "Both location identifier and port name do not exist");
                        util.insertLog_text(logMsg);
                        break;
                    }

                    container.port_of_loading_country  = r4.country_code;
                    container.port_of_loading_datetime = util.changeDateTimeFormat(r4.dtm.date, r4.dtm.time);
                    break;

                case "D":
                    //If location qualifier presents, location identifier must be present also.
                    container.port_of_discharge_location_qualifier = r4.location_qualifier;

                    if (r4.location_identifier != null)
                    {
                        container.port_of_discharge_location_identifier = r4.location_identifier;
                        isLocationIdentifierExist = true;
                    }
                    if (r4.port_name != null)
                    {
                        container.port_of_discharge_portname = r4.port_name;
                        isPortNameExist = true;
                    }

                    //Either one of these or both must exist; Otherwise invalid format
                    if (isLocationIdentifierExist == false && isPortNameExist == false)
                    {
                        logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                                  "Both location identification and port name do not exist");
                        util.insertLog_text(logMsg);
                        break;
                    }

                    container.port_of_discharge_country  = r4.country_code;
                    container.port_of_discharge_datetime = util.changeDateTimeFormat(r4.dtm.date, r4.dtm.time);
                    break;

                case "E":
                    //If location qualifier presents, location identifier must be present also.
                    container.place_of_delivery_location_qualifier = r4.location_qualifier;

                    if (r4.location_identifier != null)
                    {
                        container.place_of_delivery_location_identifier = r4.location_identifier;
                        isLocationIdentifierExist = true;
                    }
                    if (r4.port_name != null)
                    {
                        container.place_of_delivery_portname = r4.port_name;
                        isPortNameExist = true;
                    }

                    //Either one of these or both must exist; Otherwise invalid format
                    if (isLocationIdentifierExist == false && isPortNameExist == false)
                    {
                        logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                                  "Both location identification and port name do not exist");
                        util.insertLog_text(logMsg);
                        break;
                    }

                    container.place_of_delivery_country  = r4.country_code;
                    container.place_of_delivery_datetime = util.changeDateTimeFormat(r4.dtm.date, r4.dtm.time);
                    break;

                case "M":
                    //If location qualifier presents, location identifier must be present also.
                    container.MBL_destination_location_qualifier = r4.location_qualifier;

                    if (r4.location_identifier != null)
                    {
                        container.MBL_destination_location_identifier = r4.location_identifier;
                        isLocationIdentifierExist = true;
                    }
                    if (r4.port_name != null)
                    {
                        container.MBL_destination_portname = r4.port_name;
                        isPortNameExist = true;
                    }

                    //Either one of these or both must exist; Otherwise invalid format
                    if (isLocationIdentifierExist == false && isPortNameExist == false)
                    {
                        logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                                  "Both location identifier and port name do not exist");
                        util.insertLog_text(logMsg);
                        break;
                    }

                    container.MBL_destination_country  = r4.country_code;
                    container.MBL_destination_datetime = util.changeDateTimeFormat(r4.dtm.date, r4.dtm.time);
                    break;

                case "5":

                    Activity_Place activity_place = null;

                    activity_place = (context.Activity_Place.Where(x => x.activity_place_idnum == msg_idnum)).SingleOrDefault();

                    if (activity_place == null)
                    {
                        activity_place = new Activity_Place {
                            container_idnum = msg_idnum, created_date = DateTime.Now
                        };
                    }

                    if (r4.location_identifier != null)
                    {
                        activity_place.activity_place_location = r4.location_identifier;
                    }
                    if (r4.port_name != null)
                    {
                        activity_place.activity_place_portname = r4.port_name;
                    }

                    //Either one of these or both must exist; Otherwise invalid format
                    if (isLocationIdentifierExist == false && isPortNameExist == false)
                    {
                        logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                                  "Both location identification and port name do not exist");
                        util.insertLog_text(logMsg);
                        break;
                    }

                    activity_place.activity_place_country  = r4.country_code;
                    activity_place.activity_place_datetime = util.changeDateTimeFormat(r4.dtm.date, r4.dtm.time);
                    break;

                default:
                    logMsg = util.buildLogMsg("UpdateR4", "Invalid format: " +
                                              "There is no location qualifier in the message");
                    util.insertLog_text(logMsg);
                    break;
                }
            }
            return(container);
        }