Exemple #1
0
/*
 */
        public void BindData(classes.BoardItem tBoardItem)
        {
            //sets the dynamic UI up according to category
            //FillDropDowns(tBoardItem.Category.ToString());
            SetUpUIForCategory(tBoardItem.Category.ToString());
            lblCat.Text = Global.up1(DecodeiCat(tBoardItem.Category));
        }
Exemple #2
0
        private void imgNext_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            //string catVal;

            classes.BoardItem tmpItem = new classes.BoardItem();

            tmpItem.Category = Convert.ToInt32(cboCategory.SelectedItem.Value);
            //Session["Category"] = cboCategory.SelectedItem.Value;

            //tmpItem.Location = Convert.ToInt32(cboRegion.SelectedItem.Value);
            //Session["Region"]= cboRegion.SelectedItem.Value;

            tmpItem.AdType = (int)3;
            //Session["AdType"] = radioAdType.SelectedItem.Value;

            //tmpItem.Town = txtTown.Text;
            //Session["Town"] = txtTown.Text;

            //TODO: Remove old code
            //save to a global object to access other from other wizard pages
            //Global.gItem = Item;
            //Item = null;

            tmpItem.EditMode = false;

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

            //to next wizard page
            Response.Redirect("showcase_item.aspx");
        }
Exemple #3
0
/**
 */

        private void imgGoBack_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];
            tmpBoardItem.EditMode = true;
            Session["Item"]       = tmpBoardItem;
            Response.Redirect("showcase_item.aspx");
        }
Exemple #4
0
/**
 */
        private void imgContinue_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            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)
            {
                pnlError.Visible = true;
                return;
            }
            else
            {
                ErrorLog.ErrorRoutine(false, "ShowcaseItem OK!");
            }

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

            //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()))
                    {
                        Response.Redirect("../post_finish.aspx");
                    }
                }
                else
                {
                    lblStatus.Text = "Error posting";
                }
            }
            catch { lblStatus.Text = "ERROR: "; }
            finally{}

            //TODO: Remove.  Do we needed it?
            //Session["Item"] = tmpBoardItem;
        }
Exemple #5
0
        //TODO: Replace these gloabal vars
        //static string strUserDir;
        //static bool blnNoPics;

        protected void Page_Load(object sender, System.EventArgs e)
        {
            Global.AuthenticateUser();
            if (Session["acctType"].ToString() != "3")
            {
                Response.Redirect("../UserMenu.aspx");
            }

            classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];

            if (!Page.IsPostBack)
            {
                ErrorLog.ErrorRoutine(false, "Preview_post:BindData -> Category:" + tmpBoardItem.Category);
                ErrorLog.ErrorRoutine(false, "PP:SessionID:" + Session.SessionID);

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

                //Hide all sub-panels then enable accordingly

                pnlBoardType.Visible = false;

                //imgGoBack.Attributes.Add("onClick", "javascript:history.go(-1); return false;");

                //Load up display data and show a preview of the posting
                if (tmpBoardItem != null)
                {
                    BindData(tmpBoardItem);
                }
                else
                {
                    lblStatus.Text     = "Error loading data.";
                    lblStatus.CssClass = "errorLabel";
                    return;
                }
            }

            //reload the session item
            //Session["Item"] = tmpBoardItem;
        }
