static void Main()
        {
            Type obj = Type.GetType(ConfigurationManager.AppSettings["UserRepository"]);

            System.Reflection.ConstructorInfo constructor = obj.GetConstructor(new Type[] { });
            IUserDAO userRepository = (IUserDAO)constructor.Invoke(null);

            UserService userService = new UserService(userRepository);

            obj         = Type.GetType(ConfigurationManager.AppSettings["ServiciuRepository"]);
            constructor = obj.GetConstructor(new Type[] { });
            IServiciuDAO serviciuRepository = (IServiciuDAO)constructor.Invoke(null);

            ServiciuService serviciuServer = new ServiciuService(serviciuRepository);

            obj         = Type.GetType(ConfigurationManager.AppSettings["ProgramareServiciuRepository"]);
            constructor = obj.GetConstructor(new Type[] { });
            IProgramareServiciuDAO programareServiciuRepository = (IProgramareServiciuDAO)constructor.Invoke(null);


            obj         = Type.GetType(ConfigurationManager.AppSettings["ProgramareRepository"]);
            constructor = obj.GetConstructor(new Type[] { });
            IProgramareDAO programareRepository = (IProgramareDAO)constructor.Invoke(null);

            ProgramareService programareService = new ProgramareService(programareRepository, serviciuRepository, programareServiciuRepository);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new LoginForm(userService, serviciuServer, programareService));
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String date     = monthCalendar1.SelectionRange.Start.ToShortDateString();
            String name     = textBox1.Text;
            String telefon  = textBox2.Text;
            String services = textBox3.Text;
            String ora      = textBox4.Text;

            String result = null;

            Type            obj               = Type.GetType(ConfigurationManager.AppSettings["DefaultRepositoryProgramari"]);
            ConstructorInfo constructor       = obj.GetConstructor(new Type[] { });
            IProgramareDAO  defaultRepository = (IProgramareDAO)constructor.Invoke(null);

            ProgramareService programareService = new ProgramareService(defaultRepository);

            Type            obj1               = Type.GetType(ConfigurationManager.AppSettings["DefaultRepositoryServicii"]);
            ConstructorInfo constructor1       = obj1.GetConstructor(new Type[] { });
            IServiciiDAO    defaultRepository1 = (IServiciiDAO)constructor1.Invoke(null);

            ServiciiService serviciiService = new ServiciiService(defaultRepository1);

            String serviciiAvailable = null;


            if (!(name == "" || telefon == "" || services == "" || ora == ""))
            {
                result = programareService.addProgramare(date, name, telefon, services, ora);

                if (result == null)
                {
                    serviciiAvailable = serviciiService.getServicii(null);
                    MessageBox.Show("Something went wrong!\n\n" + serviciiAvailable);
                }
                else if (result.Substring(0, 6).Equals("ERROR!"))
                {
                    String[] s = result.Split(' ');
                    serviciiAvailable = serviciiService.getServicii(s[2]);
                    MessageBox.Show(result + "\n" + serviciiAvailable);
                }
                else
                {
                    MessageBox.Show("Appointment booked successfully!");
                }
            }
            else
            {
                MessageBox.Show("Fields must not be empty!");
            }
        }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            Type            obj               = Type.GetType(ConfigurationManager.AppSettings["DefaultRepositoryProgramari"]);
            ConstructorInfo constructor       = obj.GetConstructor(new Type[] { });
            IProgramareDAO  defaultRepository = (IProgramareDAO)constructor.Invoke(null);

            ProgramareService programareService = new ProgramareService(defaultRepository);

            String result = programareService.getProgramari();

            if (result == null)
            {
                MessageBox.Show("Something went wrong!");
            }
            else
            {
                MessageBox.Show(result);
            }
        }
Esempio n. 4
0
        private void button4_Click(object sender, EventArgs e)
        {
            String startDate = monthCalendar1.SelectionRange.Start.ToShortDateString();
            String endDate   = monthCalendar2.SelectionRange.Start.ToShortDateString();

            Type            obj               = Type.GetType(ConfigurationManager.AppSettings["DefaultRepositoryProgramari"]);
            ConstructorInfo constructor       = obj.GetConstructor(new Type[] { });
            IProgramareDAO  defaultRepository = (IProgramareDAO)constructor.Invoke(null);

            ProgramareService programareService = new ProgramareService(defaultRepository);

            String result = programareService.getRaportByDates(startDate, endDate);

            if (result == null)
            {
                MessageBox.Show("Something went wrong");
            }
            else
            {
                MessageBox.Show(result);
            }
        }
 public ProgramareService(IProgramareDAO programareDAO, IServiciuDAO serviciuDAO, IProgramareServiciuDAO programareServiciuDAO)
 {
     _programareDAO         = programareDAO;
     _serviciuDAO           = serviciuDAO;
     _programareServiciuDAO = programareServiciuDAO;
 }
Esempio n. 6
0
 public ProgramareService(IProgramareDAO repository)
 {
     _repository = repository;
 }