Пример #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();
        }
Пример #2
0
        /*
         *      //Here we check the file type and size.  Halt processing any further if the wrong file type or too big o' size is detected.
         */
        public bool CheckFileType()
        {
            //user wanted to upload but no pic
            if (File1.PostedFile == null)
            {
                return(false);
            }

            //get file name & ext
            HttpPostedFile oFile       = File1.PostedFile;
            string         fileName    = oFile.FileName;
            string         fileExt     = Path.GetExtension(fileName).ToLower();
            int            IntFileSize = oFile.ContentLength;

            //Check for file type and size:
            if (fileName != string.Empty)
            {
                if ((!Regex.IsMatch(oFile.ContentType, "(.gif|.jpg|.jpeg|.bmp|.png)")))
                {
                    lblStatus.Text = "Wrong file type!";
                    ErrorLog.ErrorRoutine(false, "edit_item:imgContinue_Click:Wrong file type!");
                    return(false);
                }
                //check for 2.5 MB max
                if (IntFileSize <= 0 || IntFileSize >= 2621440)
                {
                    lblStatus.Text = "File too big!";
                    ErrorLog.ErrorRoutine(false, "edit_item:imgContinue_Click:File too big!");
                    return(false);
                }
            }
            return(true);
        }
Пример #3
0
/*
 */
        protected void BindUpgrades()
        {
            string strSQL;
            //string strUser;

            IDBManager dbManager = new DBManager(DataProvider.SqlServer);

            //SELECT * from my_table ORDER BY RAND() LIMIT 25


            //build SQL
            strSQL = @"SELECT e.txtImgPath1, e.iD, e.iHtFt, e.iHtIn, e.iUser, e.txtBrand, u.userDir 
            FROM tblServices s
            INNER JOIN tblEntry e on s.iEntryId = e.iD
            INNER JOIN tblUser u on u.id = e.iUser";

            dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            try
            {
                dbManager.Open();
                dbManager.ExecuteReader(CommandType.Text, strSQL);
                dlUpgrades.DataSource = dbManager.DataReader;
                dlUpgrades.DataBind();
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Error: RegisterDBEntry: " + ex.Message);
            }
            finally
            {
                dbManager.Close();
                dbManager.Dispose();
            }
        }
Пример #4
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);
        }
Пример #5
0
        protected bool hasCoupons()
        {
            string     strSQL    = string.Empty;
            IDBManager dbManager = new DBManager(DataProvider.SqlServer);

            dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;
            strSQL = @"SELECT iD FROM tblCoupon WHERE iUser = '******'";

            try
            {
                dbManager.Open();
                dbManager.ExecuteReader(CommandType.Text, strSQL);
                if (dbManager.DataReader.Read())
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "UserMenu:hasCoupons:Error:" + ex.Message);
                classes.Email.SendErrorEmail("UserMenu:hasCoupons:Error:" + ex.Message);
                return(false);
            }
            finally
            {
                dbManager.Close();
                dbManager.Dispose();
            }
        }
Пример #6
0
/*
 * */
        private void LoadControl()
        {
            string     strSQL    = "SELECT BoardType, iValue FROM LK_BoardType WHERE BoardCategory = 1;SELECT iD, Region FROM LK_Region";
            IDBManager dbManager = new DBManager(DataProvider.SqlServer);

            dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;
            DataSet ds = new DataSet();

            try
            {
                dbManager.Open();
                ds = dbManager.ExecuteDataSet(CommandType.Text, strSQL);

                chkListShaping.DataSource     = ds;
                chkListShaping.DataMember     = ds.Tables[0].ToString();
                chkListShaping.DataTextField  = "BoardType";
                chkListShaping.DataValueField = "iValue";
                chkListShaping.DataBind();

                cboRegion.DataSource     = ds;
                cboRegion.DataMember     = ds.Tables[1].ToString();
                cboRegion.DataTextField  = "Region";
                cboRegion.DataValueField = "iD";
                cboRegion.DataBind();
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Error:EditProfile:LoadControl: " + ex.Message);
            }
            finally
            {
                dbManager.Close();
                dbManager.Dispose();
            }
        }
