//Methods
        #region Page_PreRender
        protected void Page_PreRender(object sender, EventArgs e)
        {
            this.CreateNewEntryLink.NavigateUrl = PageUrlAttribute.Get <MailingCosts.Edit>(new MailingCosts.Edit.Query());

            this.MailingCostRepeater.DataSource = MailingCostCountry.LoadAll();
            this.MailingCostRepeater.DataBind();
        }
Ejemplo n.º 2
0
        protected void SaveButton_Click(Object sender, EventArgs e)
        {
            try
            {
                var current = this.RequestAddOn.Query.MailingCostCountry;

                if (current == null)
                {
                    current = new MailingCostCountry();
                    MyDataContext.Default.MailingCostCountries.Add(current);
                }
                current.Name               = this.NameTextBox.Text;
                current.IsoCode2           = this.IsoCode2TextBox.Text;
                current.IsoCode3           = this.IsoCode3TextBox.Text;
                current.DpdCostsUnto4kg    = this.DpdCostsUnto4kgTextBox.Text.ToDecimal();
                current.DpdCostsUnto31_5kg = this.DpdCostsUnto31_5kgTextBox.Text.ToDecimal();
                current.DhlCosts           = this.DhlCostsTextBox.Text.ToDecimal();
                current.DhlProductCode     = (DhlZones)this.DhlProductCodeList.SelectedValue.ToInt32();
                current.HideNetPrices      = this.HideNetPricesCheckBox.Checked;

                MyDataContext.Default.SaveChanges();
                this.ResponseAddOn.Redirect <MailingCosts.Default>();
            }
            catch (Exception ex)
            {
                this.Master.ShowError(ex);
            }
        }
Ejemplo n.º 3
0
 //Methods
 #region Page_Load
 protected void Page_Load(Object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         this.RecepientCountryList.DataValueField = nameof(MailingCostCountry.IsoCode2);
         this.RecepientCountryList.DataTextField  = nameof(MailingCostCountry.Name);
         this.RecepientCountryList.DataSource     = MailingCostCountry.LoadAll()
                                                    .OrderBy(runner => runner.Name)
                                                    .ToList();
         this.RecepientCountryList.DataBind();
     }
 }
Ejemplo n.º 4
0
        //Initializers
        #region InitializeDatabase
        /// <summary>
        /// Initializes the database
        /// </summary>
        private void InitializeDatabase()
        {
            MailingCostCountry mailingCostCountry = new MailingCostCountry()
            {
                Name = "Germany", IsoCode2 = "DE", IsoCode3 = "DEU", DpdCostsUnto4kg = 4, DpdCostsUnto31_5kg = 15, DhlCosts = 0, DhlProductCode = DhlZones.Germany, HideNetPrices = false
            };

            MyDataContext.Default.MailingCostCountries.Add(mailingCostCountry);

            MaterialGroup materialGroup = new MaterialGroup()
            {
                Name = "MaterialGroup1", AdditionalDescriptionEnglish = String.Empty, AdditionalDescriptionGerman = String.Empty, DescriptionEnglish = String.Empty, DescriptionGerman = String.Empty, EbayAuctionHtmlTemplate = String.Empty, IntroductionEnglish = String.Empty, IntroductionGerman = String.Empty
            };

            MyDataContext.Default.MaterialGroups.Add(materialGroup);

            Supplier supplier = new Supplier()
            {
                Name = "Supplier", EmailAddress = String.Empty
            };

            MyDataContext.Default.Suppliers.Add(supplier);

            Article article1 = new Article()
            {
                ArticleNumber = "art001", DescriptionEnglish = "descEn", DescriptionGerman = "descDe", IsInEbay = true, IsInMagento = true, MaterialGroup = materialGroup, MustSyncStockAmount = false, NameEnglish = "NameEn", NameGerman = "NameDe", NameIntern = "NameIntern", PictureName1 = String.Empty, PictureName2 = String.Empty, PictureName3 = String.Empty, PurchasePrice = 10, SellingPriceGross = 100, SellingPriceWholesaleGross = 80, Supplier = supplier, SupplierArticleNumber = "Sup1", Tags = String.Empty, SyncTechnicalInfo = String.Empty, EAN = String.Empty, EbayArticleNumber = String.Empty
            };

            MyDataContext.Default.Articles.Add(article1);

            Article article2 = new Article()
            {
                ArticleNumber = "art002", DescriptionEnglish = "descEn", DescriptionGerman = "descDe", IsInEbay = true, IsInMagento = true, MaterialGroup = materialGroup, MustSyncStockAmount = false, NameEnglish = "NameEn", NameGerman = "NameDe", NameIntern = "NameIntern", PictureName1 = String.Empty, PictureName2 = String.Empty, PictureName3 = String.Empty, PurchasePrice = 10, SellingPriceGross = 100, SellingPriceWholesaleGross = 80, Supplier = supplier, SupplierArticleNumber = "Sup1", Tags = String.Empty, SyncTechnicalInfo = String.Empty, EAN = String.Empty, EbayArticleNumber = String.Empty
            };

            MyDataContext.Default.Articles.Add(article2);

            StockMovement stockMovement1 = new StockMovement(article1)
            {
                Amount = 100, Reason = "test for art001", Timestamp = DateTime.Now
            };

            MyDataContext.Default.StockMovements.Add(stockMovement1);

            StockMovement stockMovement2 = new StockMovement(article2)
            {
                Amount = 100, Reason = "test for art002", Timestamp = DateTime.Now
            };

            MyDataContext.Default.StockMovements.Add(stockMovement2);

            MyDataContext.Default.SaveChanges();
        }
        //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;
            }
        }
Ejemplo n.º 7
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);
            }
        }