Esempio n. 1
0
/*
 */
        public void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                classes.BoardItem oBoard = new classes.BoardItem();

                if (dlEntryList.Items.Count > 0)
                {
                    foreach (DataListItem item in dlEntryList.Items)
                    {
                        CheckBox    pubCheckBox = item.FindControl("chkPublish") as CheckBox;
                        HiddenField hdnVal      = item.FindControl("hdnItemVal") as HiddenField;
                        //find the id and publish it
                        oBoard.PublishBoard(hdnVal.Value, pubCheckBox.Checked);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Error publishing model: " + ex.Message);
            }

            finally { }

            this.ItemsGet();
        }
Esempio n. 2
0
/**
 */
        private void btnNext_Click(object sender, System.EventArgs e)
        {
            classes.BoardItem tmpItem = new classes.BoardItem();

            ErrorLog.ErrorRoutine(false, "Post:btnNext_Click: " + Session.SessionID + " isPB: " + Page.IsPostBack);

            tmpItem.Category = 1;           //hardcoded for ALWAYS surfboards
            tmpItem.AdType   = 1;           //hardcoded for ALWAYS surfboards

            tmpItem.Location = Convert.ToInt32(cboRegion.SelectedItem.Value);
            tmpItem.Ship     = Convert.ToInt32(rdoShip.SelectedItem.Value);
            tmpItem.Town     = txtTown.Text;
            tmpItem.EditMode = false;

            tmpItem.Zip        = txtZip.Text;
            tmpItem.ICondition = Convert.ToInt32(radioConditionType.SelectedItem.Value);

            //Used for convenient 1-click editing from emails.
            BoardHunt.classes.RandomPassword pwdGen = new BoardHunt.classes.RandomPassword();
            tmpItem.ActivateCode = pwdGen.Generate();

            //Save board object to session variable
            Session["Item"] = tmpItem;
            tmpItem         = null;

            //to next wizard page
            Response.Redirect("post_item.aspx", false);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];

            //TODO: fix double load
            ErrorLog.ErrorRoutine(false, "preview_post:Page_Load:SID: " + Session.SessionID + " isPB: " + Page.IsPostBack);

            if (tmpBoardItem == null)
            {
                HandleError();
                return;
            }

            if (!Page.IsPostBack)
            {
                Global.AuthenticateUser();

                // Put user code to initialize the page here
                lnkSignIn.Text = Global.SetLnkSignIn( );
                lnkSignUp.Text = Global.SetLnkSignUp( );

                //Hide all sub-panels then enable accordingly
                pnlAll.Visible       = false;
                pnlWidth.Visible     = false;
                pnlSurfOnly.Visible  = false;
                pnlBoardType.Visible = false;

                //Load up display data and show a preview of the posting
                BindData(tmpBoardItem);
            }

            ErrorLog.ErrorRoutine(false, "preview_post:Page_Load:END:SID:" + Session.SessionID + " isPB: " + Page.IsPostBack);
        }
Esempio n. 4
0
/*
 * */
        private void StepBackEdit()
        {
            ErrorLog.ErrorRoutine(false, "post_preview:StepBackEdit:SID: " + Session.SessionID);
            classes.BoardItem oBoardItem = (classes.BoardItem)Session["Item"];
            oBoardItem.EditMode = true;
            Session["Item"]     = oBoardItem;
            Response.Redirect("post_item.aspx?", true);
        }