Пример #7
0
        //private void imgAddFav_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        //{
        //    if (Session["LoggedIn"].ToString() == "No")
        //    {
        //        Global.CreateMessageAlert(this.Page, "You must be logged in to do that.", "alertKey");
        //        return;
        //    }

        //    //add this entry into the favorites table
        //    string strSQL;
        //    string myConnectString;

        //    //form connect string
        //    myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;


        //    //Build SQL
        //    strSQL = "INSERT INTO tblFavs (userId, entryId)";
        //    strSQL += "VALUES ('" + Session["userId"].ToString() + "','" + Request.QueryString["iD"].ToString() + "')";

        //    SqlConnection myConnection = new SqlConnection(myConnectString);

        //    //TODO: need to check for duplicate entries
        //    try
        //    {
        //        myConnection.Open();

        //        SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
        //        objCommand.ExecuteNonQuery();

        //        myConnection.Close();

        //        BindComments();

        //        Global.CreateMessageAlert(this.Page,"Entry has been added to your favorites.", "alertKey");

        //    }

        //    catch
        //    {
        //        lblStatus.Text = "SQL Error: Connection Bad.<br>";
        //        lblStatus.Text = "SQL: " + strSQL;
        //    }


        //}

        protected void btnPostComment_Click(object sender, EventArgs e)
        {
            //add this entry into the favorites table
            string strSQL;
            string myConnectString;

            //check login status
            if (Session["LoggedIn"].ToString() == "No")
            {
                //TODO: display please log in?
                return;
            }

            //check for an empty comment
            if (txtComment.Text.Length <= 0)
            {
                txtComment.BorderColor = Color.Red;
                return;
            }

            //form connect string
            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Build SQL
            strSQL  = "INSERT INTO tblComments (entryId, userId, txtComment, dPosted)";
            strSQL += "VALUES ('" + Convert.ToInt32(hdnEId.Value) + "','" + Convert.ToInt32(Session["userId"].ToString()) + "','" + Global.CheckString(txtComment.Text) + "','" + DateTime.Now + "')";

            SqlConnection myConnection = new SqlConnection(myConnectString);

            //TODO: need to check for duplicate entries - ?
            try
            {
                myConnection.Open();

                SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
                objCommand.ExecuteNonQuery();

                string[] eLinkArr = new string[1];
                eLinkArr[0] = Request.Url.ToString();

                //Send E-mail
                if (hdnNotifyEmail.Value == "Y")
                {
                    classes.Email.SendEmail("A new comment was posted on your board", lnkEmailData.CommandArgument, classes.Email.MSG_POSTED_COMMENT, eLinkArr);
                }

                Response.Redirect(Request.Url.ToString());
            }

            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "ItemDetails:Error posting comment:" + ex.Message);
                lblStatus.Text = "Error posting comment.<br>";
            }

            finally
            {
                myConnection.Close();
            }
        }
Пример #8
0
/*
 */
        private bool verify_User(string myConnStr, string emailId)
        {
            bool          user_Registered = false;
            string        SQLstr          = "SELECT iD FROM tblUser WHERE txtEmail ='" + emailId + "'";
            SqlConnection myConn          = new SqlConnection(myConnStr);
            SqlDataReader rdr             = null;
            SqlCommand    objSQLCommand   = new SqlCommand(SQLstr, myConn);

            try
            {
                myConn.Open();
                rdr = objSQLCommand.ExecuteReader();

                if (rdr.Read())
                {
                    user_Registered = true;
                }
            }
            catch
            {
                ErrorLog.ErrorRoutine(false, "Error attempting to verify new user e-mail");
                lblStatus.Text = "ERROR!";
            }
            finally
            {
                myConn.Close();
            }
            return(user_Registered);
        }
