コード例 #1
0
        private void ButtonConnect_Click1(object sender, RoutedEventArgs e)
        {
            Db = Factory.LoadBugTracking(null, Adminpwd.Password);
            DataBox.Document.Blocks.Clear();
            DataBox.AppendText("Connected !");
            UsrTable.Visibility = 0;
            Products.Visibility = 0;


            //var user1 = new Utente()
            //{
            //    Name = "Stefano",
            //    Surname = "Castello",
            //    Dob = new DateTime(93, 12, 12),
            //    CodFisc = "CSTSFN93D12D969U",
            //    Age = 24,
            //    LogIn = "******",
            //    Indirizzo = new Address() { Civico = 9, Interno = 2, Via = "viale Villa Chiesa" }
            //};
            //var user2 = new Utente()
            //{
            //    Name = "Giorgio",
            //    Surname = "Castello",
            //    Dob = new DateTime(60, 07, 20),
            //    CodFisc = "CSTGRG60L20D969A",
            //    Age = 57,
            //    LogIn = "******",
            //    Indirizzo = new Address() { Civico = 9, Interno = 2, Via = "viale Villa Chiesa" }
            //};

            //db.Users.Add(user1);
            //db.Users.Add(user2);
            //db.SaveChanges();
        }
コード例 #2
0
        public static BugReportContext LoadBugTracking(string connStr, string adminPwd)
        {
            var db    = new BugReportContext();
            var query = from b in db.Users
                        where b.Name.Equals("Admin")
                        select b;

            if (query.First().LogIn.Equals(adminPwd))
            {
                return(db);
            }
            throw new NotImplementedException("Password Errata");
        }
コード例 #3
0
 public static void InitializeBugTracking(string connStr, string adminPwd)
 {
     using (var db = new BugReportContext())
     {
         db.Database.Delete();
         db.Database.Create();
         var user = new Utente()
         {
             Name = "Admin", CodFisc = "CF", Age = 12, Dob = DateTime.Today, LogIn = adminPwd, Surname = "admin", Indirizzo = new Address()
             {
                 Civico = 0, Interno = 0, Via = ""
             }
         };
         db.Users.Add(user);
         db.SaveChanges();
     }
 }
コード例 #4
0
 public void SetUp()
 {
     Factory.InitializeBugTracking(null, "password");
     Db    = Factory.LoadBugTracking(null, "password");
     User1 = new Utente()
     {
         Name      = "Stefano",
         Surname   = "Castello",
         Dob       = new DateTime(93, 12, 12),
         CodFisc   = "CSTSFN93D12D969U",
         Age       = 24,
         LogIn     = "******",
         Indirizzo = new Address()
         {
             Civico = 9, Interno = 2, Via = "viale Villa Chiesa"
         }
     };
     User2 = new Utente()
     {
         Name      = "Giorgio",
         Surname   = "Castello",
         Dob       = new DateTime(60, 07, 20),
         CodFisc   = "CSTGRG60L20D969A",
         Age       = 57,
         LogIn     = "******",
         Indirizzo = new Address()
         {
             Civico = 9, Interno = 2, Via = "viale Villa Chiesa"
         }
     };
     Prod1 = new Prodotto()
     {
         CommName = "Schermo",
         Id       = 10,
         Req      = new List <Prodotto>(),
         NotComp  = new List <Prodotto>()
     };
     Prod3 = new Prodotto()
     {
         CommName = "Android",
         Id       = 12,
         Req      = new List <Prodotto>(),
         NotComp  = new List <Prodotto>()
     };
     Prod2 = new Prodotto()
     {
         CommName = "iPhone",
         Id       = 11,
         Req      = new List <Prodotto> {
             Prod1
         },
         NotComp = new List <Prodotto> {
             Prod3
         }
     };
     Prod3.NotComp.Add(Prod2);
     Report1 = new Segnalazione()
     {
         Author       = User1,
         CreationDate = DateTime.Today,
         Descr        = "Sistema Orrendo!",
         SigProd      = Prod3,
         State        = "Aperta",
         Text         = "Nulla da aggingere !",
         Comments     = new List <Commento>()
     };
     Comment1 = new Commento()
     {
         Author       = User2,
         CreationDate = DateTime.Today,
         Text         = "Vero Meglio Apple!"
     };
 }
コード例 #5
0
 public BugsController(BugReportContext context)
 {
     _context = context;
 }