Exemple #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            Global.AuthenticateUser();

            if (Session["acctType"].ToString() != "3")
            {
                Response.Redirect("../UserMenu.aspx");
            }

            if (Session["Item"] == null)
            {
                HttpContext.Current.Response.Redirect("../Login.aspx");
            }

            classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];

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

            // Put user code to initialize the page here
            //if (pnlItem.Visible)
            //{
            //    PageType = 0; //wtf is this?  adtype?
            //}

            //usrId = Session["userId"].ToString();   //TODO: remove if this isn't doing squat

            if (!Page.IsPostBack)
            {
                BindData(tmpBoardItem);

                //Check for editMode
                if (tmpBoardItem.EditMode)
                {
                    LoadForEdits(tmpBoardItem);
                }
                else
                {
                    //setup pic panel for first time thru; TODO: stub this out into it's own function later
                    img1.ImageUrl = "../images/s1x1.gif";
                    img2.ImageUrl = "../images/s1x1.gif";
                    img3.ImageUrl = "../images/s1x1.gif";
                    img4.ImageUrl = "../images/s1x1.gif";

                    rdoImgMgr1.Items[2].Text = "Add";
                    rdoImgMgr1.Items.Remove("Delete");
                    rdoImgMgr1.Items.Remove("Keep");
                    File1.Disabled = true;

                    rdoImgMgr2.Items[2].Text = "Add";
                    rdoImgMgr2.Items.Remove("Delete");
                    rdoImgMgr2.Items.Remove("Keep");
                    File2.Disabled = true;

                    rdoImgMgr3.Items[2].Text = "Add";
                    rdoImgMgr3.Items.Remove("Delete");
                    rdoImgMgr3.Items.Remove("Keep");
                    File3.Disabled = true;

                    rdoImgMgr4.Items[2].Text = "Add";
                    rdoImgMgr4.Items.Remove("Delete");
                    rdoImgMgr4.Items.Remove("Keep");
                    File4.Disabled = true;
                }
            }

            switch (tmpBoardItem.AdType)
            {
            case 3:     //showcase
                pnlBoardType.Visible = false;
                pnlBrand.Visible     = true;
                pnlGenDims.Visible   = true;
                pnlWeb.Visible       = true;
                pnlGearItem.Visible  = true;
                lblItem.Text         = "Item: ";

                break;
            }
        }
Exemple #7
0
/*
 * TODO: Still need to code for all cats and adtypes
 */
        private bool LoadForEdits(classes.BoardItem tempBoardItem)
        {
            bool retVal = false;

            //pic setup
            if (tempBoardItem.AdType == (int)1)
            {
                img1.ImageUrl = "images/s1x1.gif";
                img2.ImageUrl = "images/s1x1.gif";
                img3.ImageUrl = "images/s1x1.gif";
                img4.ImageUrl = "images/s1x1.gif";
                string strServerURL = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"];
                if (tempBoardItem.ImgPath1.Length > (int)0)
                {
                    //get URL to show pic
                    string   path = strServerURL + @"\users\" + Session["userDir"].ToString() + @"\temp\";
                    string[] strArray;
                    char[]   splitter = { '\\' };
                    strArray             = tempBoardItem.ImgPath1.Split(splitter);
                    img1.ImageUrl        = path + "thmbNail_" + strArray[strArray.Length - 1];
                    HiddenField1.Value   = img1.ImageUrl;
                    pnlAddImages.Visible = true;
                }
                else
                {
                    rdoImgMgr1.Items[2].Text = "Add";
                    rdoImgMgr1.Items.Remove("Delete");
                    rdoImgMgr1.Items.Remove("Keep");
                    File1.Disabled = true;
                }
                if (tempBoardItem.ImgPath2.Length > (int)0)
                {
                    //get URL to show pic
                    string   path = strServerURL + @"\users\" + Session["userDir"].ToString() + @"\temp\";
                    string[] strArray;
                    char[]   splitter = { '\\' };
                    strArray             = tempBoardItem.ImgPath2.Split(splitter);
                    img2.ImageUrl        = path + "thmbNail_" + strArray[strArray.Length - 1];// tmpBoardItem.ImgPath1;
                    HiddenField2.Value   = img2.ImageUrl;
                    pnlAddImages.Visible = true;
                }
                else
                {
                    rdoImgMgr2.Items[2].Text = "Add";
                    rdoImgMgr2.Items.Remove("Delete");
                    rdoImgMgr2.Items.Remove("Keep");
                    File2.Disabled = true;
                }
                if (tempBoardItem.ImgPath3.Length > (int)0)
                {
                    //get URL to show pic
                    string   path = strServerURL + @"\users\" + Session["userDir"].ToString() + @"\temp\";
                    string[] strArray;
                    char[]   splitter = { '\\' };
                    strArray             = tempBoardItem.ImgPath3.Split(splitter);
                    img3.ImageUrl        = path + "thmbNail_" + strArray[strArray.Length - 1];// tempBoardItem.ImgPath1;
                    HiddenField3.Value   = img3.ImageUrl;
                    pnlAddImages.Visible = true;
                }
                else
                {
                    rdoImgMgr3.Items[2].Text = "Add";
                    rdoImgMgr3.Items.Remove("Delete");
                    rdoImgMgr3.Items.Remove("Keep");
                    File3.Disabled = true;
                }
                if (tempBoardItem.ImgPath4.Length > (int)0)
                {
                    //get URL to show pic
                    string   path = strServerURL + @"\users\" + Session["userDir"].ToString() + @"\temp\";
                    string[] strArray;
                    char[]   splitter = { '\\' };
                    strArray             = tempBoardItem.ImgPath4.Split(splitter);
                    img4.ImageUrl        = path + "thmbNail_" + strArray[strArray.Length - 1];// tempBoardItem.ImgPath1;
                    HiddenField4.Value   = img4.ImageUrl;
                    pnlAddImages.Visible = true;
                }
                else
                {
                    rdoImgMgr4.Items[2].Text = "Add";
                    rdoImgMgr4.Items.Remove("Delete");
                    rdoImgMgr4.Items.Remove("Keep");
                    File4.Disabled = true;
                }
            }

            switch (tempBoardItem.Category)
            {
            case 1:

                txtPrice.Text   = tempBoardItem.Price.ToString();
                txtDetails.Text = tempBoardItem.Details.ToString();
                if (tempBoardItem.AdType == (int)1)      //selling only
                {
                    txtBrand.Text = tempBoardItem.Brand.ToString();

                    txtWidthDNum.Text = tempBoardItem.WidthDenum.ToString();
                    txtWidthNum.Text  = tempBoardItem.WidthNum.ToString();
                    txtThick.Text     = tempBoardItem.Thickness.ToString();
                    txtThickDNum.Text = tempBoardItem.ThickDenum.ToString();
                    txtThickNum.Text  = tempBoardItem.ThickNum.ToString();
                }
                retVal = true;
                break;
            }
            return(retVal);
        }