Пример #9
0
/*
 * Deletes all files in temp dir
 */
        private bool DeletePicsInTempDir()
        {
            //delete all files in tempDir
            try
            {
                if (Directory.Exists(Server.MapPath(".\\" + @"\users\" + hdnUserDir.Value + @"\temp\")))
                {
                    string[] files = Directory.GetFiles(Server.MapPath(".\\" + @"\users\" + hdnUserDir.Value + @"\temp\"));
                    foreach (string file in files)
                    {
                        File.Delete(file);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                ErrorLog.ErrorRoutine(false, "Preview_Post:DeletePicsInTempDir:ErrorDeletingTempPics: " + e.Message);
                return(false);
            }
        }
Пример #10
0
/*
 */
        public void BindData()
        {
            return;

            string strSQL = string.Empty;

            strSQL = "SELECT COUNT(*) as scount FROM tblEntry WHERE iStatus = 3";

            IDBManager dbManager = new DBManager(DataProvider.SqlServer);

            dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            try
            {
                dbManager.Open();
                dbManager.ExecuteReader(CommandType.Text, strSQL);
                if (dbManager.DataReader.Read())
                {
                    lblSold.Text = dbManager.DataReader["scount"].ToString() + " Boards SOLD";
                }
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "index:bindData:Error:" + ex.Message);
            }
            finally
            {
                dbManager.Close();
                dbManager.Dispose();
            }
        }
Пример #11
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);
        }
Пример #12
0
/*
 */
        private void btnSend_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            try
            {
                //Send the message
                if (classes.Email.SendContactEmail(message.Text, cboSubject.SelectedItem.Text, email.Text, name.Text))
                {
                    //smtpClient.Send(mail);
                    panelSendEmail.Visible = false;
                    panelMailSent.Visible  = true;
                }
            }
            catch (System.Web.HttpException ehttp)
            {
                ErrorLog.ErrorRoutine(false, "Error: " + ehttp.Message);
                lblErrMessage.Text     = "Your e-mail address is invalid.  Please fix and resend.";
                lblErrMessage.CssClass = "errorLabel";
            }

            finally
            {
            }
        }
Пример #13
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);
        }
Пример #14
0
 /*
  * //Fired when user clicks the Upgrade button.  NOTE: This handler will not fire unless VIEWSTATE is set to False.
  */
 public void UpgradeEntry(object src, CommandEventArgs e)
 {
     //Set session for posting upgrade
     Session["ServiceId"] = "1";
     Session["TxnItemId"] = e.CommandArgument.ToString();
     ErrorLog.ErrorRoutine(false, "UpgradeId: " + Session["TxnItemId"].ToString());
     Response.Redirect("/Pay/OrderForm.aspx");
 }
Пример #15
0
/*
 */
        protected void BindData()
        {
            string strSQL;
            string val;

            val = string.Empty;

            IDBManager dbManager = new DBManager(DataProvider.SqlServer);

            dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Declare Dataset
            DataSet dsItems = new DataSet();

            strSQL  = "SELECT ts.dStartDate, ts.iStatus, lks.name, lks.amount FROM tblServices ts ";
            strSQL += "INNER JOIN LK_Services lks ON ";
            strSQL += "ts.iServiceVal = lks.iD ";
            strSQL += "WHERE ts.iUserId= '" + Session["userId"].ToString() + "'";
            strSQL += " AND ts.iServiceVal = '2'";

            //Get the service info and display the data or if no data redirect them to the order for so they can subscribe to Bidder
            try
            {
                dbManager.Open();
                dsItems = dbManager.ExecuteDataSet(CommandType.Text, strSQL);

                int listCount = dsItems.Tables[0].Rows.Count;

                ErrorLog.ErrorRoutine(false, "ListCount: " + listCount);

                if (listCount > 0)
                {
                    PagedDataSource objPds = new PagedDataSource();
                    objPds.DataSource  = dsItems.Tables[0].DefaultView;
                    objPds.AllowPaging = true;
                    objPds.PageSize    = 15;

                    //bind to control
                    dlEntryList.DataSource = objPds;
                    dlEntryList.DataBind();
                }
                else
                {
                    Session["ServiceId"] = "2";
                    Response.Redirect("Pay/OrderForm.aspx", false);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "OrderForm:Page_Load:Msg: " + ex.Message);
            }
            finally
            {
                dbManager.Close();
                dbManager.Dispose();
            }
        }
Пример #16
0
        //Creates the new user direcectory only after they have successfully registered
        private bool CreateUserDir(string uId)
        {
            int    i         = 1;
            int    pad_size  = 10 - uId.Length;
            string user_path = @Server.MapPath("/") + @"users\";
            string userDir   = "";
            String strSQL;
            String myConnectString;

            //pad the user ID with zeroes
            //construct dir path string
            while (i <= pad_size)
            {
                userDir   = userDir + @"0\";
                user_path = user_path + @"0\";
                i++;
            }

            i = 0;
            while (i < uId.Length)
            {
                userDir   = userDir + uId[i] + @"\";
                user_path = user_path + @uId[i] + @"\";
                i++;
            }

            //create the users' directories
            Directory.CreateDirectory(user_path);
            Directory.CreateDirectory(user_path + Global.BOARDCAT_DIRS.surfboards.ToString());
            Directory.CreateDirectory(user_path + Global.BOARDCAT_DIRS.snowboards.ToString());
            Directory.CreateDirectory(user_path + Global.BOARDCAT_DIRS.other.ToString());
            Directory.CreateDirectory(user_path + Global.BOARDCAT_DIRS.accessories.ToString());
            Directory.CreateDirectory(user_path + @"temp");

            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Formulate SQL
            strSQL = "UPDATE tblUser SET userDir = '" + userDir + "' WHERE id = '" + uId + "'";
            SqlConnection myConnection = new SqlConnection(myConnectString);

            try
            {
                myConnection.Open();
                SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
                objCommand.ExecuteNonQuery();
                myConnection.Close();
                //lblMessage.Text = "You're offically registered with Boardhunt!";
                return(true);
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Error!";
                ErrorLog.ErrorRoutine(false, "Error setting userDir:" + ex.Message);
                return(false);
            }
        }//end of method
Пример #17
0
        protected void lnkBoost_Click(object sender, EventArgs e)
        {
            ErrorLog.ErrorRoutine(false, "post_finish:lnkBoost_Click");

            //Set session for posting upgrade
            Session["ServiceId"] = "1";
            Session["TxnItemId"] = hdnEntryVal.Value;

            Response.Redirect("/Pay/OrderForm.aspx", true);
        }
Пример #18
0
/*
 */
        public string SetPicPath(object uDir, object imgPath)
        {
            //set the default
            string retVal = "images/s1x1.gif";

            if (uDir != null && imgPath != null)
            {
                retVal = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"].ToString() + "/users/" + Global.ReplaceEx(uDir.ToString(), @"\", @"/") + "surfboards/" + "thmbNail_" + imgPath;
                ErrorLog.ErrorRoutine(false, "path: " + retVal);
            }

            return(retVal);
        }
Пример #19
0
        protected void Application_End(Object sender, EventArgs e)
        {
            ErrorLog.ErrorRoutine(false, "APP_END");

            HttpRuntime runtime = (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime",
                                                                                           BindingFlags.NonPublic
                                                                                           | BindingFlags.Static
                                                                                           | BindingFlags.GetField,
                                                                                           null,
                                                                                           null,
                                                                                           null);

            if (runtime == null)
            {
                return;
            }

            string shutDownMessage = (string)runtime.GetType().InvokeMember("_shutDownMessage",
                                                                            BindingFlags.NonPublic
                                                                            | BindingFlags.Instance
                                                                            | BindingFlags.GetField,
                                                                            null,
                                                                            runtime,
                                                                            null);

            string shutDownStack = (string)runtime.GetType().InvokeMember("_shutDownStack",
                                                                          BindingFlags.NonPublic
                                                                          | BindingFlags.Instance
                                                                          | BindingFlags.GetField,
                                                                          null,
                                                                          runtime,
                                                                          null);

            //if (!EventLog.SourceExists(".NET Runtime"))
            //{
            //    EventLog.CreateEventSource(".NET Runtime", "Application");
            //}

            //EventLog log = new EventLog();
            //log.Source = ".NET Runtime";

            string errStr;

            errStr = String.Format("\r\n\r\n_shutDownMessage={0}\r\n\r\n_shutDownStack={1}",
                                   shutDownMessage,
                                   shutDownStack);

            ErrorLog.ErrorRoutine(false, "APP_END: " + errStr);
        }
Пример #20
0
/*
 */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            ErrorLog.ErrorRoutine(false, "Matrix:SearchClicked");

            //Get/Set Values
            cboWaveSizeVal   = cboWaveSize.SelectedValue;                                         //wavesize
            cboSkillLevelVal = cboLevel.SelectedValue;                                            //skill level

            rdoWaveTypeVal = rdoWaveType.SelectedValue;                                           //wave type

            cboHeightTotal  = Convert.ToInt32(txtHtFt.Text) * 12 + Convert.ToInt32(txtHtIn.Text); //height
            hdnWeight.Value = txtWeight.Text;                                                     //weight

            ShowResults();
        }