Esempio n. 5
0
        //protected System.Web.UI.WebControls.TextBox searchTextField;

        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            Global.AuthenticateUser("post.aspx");

            string iUID = Session["userId"].ToString();
            string i;

            //check for ProUser
            BoardHunt.wsBH.BHService oWS = new BoardHunt.wsBH.BHService();
            i = oWS.isPro(Convert.ToInt32(iUID)).ToString();

            if (i != "1")             //if not Pro acct the check to see if they're maxed out of posts
            {
                if (oWS.GetActiveBoardCount(Convert.ToInt32(iUID), 1, 0) > 4)
                {
                    Response.Redirect("/UserMenu.aspx", true);                     //TODO: add message that they're out of posts
                }
            }

            BindData();             //unconditionally bind the data for the controls

            //if (!Page.IsPostBack)
            //{
            //	Session ["EditMode"] = "false"; //a check for edit mode ???
            //}

            //check first time arrival or edit mode
            string[] arString;
            arString = Request.QueryString.GetValues("em");
            if (arString != null)
            {
                if (HttpUtility.UrlDecode(arString [0].ToString()) == "1")
                {
                    //load object values
                    classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];
                    if (tmpBoardItem != null)
                    {
                        txtTown.Text = tmpBoardItem.Town;
                        txtZip.Text  = tmpBoardItem.Zip;
                    }
                }
            }
            else
            {
                Session ["EditMode"] = "false";
            }

            // Put user code to initialize the page here
            lnkSignIn.Text = Global.SetLnkSignIn( );
            lnkSignUp.Text = Global.SetLnkSignUp( );

            Session ["Item"] = null;
        }
Esempio n. 6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            Global.AuthenticateUser();

            lnkSignIn.Text = Global.SetLnkSignIn();
            lnkSignUp.Text = Global.SetLnkSignUp();

            if (!Page.IsPostBack)
            {
                classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];

                string serverURL = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"];

                string entryId = GetNewEntryId();   //this should be moved closer to INSERT in p_preview
                hdnEntryVal.Value = entryId;

                BoardHunt.wsBH.BHService oWS = new BoardHunt.wsBH.BHService();
                oWS.InsertBoardForRatings(Convert.ToInt32(entryId.ToString()));

                string eLink;

                //reg posts
                if (tmpBoardItem.AdType != 4)
                {
                    pnlBoost.Visible        = true;
                    eLink                   = serverURL + "/surfboard.aspx?iD=" + entryId;
                    hypLnkPost.Visible      = true;
                    hypLnkPostModel.Visible = false;
                }
                else //AdType: 4 = Shaperhouse Model
                {
                    pnlBoost.Visible        = false;
                    eLink                   = serverURL + "/Shaper/ModelDetails.aspx?iD=" + entryId;
                    hypLnkPost.Visible      = false;
                    hypLnkPostModel.Visible = true;
                }

                //FB
                lnkFBShare.Attributes.Add("href", "javascript:void(window.open('http://www.facebook.com/sharer.php?u=" + eLink + "&t=Boardhunt.com|Surfboards+For+Sale'))");

                lnkLivePost.NavigateUrl = eLink;

                txtEntryLink.Text     = eLink;
                txtEntryLink.ReadOnly = true;

                switch (tmpBoardItem.AdType)
                {
                case 1:
                    break;

                case 2:
                    break;

                case 3:
                    lnkPostItem.Text        = serverURL + "/ShowcaseDetails.aspx?iD=" + entryId + "&uId=" + tmpBoardItem.IUser + "&iCat=" + tmpBoardItem.Category;
                    lnkPostItem.NavigateUrl = "ShowcaseDetails.aspx?iD=" + entryId + "&uId=" + tmpBoardItem.IUser + "&iCat=" + tmpBoardItem.Category;
                    break;

                case 4:
                    break;

                default:
                    break;
                }

                //hide upgrade for non-surf items
                if (tmpBoardItem.Category != (int)1)
                {
                    //btnUpgrade.Visible = false;
                }

                string[] eLinkArr = new string[4];
                eLinkArr[0] = eLink;
                eLinkArr[1] = tmpBoardItem.ActivateCode;
                eLinkArr[2] = entryId;

                //TODO: refine for categories and ad types
                if (tmpBoardItem.BoardType > 0)//surf or accessory?
                {
                    if (tmpBoardItem.AdType == 4)
                    {
                        eLinkArr[3] = tmpBoardItem.Model; //SH
                    }
                    else
                    {
                        eLinkArr[3] = tmpBoardItem.HtFt + "'" + " " + tmpBoardItem.HtIn + "\"" + " " + tmpBoardItem.Brand;
                    }
                }
                else
                {
                    eLinkArr[3] = tmpBoardItem.Brand + " " + tmpBoardItem.GearItem;
                }

                if (tmpBoardItem.AdType != 4)
                {
                    classes.Email.SendEmail("Thanks", Session["EmailId"].ToString(), classes.Email.MSG_THX_FOR_POST, eLinkArr);
                }
                else
                {
                    classes.Email.SendEmail("Thanks", Session["EmailId"].ToString(), classes.Email.MSG_THX_FOR_MODEL, eLinkArr);
                }


                //check for pro and..
                //BoardHunt.wsBH.BHService
                oWS = new BoardHunt.wsBH.BHService();
                string i = oWS.isPro(Convert.ToInt32(Session["userId"].ToString())).ToString();

                //set style accordingly
                if (i == "1")
                {
                    oWS.boost(Convert.ToInt32(Session["userId"].ToString()), Convert.ToInt32(entryId));
                    btnUpgradePro.Visible = false;
                    ImageButton1.Visible  = false;
                    hypLnkPost.Visible    = true;
                }
                else
                {
                    btnUpgradePro.Visible = true;
                    ImageButton1.Visible  = false;

                    if (classes.User.NeedsUpgrade(Convert.ToInt32(Session["userId"].ToString())))
                    {
                        hypLnkPost.Text        = "All free posts have been used.  Please UPGRADE your account to Pro in UserMenu";
                        hypLnkPost.NavigateUrl = "/UserMenu.aspx";
                    }
                }

                //All done - clean up Session variable
                Session["Item"] = null;
            }
        }
