Exemplo n.º 1
0
        private void ucVenueListItem_Click(object sender, EventArgs e)
        {
            frmVenueDetails oForm = new frmVenueDetails(_strVenueID);
            oForm.Show();

            var oObject = this.Parent;
            while (!oObject.ToString().Contains("frm"))
            {
                oObject = oObject.Parent;
            }

            oObject.Hide();
        }
Exemplo n.º 2
0
        private void miSave_Click(object sender, EventArgs e)
        {
            /*
            name - the name of the venue
            address - (optional) the address of the venue (e.g., "202 1st Avenue")
            crossstreet - (optional) the cross streets (e.g., "btw Grand & Broome")
            city - (optional) the city name where this venue is
            state - (optional) the state where the city is
            zip - (optional) the ZIP code for the venue
            phone - (optional) the phone number for the venue
            geolat - (optional, but recommended)
            geolong - (optional, but recommended)
            primarycategoryid - (optional) the ID of the category to which you want to assign this venue
            */
            string strName = tbName.Text.Trim();
            string strAddress = tbAddress.Text.Trim();
            string strCrossStreet = tbCrossStreet.Text.Trim();
            string strCity = tbCity.Text.Trim();
            string strState = tbState.Text.Trim();
            string strZip = tbZip.Text.Trim();
            string strPhone = tbPhone.Text.Trim();
            string strLat = tbLat.Text.Trim();
            string strLon = tbLon.Text.Trim();
            string strCatID = lblCategoryID.Text.Trim();

            if (String.IsNullOrEmpty(strName))
            {
                MessageBox.Show("Oops! Name cannot be blank", Program.strProgramName,
                     MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                return;
            }

            if (!_strFormType.Equals("add"))
            {
                /*
                vid - (required) the venue for which you want to propose an edit
                name - (required) the name of the venue
                address - (required) the address of the venue (e.g., "202 1st Avenue")
                crossstreet - the cross streets (e.g., "btw Grand & Broome")
                city - (required) the city name where this venue is
                state - (required) the state where the city is
                zip - (optional) the ZIP code for the venue
                phone - (optional) the phone number for the venue
                geolat - (required)
                geolong - (required)
                */
                if (String.IsNullOrEmpty(strAddress))
                {
                    MessageBox.Show("Oops! Address cannot be blank.", Program.strProgramName,
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                    return;
                }

                if (String.IsNullOrEmpty(strCity))
                {
                    MessageBox.Show("Oops! City cannot be blank.", Program.strProgramName,
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                    return;
                }

                if (String.IsNullOrEmpty(strState))
                {
                    MessageBox.Show("Oops! State cannot be blank.", Program.strProgramName,
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                    return;
                }

                if ((String.IsNullOrEmpty(strLat)) || (String.IsNullOrEmpty(strLon)))
                {
                    MessageBox.Show("Oops! You must specify a valid lat / long pair. Either click the 'Preview Map' button or enter it manually.", Program.strProgramName,
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                    return;
                }
            }
            else
            {
                if ((String.IsNullOrEmpty(strAddress)) && ((String.IsNullOrEmpty(strLat)) || (String.IsNullOrEmpty(strLon))))
                {
                    MessageBox.Show("Oops! You must specify either a valid address or a lat/long pair", Program.strProgramName,
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                    return;
                }
            }

            DotNetSquare.NetSquare.FourSquareVenue strResult = DotNetSquare.NetSquare.VenueAdd(strName, strAddress, strCrossStreet, strCity, strState, strZip, strPhone, strLat + "," + strLon, strCatID, Program.AccessToken);

            if (!(strResult.Equals(null)))
            {
                MessageBox.Show("OK! Venue saved successfully", Program.strProgramName,
                     MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);

                int i = Program.arrForm.Count - 1;
                Program.arrForm.RemoveAt(i);
                this.Close();

                if (_strFormType.Equals("add"))
                {
                    //get id
                    string strVenueID = strResult.id;
                    //show details
                    frmVenueDetails oVenueDetails = new frmVenueDetails(strVenueID);
                    oVenueDetails.Show();
                }
                else
                {
                    i--;
                    ((Form)Program.arrForm[i]).Show();
                }
            }
        }