コード例 #1
0
ファイル: Festival.cs プロジェクト: JaronV/FestivalApp
        private static Festival VerwerkRij(IDataRecord rij)
        {

            Festival nieuw = new Festival();

            nieuw.StartDate = Convert.ToDateTime( rij["StartDate"].ToString());
            nieuw.EndDate = Convert.ToDateTime(rij["EndDate"].ToString());

            return nieuw;
        }
コード例 #2
0
ファイル: Festival.cs プロジェクト: JaronV/FestivalApp
        public static Festival GetData()
        {
            Festival nieuw= new Festival();
           
            string sql = "SELECT * FROM Festival";

            DbDataReader reader = Database.GetData(sql);

            while (reader.Read())
            {
              nieuw =  VerwerkRij(reader);

            }
            return nieuw;
        }
コード例 #3
0
ファイル: Festival.cs プロジェクト: JaronV/FestivalApp
        public static void AddType(Festival festi)
        {
            try
            {
                DbParameter paramstart = Database.AddParameter("@start", festi.StartDate);
                DbParameter paramend = Database.AddParameter("@end", festi.EndDate);
               


                Database.ModifyData("INSERT INTO Festival (StartDate,EndDate) values (@start,@end)",paramstart,paramend);


            }
            catch (Exception e)
            {

                Console.WriteLine(e.Message);
            }
        }
コード例 #4
0
ファイル: InstellingenVM.cs プロジェクト: JaronV/FestivalApp
        private void AddFestival()
        {
            Festival.DeleteType();
          
            //DateTime.Today.ToString("yyyy-MM-dd")
            string begin = BeginDatum.ToString("yyyy-dd-MM");
            string einde = EindDatum.ToString("yyyy-dd-MM");

            Festival festi = new Festival();
            festi.StartDate = BeginDatum;
            festi.EndDate = EindDatum;
            festi.Naam = FestivalNaam;
            Festival.AddType(festi);
            
        }
コード例 #5
0
ファイル: Ticket.cs プロジェクト: JaronV/FestivalApp
        public static void PrintWord(Ticket ticket, Festival festival, string sPad)
        {
            string sFileNaam = ticket.ID + "_" + ticket.Ticketholder + ".docx";
            string sFullPad = sPad + "\\" + sFileNaam;
            try
            {
                File.Copy("C:\\Users\\jerry_000\\Dropbox\\2NMCT4\\S1\\Business applications\\Project\\FestivalApp\\word\\template.docx", sFullPad, true);
               
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
            }

            WordprocessingDocument newDoc = WordprocessingDocument.Open(sFullPad, true);
            IDictionary<string, BookmarkStart> bookmarks = new Dictionary<string, BookmarkStart>();
            foreach (BookmarkStart bms in newDoc.MainDocumentPart.RootElement.Descendants<BookmarkStart>())
            {
                bookmarks[bms.Name] = bms;
            }

            //Festival name moet iets anders qua opmaak zijn
            Run runTitle = new Run(new Text(festival.Naam));

            RunProperties propTitle = new RunProperties();
            RunFonts fontTitle = new RunFonts() { Ascii = "Segoe UI", HighAnsi = "Segoe UI" };
            FontSize sizeTitle = new FontSize() { Val = "36" };

            propTitle.Append(fontTitle);
            propTitle.Append(sizeTitle);
            runTitle.PrependChild<RunProperties>(propTitle);

            bookmarks["FestivalTitle"].Parent.InsertAfter<Run>(runTitle, bookmarks["FestivalTitle"]);

            bookmarks["Name"].Parent.InsertAfter<Run>(new Run(new Text(ticket.Ticketholder)), bookmarks["Name"]);
            bookmarks["Email"].Parent.InsertAfter<Run>(new Run(new Text(ticket.TicketholderEmail)), bookmarks["Email"]);
            bookmarks["Day"].Parent.InsertAfter<Run>(new Run(new Text(ticket.tickettype.Name)), bookmarks["Day"]);
            bookmarks["Type"].Parent.InsertAfter<Run>(new Run(new Text(ticket.tickettype.Name)), bookmarks["Type"]);
            bookmarks["Amount"].Parent.InsertAfter<Run>(new Run(new Text(ticket.Amount.ToString())), bookmarks["Amount"]);
            bookmarks["Price"].Parent.InsertAfter<Run>(new Run(new Text(ticket.tickettype.Price.ToString())), bookmarks["Price"]);
            double iTotalPrice = ticket.Amount * ticket.tickettype.Price;
            bookmarks["Totalprice"].Parent.InsertAfter<Run>(new Run(new Text(iTotalPrice.ToString())), bookmarks["Totalprice"]);

            //BARCODE TOEVOEGEN            
            //string code = Guid.NewGuid().ToString();
            string code = GenerateUnique(ticket.TicketholderEmail);
            Run run = new Run(new Text(code));

            RunProperties prop = new RunProperties();
            RunFonts font = new RunFonts() { Ascii = "Free 3 of 9 Extended", HighAnsi = "Free 3 of 9 Extended" };
            FontSize size = new FontSize() { Val = "96" };

            prop.Append(font);
            prop.Append(size);
            run.PrependChild<RunProperties>(prop);

            bookmarks["Barcode"].Parent.InsertAfter<Run>(run, bookmarks["Barcode"]);

            newDoc.Close();
            MessageBox.Show(sFullPad + " is opgeslaan");
        }