Esempio n. 7
0
/**
 * Display the data collected from the (previous) post_item page.  The data now resides in a general entry item object
 * Show the general info then display the specifics
 */
        private void BindData(classes.BoardItem bItem)
        {
            hdnUserDir.Value = Session["userDir"].ToString();
            hdnAdType.Value  = bItem.AdType.ToString();

            //show today's date
            lblDateData.Text = String.Format("{0:MM/dd}", DateTime.Now);

            //location-region and town
            if (bItem.Location > 0)
            {
                lblLocation.Text = Global.SwapChar(DecodeRegion(Convert.ToInt32(bItem.Location)), " ", "_");
                if (bItem.Town.Length > 0)
                {
                    lblLocation.Text += " - " + bItem.Town + " " + bItem.Zip;
                }
            }

            //brand
            lblBrandData.Text = bItem.Brand;
            if (bItem.Shaper.Length > 1)
            {
                lblBrandData.Text += " / " + bItem.Shaper;
            }
            //price
            lblPriceData.Text = "$" + bItem.Price.ToString();
            //details
            lblDetailsData.Text = bItem.Details.ToString();
            //boardtype label
            lblBoardType.Text = "Board Type: ";


            //TODO: ShowPicsForPreview(bItem)
            //TODO: dont show no image if slot 2

            //show pictures waiting in temp dir
            if (hdnAdType.Value != "2")    //1 = selling items; 2 = wanted; 3 = showcase
            {
                //Pic1
                Pic1.ImageUrl = GetPicPath(bItem.ImgPath1);
                if (Pic1.ImageUrl.IndexOf("s1x1.gif") != -1)
                {
                    Pic1.ImageUrl     = "images/noimage.gif";
                    Pic1.Width        = 400;
                    Pic1.Height       = 468;
                    hdnProcPics.Value = "False";
                }
                else //do thmbnail
                {
                    Pic1ThmbNail.ImageUrl = GetPicPath("thmbNail_" + bItem.ImgPath1);
                    Pic1ThmbNail.Visible  = true;
                    Pic1ThmbNail.Width    = 75;
                    Pic1ThmbNail.Height   = 75;
                    hdnProcPics.Value     = "True";
                }

                //Pic2
                Pic2.ImageUrl = GetPicPath(bItem.ImgPath2);
                if (Pic2.ImageUrl.IndexOf("s1x1.gif") != -1)
                {
                    Pic2.Width  = 1;
                    Pic2.Height = 1;
                }
                else
                {
                    Pic2ThmbNail.Visible  = true;
                    Pic2ThmbNail.ImageUrl = GetPicPath("thmbNail_" + bItem.ImgPath2);
                    Pic2ThmbNail.Width    = 75;
                    Pic2ThmbNail.Height   = 75;
                    hdnProcPics.Value     = "True";
                }

                //Pic3
                Pic3.ImageUrl = GetPicPath(bItem.ImgPath3);
                if (Pic3.ImageUrl.IndexOf("s1x1.gif") != -1)
                {
                    Pic3.Width  = 1;
                    Pic3.Height = 1;
                }
                else
                {
                    Pic3ThmbNail.Visible  = true;
                    Pic3ThmbNail.ImageUrl = GetPicPath("thmbNail_" + bItem.ImgPath3);
                    Pic3ThmbNail.Width    = 75;
                    Pic3ThmbNail.Height   = 75;
                    hdnProcPics.Value     = "True";
                }

                //Pic4
                Pic4.ImageUrl = GetPicPath(bItem.ImgPath4);
                if (Pic4.ImageUrl.IndexOf("s1x1.gif") != -1)
                {
                    Pic4.Width  = 1;
                    Pic4.Height = 1;
                }
                else
                {
                    Pic4ThmbNail.Visible  = true;
                    Pic4ThmbNail.ImageUrl = GetPicPath("thmbNail_" + bItem.ImgPath4);
                    Pic4ThmbNail.Width    = 75;
                    Pic4ThmbNail.Height   = 75;
                    hdnProcPics.Value     = "True";
                }
            }
            else //show wanted pic
            {
                Pic1.ImageUrl     = "images//wantedbig.gif";
                Pic1.Height       = 214;
                Pic1.Width        = 168;
                hdnProcPics.Value = "False";
            }

            //Show e-mail and possibly phone num
            ShowContactDetails();

            //board specific data
            switch (bItem.Category.ToString())
            {
            case "1":                     //surf

                //switch (bItem.BoardType)
                switch (bItem.AdType)
                {
                case 1:         //buy
                    pnlAll.Visible       = true;
                    pnlBoardType.Visible = true;
                    //fins
                    lblFinsData.Text = DecodeFins(bItem.Fins);
                    //tail
                    lblTailData.Text = Global.ProperSpace(DecodeTail(bItem.TailType));

                    //height
                    lblHeightFtData.Text = bItem.HtFt + "\'";
                    lblHeightInData.Text = bItem.HtIn + "\"";

                    //width
                    lblWidthData.Text = bItem.Width.ToString();
                    if (bItem.WidthDenum.ToString().Length > 0 && bItem.WidthNum.ToString().Length > 0)
                    {
                        lblWidthData.Text += " + " + bItem.WidthNum.ToString() + "/" + bItem.WidthDenum.ToString();
                    }
                    lblWidthData.Text += "\"";

                    //thickness
                    lblThick.Text = bItem.Thickness.ToString();
                    if (bItem.ThickNum.ToString().Length > 0 && bItem.ThickDenum.ToString().Length > 0)
                    {
                        lblThick.Text += " + " + bItem.ThickNum.ToString() + "/" + bItem.ThickDenum.ToString();
                    }
                    lblThick.Text += "\"";

                    //enable surf panels
                    pnlWidth.Visible      = true;
                    pnlSurfOnly.Visible   = true;
                    pnlGearItem.Visible   = false;
                    lblBoardTypeData.Text = DecodeBoard(bItem.Category, bItem.BoardType);
                    break;

                case 2:         //sell
                    break;

                case 3:         //showcase
                    pnlAll.Visible       = false;
                    lblWeb.Text          = bItem.WebURL;
                    pnlWeb.Visible       = true;
                    lblGenDims.Text      = bItem.GenDimensions;
                    pnlGenDims.Visible   = true;
                    lblGearItem.Text     = "&nbps;Model:&nbsp";
                    lblGearItem.Visible  = true;
                    lblGearItemData.Text = bItem.GearItem;
                    pnlGearItem.Visible  = true;

                    break;

                case 4:
                    lblPrice.Text         = "Model Price";
                    lblModelData.Text     = bItem.Model;
                    lblBoardTypeData.Text = DecodeBoard(bItem.Category, bItem.BoardType);
                    lblGenDims.Text       = bItem.GenDimensions;
                    break;

                default:
                    break;
                }

                break;

            case "2":                     //snow
                pnlBoardType.Visible = true;
                lblHeightFtData.Text = bItem.HtFt + "" + "cm";

                lblBoardTypeData.Text = DecodeBoard(bItem.Category, bItem.BoardType);
                lblBrand.Text         = "Brand:" + "";

                pnlSurfOnly.Visible = false;

                break;

            case "3":                     //other board
                pnlBoardType.Visible = true;
                lblBrand.Text        = "Brand:" + "";

                if (bItem.OtherBoardType == null || bItem.OtherBoardType == "")
                {
                    //todo: maybe set other = "" so sql doesn't complain

                    bItem.OtherBoardType  = "";
                    lblBoardTypeData.Text = DecodeBoard(bItem.Category, bItem.BoardType);
                }
                else
                {
                    lblBoardTypeData.Text = bItem.OtherBoardType;
                }
                pnlAll.Visible      = false;
                pnlSurfOnly.Visible = false;
                pnlGenDims.Visible  = true;
                lblGenDims.Text     = bItem.GenDimensions;
                break;

            case "4":                     //gear
                lblBrand.Text        = "Brand:" + "";
                pnlAll.Visible       = false;
                pnlSurfOnly.Visible  = false;
                pnlGearItem.Visible  = true;
                lblGearItem.Visible  = true;
                pnlBoardType.Visible = false;
                lblGearItemData.Text = bItem.GearItem;
                break;
            }
            SetupUIForEntryType();  //superflous?
        }
