//Methods
        #region Page_Load
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_PreRender(object sender, EventArgs e)
        {
            try
            {
                this.SenderCompanyLiteral.Text = ShopperConfiguration.Default.Mandantor.Company;
                this.SenderStreetLiteral.Text  = ShopperConfiguration.Default.Mandantor.StreetWithNumber;
                this.SenderCityLiteral.Text    = $"{ShopperConfiguration.Default.Mandantor.CountryIso2}-{ShopperConfiguration.Default.Mandantor.ZipWithCity}";

                Mailing current = this.RequestAddOn.Query.Mailing;

                MailingCostCountry country     = MailingCostCountry.LoadByName(current.RecepientCountry);
                String             countryName = country == null ? current.RecepientCountry : country.Name;

                this.NameLabel.Text     = current.RecepientName;
                this.Address1Label.Text = current.RecepientStreet1;
                this.Address2Label.Text = current.RecepientStreet2;
                this.CityLabel.Text     = current.RecepientPostcode + " " + current.RecepientCity;
                this.CountryLabel.Text  = countryName;
            }
            catch (Exception ex)
            {
                this.ErrorLabel.Text = ex.DeepParse();
            }
        }
        protected void PageRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var ee = new PageRepeaterItemEventArgs(e);

            ee.CompanyLiteral.Text     = ShopperConfiguration.Default.Mandantor.Company;
            ee.StreetLiteral.Text      = ShopperConfiguration.Default.Mandantor.Street;
            ee.ZipCityLiteral.Text     = ShopperConfiguration.Default.Mandantor.ZipWithCity;
            ee.PhoneLiteral.Text       = ShopperConfiguration.Default.Mandantor.Phone;
            ee.FaxLiteral.Text         = ShopperConfiguration.Default.Mandantor.Fax;
            ee.WebUrlLiteral.Text      = ShopperConfiguration.Default.Mandantor.WebUrl;
            ee.EmailLiteral.Text       = ShopperConfiguration.Default.Mandantor.Email;
            ee.FullAddressLiteral.Text = ShopperConfiguration.Default.Mandantor.FullAddress;
            ee.TaxLiteral.Text         = ShopperConfiguration.Default.Mandantor.Tax.Replace("|", "<br/>");
            ee.BankLiteral.Text        = ShopperConfiguration.Default.Mandantor.Bank.Replace("|", "<br/>");

            if (ee.Data != null)
            {
                var validInvoiceAddress = ee.Data.Invoice.Sales.FirstOrDefault(runner => runner.HasValidInvoiceAddress);

                if (validInvoiceAddress != null)
                {
                    ee.InvoiceAddressPanel.Visible = true;
                    ee.InvoiceNameLabel.Text       = ee.Data.Invoice.InvoiceName;
                    ee.InvoiceAddress1Label.Text   = ee.Data.Invoice.InvoiceStreet1;
                    ee.InvoiceAddress2Label.Text   = ee.Data.Invoice.InvoiceStreet2;
                    ee.InvoiceCountryLabel.Text    = ee.Data.Invoice.InvoiceCountry;
                    ee.InvoicePostcodeLabel.Text   = ee.Data.Invoice.InvoicePostcode;
                    ee.InvoiceCityLabel.Text       = ee.Data.Invoice.InvoiceCity;
                }
                else
                {
                    ee.InvoiceAddressPanel.Visible = false;
                }

                ee.InvoiceCopyLiteral.Text = ee.Data.IsCopy ? "* Copy" : String.Empty;

                ee.InvoiceNumberLabel.Text   = ee.Data.Invoice.InvoiceNumber;
                ee.ProtocoleNumberLabel.Text = ee.Data.Invoice.ProtocolNumbers;
                ee.InvoiceDateLabel.Text     = ee.Data.Invoice.InvoiceDate.ToShortDateString();
                ee.ShippingDateLabel.Text    = ee.Data.Invoice.DeliveryDate.ToShortDateString();

                ee.TaxTableHeadLiteral.Visible   = !(ee.Data.Invoice.HideNetPrices);
                ee.GrossTableHeadLiteral.Visible = !(ee.Data.Invoice.HideNetPrices);

                ee.TotalNetRow.Visible         = !(ee.Data.Invoice.HideNetPrices);
                ee.TotalNetCaptionLiteral.Text = ee.Data.NextPage == null ? "Total (net)" : "Subtotal (net)";
                ee.TotalNetLabel.Text          = ee.Data.TotalPriceNet.ToString("0.00");

                ee.TotalTaxRow.Visible = !(ee.Data.Invoice.HideGrossPrice || ee.Data.Invoice.HideNetPrices || !this.IsLastPage(e.Item.ItemIndex));
                ee.TotalTaxLabel.Text  = ee.Data.SalesTaxes.ToString("0.00");

                MailingCostCountry country = MailingCostCountry.LoadByName(ee.Data.Invoice.InvoiceCountry);
                if (country != null && country.DhlProductCode == DhlZones.World && !ee.Data.Invoice.HideGrossPrice)
                {
                    //Patch (brutto for netto) in case of foreign recepients
                    ee.TotalGrossCaptionLiteral.Text = ee.Data.NextPage == null ? "Total (net)" : "Subtotal (net)";
                }
                else
                {
                    ee.TotalGrossRow.Visible         = !(ee.Data.Invoice.HideGrossPrice || !this.IsLastPage(e.Item.ItemIndex));
                    ee.TotalGrossCaptionLiteral.Text = ee.Data.NextPage == null ? "Subtotal (gross)" : "Subtotal (gross)";
                }
                ee.TotalGrossLabel.Text = ee.Data.TotalPriceGross.ToString("0.00");

                ee.TypeOfDocumentLiteral.Text = this.RequestAddOn.Query.DocumentType == DocumentTypes.Invoice ? "Invoice" : "Invoice cancellation";

                ee.UstIdNrRow.Visible = ee.Data.Invoice.HideGrossPrice;
                ee.UstIdNrLabel.Text  = ee.Data.Invoice.UstIdNr;

                ee.ItemRepeater.DataSource = ee.Data.InvoiceItems;
                ee.ItemRepeater.DataBind();

                var allPaidWithPayPal = ee.Data.Invoice.Sales.All(runner => runner.PaidWithPayPal);
                ee.BankPanel.Visible = !allPaidWithPayPal;
            }
        }
