Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Form.Attributes["data-form"] = "message";

        note.Visible = MyUtils.IsMale;

        ID_USER          = (int)MyUtils.GetUserField("ID_USER"); //will redirect to login page if not logged in
        ID_USER_CHATWITH = Convert.ToInt32(Request.QueryString["id"]);

        DB_Helper db = new DB_Helper();

        int id_offer = db.ExecuteScalarInt("exec CAN_MESSAGE_WITH " + ID_USER + "," + ID_USER_CHATWITH, 0);

        if (id_offer == 0)
        {
            id_offer = db.ExecuteScalarInt("select id_offer from offers where id_offer_state=404 and (id_user_from=" + ID_USER_CHATWITH + " and id_user_to=" + MyUtils.ID_USER + ") or (id_user_from=" + MyUtils.ID_USER + " and id_user_to=" + ID_USER_CHATWITH + ")", 0);

            if (id_offer > 0)
            {
                Response.Redirect("/Account/Messages#" + id_offer, true);
                return;
            }

            Response.Clear();
            Response.Write("You don't have permission to send messages to this user.");
            Response.End();
        }

        R = db.GetRow("exec GET_USER_PROFILE " + ID_USER + "," + ID_USER_CHATWITH);
        if (R == null)
        {
            Response.Clear();
            Response.Write("This user doesn't exist.");
            Response.End();
        }

        Offer = db.GetRow("select amount from offers where (id_user_to=" + ID_USER + " and id_user_from=" + ID_USER_CHATWITH + ") or (id_user_to=" + ID_USER_CHATWITH + " and id_user_from=" + ID_USER + ")");



        //do some magic here with  ID_USER and ID_USER_CHATWITH

        //.......................................................


        //Example on how to insert message to DB
        //SaveMessage2DB(10002, 10003, "testing.... ", "1,2,3,4");

        //Example on how to get messages for user pair
        //DataTable T = GetMessagesForUser(10002, 10003);
    }
Example #2
0
    protected void Page_Init(object sender, EventArgs e)
    {
        Button_CANCEL_SUB.Visible = MyUtils.SUBSCRIPTION_ACTIVE && MyUtils.GetUserFieldInt("CANCEL_FROM_NEXT_PERIOD", 0) == 0;
        PAID.Visible = MyUtils.SUBSCRIPTION_ACTIVE && MyUtils.GetUserFieldInt("CANCEL_FROM_NEXT_PERIOD", 1) == 1;
        if (PAID.Visible)
        {
            PAID.Text = "<b>Subscription has been canceled, Membership will expire on " + DateTime.Parse(MyUtils.GetUserField("NextPaymentDate").ToString()).ToString("MM/dd/yyyy") + "</b><br><br>";
        }
        //Select profile
        DataRow dataRow = db.GetRow(string.Format("select * from users where id_user={0}", MyUtils.ID_USER));

        //txtPassword.Attributes.Add("value", dataRow["password"].ToString());

        txtEmail.Text = dataRow["email"].ToString();

        cbxEmailNewMatches.Checked      = Utils.GetBoolField(dataRow, "email_new_matches");
        cbxEmailWhenNewMessage.Checked  = Utils.GetBoolField(dataRow, "email_when_new_message");
        cbxEmailWhenFavorited.Checked   = Utils.GetBoolField(dataRow, "email_when_favorited");
        cbxemail_when_new_offer.Checked = Utils.GetBoolField(dataRow, "email_when_new_offer");
        cbxEmailNewsletter.Checked      = Utils.GetBoolField(dataRow, "email_newsletter");

        cbxHideFromSearchResults.Checked     = Utils.GetBoolField(dataRow, "hide_from_search_results");
        cbxHideOnViewedFavoritedList.Checked = Utils.GetBoolField(dataRow, "hide_on_viewed_favorited_list");
        cbxHideLastLogintime.Checked         = Utils.GetBoolField(dataRow, "hide_last_logintime");
    }
Example #3
0
    private string GetUserPhotoUrl()
    {
        string photoGuid = null;

        if (Session["MainPhotoGuid"] == null)
        {
            var mainPhotoRow = db.GetRow(string.Format("select * from users where id_user = {0}", MyUtils.ID_USER));
            if (mainPhotoRow != null)
            {
                var mainPhotoId = mainPhotoRow["id_photo"];

                if (!(mainPhotoId is DBNull))
                {
                    DataSet photoData = db.GetDataSet(string.Format("select * from photos where id_photo={0}", mainPhotoId.ToString()));
                    if (photoData.Tables.Count > 0 && photoData.Tables[0].Rows.Count > 0)
                    {
                        photoGuid = photoData.Tables[0].Rows[0]["GUID"].ToString();
                        Session["MainPhotoGuid"] = photoGuid;
                    }
                }
            }
        }
        else
        {
            photoGuid = Session["MainPhotoGuid"].ToString();
        }

        if (!string.IsNullOrEmpty(photoGuid))
        {
            return(MyUtils.GetImageUrl(photoGuid, MyUtils.ImageSize.TINY));
        }



        return("/img/NoPhoto" + MyUtils.GetUserField("sex") + "-s.jpg");
    }