Пример #21
0
/*
 */
        private string CalcThickness(int x)
        {
            double a, b, r, lb, eThk, w;
            string sVal, sThk, sSrc;
            string pre = "&nbsp;&nbsp;&nbsp;<b>Thickness:</b> ";

            w = Convert.ToDouble(txtWeight.Text);

            b    = thick[0, x];                 //high
            a    = thick[1, x];                 //low
            lb   = b - a;                       //thick diff
            r    = ((w - 100) / 220) * lb;      //right
            eThk = Math.Round((r + a) * 8) / 8; //round to nearest 8th -> 2.75

            try
            {
                sVal = eThk.ToString();         //"2.75"

                if (!sVal.Contains("."))        //ignore and return if .0
                {
                    return(pre + sVal + "\"");
                }

                string[] sArr = sVal.Split('.');

                sSrc = "." + sArr[1];

                //check for ZERO
                if (hsF.ContainsKey((object)sSrc))
                {
                    sThk = sArr[0] + "+" + hsF[sSrc].ToString();
                }
                else
                {
                    sThk = sVal;
                }
                //ErrorLog.ErrorRoutine(false, "BT: " + x + " " + "HiThick: " + b + " LowThick: " + a);
                return(pre + sThk + "\"");
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, ex.Message);
                return(string.Empty);
            }
            finally
            {
            }
        }
