protected void RpListMembers_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string c = e.CommandName.Trim();
        string p = e.CommandArgument.ToString().Trim();

        top       = "";
        fields    = "*";
        condition = MembersTSql.GetMembersByImid(p);
        order     = "";
        DataTable dt = new DataTable();

        dt = Members.GetMembersCondition(top, fields, condition, order);
        switch (c)
        {
            #region Delete
        case "delete":
            Members.DeleteMembersByIMID(p);
            GetListMembers();

            #region Logs
            string logAuthor     = CookieExtension.GetCookies("LoginSetting");
            string logCreateDate = DateTime.Now.ToString();
            Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", dt.Rows[0][MembersColumns.vMemberAccount].ToString(), logAuthor, "", logCreateDate + ": " + logAuthor + " xóa thành viên " + dt.Rows[0][MembersColumns.vMemberAccount].ToString());
            #endregion
            break;

            #endregion
            #region Edit Status
        case "lock":
            string[] fieldsEditStatus = { "iMemberIsLockedOut" };
            string[] valuesEditStatus = { "" };
            if (dt.Rows[0]["iMemberIsLockedOut"].ToString().Equals("0"))
            {
                valuesEditStatus[0] = "1";
                Members.UpdateMembersCondition(DataExtension.UpdateTransfer(fieldsEditStatus, valuesEditStatus), condition);
            }
            else
            {
                valuesEditStatus[0] = "0";
                Members.UpdateMembersCondition(DataExtension.UpdateTransfer(fieldsEditStatus, valuesEditStatus), condition);
            }
            GetListMembers();

            #region Logs
            logAuthor     = CookieExtension.GetCookies("LoginSetting");
            logCreateDate = DateTime.Now.ToString();
            Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", dt.Rows[0][MembersColumns.vMemberAccount].ToString(), logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật trạng thái thành viên " + dt.Rows[0][MembersColumns.vMemberAccount].ToString());
            #endregion
            break;

            #endregion
            #region edit
        case "edit":
            Response.Redirect(LinkAdmin.GoAdminItem(CodeApplications.Member, TypePage.UpdateItem, p));
            break;
            #endregion
        }
    }