Example #4
0
    private bool IsUserBlockedByYou()
    {
        DataRow userBlock = db.GetRow(string.Format("select * from Blocks where id_user_child = {0} and id_user = {1}", (int)MyUtils.GetUserField("id_user"), currentUser));

        return(userBlock != null);
    }
Example #5
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (IsRegistration)
        {
            h2Title.InnerText       = "Create Your Profile";
            btnCompleteProfile.Text = "Create My Profile";
        }
        else
        {
            h2Title.InnerText       = "Update Your Profile";
            btnCompleteProfile.Text = "Update Profile";
        }

        #region Set DropDownLists

        BindLookupDropdown("Ethnicity", ddlEthnicity);
        BindLookupDropdown("Religion", ddlReligion);
        BindLookupDropdown("Children", ddlChildren);
        BindLookupDropdown("Drinking Habit", ddlDrinking);
        BindLookupDropdown("Smoking Habit", ddlSmoking);
        BindLookupDropdown("Height", ddlHeight);
        BindLookupDropdown("Body Type", ddlBodyType);
        BindLookupDropdown("Eye Color", ddlEyeColor);
        BindLookupDropdown("Hair Color", ddlHairColor);
        BindLookupDropdown("Relationship Status", ddlRelationship);
        BindLookupDropdown("Education", ddlEducation);
        BindLookupDropdown("Income", ddlIncome);
        BindLookupDropdown("Net Worth", ddlWorth);

        birthday.IsRegistration = IsRegistration;
        #endregion

        #region GetUserData from DB

        DataRow userRow = db.GetRow(string.Format("select * from users where id_user={0}", ID_USER));

        profileHeadline.Text = userRow["title"].ToString();
        describe.Text        = userRow["description"].ToString();
        ideal.Text           = userRow["firstdate"].ToString();
        zipCode.Text         = userRow["zip"].ToString();

        //ddl
        ddlEthnicity.SelectedValue    = Utils.GetDdlField(userRow, "id_ethnicity");
        ddlReligion.SelectedValue     = Utils.GetDdlField(userRow, "id_religion");
        ddlChildren.SelectedValue     = Utils.GetDdlField(userRow, "id_children");
        ddlDrinking.SelectedValue     = Utils.GetDdlField(userRow, "id_drinking");
        ddlSmoking.SelectedValue      = Utils.GetDdlField(userRow, "id_smoking");
        ddlHeight.SelectedValue       = Utils.GetDdlField(userRow, "id_height");
        ddlBodyType.SelectedValue     = Utils.GetDdlField(userRow, "id_bodytype");
        ddlEyeColor.SelectedValue     = Utils.GetDdlField(userRow, "id_eyecolor");
        ddlHairColor.SelectedValue    = Utils.GetDdlField(userRow, "id_haircolor");
        ddlRelationship.SelectedValue = Utils.GetDdlField(userRow, "id_relationship");
        ddlEducation.SelectedValue    = Utils.GetDdlField(userRow, "id_education");
        ddlIncome.SelectedValue       = Utils.GetDdlField(userRow, "id_income");
        ddlWorth.SelectedValue        = Utils.GetDdlField(userRow, "id_networth");

        birthday.SetBirthday((DateTime)userRow["birthdate"]);

        ocupation.Text = userRow["occupation"].ToString();

        //cbx
        cbxShortDating.Checked = Utils.GetBoolField(userRow, "lookingforshortterm");
        cbxFriendship.Checked  = Utils.GetBoolField(userRow, "lookingforfriendship");
        cbxLongTerm.Checked    = Utils.GetBoolField(userRow, "lookingforlongterm");
        cbxMutually.Checked    = Utils.GetBoolField(userRow, "lookingforarrangement");
        cbxDiscreet.Checked    = Utils.GetBoolField(userRow, "lookingforaffair");
        cbxCasual.Checked      = Utils.GetBoolField(userRow, "lookingforcasualdating");
        #endregion
    }