Example #1
0
        public void SetCorrectLocationCashLedger()
        {
            ModelTMSContainer ControlObjectContext = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);
            Location          loc = ControlObjectContext.GetObjectByKey(new EntityKey("ModelTMSContainer.LocationSet", "Id", Guid.Parse(ComboBoxWeighingLocation.SelectedValue))) as Location;

            ComboBoxLedger.DataBind();
            ListItem li = ComboBoxLedger.Items.FindByValue(loc.CashLedger.Id.ToString());

            if (li != null)
            {
                li.Selected = true;
            }
        }
        public void ShowCorrectElements()
        {
            PanelCustomerInformation.Enabled = false;
            PanelRentOverview.Enabled        = false;
            PanelInvoice.Enabled             = false;
            PanelCreatedInvoice.Enabled      = false;
            PanelCustomerInformation.Visible = true;
            PanelRentOverview.Visible        = false;
            PanelInvoice.Visible             = false;
            PanelCreatedInvoice.Visible      = false;

            ButtonPrevious.Visible      = false;
            ButtonNext.Visible          = false;
            ButtonProcess.Visible       = false;
            ButtonUnprocess.Visible     = false;
            ButtonNewRentReturn.Visible = false;

            FrameShowInvoiceA.Visible = false;

            URLPopUpControlOpenInvoice.Visible = false;

            try
            {
                switch (PageNr)
                {
                case 1:
                    PanelCustomerInformation.Enabled = true;
                    ButtonNext.Visible = true;
                    break;

                case 2:
                    PanelRentOverview.Enabled = true;
                    PanelRentOverview.Visible = true;
                    ButtonPrevious.Visible    = true;
                    ButtonNext.Visible        = true;
                    break;

                case 3:
                    PanelRentOverview.Visible = true;
                    PanelInvoice.Visible      = true;
                    PanelInvoice.Enabled      = true;

                    ButtonPrevious.Visible = true;

                    // check if there is at least one rental item activity selected, otherwise inform user & cycle back
                    if (AmountOfRentalItemsSelected() <= 0)
                    {
                        Common.InformUser(Page, "U dient minimaal één verhuring te selecteren.");
                        PageNr--;
                        ShowCorrectElements();
                    }
                    else
                    {
                        // otherwise enable correct checboxes for invoices
                        CheckBoxDisableDamagedAndLost.Visible = NrOfDamagedOrLostItems() > 0;

                        CheckBoxInvoice.Visible = NrOfUnInvoicedItems() > 0;

                        CheckBoxBailReturn.Visible = NrOfInvoicedItems() > 0;
                        LabelBailAmount.Visible    = CheckBoxBailReturn.Visible;
                        TextBoxBail.Visible        = CheckBoxBailReturn.Visible;

                        ButtonProcess.Visible = true;

                        ComboBoxLedger.DataBind();
                    }

                    break;

                case 4:
                    PanelRentOverview.Visible   = true;
                    PanelInvoice.Visible        = true;
                    PanelCreatedInvoice.Visible = LabelInvoiceId.Text != "";
                    ButtonUnprocess.Visible     = true;
                    ButtonNewRentReturn.Visible = true;

                    if (LabelInvoiceId.Text != "")
                    {
                        URLPopUpControlOpenInvoice.Visible    = true;
                        URLPopUpControlOpenInvoice.URLToPopup = "WebFormPopup.aspx?UC=InvoiceBase&Id=" + LabelInvoiceId.Text;
                        FrameShowInvoiceA.Attributes["src"]   = "WebFormPopup.aspx?UC=ShowReport&d=DataSetInvoice&r=ReportInvoiceRentA4&Id=" + LabelInvoiceId.Text;
                        FrameShowInvoiceA.Visible             = true;
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                // inform user
                Common.InformUserOnGeneralFail(ex, Page, "Het scherm kan niet goed worden getoond. Mogelijk heeft iemand anders de onderliggende gegevens gewijzigd. Ga niet door maar begin opnieuw met deze actie door deze uit het rechtermenu te kiezen.");
            }
        }