Beispiel #2
0
    /// <summary>
    /// Kiểm tra xem email này đã có trong bảng member hay chưa, nếu là cập nhật sẽ kiểm tra các dòng trừ dòng hiện tại
    /// </summary>
    /// <param name="email"></param>
    /// <param name="insert"></param>
    /// <param name="tenDangNhapHienTai"></param>
    /// <returns></returns>
    private bool CheckExistedEmail(string email, bool insert, string tenDangNhapHienTai)
    {
        condition = MembersTSql.GetMembersByVmemberemail(email);
        if (!insert)
        {
            condition = DataExtension.AndConditon(condition, MembersColumns.vMemberAccount + " <> '" + tenDangNhapHienTai + "'");
        }
        DataTable dt = new DataTable();

        dt = Members.GetMembersCondition("1", MembersColumns.IMID, condition, "");
        return(dt.Rows.Count > 0);
    }
    void GetCategories(string order)
    {
        DdlListShowItem.SelectedValue = NumberShowItem;

        fields = "*";

        condition = DataExtension.AndConditon(
            MembersTSql.GetMembersByVproperty(app),
            MembersColumns.ImemberisapprovedColumn + "<>2");
        if (txtKeySearch.Text.Length > 0 && !txtKeySearch.Text.Equals("Nhập địa chỉ email cần tìm"))
        {
            condition = DataExtension.AndConditon(condition, TatThanhJsc.TSql.SearchTSql.GetSearchMathedCondition(txtKeySearch.Text, MembersColumns.VmemberaccountColumn, MembersColumns.VmembernameColumn));
        }

        #region OrderBy
        if (order.Length > 0)
        {
            orderBy = order;
        }
        else
        {
            orderBy = CookieExtension.GetCookiesSort(sortCookiesName);
            if (orderBy.Length < 1)
            {
                orderBy = MembersColumns.VmemberaccountColumn;
            }
        }
        #endregion

        DataTable dt = new DataTable();

        DataSet ds = Members.GetMembersPaggingCondition(p, NumberShowItem, condition, orderBy);

        dt = ds.Tables[1];


        LtPagging.Text = PagingExtension.SpilitPages(Convert.ToInt32(dt.Rows[0]["TotalRows"]),
                                                     Convert.ToInt16(DdlListShowItem.SelectedValue), Convert.ToInt32(p),
                                                     LinkAdmin.UrlAdmin("", TypePage.Item,
                                                                        "", key,
                                                                        NumberShowItem), "currentPS", "otherPS", "firstPS",
                                                     "lastPS", "previewPS", "nextPS");

        dt = ds.Tables[0];
        rp_mn_users.DataSource = dt;
        rp_mn_users.DataBind();
    }
    bool ExistedEmail(string email, string app)
    {
        condition = DataExtension.AndConditon(
            MembersTSql.GetMembersByVmemberemail(email),
            MembersTSql.GetMembersByVproperty(app));
        DataTable dt = new DataTable();

        dt = Members.GetMembersCondition("", MembersColumns.ImidColumn, condition, "");
        if (dt.Rows.Count > 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
    protected void rp_mn_users_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string c = e.CommandName.Trim();
        string p = e.CommandArgument.ToString().Trim();

        fields = "*";
        DataTable dt = new DataTable();

        dt = Members.GetMembersCondition("", MembersColumns.ImemberisapprovedColumn, MembersTSql.GetMembersByImid(p), "");

        switch (c)
        {
            #region Delete
        case "delete":
            Members.DeleteMembersByIMID(p);
            GetCategories("");
            break;

            #endregion
            #region Edit Status
        case "EditStatus":
            string[] fieldsEditStatus = { "iMemberIsLockedOut" };
            string[] valuesEditStatus = { "" };
            if (dt.Rows[0]["iMemberIsLockedOut"].ToString().Equals("0"))
            {
                valuesEditStatus[0] = "1";
                Members.UpdateMembersCondition(DataExtension.UpdateTransfer(fieldsEditStatus, valuesEditStatus), condition);
            }
            else
            {
                valuesEditStatus[0] = "0";
                Members.UpdateMembersCondition(DataExtension.UpdateTransfer(fieldsEditStatus, valuesEditStatus), condition);
            }
            GetCategories("");

            break;

            #endregion
            #region edit
        case "editPassword":
            Response.Redirect(LinkAdmin.GoAdminItem(CodeApplications.Member, TypePage.UpdateItem, p));
            break;
            #endregion
        }
    }
    string GetListEmail()
    {
        string s = "";

        #region Lấy khách hàng tiềm năng

        condition = DataExtension.AndConditon(
            MembersTSql.GetMembersByVproperty(TatThanhJsc.MemberModul.CodeApplications.MemberNewsletter),
            MembersTSql.GetMembersByImemberisapproved("1"),
            MembersTSql.GetMembersByVmemberidentitycard("1"));
        fields = MembersColumns.VmemberemailColumn;
        DataTable dt = new DataTable();
        dt = Members.GetMembersCondition("", fields, condition, "");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            s += dt.Rows[i][MembersColumns.VmemberemailColumn] + parramSplitString;
        }

        #endregion
        return(s);
    }
