예제 #1
0
 public Form5()
 {
     InitializeComponent();
     comboBox1.DataSource = userLogic.GetAll();
     comboBox2.DataSource = awardLogic.GetAll();
 }
예제 #2
0
 public Form4()
 {
     InitializeComponent();
     dataGridView1.DataSource = awardLogic.GetAll();
 }
예제 #3
0
        static void Main(string[] args)
        {
            IUserListBLL  userlogic  = null;
            IAwardListBLL awardlogic = null;

            try
            {
                userlogic  = new UserListLogic();
                awardlogic = new AwardLogic();
            }
            catch (ConfigurationFileExeption e)
            {
                System.Console.WriteLine("AAAAA!!! Config is not found, or cant be read. Bye.");
                LogType.AddLog(e);
            }
            catch (Exception e)
            {
                LogType.AddLog(e);
            }

            int count = 0;

            do
            {
                System.Console.WriteLine("Select action:");
                System.Console.WriteLine("1 - View all users");
                System.Console.WriteLine("2 - Delete User");
                System.Console.WriteLine("3 - Add User");
                System.Console.WriteLine("4 - View all awards");
                System.Console.WriteLine("5 - Delete award");
                System.Console.WriteLine("6 - Reward the user");
                System.Console.WriteLine("7 - Add new reward");
                System.Console.WriteLine("8 - Exit and save");
                System.Console.Write("Enter number: ");
                int.TryParse(System.Console.ReadLine(), out count);
                try
                {
                    switch (count)
                    {
                    case 1:
                    {
                        System.Console.Clear();
                        int temp = 0;
                        foreach (var item in userlogic.GetAll())
                        {
                            System.Console.WriteLine("{0} - {1}", ++temp, item);
                        }
                    }
                    break;

                    case 2:
                    {
                        System.Console.Clear();
                        Remove(userlogic);
                    }
                    break;

                    case 3:
                    {
                        System.Console.Clear();
                        UserAdd(userlogic);
                    }
                    break;

                    case 4:
                    {
                        System.Console.Clear();
                        int temp = 0;
                        foreach (var item in awardlogic.GetAll())
                        {
                            System.Console.WriteLine("{0} - {1}", ++temp, item);
                        }
                    }
                    break;

                    case 5:
                    {
                        System.Console.Clear();
                        Remove(awardlogic, userlogic);
                    }
                    break;

                    case 6:
                    {
                        System.Console.Clear();
                        RewardUser(userlogic, awardlogic);
                    }
                    break;

                    case 7:
                    {
                        System.Console.Clear();
                        RewardAdd(awardlogic);
                    }
                    break;

                    case 8:
                    {
                        System.Console.Clear();
                        System.Console.WriteLine("Save all data");
                        userlogic.Save();
                        awardlogic.Save();
                        Environment.Exit(0);
                    }
                    break;
                    }
                }
                catch (Exception e)
                {
                    LogType.AddLog(e);
                }


                System.Console.ReadLine();
                System.Console.Clear();
            } while (count != 100);
        }