Пример #22
0
        //Fired when user clicks to vote the entry.  NOTE:  This handler will not fire unless VIEWSTATE is set to False.
        public void ProcRating(object src, CommandEventArgs e)
        {
            //Already confirmed so go ahead and delete the entry
            string connStr, strSQL;

            //get conn string
            connStr = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Did this to handle NULL values in the db.  Apparently NULL arithmatic is frowned upon
            //if (blnNullFlag)
            if (Convert.ToInt32(hdnRatingVal.Value) < (int)1)
            {
                strSQL = "UPDATE tblEntry SET iRatingCount = 1,iRatingVal = " + e.CommandArgument + "WHERE iD = '" + Request.QueryString["iD"] + "'";
            }
            else
            {
                strSQL = "UPDATE tblEntry SET iRatingCount = iRatingCount + 1,iRatingVal = iRatingVal + " + e.CommandArgument + "WHERE iD = '" + Request.QueryString["iD"] + "'";
            }

            SqlConnection myConnection = new SqlConnection(connStr);

            try
            {
                myConnection.Open();

                SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
                objCommand.ExecuteNonQuery();

                string voteVal = "voted_" + hdnEId.Value;

                Session[voteVal] = "Y";

                //rebind data to control
                BindData();
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Error in ProcRating:" + ex.Message);
                lblStatus.Text = "Ratings Error.";
            }
            finally
            {
                //close
                myConnection.Close();
            }
        }
Пример #23
0
        protected void ShowLinks()
        {
            if (Session["isPro"].ToString() != "1")
            {
                string     strSQL    = string.Empty;
                IDBManager dbManager = new DBManager(DataProvider.SqlServer);

                strSQL = "select count(iD) as numpost from tblentry where iStatus = 1 and iCategory = 1 and iuser = '******'";

                dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

                try
                {
                    dbManager.Open();
                    dbManager.ExecuteReader(CommandType.Text, strSQL);

                    if (dbManager.DataReader.Read())
                    {
                        if (Convert.ToInt32(dbManager.DataReader["numpost"].ToString()) >= (int)FREE_BOARD_COUNT)
                        {
                            ErrorLog.ErrorRoutine(false, "NumPost: " + dbManager.DataReader["numpost"].ToString());
                            lnkSellGear.Text     = "&nbsp;Upgrade";
                            lnkSellGear.CssClass = "ltgreen_green18";
                            //lnkSellGear.CssClass = Global.
                        }
                    }
                    else
                    {
                        ErrorLog.ErrorRoutine(false, "No boards found.  On with post");
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.ErrorRoutine(false, "UM: Error Getting Post within last 30: " + ex.Message);
                    classes.Email.SendErrorEmail("UM: Error Getting Post within last 30: " + ex.Message);
                }
                finally
                {
                    dbManager.Close();
                    dbManager.Dispose();
                }

                //if read() then yes and remove links.  If no read then all good.
            }
        }
Пример #24
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            ErrorLog.ErrorRoutine(false, "SessionStart: " + Session.SessionID);

            Session["MaxLoginAttempts"] = 3;            // Max # of Administrator login attempts
            Session["LoginCount"]       = 0;            // not used
            Session["EmailId"]          = "unknown";    // user's email handle
            Session["userId"]           = "0";          // user's id

            Session["LoggedIn"] = "No";                 // Track whether they're logged in or not
            if (Global.CheckLoginCookies(false))
            {
                Session["LoggedIn"] = "Yes";
            }

            Session["AdType"]  = "";                //Type of ad; 0 = Sell; 1 = Wanted
            Session["GoToURL"] = "";
            Session["BlogFlg"] = "";                // Blog Flag
        }
