protected void Page_Load(object sender, EventArgs e) { string myURL = Request.Url.ToString(); myURL = Global.ReplaceEx(myURL, "search_results", "Surfboardsforsale"); Response.Redirect(myURL, false); }
/* */ //checks for single quotes public static string CheckString(string val) { if (val == null) { return(string.Empty); } string val2 = val; if (val.IndexOf("'") >= 0) { val2 = Global.ReplaceEx(val, "'", "\''"); } return(val2); }
/* */ 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); }
protected void BindData() { //TODO: need to break up into 2 parts: part1) get userdir / part 2) isPro? string userDir = ""; string strSQL = string.Empty; IDBManager dbManager = new DBManager(DataProvider.SqlServer); dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;; /* * strSQL = @"SELECT coalesce(s.iStatus, 0) as Pro, u.iD, u.profilePic, u.txtUserName, u.userDir, u.iAcctType, u.iStatus, u.iMerchantType, (SELECT iServiceVal FROM tblServices WHERE iServiceVal = 3 AND iUserId = " + Session["userId"].ToString() + ") as iService,"; * strSQL += @" (SELECT COUNT(*)FROM tblEntry WHERE iCategory = 1 AND iUser= '******' AND iStatus=1 ) as boardCnt"; * strSQL += @" FROM tblUser u"; * strSQL += @" LEFT JOIN tblServices s ON s.iUserId ='" + Session["userId"].ToString() + "'"; * strSQL += @" WHERE u.id = '" + Session["userId"].ToString() + "'"; */ strSQL = @"SELECT u.iD, u.profilePic, u.txtUserName, u.userDir, u.iAcctType, u.iStatus, u.iMerchantType"; strSQL += @" FROM tblUser u"; strSQL += @" LEFT JOIN tblServices s ON s.iUserId ='" + Session["userId"].ToString() + "'"; strSQL += @" WHERE u.id = '" + Session["userId"].ToString() + "'"; try { dbManager.Open(); dbManager.ExecuteReader(CommandType.Text, strSQL); if (dbManager.DataReader.Read()) { userDir = Global.ReplaceEx(dbManager.DataReader["userDir"].ToString(), @"\", @"/"); imgBtnAcct.ImageUrl = FormatPicPath(dbManager.DataReader["userDir"].ToString(), dbManager.DataReader["profilePic"].ToString()); hypAcctEdit.Text = dbManager.DataReader["txtUserName"].ToString(); hypAcctEdit.NavigateUrl = "edit_profile.aspx"; lblBoardCount.Visible = false; Session["userDir"] = userDir; hdnACT.Value = dbManager.DataReader["iAcctType"].ToString(); hdnMT.Value = dbManager.DataReader["iMerchantType"].ToString(); //replace by isShaper //if (dbManager.DataReader["iService"] != null) //{ // if (dbManager.DataReader["iService"].ToString() == "3") // hdnShaperAcctValid.Value = "Y"; //} //if } else { //big problems: this could happen for dual entries into table services ErrorLog.ErrorRoutine(false, "Error: UserMenu:couldn't read userDir or invalid query."); } } catch (Exception ex) { ErrorLog.ErrorRoutine(false, "UserMenu:Error:BindData: " + ex.Message); classes.Email.SendErrorEmail("UserMenu:Error:BindData: " + ex.Message); } finally { dbManager.Close(); dbManager.Dispose(); } //Show/hide panels switch (hdnACT.Value) { //TODO: Move to bottom or hide? Could be confusing with reg user. case Global.ACCT_USR: //allow user to see shaper's panel and upgrade if they'd like pnlShowcase.Visible = false; pnlShaper.Visible = false; pnlShaperCtls.Visible = false; pnlShaperBuy.Visible = false; break; case Global.ACCT_BIZ: pnlShowcase.Visible = false; if (hdnMT.Value == Global.MERCHANT_SHAPER) { //TODO LATER: Check if Shaper Account is paid up pnlShaper.Visible = true; pnlShaperCtls.Visible = true; pnlShaperBuy.Visible = false; } else { pnlShaperCtls.Visible = false; pnlShaperBuy.Visible = true; } pnlQP.Visible = false; break; case Global.ACCT_ADMIN: pnlShowcase.Visible = true; break; default: break; } if (Session["BlogFlg"] != null) { if (Session["BlogFlg"].ToString() == "Y") { pnlBlog.Visible = true; } } //Not implemented pnlShowcase.Visible = false; pnlSUB.Visible = false; //subscriptions pnlBidder.Visible = false; }
/** */ private void GetUserProfileData() { string strSQL, tempPhone; int iPhoneLength; pnlShaper.Visible = false; pnlShaping.Visible = false; tempPhone = string.Empty; IDBManager dbManager = new DBManager(DataProvider.SqlServer); dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;; //Make SQL query and command obj strSQL = "SELECT * FROM tblUser WHERE iD = '" + Session["userId"] + "'"; try { dbManager.Open(); dbManager.ExecuteReader(CommandType.Text, strSQL); if (dbManager.DataReader.Read()) { //SECURITY CHECK: Ensure user or admin is editing if (dbManager.DataReader["iD"].ToString() != Session["userId"].ToString() && (Session["EmailId"].ToString() != "*****@*****.**")) { Response.Redirect("UserMenu.aspx", true); classes.Email.SendEmail("hack attempt", "*****@*****.**", "Hack attempt at posting: " + Session["userId"].ToString()); } //Set and get values for textboxes txtFullName.Text = dbManager.DataReader["txtFullName"].ToString(); txtEmail.Text = dbManager.DataReader["txtEmail"].ToString(); txtBrandName.Text = dbManager.DataReader["txtBrandName"].ToString(); radioAcctType.SelectedValue = dbManager.DataReader["iAcctType"].ToString(); rdoEmailNotify.SelectedValue = dbManager.DataReader["notify_comment_flg"].ToString(); rdoBlogNotify.SelectedValue = dbManager.DataReader["notify_blog_flg"].ToString(); hdnUserDir.Value = dbManager.DataReader["userDir"].ToString(); hdnProfilePic.Value = dbManager.DataReader["profilePic"].ToString(); hdnAcctType.Value = dbManager.DataReader["iAcctType"].ToString(); hdnMT.Value = dbManager.DataReader["iMerchantType"].ToString(); cboRegion.SelectedValue = dbManager.DataReader["iRegion"].ToString(); img1.ImageUrl = "images/nopic64.jpg"; //default string strServerURL = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"]; //profile pic if (dbManager.DataReader["profilePic"].ToString().Length > 1) { img1.ImageUrl = strServerURL + "/users/" + Global.ReplaceEx(hdnUserDir.Value, @"\", @"/") + hdnProfilePic.Value; } else //default or no pic, so set first time "Add" text { rdoImgMgr1.Items[2].Text = "Add"; rdoImgMgr1.Items.Remove("Delete"); rdoImgMgr1.Items.Remove("Keep"); } File1.Disabled = true; //username if (dbManager.DataReader["txtUserName"].ToString().Length > 1) { txtUserName.Text = dbManager.DataReader["txtUserName"].ToString(); } else { txtUserName.Text = Global.ParseEmail(dbManager.DataReader["txtEmail"]); } //phone chkShowPhone.Checked = false; if (dbManager.DataReader["iShowPhoneNum"].ToString() == "1") { chkShowPhone.Checked = true; } txtAreaCode.Text = txtPhoneNum.Text = string.Empty; if (dbManager.DataReader["txtPhoneNum"].ToString().Length > 1) { tempPhone = dbManager.DataReader["txtPhoneNum"].ToString(); iPhoneLength = tempPhone.Length; //show area code txtAreaCode.Text = tempPhone.Substring(0, 3); txtPhoneNum.Text = tempPhone.Substring(4, iPhoneLength - 4); } //shaper if (hdnAcctType.Value == "2" && hdnMT.Value == "1") { hdnIsShaper.Value = "1"; pnlShaper.Visible = true; pnlShaping.Visible = true; txtHomeTown.Text = dbManager.DataReader["txtHomeTown"].ToString(); txtDetails.Text = dbManager.DataReader["txtUserDetails"].ToString(); txtShapingYrs.Text = dbManager.DataReader["iWisdom"].ToString(); txtWebsite.Text = dbManager.DataReader["txtWebSite"].ToString(); hdnShaperCode.Value = dbManager.DataReader["iShaperCode"].ToString(); } } } catch (Exception ex) { ErrorLog.ErrorRoutine(false, "Edit_Profile:Error:" + ex.Message); //classes.Email.SendErrorEmail("Edit_Profile:Error" + ex.Message); } finally { dbManager.Close(); dbManager.Dispose(); } }
/* */ private void ShowShapers(int sCode) { pnlShaperResults.Controls.Clear(); if (sCode <= 0) { return; } pnlShaperResults.Visible = true; lblSHResultIntro.Visible = true; string ssCode; string strSQL = string.Empty; strSQL = @"SELECT u.iD, u.txtFullName, u.txtBrandName, u.profilePic, u.txtHomeTown, u.userDir, u.txtUserDetails, u.iAcctType, u.iStatus, u.iMerchantType, u.txtUserName, u.iWisdom, u.iShaperCode, u.iPageViewCount, u.iVoucher FROM tblUser u INNER JOIN tblServices s ON u.iD = s.iUserId WHERE u.iAcctType = 2 AND u.iMerchantType = 1 AND s.iServiceVal = 3 AND s.iStatus = 1"; IDBManager dbManager = new DBManager(DataProvider.SqlServer); dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;; try { dbManager.Open(); dbManager.ExecuteReader(CommandType.Text, strSQL); while (dbManager.DataReader.Read()) { //ErrorLog.ErrorRoutine(false, "reading SH"); ssCode = dbManager.DataReader["iShaperCode"].ToString(); //ErrorLog.ErrorRoutine(false, "ssCode: " + ssCode); double Num; bool isNum = double.TryParse(ssCode, out Num); if (isNum) { if (((int)Num & sCode) > 0) { //add controls for shaper: image and name System.Web.UI.WebControls.ImageButton imgBtnShaper = new System.Web.UI.WebControls.ImageButton(); Label bLabel = new Label(); //board bLabel.CssClass = "dkorange20b"; imgBtnShaper.ID = "imgBtnShaper_" + dbManager.DataReader["iD"].ToString();; imgBtnShaper.Attributes.Add("valign", "middle"); imgBtnShaper.CommandArgument = dbManager.DataReader["iD"].ToString(); imgBtnShaper.Click += new System.Web.UI.ImageClickEventHandler(this.DynamicButton_Click); //strImgPath = "thmb_" + oImgPath.ToString(); imgBtnShaper.ImageUrl = hdnServer.Value + "/users/" + Global.ReplaceEx(dbManager.DataReader["userDir"].ToString(), @"\", @"/") + "thmb_" + dbManager.DataReader["profilePic"].ToString(); //imgBtnShaper.OnClientClick = ("javascript:__doPostBack('SeeShaper','" + dbManager.DataReader["iD"].ToString() + "');event.returnValue=false;return false;"); //imgBtnShaper.CommandArgument = dbManager.DataReader["iD"].ToString(); bLabel.Text = dbManager.DataReader["txtBrandName"].ToString(); pnlShaperResults.Controls.Add(imgBtnShaper); pnlShaperResults.Controls.Add(new LiteralControl(" ")); pnlShaperResults.Controls.Add(bLabel); pnlShaperResults.Controls.Add(new LiteralControl(" ")); pnlShaperResults.Controls.Add(new LiteralControl("<br><br>")); } } } } catch (Exception ex) { ErrorLog.ErrorRoutine(false, "Matrix:ShowShapers:Error:" + ex.Message); classes.Email.SendErrorEmail("Matrix:ShowShapers: " + ex.Message); } finally { dbManager.Close(); dbManager.Dispose(); } }
/** */ public string DecodeiCat(object iCat) { return(Global.ReplaceEx(Enum.GetName(typeof(Global.BOARDCAT_TYPE), iCat), "_", " ")); }