Ejemplo n.º 1
0
        public ChartResult(Chart chart, User creator)
        {
            this.User = chart.Users;
            this.Profile = chart.Profile;
            this.Creator = creator;
            this.CreationBegin = DateTime.Now;
            this.Sales = DatabaseHandler.GetPurchaseCart(Profile, User);
            this.Cancellations = DatabaseHandler.GetCanceledArticles(Profile, User);

            List<DepositReturn> returns = new List<DepositReturn>();
            foreach (User u in User)
            {
                var userDepRet = DatabaseHandler.GetUserDepositReturnsDetailed(u, Profile);
                returns.AddRange(userDepRet);
            }
            DepositReturns = new ObservableCollection<DepositReturn>((from r in returns orderby r.Created select r).ToList());

            this.CreationEnd = DateTime.Now;
        }
Ejemplo n.º 2
0
        public static void RemoveChart(Chart chart)
        {
            string query = "DELETE Chart WHERE ChartID = " + chart.ChartID;

            try
            {
                SqlConnection connection = new SqlConnection(ConnectionString);
                SqlCommand cmd = new SqlCommand(query, connection);
                connection.Open();
                cmd.ExecuteNonQuery();
                connection.Close();
            }
            catch (Exception ex)
            {
                string errmsg = "Fehler beim Löschen der Auswertung.\n\n";
                errmsg += "DatabaseHandler.RemoveChart(chart): " + ex.ToString();
                throw new Exception(errmsg);
            }
        }