Beispiel #1
0
        public static void PayOutSalaryHandler(ShowObject sender, EventArgs e)
        {
            List <Worker> workerList = DatabaseMethods.SelectWorkers();

            if (workerList.Count() > 0)
            {
                Worker worker = null;
                int    number = Convert.ToInt32(sender.objectBox.SelectedItem.ToString().Split('.').First());
                worker = workerList.Where(x => x.WorkerNumber == number).First();

                if (Budget.Balance - worker.Salary > Convert.ToDouble(Program.ReadSetting("Limit of bankrupt", "App.config")))
                {
                    MessageBox.Show("Paid out €" + worker.Salary + " to " + worker.Name + " " + worker.LastName, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    worker.PaySalary();
                    sender.Dispose();
                }
                else
                {
                    worker.PaySalary();
                    sender.Dispose();
                }
            }
            else
            {
                MessageBox.Show("No workers!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        public static void SendEmailClientHandler(ShowObject sender, EventArgs e)
        {
            Client client = null;
            int    number = Convert.ToInt32(sender.objectBox.SelectedItem.ToString().Split(' ').Last().Remove(sender.objectBox.SelectedItem.ToString().Split(' ').Last().Length - 1));

            client = DatabaseMethods.SelectClientFromQuery("SELECT * FROM Clients WHERE ClientNumber = '" + number.ToString() + "'");
            Task.Run(() => EmailSender.SendIt(client, client.Email, client.RegisterDate, "Client information"));
            MessageBox.Show("E-mail sent to " + client.Email, "E-mail sent", MessageBoxButtons.OK, MessageBoxIcon.Information);
            sender.Dispose();
        }
Beispiel #3
0
        public static void SendEmailOrderHandler(ShowObject sender, EventArgs e)
        {
            Order order  = null;
            int   number = Convert.ToInt32(sender.objectBox.SelectedItem.ToString().Split('.').First());

            order = DatabaseMethods.SelectOrderFromQuery("SELECT * FROM Orders WHERE OrderNumber = '" + number.ToString() + "'");
            string email = DatabaseMethods.SelectClients().Where(x => x.ClientNumber == order.OrderClientNumber).First().Email;

            Task.Run(() => EmailSender.SendIt(order, email, order.OrderRegisterDate, "Order information"));
            MessageBox.Show("E-mail sent to " + email, "E-mail sent", MessageBoxButtons.OK, MessageBoxIcon.Information);
            sender.Dispose();
        }