Exemplo n.º 1
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            // the user instance will be used accross all registration types
            var user = new User()
            {
                //WordpressUserId = Convert.ToInt32(txtWordpressId.Text),
                //CreatedDate = DateTime.Now,
                //UserTypeId = (int)GetUserType()
            };

            switch (GetUserType())
            {
                case User.UserTypeList.Admin:
                    WCFWebServiceJson.RegisterAdmin(user);
                    break;
                case User.UserTypeList.Artist:
                    var artist = new Artist();
                    var artistGenreCollection = (from ListItem listItem in lbGenres.SelectedItems select WCFWebServiceJson.GetGenre(listItem.SelectedValue())).ToList();

                    WCFWebServiceJson.RegisterArtist(artist, artistGenreCollection, null);
                    break;
                case User.UserTypeList.Business:
                    var businessTypeListItem = (ListItem)cbBusinessType.SelectedItem;
                    var businessType = new BusinessType()
                    {
                        BusinessTypeName = businessTypeListItem.ToString(),
                        BusinessTypeId = businessTypeListItem.SelectedValue()
                    };
                    //WCFWebServiceJson.RegisterBusiness(user, businessType, "0.0345749857", "-52.489082309");
                    break;
                default:
                    WCFWebServiceJson.RegisterCustomer(user);
                    break;
            }
        }
Exemplo n.º 2
0
        private void btnUpdateUser_Click(object sender, EventArgs e)
        {
            switch (GetUserType())
            {
                case User.UserTypeList.Artist:
                    var artist = WCFWebServiceJson.GetArtist(Convert.ToInt32(txtWordpressId.Text));

                    var businessTypeCollection = (from ListItem listItem in lbGenres.SelectedItems select WCFWebServiceJson.GetGenre(listItem.SelectedValue())).ToList();

                    WCFWebServiceJson.UpdateArtistGenreCollection(artist.UserId, businessTypeCollection);
                    break;
                case User.UserTypeList.Business:
                    var business = WCFWebServiceJson.GetArtist(Convert.ToInt32(txtWordpressId.Text));

                    var businessTypeListItem = (ListItem)cbBusinessType.SelectedItem;
                    var businessType = new BusinessType()
                    {
                        BusinessTypeName = businessTypeListItem.ToString(),
                        BusinessTypeId = businessTypeListItem.SelectedValue()
                    };

                    WCFWebServiceJson.UpdateBusinessUser(business, businessType, "0.0345749857", "-52.489082309");
                    break;
            }
        }
Exemplo n.º 3
0
        public bool UpdateBusinessUser(User user, BusinessType businessType, string latitude, string longitude)
        {
            // create the business object and insert it
            var businessUser = SqlBusinessUserRepository.GetBusinessUserByUserId(user.UserId);
            businessUser.BusinessTypeId = businessType.BusinessTypeId;

            return SqlBusinessUserRepository.SaveBusinessUser(businessUser);
        }