Beispiel #7
0
    void InitialControlsValue(bool insert)
    {
        #region update
        if (!insert)
        {
            btOK.Text         = "Đồng ý";
            cbTiepTuc.Visible = false;
            DataTable dt = new DataTable();
            dt = Members.GetMembersCondition("1", "*", MembersTSql.GetMembersByImid(imid), "");

            tbTenDangNhap.Text    = dt.Rows[0][MembersColumns.vMemberAccount].ToString();
            tbTenDangNhap.Enabled = false;
            hdTenDangNhap.Value   = SecurityExtension.Encode(dt.Rows[0][MembersColumns.vMemberAccount].ToString());

            ltrGhiChuMatKhau.Text           = "<div class='GhiChuMatKhau'>Để trống ô mật khẩu nếu không muốn thay đổi</div>";
            tbMatKhau.Text                  = dt.Rows[0][MembersColumns.vMemberPassword].ToString();
            tbNhapLaiMatKhau.Text           = dt.Rows[0][MembersColumns.vMemberPassword].ToString();
            RequiredFieldValidator2.Visible = false;
            RequiredFieldValidator3.Visible = false;

            tbEmail.Text = dt.Rows[0][MembersColumns.vMemberEmail].ToString();

            tbHoTen.Text               = dt.Rows[0][MembersColumns.vMemberName].ToString();
            tbNgaySinh.Text            = ((DateTime)dt.Rows[0][MembersColumns.dMemberBirthday]).ToString("MM/dd/yyyy");
            ddlGioiTinh.SelectedValue  = tbTenDangNhap.Text = dt.Rows[0][MembersColumns.vMemberIdentityCard].ToString();
            tbDiaChi.Text              = dt.Rows[0][MembersColumns.vMemberAddress].ToString();
            tbDienThoai.Text           = dt.Rows[0][MembersColumns.vMemberPhone].ToString();
            tbTrinhDoHocVan.Text       = dt.Rows[0][MembersColumns.vMemberEdu].ToString();
            tbNgheNghiep.Text          = dt.Rows[0][MembersColumns.vMemberJob].ToString();
            tbQuanHeXaHoi.Text         = dt.Rows[0][MembersColumns.vMemberRelationship].ToString();
            tbTenDangNhap.Text         = dt.Rows[0][MembersColumns.vMemberAccount].ToString();
            tbChieuCao.Text            = dt.Rows[0][MembersColumns.VmemberheightColumn].ToString();
            tbCanNang.Text             = dt.Rows[0][MembersColumns.VmemberweightColumn].ToString();
            tbCauGioiThieuNgan.Text    = dt.Rows[0][MembersColumns.VmemberblastColumn].ToString();
            ddlKichHoat.SelectedValue  = dt.Rows[0][MembersColumns.iMemberIsApproved].ToString();
            ddlTrangThai.SelectedValue = dt.Rows[0][MembersColumns.iMemberIsLockedOut].ToString();

            #region Image
            if (!dt.Rows[0][MembersColumns.vMemberImage].ToString().Equals(""))
            {
                ltimg.Text = ImagesExtension.GetImage(pic, dt.Rows[0][MembersColumns.vMemberImage].ToString(), "", "imgItem", false, false, "", false);
                lnk_delete_Image_current.Visible = true;
            }
            else
            {
                ltimg.Visible = false;
                lnk_delete_Image_current.Visible = false;
            }
            hd_img.Value = dt.Rows[0][MembersColumns.vMemberImage].ToString();
            #endregion

            #region Các trường không xuất hiện trên form
            hdvProperty.Value               = dt.Rows[0][MembersColumns.VpropertyColumn].ToString();
            hdvMemberYahooNick.Value        = dt.Rows[0][MembersColumns.vMemberYahooNick].ToString();
            hdvMemberPasswordQuestion.Value = dt.Rows[0][MembersColumns.vMemberPasswordQuestion].ToString();
            hdvMemberPasswordAnswer.Value   = dt.Rows[0][MembersColumns.vMemberPasswordAnswer].ToString();
            hdvMemberComment.Value          = dt.Rows[0][MembersColumns.vMemberComment].ToString();
            hdiMemberTotalLogin.Value       = dt.Rows[0][MembersColumns.ImemberTotalLoginColumn].ToString();
            hdiMemberTotalview.Value        = dt.Rows[0][MembersColumns.ImembertotalviewColumn].ToString();
            #endregion
        }
        #endregion
        #region  insert
        else
        {
            tbTenDangNhap.Focus();
        }
        #endregion
    }