Exemple #1
0
        public Process(Dictionary <string, string> process, Exhibitor exhibitor, Employee employee, Schedule schedule,
                       IList <Room> room)
        {
            var adapter = new DictionaryAdapter(process);

            Description = adapter.GetValue(DbQuery.DescriptionProperty);
            Title       = adapter.GetValue(DbQuery.TitleProperty);
            Name        = adapter.GetValue(DbQuery.NameProperty);
            LastUpdate  = adapter.GetValue("lastUpdate");
            ///////////////INPUTS////////////////
            Id = int.Parse(adapter.GetValue("id"));
            try
            {
                Price = float.Parse(adapter.GetValue("price"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Price = null;
            }

            try
            {
                Result = int.Parse(adapter.GetValue("result"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Result = null;
            }

            Active    = int.Parse(adapter.GetValue("active"));
            Exhibitor = exhibitor;
            Employee  = employee;
            Schedule  = schedule;
            Room      = room;

            Pendent   = new Pendent(this);
            Approved  = new Approved(this);
            Denied    = new Denied(this);
            Confirmed = new Confirmed(this);


            if (Result == null)
            {
                Actual = Pendent;
            }
            else if (Result != 0)
            {
                Actual = Active != 0 ? Approved : Confirmed;
            }
            else
            {
                Actual = Denied;
            }
        }
Exemple #2
0
        public void Save()
        {
            Id = DbQuery.InsertProcess(Active.ToString(), Description, "img", Title, Name, Employee.RoleId().ToString(),
                                       Exhibitor.RoleId().ToString(), Schedule.Id.ToString());

            foreach (var item in Room)
            {
                DbQuery.AssociateProcessRoom(Id.ToString(), item.Id.ToString());
            }
        }
Exemple #3
0
        public object Create(string type)
        {
            Person person;

            if (type == Exhibitor)
            {
                person = new Exhibitor();
            }
            else if (type == Employee)
            {
                person = new Employee();
            }
            else
            {
                return(null);
            }
            return(person);
        }
Exemple #4
0
        public object ImportData(string type, Dictionary <string, string> dictionary)
        {
            Person person;

            if (type == Exhibitor)
            {
                person = new Exhibitor(dictionary);
            }
            else if (type == Employee)
            {
                person = new Employee(dictionary);
            }
            else
            {
                return(null);
            }
            return(person);
        }
Exemple #5
0
        public Process(Exhibitor exhibitor, Employee employee, Schedule schedule, Room room)
        {
            ///////////////INPUTS////////////////
            Exhibitor = exhibitor;
            Employee  = employee;
            Schedule  = schedule;
            Room      = room;
            /////////////////////////////////////
            Price  = null;
            Result = null;
            Active = true;

            pendent   = new Pendent(this);
            approved  = new Approved(this);
            denied    = new Denied(this);
            confirmed = new Confirmed(this);
            Actual    = pendent;
        }
Exemple #6
0
        public static Person Login(string mailInserted, string passwordInserted)
        {
            var mail     = mailInserted;
            var password = passwordInserted;
            var checkEmailAvailabilityResult = DbQuery.GetPeopleByMail(mail);

            if (checkEmailAvailabilityResult != null)
            {
                if (checkEmailAvailabilityResult.Count > 0)
                {
                    //Debug.WriteLine("Tem n linhas:"+ checkEmailAvailabilityResult.Count);
                    var adapter = new DictionaryAdapter(checkEmailAvailabilityResult[0]);
                    if (adapter.GetValue(DbQuery.PasswordProperty).Equals(password))
                    {
                        var exhibitorResult = DbQuery.GetExhibitorByPersonId(adapter.GetValue("id"));

                        Person user;
                        if (exhibitorResult.Count > 0)
                        {
                            user = new Exhibitor(exhibitorResult[0]);
                        }
                        else
                        {
                            var userData = DbQuery.GetEmployeeByPersonId(adapter.GetValue("id"));
                            user = new Employee(userData[0]);
                        }

                        return(user);
                    }

                    Console.WriteLine(@"Falta preencher coisas!!!!");
                    return(null);
                }
                else
                {
                    Console.WriteLine(@"Falta preencher coisas!!!!");
                    return(null);
                }
            }

            return(null);
        }
Exemple #7
0
        public Process(Exhibitor exhibitor, Employee employee, Schedule schedule, IList <Room> room, string name,
                       string description, string title, string img)
        {
            ///////////////INPUTS////////////////
            Exhibitor   = exhibitor;
            Employee    = employee;
            Schedule    = schedule;
            Room        = room;
            Name        = name;
            Description = description;
            Title       = title;
            Img         = img;
            /////////////////////////////////////
            Price  = null;
            Result = null;
            Active = 1;

            Pendent   = new Pendent(this);
            Approved  = new Approved(this);
            Denied    = new Denied(this);
            Confirmed = new Confirmed(this);
            Actual    = Pendent;
        }