示例#3
0
        protected void MailingRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                MailingRepeaterItemEventArgs ee = new MailingRepeaterItemEventArgs(e);

                if (ee.Data != null)
                {
                    ee.RowCheckBox.Value       = ee.Data.Id.ToString();
                    ee.DetailsLink.NavigateUrl = PageUrlAttribute.Get <Mailings.Details>(new Mailings.Details.Query()
                    {
                        Mailing    = ee.Data,
                        SearchTerm = this.RequestAddOn.Query.SearchTerm
                    });
                    ee.EditLink.NavigateUrl = PageUrlAttribute.Get <Mailings.Edit>(new Mailings.Edit.Query()
                    {
                        Mailing    = ee.Data,
                        SearchTerm = this.RequestAddOn.Query.SearchTerm
                    });
                    ee.PrintLabelButton.CommandArgument      = ee.Data.Id.ToString();
                    ee.ToggleDeliveredButton.Text            = ee.Data.DateOfShipping.HasValue ? StringTable.NotSent : StringTable.Sent;
                    ee.ToggleDeliveredButton.CommandArgument = ee.Data.Id.ToString();

                    if (ee.Data.ShippingMethod == ShippingMethods.Undecided)
                    {
                        ee.MailingCell.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#a03e3e");
                        ee.MailingCell.Style.Add(HtmlTextWriterStyle.Color, "white");
                    }

                    ee.MailingCompanyLabel.Text = ee.Data.MailingCompany;

                    if (ee.Data.ShippingMethod == ShippingMethods.DHL)
                    {
                        if (MailingCostCountry.LoadByName(ee.Data.RecepientCountry) == null)
                        {
                            ee.MailingCompanyLabel.Text     += " Land unbekannt";
                            ee.MailingCompanyLabel.ForeColor = System.Drawing.Color.Red;
                        }
                    }

                    ee.TrackingNumberHyperLink.Text = String.IsNullOrEmpty(ee.Data.TrackingNumber) ? "keine Versandnummer" : ee.Data.TrackingNumber;
                    if (!String.IsNullOrEmpty(ee.Data.TrackingNumber))
                    {
                        switch (ee.Data.ShippingMethod)
                        {
                        case ShippingMethods.DPD:
                        {
                            ee.TrackingNumberHyperLink.NavigateUrl = String.Format("https://tracking.dpd.de/parcelstatus?query={0}&locale=de_DE", ee.Data.TrackingNumber);
                            break;
                        }

                        case ShippingMethods.DHL:
                        {
                            ee.TrackingNumberHyperLink.NavigateUrl = String.Format("https://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc={0}&rfn=&extendedSearch=true", ee.Data.TrackingNumber);
                            break;
                        }
                        }
                    }
                    ee.PackstationLabel.Text = ee.Data.IsDeliveredToPackstation ? "Packstation" : String.Empty;

                    ee.SaleItemRepeater.DataSource = ee.Data.GetAllSaleItemsOfAllSalesGrouped(false);
                    ee.SaleItemRepeater.DataBind();
                    ee.NotesLabel.Text                 = ee.Data.Notes.Replace(Environment.NewLine, "<br/>");
                    ee.DeliveredCheckBox.Checked       = ee.Data.DateOfShipping.HasValue;
                    ee.InvoiceCheckBox.Checked         = ee.Data.Sales.AreAllBilled();
                    ee.ProtocoleNumberLabel.Text       = ee.Data.ProtocoleNumbers.Replace(Environment.NewLine, "<br/>");
                    ee.MailingCostsSenderLabel.Text    = ee.Data.MailingCostsSender.ToString("C");
                    ee.MailingCostsRecepientLabel.Text = ee.Data.MailingCostsRecepient.ToString("C");
                    ee.TotalPriceLabel.Text            = ee.Data.TotalPriceGross.ToString("C");
                    ee.RecepientCountryLabel.Text      = ee.Data.RecepientCountry;
                    ee.TotalWeightLabel.Text           = (ee.Data.TotalWeight / 1000).ToString();
                    ee.SaleDatesLabel.Text             = ee.Data.SaleDates.Replace(Environment.NewLine, "<br/>");
                    ee.RecepientLabel1.Text            = ee.Data.RecepientName;
                    ee.RecepientLabel2.Text            = ee.Data.RecepientEmail;
                    ee.DeleteButton.CommandArgument    = ee.Data.Id.ToString();

                    //TODO: DHL
                    //if (ee.Data.DHLStatus != null)
                    //{
                    //    ee.DHLTrackNumber.Text = ee.Data.Id.ToString();
                    //    ee.DHLStatusImage.Visible = true;
                    //    if (ee.Data.DHLStatus.Contains("0: ok"))
                    //    {
                    //        ee.DHLStatusImage.ImageUrl = "~/Styles/checkmark.png";
                    //    }

                    //    if (ee.Data.DHLTrackingNumber != null)
                    //    {
                    //        ee.DHLLabelLink.Visible = true;
                    //        ee.DHLLabelLink.NavigateUrl = ee.Data.DHLLabelUrl;

                    //        //Liegt evtl. eine Warning vor?
                    //        var splitMessage = ee.Data.DHLStatus.Split("\r\n");
                    //        if (splitMessage.Count() > 2)
                    //        {
                    //            ee.DHLWarning.Visible = true;
                    //            ee.DHLWarning.ToolTip = ee.Data.DHLStatus;
                    //            ee.DHLWarning.ImageUrl = "~/Styles/warning.png";
                    //        }

                    //    }
                    //    else
                    //    {
                    //        ee.DHLStatusImage.ImageUrl = "~/Styles/cancel.png";
                    //        ee.DHLStatusImage.ToolTip = ee.Data.DHLStatus;
                    //    }

                    //}
                }
            }
            catch (Exception ex)
            {
                this.Master.ShowError(ex);
            }
        }