public Dashboard()
        {
            InitializeComponent();
            for (int i = 0; i < 4; i++)
            {
                Client c = new Client();
                c.FirstName = "Client " + i;
                c.LastName = " Client " + i;
                c.Cin = "HH145521";
                Contrat co = new Contrat();
                co.Prix = 200;
                co.Avance = 100;
                co.CreatedAt = new DateTime();
                Car ca = new Car();
                ca.Name = "Mercedes CLS";
                Location l = new Location();
                l.car = ca;
                l.contrat = co;
                l.client = c;

                ActivityCell cell = new ActivityCell(l);
                cell.MouseLeftButtonUp += ShowLocationInfo;
                activity_container.Children.Add(cell);
            }
            design();
        }
 public ActivityCell(Location location)
 {
     InitializeComponent();
     this.current = location;
     design();
 }
        public static bool login(string email, string password)
        {
            var responseString = Http.Post(Constants.LoginURI, new Dictionary<string,string>() {
                { "email", email },
                { "password", password }
            });

            JObject o = JObject.Parse(responseString);
            if(((string)o.GetValue("success")).CompareTo("true")==0)
            {
                /* ----------------------------------------------------
                *   ## CONNECTED USER INISIALIZATION
                * ----------------------------------------------------*/
                User connected = new User();
                JObject user_json = (JObject)o.GetValue("user");
                connected.id = (int)user_json.GetValue("id");
                connected.Email = (string)user_json.GetValue("user_email");
                connected.FirstName = (string)user_json.GetValue("user_first_name");
                connected.LastName = (string)user_json.GetValue("user_last_name");
                if (((string)user_json.GetValue("user_role")).CompareTo("admin") == 0)
                    connected.Role = Constants.ADMIN_USER;
                else
                    connected.Role = Constants.EMPLOYEE_USER;
                connected.BirthDate = (DateTime)user_json.GetValue("user_birth_date");
                connected.Avatar = (string)user_json.GetValue("user_avatar");
                connected.AgenceId = (int)user_json.GetValue("agence_id");
                connected.CreatedAt = (DateTime)user_json.GetValue("user_createdAt");
                connected.UpdatedAt = (DateTime)user_json.GetValue("user_updatedAt");
                GeneralObjects.connected_user = connected;

                /* ----------------------------------------------------
                *   ## CURRENT COMPANY INISIALIZATION
                * ----------------------------------------------------*/
                Company current_company = new Company();
                JObject company_json = (JObject)o.GetValue("company");
                current_company.id = (int)company_json.GetValue("id");
                current_company.Logo = (string)company_json.GetValue("company_logo");
                current_company.Name = (string)company_json.GetValue("company_name");
                current_company.Description = (string)company_json.GetValue("company_description");
                current_company.CreatedAt = (DateTime)company_json.GetValue("company_createdAt");
                current_company.UpdatedAt = (DateTime)company_json.GetValue("company_updatedAt");
                current_company.SubscriptionId = (int)company_json.GetValue("subscription_id");
                GeneralObjects.connected_company = current_company;

                /* ----------------------------------------------------
                *   ## CURRENT AGENCE INISIALIZATION
                * ----------------------------------------------------*/
                Agence current_agence = new Agence();
                JObject agence_json = (JObject)o.GetValue("agence");
                current_agence.id = (int)agence_json.GetValue("id");
                current_agence.Name = (string)agence_json.GetValue("agence_name");
                current_agence.Adress = (string)agence_json.GetValue("agence_adress");
                current_agence.City = (string)agence_json.GetValue("agence_city");
                current_agence.CompanyId = (int)agence_json.GetValue("company_id");
                current_agence.CreatedAt = (DateTime)agence_json.GetValue("agence_createdAt");
                current_agence.UpdatedAt = (DateTime)agence_json.GetValue("agence_updatedAt");
                GeneralObjects.connected_agence = current_agence;

                /* ----------------------------------------------------
                *   ## STATISTICS INISIALIZATION
                * ----------------------------------------------------*/
                JObject statistics = (JObject)o.GetValue("statistics");
                GeneralObjects.nb_cars = (int)statistics.GetValue("cars_count");
                GeneralObjects.nb_locations = (int)statistics.GetValue("locations_count");
                GeneralObjects.nb_clients = (int)statistics.GetValue("clients_count");

                /* ----------------------------------------------------
                *   ## RECENT LOCATIONS
                * ----------------------------------------------------*/
                JArray locations = (JArray)o.GetValue("locations");
                JObject temp_json;
                Contrat temp_contrat;
                Car temp_car;
                ContratFile temp_contratfile;
                Client temp_client;
                User temp_user;

                List<Location> locations_list = new List<Location>();
                Location temp;
                foreach (var item in locations)
                {
                    //JSON LOCATION
                    temp_json = (JObject)item;

                    //TEMPORARY LOCATION
                    temp = new Location();

                    //JSON CONTRAT
                    temp_contrat = new Contrat();
                    temp_contrat.id = (int)temp_json.GetValue("id_contrat");
                    temp_contrat.idCar = (int)temp_json.GetValue("id_car");
                    temp_contrat.idClient = (int)temp_json.GetValue("id_client");
                    temp_contrat.idFile = (int)temp_json.GetValue("id_file");
                    temp_contrat.idUser = (int)temp_json.GetValue("id_user");
                    temp_contrat.Prix = (float)temp_json.GetValue("contrat_prix");
                    temp_contrat.StartAt = (DateTime)temp_json.GetValue("contrat_start_at");
                    temp_contrat.EndAt = (DateTime)temp_json.GetValue("contrat_end_at");
                    temp_contrat.Avance = (float)temp_json.GetValue("contrat_avance");
                    temp_contrat.CreatedAt = (DateTime)temp_json.GetValue("contrat_createdAt");
                    temp_contrat.UpdatedAt = (DateTime)temp_json.GetValue("updatedAt");
                    temp.contrat = temp_contrat;

                    //JSON FILE
                    temp_contratfile = new ContratFile();
                    temp_contratfile.id = temp_contrat.idFile;
                    temp_contratfile.Size = (int)temp_json.GetValue("contratfile_size");
                    temp_contratfile.File = (string)temp_json.GetValue("contratfile_file");
                    temp_contratfile.

                }

                return true;
            }
            else
            {
                return false;
            }
        }