コード例 #1
0
 private void Initialize()
 {
     myDS = new dsSage();
     taCustomer.FillByNumber(myDS.Customer, myCustomerId);
     if (myDS.Customer.Count == 1)
     {
         myCustomerRow = myDS.Customer[0];
     }
     taCustomizedPrice.Fill(myDS.CustomizedPrice, myCustomerId);
 }
コード例 #2
0
 void dgvCustomers_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     mySelectedCustomerRow = (dgvCustomers.Rows[e.RowIndex].DataBoundItem as DataRowView).Row as dsCustomer.CustomerRow;
     if (mySelectedCustomerRow != null)
     {
         mlblSelektierterKunde.Text = mySelectedCustomerRow.Name1;
     }
     else
     {
         mlblSelektierterKunde.Text = "Kein Kunde ausgewählt";
     }
 }
コード例 #3
0
ファイル: CpmMainView.cs プロジェクト: AxlOnGit/Catalist
        private void CreateCatalog()
        {
            // Select customer
            var csv = new CustomerSearchView("Für welchen Kunden soll der Katalog erstellt werden?", false);

            if (csv.ShowDialog(this) == DialogResult.OK && (csv.SelectedCustomer != null))
            {
                dsCustomer.CustomerRow customer = csv.SelectedCustomer;
                bool makeItShort = false;
                DocxCreator.DocXService docx;
                string newDoc = string.Empty;

                var dlg = new AuswahlDialog("Wir können kurz und lang können wir auch - was soll's werden",
                                            new string[] { "Kurzpreisliste", "Normaler Katalog", "Ach, lass mal" },
                                            MetroFramework.MetroColorStyle.Green);

                dlg.ShowDialog();
                switch (dlg.SelectedOption)
                {
                case 0:
                    makeItShort = true;
                    docx        = DocxCreator.ServiceManager.DocXService;
                    newDoc      = docx.CreateCatalogDocument(customer, CatalistRegistry.Application.CatalogPath, makeItShort);
                    if (MetroMessageBox.Show(this, string.Format(@"Soll die Datei ""{0}"" jetzt geöffnet werden?", newDoc), "Catalist - Katalog", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        var progName = "winword.exe";
                        var progPath = string.Format(@"""{0}""", Path.Combine(@"\\cpm-dc\sage_ncl\catalist\kundenkataloge\", newDoc));
                        Process.Start(progName, progPath);
                    }
                    break;

                case 1:
                    makeItShort = false;
                    docx        = DocxCreator.ServiceManager.DocXService;
                    newDoc      = docx.CreateCatalogDocument(customer, CatalistRegistry.Application.CatalogPath, makeItShort);
                    if (MetroMessageBox.Show(this, string.Format("Soll die Datei '{0}' jetzt geöffnet werden?", newDoc), "Catalist - Katalog", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        var progName = "winword.exe";
                        //string progPath = Path.Combine(@"\\cpm-dc\sage_ncl\catalist\kundenkataloge", newDoc);
                        var progPath = string.Format(@"""{0}""", Path.Combine(@"\\cpm-dc\sage_ncl\catalist\kundenkataloge\", newDoc));
                        Process.Start(progName, progPath);
                    }
                    break;

                case 2:
                    docx = null;
                    MetroMessageBox.Show(this, "Ganz genau. Gute Wahl. Sollen die Anderen das doch machen ...");
                    break;
                }
                docx = null;
            }
        }
コード例 #4
0
 /// <summary>
 /// Erzeugt eine neue Instanz der <seealso cref="Kunde"/> Klasse.
 /// </summary>
 /// <param name="baseRow"></param>
 public Kunde(dsCustomer.CustomerRow baseRow)
 {
     this.myBase = baseRow;
     //ModelManager.NotesService.NoteCreated += new EventHandler<NotesService.NoteCreatedEventArgs>(NotesService_NoteCreated);
     //ModelManager.NotesService.NoteDeliting += new EventHandler<NotesService.NoteDeletedEventArgs>(NotesService_NoteDeleted);
 }
コード例 #5
0
ファイル: DocXService.cs プロジェクト: AxlOnGit/Catalist
        /// <summary>
        /// Creates a Word document with the product catalog for the given customer.
        /// </summary>
        /// <param name="customer"></param>
        public string CreateCatalogDocument(dsCustomer.CustomerRow customer, string catalogPath, bool shorty)
        {
            var kunde = ModelManager.CustomerService.GetKunde(customer.Kundennummer, true);

            if (kunde == null)
            {
                return(string.Empty);
            }

            var catFileName         = string.Format("{0:yyyy-MM-dd_mmss}_({1})_{2}.docx", DateTime.Now, kunde.KundenNrCpm, kunde.Matchcode);
            var catCompleteFilePath = string.Format("{0}{1}", catalogPath, catFileName);

            using (DocX doc = DocX.Load(CatalistRegistry.Application.CatalogTemplateFilePath))
            {
                // Firmenname und Kundennummer einfügen
                var companyAndNumber = string.Format(@"{0} - [Ihre Kd.-Nr.: {1}]", kunde.CompanyName1, kunde.KundenNrCpm);
                foreach (Paragraph p in doc.Paragraphs)
                {
                    var cbm = p.GetBookmarks().FirstOrDefault(bookmark => bookmark.Name == "Firmenname");
                    if (cbm != null)
                    {
                        cbm.Paragraph.InsertText(companyAndNumber);
                        p.StyleName             = "Firmenname";
                        cbm.Paragraph.StyleName = "Firmenname";
                    }
                }

                // Iterate over all catalog outline entries.
                foreach (var cRow in DataManager.CatalogDataService.GetCatalogTable())
                {
                    // Iterate over all products of the current section
                    var pList = ModelManager.ProductService.GetProductList(kunde).Where(p => p.KatalogFlag == true & p.Katalogsektion == cRow.Numbering).OrderBy(c => c.Artikelnummer);
                    foreach (var product in pList)
                    {
                        if (!product.InactiveFlag)
                        {
                            // Find
                            foreach (Paragraph p in doc.Paragraphs)
                            {
                                var b = p.GetBookmarks().FirstOrDefault(bm => bm.Name == cRow.Numbering);
                                if (b != null)
                                {
                                    if (cRow.Numbering == "J00")
                                    {
                                        System.Threading.Thread.Sleep(100);
                                    }

                                    Table t = null;
                                    if (shorty)
                                    {
                                        t = this.NewShortDocTable(doc, product);
                                    }
                                    else
                                    {
                                        t = this.NewDocTable(doc, product);
                                    }
                                    if (t != null)
                                    {
                                        var pi = b.Paragraph.InsertParagraphBeforeSelf(string.Empty);
                                        pi.InsertTableBeforeSelf(t);
                                    }
                                }
                            }
                        }
                    }
                }
                // Save the created catalog file.
                doc.SaveAs(catCompleteFilePath);
                return(catCompleteFilePath);
            }
        }
コード例 #6
0
 void mbtnCancel_Click(object sender, EventArgs e)
 {
     this.DialogResult     = System.Windows.Forms.DialogResult.Cancel;
     mySelectedCustomerRow = null;
     this.Close();
 }