Exemple #8
0
/*
 * Things to keep in mind here for this event handler:
 *      - we process all board types here including gear
 *      - we process wanted ads too which is a very limited subset including only
 *        category, boardtype, region, town, details, and price maybe
 */

        private void imgContinue_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            //get object from session object
            classes.BoardItem tmpBoardItem = (classes.BoardItem)Session["Item"];

            //kick out if validation failed
            if (!(Page.IsValid))
            {
                return;
            }

            //array holder for pics
            string[] strImgPathArray = new string[4];

            //init img array with blank space
            for (int j = 0; j <= 3; j++)
            {
                strImgPathArray[j] = "";
            }

            //Check for new or swapped pics.  The user has 3 possible options here; Keep, delete,
            //, or change an image. ***NOTE: For BETA entry updates will not use preview_post.
            //This means pics will *not* be moved to a temp dir as we do in posting.  This should change eventually.'
            //Delete any files in imgDel array
            bool blnProcImgs = false;

            switch (rdoImgMgr1.SelectedValue)
            {
            case "Keep":
                break;

            case "Delete":
                tmpBoardItem.ImgPath1 = "";
                break;

            case "Change":
                blnProcImgs = true;
                break;

            case "Add":
                blnProcImgs = true;
                break;

            default:
                break;
            }

            switch (rdoImgMgr2.SelectedValue)
            {
            case "Keep":
                break;

            case "Delete":
                tmpBoardItem.ImgPath2 = "";
                break;

            case "Change":
                blnProcImgs = true;
                break;

            case "Add":
                blnProcImgs = true;
                break;

            default:
                break;
            }

            switch (rdoImgMgr3.SelectedValue)
            {
            case "Keep":
                break;

            case "Delete":
                tmpBoardItem.ImgPath3 = "";
                break;

            case "Change":
                blnProcImgs = true;
                break;

            case "Add":
                blnProcImgs = true;
                break;

            default:
                break;
            }

            switch (rdoImgMgr4.SelectedValue)
            {
            case "Keep":
                break;

            case "Delete":
                tmpBoardItem.ImgPath4 = "";
                break;

            case "Change":
                blnProcImgs = true;
                break;

            case "Add":
                blnProcImgs = true;
                break;

            default:
                break;
            }

            //Process media
            if (pnlAddImages.Visible && blnProcImgs)
            {
                //Declare and load a struct to send to UploadAllImages()
                BoardStruct bStruct = new BoardStruct();
                bStruct.sItem    = tmpBoardItem;
                bStruct.tmpArray = strImgPathArray;

                bStruct = UpLoadAllImages(ref bStruct);

                tmpBoardItem = bStruct.sItem;
            }

            //Save common data
            tmpBoardItem.Brand    = txtBrand.Text;
            tmpBoardItem.Details  = txtDetails.Text;
            tmpBoardItem.Price    = Convert.ToDecimal(txtPrice.Text);
            tmpBoardItem.IUser    = Convert.ToInt32(Session["userId"].ToString());
            tmpBoardItem.Location = (int)1;

            tmpBoardItem.AdTitle = Global.CheckString(txtAdTitle.Text);

            //Save category specific data
            switch (tmpBoardItem.Category.ToString())
            {
            case "1":     //surf

                switch (tmpBoardItem.AdType)
                {
                case 3:         //showcase
                    tmpBoardItem.GenDimensions = Global.CheckString(txtGenDims.Text);
                    tmpBoardItem.WebURL        = Global.CheckString(txtWebURL.Text.Trim());
                    break;
                }

                break;

            case "2":       //snow

                //TODO:
                //switch (tmpBoardItem.AdType)
                //{
                //    case 1: //selling
                //        break;
                //    case 2: //wanted
                //        break;
                //    case 3: //showcase
                //        break;
                //}

                break;

            case "3":       //other boards
                if (chkOther.Checked)
                {
                    tmpBoardItem.OtherBoardType = Global.CheckString(txtOtherBoard.Text);
                }
                else
                {
                    //tmpBoardItem.BoardType = Convert.ToInt32(cboBoardType.SelectedItem.Value);
                }

                tmpBoardItem.GenDimensions = Global.CheckString(txtGenDims.Text);

                //TODO:
                //switch (tmpBoardItem.AdType)
                //{
                //    case 1: //selling
                //        break;
                //    case 2: //wanted
                //        break;
                //    case 3: //showcase
                //        break;
                //}

                break;

            case "4":       //gear
                tmpBoardItem.GearItem = Global.CheckString(txtGearItem.Text);

                //TODO:
                //switch (tmpBoardItem.AdType)
                //{
                //    case 1: //selling
                //        break;
                //    case 2: //wanted
                //        break;
                //    case 3: //showcase
                //        break;
                //}

                switch (tmpBoardItem.AdType)
                {
                case 3:         //showcase
                    tmpBoardItem.GenDimensions = Global.CheckString(txtGenDims.Text);
                    tmpBoardItem.WebURL        = Global.CheckString(txtWebURL.Text.Trim());
                    break;
                }

                break;
            }

            //Save object to session variable
            Session["Item"] = tmpBoardItem;

            //Goto preview_post
            Response.Redirect("showcase_preview.aspx");
        }
