private List<order_header> GetOrderHeader(int ServiceProviderId)
        {
            List<order_header> ReturnList = new List<order_header>();
            foreach (OrderHeader oh in SyncClient.GetOrderHeader(GetFromDate, DateTimeNow, ServiceProviderId))
            {
                order_header tmp = QueryOrderHeader(oh.Id);
                Boolean NewValue = false;
                if (tmp == null)
                {
                    tmp = new order_header();
                    NewValue = true;
                }
                tmp.createdAt = System.DateTime.Parse(oh.CreateDat);
                tmp.currency_code = oh.CurrencyCode;
                tmp.customer_note = oh.CustomerNote;
                tmp.Id = oh.Id;
                tmp.ip_address = oh.IpAddress;
                tmp.orderpayment_type = oh.OrderpaymentType;
                tmp.order_state_id = oh.OrderStateId;
                tmp.sow_user_id = oh.SowUserId;
                tmp.subtotal = oh.Subtotal;
                tmp.subtotal_ex_tax = oh.SubtotalExTax;
                tmp.tax = oh.Tax;
                tmp.total = oh.Total;

                if (NewValue)
                {
                    dbContext.Set<order_header>().Add(tmp);
                }
                dbContext.SaveChanges();

                ReturnList.Add(tmp);
            }
            return ReturnList;
        }
        private void SaveLogInterface(POSAirPortClassesDataContext _posDB, OrderHeader order, order_session new_session_order)
        {
            // order_header db save
            var new_order_header = new order_header();

            new_order_header.session_id    = new_session_order.id;
            new_order_header.order_type    = order.Flight.Terminal;
            new_order_header.member_id     = order.NewOrder.MemberID;
            new_order_header.full_name     = order.Billing.FirstName + " " + order.Billing.LastName;
            new_order_header.passport_no   = order.Billing.PassportNo;
            new_order_header.country       = order.Billing.CountryCode;
            new_order_header.airport_code  = order.Flight.AirportCode;
            new_order_header.terminal_code = order.Flight.Terminal;
            new_order_header.airline_code  = order.Flight.AirlineCode;
            new_order_header.flight_code   = order.Flight.FlightCode;
            new_order_header.flight_no     = order.Flight.FlightCode;
            //new_order_header.flight_
            new_order_header.reference_1 = "";
            new_order_header.reference_2 = "";
            new_order_header.reference_3 = "";
            new_order_header.remark      = "";
            new_order_header.create_date = DateTime.Now;
            _omDB.order_headers.InsertOnSubmit(new_order_header);
            _omDB.SubmitChanges();

            // db save new order_detail and order_discount
            foreach (var item in order.Items.Select((value, index) => new { Value = value, Index = index }))
            {
                order_detail new_item = new order_detail();
                new_item.header_id       = new_order_header.id;
                new_item.line_no         = item.Index + 1;
                new_item.sub_order_type  = "I";
                new_item.article_code    = item.Value.MaterialCode;
                new_item.quantity        = item.Value.Quantity;
                new_item.selling_price   = item.Value.SellingPrice;
                new_item.total_amt       = item.Value.Amount;
                new_item.dis_rate        = item.Value.DiscountRate;
                new_item.dis_amt         = item.Value.Discount;
                new_item.dis_pro_code    = item.Value.PromoCode;
                new_item.sp_dis_amt      = item.Value.SPDiscount;
                new_item.sp_dis_rate     = item.Value.SPDiscountRate;
                new_item.sp_dis_pro_code = item.Value.SPPromoCode;
                new_item.net_amt         = item.Value.TotalNet;
                new_item.reference_1     = "";
                new_item.reference_2     = "";
                new_item.reference_3     = "";

                _omDB.order_details.InsertOnSubmit(new_item);
                _omDB.SubmitChanges();
            }
            // new df_payment_onl
            var master_paymath = _posDB.df_paymeths.ToList();

            foreach (var payment in order.Payments.Select((value, index) => new { Value = value, Index = index }))
            {
                decimal amt_curr = 0;
                var     paymath  = master_paymath.FirstOrDefault(x => x.method_code.Trim() == payment.Value.Code.Trim());
                if (paymath != null)
                {
                    if (paymath.check_voucher || paymath.is_cashcard)
                    {
                        amt_curr = 0;
                    }
                    else
                    {
                        amt_curr = payment.Value.Amount * 1;
                    }
                }

                order_payment new_payment = new order_payment();
                new_payment.header_id          = new_order_header.id;
                new_payment.payment_type       = payment.Value.Code;
                new_payment.paymemt_agent      = "";
                new_payment.paymemt_session_id = "";
                new_payment.paymemt_ref_no     = "";
                new_payment.payment_code       = payment.Value.Code;
                new_payment.paymemt_amt        = payment.Value.Amount;
                new_payment.paymemt_datetime   = DateTime.Now;
                _omDB.order_payments.InsertOnSubmit(new_payment);
                _omDB.SubmitChanges();
            }
        }