Пример #25
0
/*
 */
        public void ShowContactDetails()
        {
            string myConnectString, strSQL;

            //load up contact details
            strSQL = "SELECT txtEmail, txtPhonenum, iShowPhoneNum FROM tblUser WHERE tblUser.iD = '" + Session["userId"].ToString() + "'";

            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            SqlConnection myConnection = new SqlConnection(myConnectString);
            SqlCommand    objCommand   = new SqlCommand(strSQL, myConnection);
            SqlDataReader SQLReader    = null;

            try
            {
                myConnection.Open();
                SQLReader = objCommand.ExecuteReader();

                while (SQLReader.Read() == true)
                {
                    lnkEmailData.Text = SQLReader["txtEmail"].ToString();
                    lnkEmailData.Attributes.Add("href", "mailto:" + SQLReader["txtEmail"].ToString());

                    lblPhoneData.Text    = SQLReader["txtPhoneNum"].ToString();
                    lblPhoneData.Visible = ShowPhone(SQLReader["iShowPhoneNum"]);
                }
            }

            catch
            {
                lblStatus.Text = "SQL Error!";
                ErrorLog.ErrorRoutine(false, "Error:preview_post:showcontact_details: Can't read contact info");
            }
            finally
            {
                myConnection.Close();
            }
            return;
        }
Пример #26
0
/*
 * Handle the null object item error
 */
        private void HandleError()
        {
            ErrorLog.ErrorRoutine(false, "Error:preview_post:Page_Load:BoardItem obj NULL: SessionID: " + Session.SessionID + ":BrowserType:" + Request.Browser.Browser + " User: "******"EmailId"].ToString());

            string     eLog       = string.Empty;
            StackTrace stackTrace = new StackTrace();           // get call stack

            StackFrame[] stackFrames = stackTrace.GetFrames();  // get method calls (frames)

            // write call stack method names
            foreach (StackFrame stackFrame in stackFrames)
            {
                eLog += stackFrame.GetMethod().Name + " : ";// write method name
            }
            ErrorLog.ErrorRoutine(false, eLog);

            //notify BH
            classes.Email.SendErrorEmail("Error:preview_post:page_load:Null item: Browser: " + Request.Browser.Browser + "-" + Request.Browser.Version + " Server: " + System.Configuration.ConfigurationSettings.AppSettings["ServerURL"].ToString() + " Session: " + Session.SessionID + " isPB: " + Page.IsPostBack);

            //show error and re-login
            pnlError.Visible   = true;
            pnlDetails.Visible = false;
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ErrorLog.ErrorRoutine(false, "ItemDetails:Page_Load: ");

                string[] arString;
                arString = Request.QueryString.GetValues("iD");

                if (arString[0] != string.Empty)
                {
                    string serverURL = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"].ToString();

                    Response.Status = "301 Moved Permanently";
                    ErrorLog.ErrorRoutine(false, "addHeaderString:" + serverURL + @"/surfboard.aspx?id=" + arString[0]);
                    Response.AddHeader("Location", serverURL + @"/surfboard.aspx?id=" + arString[0]);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "InItemDetails: Exception: " + ex.Message);
            }
        }
Пример #28
0
        }//end function

