Пример #1
0
        public Orders(bool useLazyLoading)
        {
            InitializeComponent();

            order        = new OrdersTableMetadata();
            orderPersist = new OrderPersistentObject(SharedData.DatabaseServer, SharedData.ConnectionString, order);

            this.useLazyLoading = useLazyLoading;
        }
Пример #2
0
        private void comboBoxOrdersId_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            try
            {
                int selectedIndex = this.comboBoxOrdersId.SelectedIndex;

                if (this.useLazyLoading == false)
                {
                    this.order = this.orders[selectedIndex];
                }
                else
                {
                    object value = this.comboBoxOrdersId.SelectedItem;

                    //lazy load data for the current order
                    this.order = (OrdersTableMetadata)this.orderPersist.GetTableMetadata(value);
                }


                this.textBoxCustomerId.Text = this.order.CustomerID;
                this.textBoxEmployeeId.Text = this.order.EmployeeID.ToString();

                this.dateTimePickerOrderDate.Value    = this.order.OrderDate;
                this.dateTimePickerRequiredDate.Value = this.order.RequiredDate;
                this.dateTimePickerShippedDate.Value  = this.order.ShippedDate;
                this.textBoxFreight.Text     = this.order.Freight.ToString();
                this.textBoxShipAddress.Text = this.order.ShipAddress;
                this.textBoxShipCity.Text    = this.order.ShipCity;
                this.textBoxShipCountry.Text = this.order.ShipCountry;
                this.textBoxShipName.Text    = this.order.ShipName;

                if (this.order.IsNull("ShipVia"))
                {
                    this.textBoxShippedVia.Text = "";
                }
                else
                {
                    this.textBoxShippedVia.Text = this.order.ShipVia.ToString();
                }


                if (this.order.IsNull("ShipPostalCode"))
                {
                    this.textBoxShipPostalCode.Text = "";
                }
                else
                {
                    this.textBoxShipPostalCode.Text = this.order.ShipPostalCode;
                }

                if (this.order.IsNull("ShipRegion"))
                {
                    this.textBoxShipRegion.Text = "";
                }
                else
                {
                    this.textBoxShipRegion.Text = this.order.ShipRegion;
                }
                this.LoadDetails();
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }