コード例 #1
0
        private void Loginn(object sender, RoutedEventArgs e)
        {
            using (EnkuDesignDBContext context = new EnkuDesignDBContext())
            {
                List <User> users     = context.Users.ToList();
                bool        userFound = false;

                foreach (User userData in users)
                {
                    if (userData.username.ToString().Equals(UserNameTextBlock.Text.ToString()) && userData.password.ToString().Equals(passwordTextBlock.Password.ToString()))
                    {
                        userFound = true;
                        Window MainWindow = new MainWindow();
                        MainWindow.Show();
                        this.Close();
                        UserNameValidateTextBlock.Text = "";
                        PasswordValidateTextBlock.Text = "";
                        break;
                    }
                }

                if (userFound.Equals(false))
                {
                    UserNameValidateTextBlock.Text = "Incorrect Input!!";
                    PasswordValidateTextBlock.Text = "Incorrect Input!!";
                }
            }
        }
コード例 #2
0
        private void ChangereportTable(object sender, SelectionChangedEventArgs e)
        {
            string             newDate      = string.Format("{0:D}", ReportDateSelector.SelectedDate);
            List <Transaction> appointments = new EnkuDesignDBContext().Transactions.ToList().Where(a => a.Date.ToString().Equals(newDate)).ToList();

            DataGrid.ItemsSource = appointments;
        }
コード例 #3
0
 private void SearchWeek(object sender, KeyEventArgs e)
 {
     using (EnkuDesignDBContext context = new EnkuDesignDBContext())
     {
         var filltedMember = new EnkuDesignDBContext().TransactionReports.ToList().Where(x => x.Date.ToString().Contains(WeekTextBox.Text));
         WeeklyDataGrid.ItemsSource = filltedMember.ToList();
     }
 }
コード例 #4
0
 private void searchAppointment(object sender, KeyEventArgs e)
 {
     using (EnkuDesignDBContext context = new EnkuDesignDBContext())
     {
         var filltedMember = new EnkuDesignDBContext().Appointments.ToList().Where(x => x.Name.ToString().Contains(searchTextBox.Text));
         AppointmentsDataGrid.ItemsSource = filltedMember.ToList();
     }
 }
コード例 #5
0
        private void UpdateWeeklyReport(Transaction dailytransaction)
        {
            using (EnkuDesignDBContext context = new EnkuDesignDBContext())
            {
                String date = dailytransaction.Date.ToString();
                Console.WriteLine($"The date passed is : {date}");
                try
                {
                    TransactionReport treport = context.TransactionReports.Where(tr => tr.Date.ToString().Equals(date)).Single();

                    Console.WriteLine($"The date extracted is : {treport.Date.ToString()}");
                    if (dailytransaction.Type == "SALE")
                    {
                        Console.WriteLine($"Inside the if");
                        treport.Sale = treport.Sale + dailytransaction.Price;
                        treport.Net  = treport.Net + dailytransaction.Price;
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                    else if (dailytransaction.Type == "EXPENSE")
                    {
                        treport.Expense = treport.Expense + dailytransaction.Price;
                        treport.Net     = treport.Net - dailytransaction.Price;
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                }
                catch (Exception)
                {
                    if (dailytransaction.Type == "SALE")
                    {
                        Console.WriteLine($"Inside the exception if ");
                        context.TransactionReports.Add(new TransactionReport()
                        {
                            Date    = dailytransaction.Date,
                            Sale    = dailytransaction.Price,
                            Expense = 0.0,
                            Net     = dailytransaction.Price
                        });
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                    else if (dailytransaction.Type == "EXPENSE")
                    {
                        context.TransactionReports.Add(new TransactionReport()
                        {
                            Date    = dailytransaction.Date,
                            Sale    = 0.0,
                            Expense = dailytransaction.Price,
                            Net     = -1 * dailytransaction.Price
                        });
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                }
            }
        }
コード例 #6
0
 private void LoadFilteredTable()
 {
     try {
         string             newDate      = string.Format("{0:D}", AppointmentDateSelector.SelectedDate);
         List <Appointment> appointments = new EnkuDesignDBContext().Appointments.ToList().Where(a => a.AppointmentDate.ToString().Equals(newDate)).ToList();
         AppointmentsDataGrid.ItemsSource = appointments;
     }
     catch (Exception) { }
 }
コード例 #7
0
 public void LoadDailyReportsTable()
 {
     try
     {
         using (EnkuDesignDBContext context = new EnkuDesignDBContext())
         {
             DataGrid.ItemsSource = context.Transactions.ToList();
         }
     }
     catch (Exception) { }
 }
コード例 #8
0
 public void LoadData()
 {
     try
     {
         using (EnkuDesignDBContext endb = new EnkuDesignDBContext())
         {
             Thelistbox.ItemsSource = null;
             Thelistbox.ItemsSource = endb.Dresses.ToList();
         }
     }
     catch (Exception) { }
 }
コード例 #9
0
 private void DressDelivered(object sender, RoutedEventArgs e)
 {
     using (EnkuDesignDBContext context = new EnkuDesignDBContext())
     {
         try
         {
             Console.WriteLine("this is in the deliver dress function * before manipulation");
             string      IdMemeber      = ((AppointmentsDataGrid.SelectedItem as Appointment).Name).ToString();
             Appointment delivereddress = (from r in context.Appointments where (r.Name.ToString()) == IdMemeber select r).SingleOrDefault();
             context.Appointments.Remove(delivereddress);
             context.SaveChanges();
             AppointmentsDataGrid.ItemsSource = context.Appointments.ToList();
             Console.WriteLine("this is in the deliver dress function");
         }
         catch (Exception) { }
     }
 }
コード例 #10
0
 private void SaveChanges(object sender, RoutedEventArgs e)
 {
     try
     {
         using (EnkuDesignDBContext context = new EnkuDesignDBContext())
         {
             Appointment item = AppointmentsDataGrid.SelectedItem as Appointment;
             Appointment mem  = context.Appointments.Where(b => b.Id == item.Id).Single();
             mem.Name  = (AppointmentsDataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
             mem.Phone = (AppointmentsDataGrid.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
             //mem.LastName = (AppointmentsDataGrid.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text;
             mem.Price           = double.Parse((AppointmentsDataGrid.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text);
             mem.PaidAmount      = double.Parse((AppointmentsDataGrid.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text);
             mem.RemainingAmount = double.Parse((AppointmentsDataGrid.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text);
             context.SaveChanges();
             AppointmentsDataGrid.ItemsSource = context.Appointments.ToList();
         };
         TableUpdateSnackbar.Visibility = Visibility.Visible;
     }
     catch (Exception) { }
 }
コード例 #11
0
        private void UpdateDressAmount(string dressid)
        {
            try
            {
                using (EnkuDesignDBContext context = new EnkuDesignDBContext())
                {
                    Dress dress = context.Dresses.Where(dd => dd.Id.ToString().Equals(dressid)).Single();
                    if (dress.Amount == 1)
                    {
                        Dress dresstoremove = context.Dresses.Where(dd => dd.Id.ToString().Equals(dressid)).Single();
                        context.Dresses.Remove(dresstoremove);
                    }
                    else
                    {
                        dress.Amount = dress.Amount - 1;
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception) { }
        }