/*
 */
        private bool DeleteFile()
        {
            //delete the current profile pic and this should default to nopic64.jpg
            try
            {
                if (File.Exists(Server.MapPath(".\\" + @"\users\" + hdnUserDir.Value + hdnProfilePic.Value)))
                {
                    File.Delete(Server.MapPath(".\\" + @"\users\" + hdnUserDir.Value + hdnProfilePic.Value));
                    File.Delete(Server.MapPath(".\\" + @"\users\" + hdnUserDir.Value + "thmb_" + hdnProfilePic.Value));
                    return(true);
                }
                else
                {
                    ErrorLog.ErrorRoutine(false, "edit_profile:deletefile:file didn't exist: " + Server.MapPath(".\\" + @"\users\" + hdnUserDir.Value + hdnProfilePic.Value));
                    return(false);
                }
            }
            catch (Exception e)
            {
                ErrorLog.ErrorRoutine(false, "edit_profile:deletefile:ErrorDeletingOldPic: " + e.Message);
                return(false);
            }
        }
Пример #29
0
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            if (!(Page.IsValid))
            {
                return;
            }

            if (hdnMeVal.Value != "1")
            {
                return;
            }

            lblStatus.Text   = string.Empty;
            pnlError.Visible = false;

            //OBSOLETE
            //if (!chkCOPPA.Checked)
            //{
            //    lblStatus.Text = "You must be 13 yrs of age to register on this web site.";
            //    return;
            //}

            string   txtFN, txtEmailId, txtPassword, txtPhoneNumber;
            string   txtUserName;
            int      iAcctType;
            int      showPhone;
            DateTime dCreateDate;

            byte[] hBytes;      //hash bytes
            byte[] saltBytes;   //salt bytes
            string saltString;  //salt string
            int    iBoarderType;
            int    iMerchantVal;

            //Validate form and get values
            txtFN = " ";


            txtEmailId  = txtEmail.Text;
            txtPassword = txtPassword1.Text;
            txtUserName = Global.ParseEmail(txtEmail.Text);

            BoardHunt.classes.hasher pHash = new BoardHunt.classes.hasher();

            //Get SALT and encode to string
            saltBytes  = pHash.GenerateSALT();
            saltString = Convert.ToBase64String(saltBytes);

            //get hash and encode to string with SALT
            hBytes      = pHash.getHash(saltString, txtPassword);
            txtPassword = Convert.ToBase64String(hBytes);   //hashed password

            //Free = 1; Commercial = 2
            iAcctType = Convert.ToInt16(radioAcctType.SelectedValue);

            txtPhoneNumber = string.Empty;
            if (txtPhoneNum.Text != "optional")
            {
                txtPhoneNumber = txtPhoneNum.Text;
            }

            showPhone = (int)0;

            //if no phone num is entered then showPhonenum flag must be set to zero
            //if (txtAreaCode.Text != "" && txtPhoneNum.Text != "")
            //{
            //    if (chkShowPhone.Checked == true)
            //    {
            //        showPhone = (int)1;
            //    }
            //}
            //else
            //{
            //    showPhone = (int)0;
            //}

            iBoarderType = 1; // cboBoarderType.SelectedIndex;

            //log date acct created
            dCreateDate = DateTime.Now;

            //Connect to DB
            String strSQL;
            String myConnectString;

            //Formulate connect string to DB
            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Verify unique e-mail id.  This is how we try to prevent users
            if (verify_User(myConnectString, txtEmailId))
            {
                pnlError.Visible = true;
                lblStatus.Text   = "That e-mail is already registered.  Please try another one.";
                //lblStatus.CssClass = "errorLabel";
                lblStatus.Visible = true;
                return;
            }

            iMerchantVal = (int)0;
            if (iAcctType == (int)2)
            {
                iMerchantVal = Convert.ToInt16(cboMerchantType.SelectedValue);
                if (iMerchantVal == (int)0)
                {
                    pnlError.Visible = true;
                    lblStatus.Text   = "Select your type of business.";
                    //lblStatus.CssClass = "errorLabel";
                    cboMerchantType.BorderColor = Color.Red;
                    lblStatus.Visible           = true;
                    return;
                }
            }

            //Build SQL
            strSQL  = "INSERT INTO tblUser (txtFullName, txtPassword, txtPhoneNum, iShowPhoneNum, txtEmail, dCreateDate, iEntryCount, iAcctType, sashimi, salt, boarderType, iMerchantType, txtUserName)";
            strSQL += "VALUES ('" + txtFN + "', '" + txtPassword + "', '" + txtPhoneNumber + "', '" + showPhone + "','" + txtEmailId + "' , '" + dCreateDate + "','" + (int)0 + "','" + iAcctType + "','" + (int)1 + "','" + saltString + "','" + iBoarderType + "','" + iMerchantVal + "','" + txtUserName + "')";

            SqlConnection myConnection = new SqlConnection(myConnectString);

            try
            {
                myConnection.Open();

                SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
                objCommand.ExecuteNonQuery();

                Session["LoggedIn"] = "Yes";
                Session["EmailId"]  = txtEmailId;
                Session["acctType"] = Convert.ToInt16(radioAcctType.SelectedValue);
                Session["pw"]       = txtPassword1.Text;

                // Successful login, save iD for user events while logged in
                if (chkUpgrade.Checked)
                {
                    Session["ServiceId"] = 7;
                }
                else if (chkUpgrade2.Checked)
                {
                    Session["ServiceId"] = 6;
                }
                else
                {
                    Session["ServiceId"] = null;
                }

                Response.Redirect("register_finish.aspx", false);
            }

            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Signup failed!  Message: " + ex.Message);
                pnlError.Visible = true;
                lblStatus.Text   = "Signup Failed.";
                //lblStatus.CssClass = "errorLabel";
                lblStatus.Visible = true;
            }

            finally
            {
                myConnection.Close();
            }
        }
Пример #30
0
/*
 */
        private void BindData()
        {
            //load detailed data for entry item
            string strSQL;
            string strUserId;

            //Get query strings for sql query
            string[] arString;
            arString = Request.QueryString.GetValues("q");
            if (arString == null)
            {
                lblStatus.Text = "Sorry...Couldn't find that person.";
                return;
            }
            strUserId       = HttpUtility.UrlDecode(arString[0].ToString());
            hdnUserId.Value = strUserId;
            arString[0]     = string.Empty;

            IDBManager dbManager = new DBManager(DataProvider.SqlServer);

            dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //query item and user details for entry
            strSQL = "SELECT u.txtFullName, u.txtUserName, u.profilePic, u.txtUserDetails, u.txtWebSite, u.txtEmail, u.txtPhonenum, u.userDir, u.iShowPhoneNum, u.notify_comment_flg from tblUser u WHERE iD='" + strUserId + "'";

            try
            {
                dbManager.Open();
                dbManager.ExecuteReader(CommandType.Text, strSQL);

                if (dbManager.DataReader.Read())
                {
                    lblFullName.Text = dbManager.DataReader["txtFullName"].ToString();

                    //Details
                    lblDetailsData.Text = dbManager.DataReader["txtUserDetails"].ToString();

                    //Contact
                    Session["Email"]             = dbManager.DataReader["txtEmail"].ToString();
                    lnkEmailData.Text            = ParseEmail(dbManager.DataReader["txtEmail"].ToString());
                    lnkEmailData.CommandArgument = dbManager.DataReader["txtEmail"].ToString();

                    lnkEmailData.Attributes.Add("href", "mailto:" + dbManager.DataReader["txtEmail"].ToString() + "?subject=Contact from Boardhunt");
                    hdnNotifyEmail.Value = dbManager.DataReader["notify_comment_flg"].ToString();

                    lblPhoneData.Text    = dbManager.DataReader["txtPhoneNum"].ToString();
                    lblPhoneData.Visible = ShowPhone(dbManager.DataReader["iShowPhoneNum"]);

                    lblDetailsData.Text = dbManager.DataReader["txtUserDetails"].ToString();

                    Pic1.ImageUrl = FormatPicPath(dbManager.DataReader["userDir"].ToString(), dbManager.DataReader["profilePic"].ToString());

                    string ratCnt = dbManager.DataReader["numRating"].ToString();
                }
                else
                {
                    lblStatus.Text = "Sorry...Couldn't find that person.";
                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Profile:Page_Load:Msg: " + ex.Message);
            }
            finally
            {
                dbManager.Close();
                dbManager.Dispose();
            }
        }