Exemple #9
0
/**
 * Display the data the user has entered from the (previous) post_item page.  The data now resides in a general entry item object
 * Show the general info then display board specfic detail
 */
        private void BindData(classes.BoardItem bItem)
        {
            ErrorLog.ErrorRoutine(false, "PP:BindData -> Category:" + bItem.Category);

            hdnUserDir.Value = Session["userDir"].ToString();

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

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

            //brand
            lblBrandData.Text = bItem.Brand;
            //price
            lblPriceData.Text = "$" + bItem.Price.ToString();
            //details
            lblDetailsData.Text = bItem.Details.ToString();
            //boardtype label
            lblBoardType.Text = "Board Type: ";

            //TODO: ShowPicsForPreview(bItem)

            //show pictures waiting in temp dir
            if (bItem.AdType.ToString() != "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        = 157;
                    Pic1.Height       = 211;
                    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 3:         //showcase

                    lblWeb.Text         = bItem.WebURL;
                    pnlWeb.Visible      = true;
                    lblGenDims.Text     = bItem.GenDimensions;
                    pnlGenDims.Visible  = true;
                    lblAdTitle.Text     = "&nbsp;Title:&nbsp";
                    lblAdTitle.Visible  = true;
                    lblAdTitleData.Text = bItem.AdTitle;
                    //pnlGearItem.Visible = true;

                    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:" + "";



                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;
                }

                pnlGenDims.Visible = true;
                lblGenDims.Text    = bItem.GenDimensions;

                break;

            case "4":                     //gear
                lblBrand.Text = "Brand:" + "";

                pnlGearItem.Visible  = true;
                lblGearItem.Visible  = true;
                pnlBoardType.Visible = false;
                lblGearItemData.Text = bItem.GearItem;
                break;
            }
        }