Beispiel #1
0
        public void LoadProfile()
        {
            Data data = null;
            DataRowCollection dr;
            Province          province;
            City         city;
            Neighborhood neighborhood;

            try
            {
                data = new Data(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString());

                List <MySqlParameter> p = new List <MySqlParameter>()
                {
                    new MySqlParameter()
                    {
                        ParameterName = "@p_id_user", MySqlDbType = MySqlDbType.VarChar, Size = 36, Direction = ParameterDirection.Input, Value = this.Id
                    },
                };

                dr = data.ExecuteQuery("SP_SEL_USER_PROFILE", p).Tables[0].Rows;

                Name       = dr[0]["Name"].ToString();
                MiddleName = dr[0]["MiddleName"].ToString();
                LastName   = dr[0]["LastName"].ToString();
                Address1   = dr[0]["Address1"].ToString();
                Address2   = dr[0]["Address2"].ToString();
                ZipCode    = dr[0]["ZipCode"].ToString();
                EMail      = dr[0]["EMail"].ToString();
                Password   = dr[0]["Password"].ToString();

                province    = new Province();
                province.Id = Convert.ToInt16(dr[0]["province_Id"].ToString());
                Province    = province;

                city    = new City();
                city.Id = Convert.ToInt16(dr[0]["city_Id"].ToString());
                City    = city;

                neighborhood    = new Neighborhood();
                neighborhood.Id = Convert.ToInt16(dr[0]["neighborhood_Id"].ToString());
                Neighborhood    = neighborhood;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                data.CloseConnection();
                data         = null;
                dr           = null;
                province     = null;
                city         = null;
                neighborhood = null;
            }
        }
Beispiel #2
0
        public List <Neighborhood> GetNeighborhoodByCity(int idCity)
        {
            Data                data = null;
            DataSet             ds;
            List <Neighborhood> neighborhoods = null;
            Neighborhood        neighborhood  = null;

            try
            {
                data = new Data(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString());

                List <MySqlParameter> p = new List <MySqlParameter>()
                {
                    new MySqlParameter()
                    {
                        ParameterName = "@p_id_city", MySqlDbType = MySqlDbType.Int16, Size = 0, Direction = ParameterDirection.Input, Value = idCity
                    },
                };

                ds = data.ExecuteQuery("SP_SEL_NEIGHBORHOOD_BY_CITY", p);

                neighborhoods = new List <Neighborhood>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    neighborhood      = new Neighborhood();
                    neighborhood.Id   = Convert.ToInt16(dr["Id"].ToString());
                    neighborhood.Name = dr["Name"].ToString();

                    neighborhoods.Add(neighborhood);
                }

                return(neighborhoods);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.CloseConnection();
                }

                data          = null;
                neighborhoods = null;
                neighborhood  = null;
                ds            = null;
            }
        }
Beispiel #3
0
 public User(string id, string name, string middlename, string lastname, string address1, string address2, Province province, City city, Neighborhood neighborhood, string zipcode, string email, string password)
 {
     this.Id           = id;
     this.Name         = name;
     this.MiddleName   = middlename;
     this.LastName     = lastname;
     this.Address1     = address1;
     this.Address2     = address2;
     this.Province     = province;
     this.City         = city;
     this.Neighborhood = neighborhood;
     this.ZipCode      = zipcode;
     this.EMail        = email;
     this.Password     = password;
 }
Beispiel #4
0
        public List <Job> GetJobsByNeighborhood(Neighborhood neighborhood, string userId)
        {
            Data data = null;
            DataRowCollection dr;

            try
            {
                data = new Data(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString());

                List <MySqlParameter> p = new List <MySqlParameter>()
                {
                    new MySqlParameter()
                    {
                        ParameterName = "@p_neighborhood_id", Value = neighborhood.Id
                    },
                    new MySqlParameter()
                    {
                        ParameterName = "@p_user_id", Value = userId
                    },
                };

                dr = data.ExecuteQuery("SP_SEL_JOBS_BY_NEIGHBORHOOD", p).Tables[0].Rows;

                return(FillListOfJobs(dr));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.CloseConnection();
                }

                data = null;
                dr   = null;
            }
        }