Esempio n. 8
0
/*
 */
        private void SubmitItem(bool publishVal)
        {
            classes.BoardItem tmpBoardItem2 = (classes.BoardItem)Session["Item"];

            // - Tasks:
            // - Move pics from temp dir to surf dir then delete *.* temp dir
            // - Write entry to db from object

            if (tmpBoardItem2 == null)
            {
                ErrorLog.ErrorRoutine(false, "Error:Preview_Post:imgContinue_Click: BoardItem obj NULL: Session: " + Session.SessionID);
                //ErrorLog.ErrorRoutine(false, "Error:Preview_Post:imgContinue_Click: SessionID: " + Session.SessionID);

                pnlError.Visible = true;
                return;
            }
            else
            {
                ErrorLog.ErrorRoutine(false, "Preview_Post:imgContinue_Click:ENTRYITEM OK: " + Session.SessionID);
            }

            tmpBoardItem2.Created = DateTime.Now;
            tmpBoardItem2.Details = Global.CheckString(tmpBoardItem2.Details);
            tmpBoardItem2.Brand   = Global.CheckString(tmpBoardItem2.Brand);
            tmpBoardItem2.Shaper  = Global.CheckString(tmpBoardItem2.Shaper);

            //Shaperhouse
            if (tmpBoardItem2.AdType == 4)
            {
                if (publishVal)
                {
                    tmpBoardItem2.Status = 5;
                }
                else
                {
                    tmpBoardItem2.Status = 4;
                }
            }

            //check for pics
            if (hdnProcPics.Value == "True" && tmpBoardItem2.AdType != (int)2)
            {
                if (MoveFiles(tmpBoardItem2.Category, tmpBoardItem2.AdType))
                {
                    DeletePicsInTempDir();
                }
            }

            //Save entry
            try
            {
                //write entry to db
                if (tmpBoardItem2.SaveItem())
                {
                    //update user's entry count
                    if (UpdateEntryCount(tmpBoardItem2.IUser.ToString()))
                    {
                        if (!publishVal)
                        {
                            Response.Redirect("post_manager.aspx?q=4", false);
                        }
                        Response.Redirect("post_finish.aspx", false);
                    }
                }
                else
                {
                    lblStatus.Text = "Error posting";
                }
            }
            catch { lblStatus.Text = "ERROR"; }
            finally { }

            //TODO: Remove.  Do we needed it?
            //Session["Item"] = tmpBoardItem;
        }