Exemplo n.º 1
0
        private void btnUpdateProductTags_Click(object sender, EventArgs e)
        {
            string value = this.hidTags.Value;

            if (string.IsNullOrEmpty(this.userIds))
            {
                this.ShowMsg("请先选择要设置的会员", false);
            }
            else if (string.IsNullOrEmpty(value))
            {
                this.ShowMsg("请选择要设置的标签", false);
            }
            else
            {
                try
                {
                    MemberTagHelper.UpdateMemberTags(this.userIds, value);
                    string[] array = this.userIds.Split(',');
                    foreach (string s in array)
                    {
                        int num = 0;
                        int.TryParse(s, out num);
                        if (num > 0)
                        {
                            Users.ClearUserCache(num, "");
                        }
                    }
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "ServerMessageScript", "<script language='JavaScript' defer='defer'>alert('设置成功!'); art.dialog.close();</script>");
                }
                catch (Exception)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "ServerMessageScript", "<script language='JavaScript' defer='defer'>alert('设置失败!'); art.dialog.close();</script>");
                }
            }
        }
Exemplo n.º 2
0
        private DataGridViewModel <Dictionary <string, object> > GetListSplittinDraws(Pagination query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult tags = MemberTagHelper.GetTags(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(tags.Data);
                dataGridViewModel.total = tags.TotalRecords;
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                }
            }
            return(dataGridViewModel);
        }
Exemplo n.º 3
0
        private void LoadMemberInfo()
        {
            MemberInfo user = Users.GetUser(this.userId);

            if (user == null)
            {
                base.GotoResourceNotFound();
            }
            else
            {
                this.drpMemberRankList.SelectedValue = user.GradeId;
                this.lblLoginNameValue.Text          = user.UserName;
                this.lblRegsTimeValue.Time           = user.CreateDate;
                this.lblTotalAmountValue.Text        = Globals.FormatMoney(user.Expenditure);
                this.txtRealName.Text         = user.RealName;
                this.calBirthday.SelectedDate = user.BirthDate;
                this.txtAddress.Text          = Globals.HtmlDecode(user.Address);
                this.rsddlRegion.SetSelectedRegionId(user.RegionId);
                this.txtQQ.Text           = user.QQ;
                this.txtMSN.Text          = user.NickName;
                this.txtCellPhone.Text    = user.CellPhone;
                this.txtprivateEmail.Text = user.Email;
                this.gender.SelectedValue = user.Gender;
                string tagIds = user.TagIds;
                if (!string.IsNullOrWhiteSpace(tagIds))
                {
                    if (tagIds == ",")
                    {
                        tagIds = "";
                    }
                    else
                    {
                        tagIds = tagIds.TrimStart(',');
                        tagIds = tagIds.TrimEnd(',');
                    }
                    this.hidTagId.Value = tagIds;
                    if (tagIds != "")
                    {
                        IList <MemberTagInfo> tagByMember = MemberTagHelper.GetTagByMember(tagIds);
                        this.hidTagNames.Value = string.Join(",", (from t in tagByMember
                                                                   select t.TagName).ToArray());
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void Delete(HttpContext context)
        {
            int?intParam = base.GetIntParam(context, "id", true);

            if (!intParam.HasValue)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            try
            {
                MemberTagHelper.DeleteTag(intParam.Value);
                base.ReturnSuccessResult(context, "删除成功!", 0, true);
            }
            catch
            {
                throw new HidistroAshxException("删除失败!");
            }
        }
Exemplo n.º 5
0
        private void SaveTag(HttpContext context)
        {
            int?          intParam      = base.GetIntParam(context, "id", true);
            bool          flag          = !intParam.HasValue;
            MemberTagInfo memberTagInfo = new MemberTagInfo();

            memberTagInfo.TagName = base.GetParameter(context, "TagName", true);
            if (string.IsNullOrWhiteSpace(memberTagInfo.TagName))
            {
                throw new HidistroAshxException("请输入标签名称!");
            }
            if (memberTagInfo.TagName.Length > 20)
            {
                throw new HidistroAshxException("标签名称限制最多输入20个字符!");
            }
            memberTagInfo.OrderCount = base.GetIntParam(context, "OrderCount", false).Value;
            if (memberTagInfo.OrderCount < 0 || memberTagInfo.OrderCount > 10000)
            {
                throw new HidistroAshxException("请输入正确的交易笔数,限制为0-10000的正整数!");
            }
            memberTagInfo.OrderTotalAmount = base.GetParameter(context, "OrderTotalAmount", decimal.Zero);
            if (memberTagInfo.OrderTotalAmount < decimal.Zero || memberTagInfo.OrderTotalAmount > 100000000m)
            {
                throw new HidistroAshxException("请输入正确的交易笔数,为0-100000000之间的数字,限制两位小数!");
            }
            if (!flag)
            {
                memberTagInfo.TagId = intParam.Value;
                if (MemberTagHelper.Update(memberTagInfo))
                {
                    base.ReturnSuccessResult(context, "编辑成功", 0, true);
                    return;
                }
                throw new HidistroAshxException("编辑失败!");
            }
            if (MemberTagHelper.AddTag(memberTagInfo) > 0)
            {
                base.ReturnSuccessResult(context, "添加成功", 0, true);
                return;
            }
            throw new HidistroAshxException("添加失败!");
        }
Exemplo n.º 6
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            MemberInfo memberInfo = HiContext.Current.User;

            if (HiContext.Current.UserId == 0)
            {
                string text = HttpContext.Current.Request["SessionId"].ToNullString();
                if (!string.IsNullOrEmpty(text))
                {
                    memberInfo = MemberProcessor.FindMemberBySessionId(text);
                    if (memberInfo == null)
                    {
                        HttpContext.Current.Response.Write("sessionid过期");
                        HttpContext.Current.Response.End();
                    }
                    HiContext.Current.User = memberInfo;
                    Users.SetCurrentUser(memberInfo.UserId, 30, true, false);
                }
            }
            DateTime now;

            if (memberInfo != null && memberInfo.UserId > 0)
            {
                HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Shop-Member"];
                if (httpCookie != null)
                {
                    HttpCookie httpCookie2 = httpCookie;
                    now = DateTime.Now;
                    httpCookie2.Expires = now.AddDays(30.0);
                    HttpContext.Current.Response.Cookies.Add(httpCookie);
                }
            }
            if (memberInfo != null)
            {
                HttpCookie httpCookie3 = HiContext.Current.Context.Request.Cookies[AppshopMemberTemplatedWebControl.autoSetTags + "_" + memberInfo.UserId];
                if (httpCookie3 == null)
                {
                    IList <MemberTagInfo> list = MemberTagHelper.AutoTagsByMember(memberInfo.UserId, memberInfo.OrderNumber, memberInfo.Expenditure);
                    if (list.Count > 0)
                    {
                        string text2 = memberInfo.TagIds;
                        foreach (MemberTagInfo item in list)
                        {
                            if (string.IsNullOrEmpty(text2))
                            {
                                text2 = text2 + "," + item.TagId + ",";
                            }
                            if (!("," + text2 + ",").Contains("," + item.TagId + ","))
                            {
                                text2 = ((text2.LastIndexOf(",") != text2.Length - 1) ? (text2 + "," + item.TagId + ",") : (text2 + item.TagId + ","));
                            }
                        }
                        if (MemberTagHelper.UpdateSingleMemberTags(memberInfo.UserId, text2) > 0)
                        {
                            httpCookie3          = new HttpCookie(AppshopMemberTemplatedWebControl.autoSetTags + "_" + memberInfo.UserId);
                            httpCookie3.HttpOnly = true;
                            HttpCookie httpCookie4 = httpCookie3;
                            now = DateTime.Now;
                            httpCookie4.Expires = now.AddDays(1.0);
                            httpCookie3.Value   = Globals.UrlEncode(memberInfo.UserId.ToString());
                            HttpContext.Current.Response.Cookies.Add(httpCookie3);
                        }
                    }
                }
            }
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            string     text  = this.Page.Request.QueryString["action"].ToNullString();
            MemberInfo user  = HiContext.Current.User;
            string     text2 = Globals.UrlDecode(HttpContext.Current.Request.QueryString["ReturnUrl"]);

            if (string.IsNullOrEmpty(text2))
            {
                text2 = HttpContext.Current.Request.Url.ToString();
            }
            DateTime now;

            if (user != null && user.UserId > 0)
            {
                HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Shop-Member"];
                if (httpCookie != null)
                {
                    HttpCookie httpCookie2 = httpCookie;
                    now = DateTime.Now;
                    httpCookie2.Expires = now.AddDays(30.0);
                    HttpContext.Current.Response.Cookies.Add(httpCookie);
                }
                if (!user.CellPhoneVerification)
                {
                    string text3 = HttpContext.Current.Request.Url.ToString().ToLower();
                    if (text3.IndexOf("/bindphone") == -1)
                    {
                        if (MemberProcessor.IsTrustLoginUser(user) && HiContext.Current.SiteSettings.QuickLoginIsForceBindingMobbile)
                        {
                            HttpContext.Current.Response.Redirect("BindPhone");
                        }
                        else if (HiContext.Current.SiteSettings.UserLoginIsForceBindingMobbile)
                        {
                            HttpContext.Current.Response.Redirect("BindPhone");
                        }
                    }
                }
            }
            if (user.UserId == 0 || (user.UserId != 0 && !user.IsLogined))
            {
                string query = HttpContext.Current.Request.Url.Query;
                query = ((string.IsNullOrEmpty(query) || !query.StartsWith("?")) ? "" : ("&" + query.Substring(1)));
                if (base.ClientType == ClientType.VShop)
                {
                    OAuthUserInfo oAuthUserInfo = base.GetOAuthUserInfo(true);
                    if (!this.HasLogin(oAuthUserInfo.OpenId, oAuthUserInfo.unionId, oAuthUserInfo.IsAttention))
                    {
                        if (!string.IsNullOrEmpty(oAuthUserInfo.OpenId))
                        {
                            HttpCookie httpCookie3 = new HttpCookie("openId");
                            httpCookie3.HttpOnly = true;
                            httpCookie3.Value    = oAuthUserInfo.OpenId;
                            httpCookie3.Expires  = DateTime.MaxValue;
                            HttpContext.Current.Response.Cookies.Add(httpCookie3);
                        }
                        string text4 = Globals.UrlEncode(oAuthUserInfo.HeadImageUrl.ToNullString());
                        bool   isAttention;
                        if (!string.IsNullOrEmpty(oAuthUserInfo.NickName))
                        {
                            if (string.IsNullOrEmpty(text))
                            {
                                HttpResponse response = this.Page.Response;
                                string[]     obj      = new string[12]
                                {
                                    "/Vshop/Login?openId=",
                                    oAuthUserInfo.OpenId,
                                    "&headimage=",
                                    text4,
                                    "&nickname=",
                                    oAuthUserInfo.NickName,
                                    "&IsSubscribe=",
                                    null,
                                    null,
                                    null,
                                    null,
                                    null
                                };
                                isAttention = oAuthUserInfo.IsAttention;
                                obj[7]      = isAttention.ToString();
                                obj[8]      = "&unionId=";
                                obj[9]      = oAuthUserInfo.unionId;
                                obj[10]     = query;
                                obj[11]     = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2)));
                                response.Redirect(string.Concat(obj));
                            }
                            else
                            {
                                HttpResponse response2 = this.Page.Response;
                                string[]     obj2      = new string[14]
                                {
                                    "/Vshop/Login.aspx?action=",
                                    text,
                                    "&openId=",
                                    oAuthUserInfo.OpenId,
                                    "&headimage=",
                                    text4,
                                    "&nickname=",
                                    oAuthUserInfo.NickName,
                                    "&IsSubscribe=",
                                    null,
                                    null,
                                    null,
                                    null,
                                    null
                                };
                                isAttention = oAuthUserInfo.IsAttention;
                                obj2[9]     = isAttention.ToString();
                                obj2[10]    = "&unionId=";
                                obj2[11]    = oAuthUserInfo.unionId;
                                obj2[12]    = query;
                                obj2[13]    = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2)));
                                response2.Redirect(string.Concat(obj2));
                            }
                        }
                        else if (string.IsNullOrEmpty(text))
                        {
                            HttpResponse response3 = this.Page.Response;
                            string[]     obj3      = new string[10]
                            {
                                "/Vshop/Login?openId=",
                                oAuthUserInfo.OpenId,
                                "&IsSubscribe=",
                                null,
                                null,
                                null,
                                null,
                                null,
                                null,
                                null
                            };
                            isAttention = oAuthUserInfo.IsAttention;
                            obj3[3]     = isAttention.ToString();
                            obj3[4]     = "&headimage=";
                            obj3[5]     = text4;
                            obj3[6]     = "&unionId=";
                            obj3[7]     = oAuthUserInfo.unionId;
                            obj3[8]     = query;
                            obj3[9]     = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2)));
                            response3.Redirect(string.Concat(obj3));
                        }
                        else
                        {
                            HttpResponse response4 = this.Page.Response;
                            string[]     obj4      = new string[12]
                            {
                                "/Vshop/Login?action=",
                                text,
                                "&openId=",
                                oAuthUserInfo.OpenId,
                                "&headimage=",
                                text4,
                                "&IsSubscribe=",
                                null,
                                null,
                                null,
                                null,
                                null
                            };
                            isAttention = oAuthUserInfo.IsAttention;
                            obj4[7]     = isAttention.ToString();
                            obj4[8]     = "&unionId=";
                            obj4[9]     = oAuthUserInfo.unionId;
                            obj4[10]    = query;
                            obj4[11]    = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2)));
                            response4.Redirect(string.Concat(obj4));
                        }
                    }
                }
                else if (string.IsNullOrEmpty(text))
                {
                    this.Page.Response.Redirect("Login?returnUrl=" + HttpUtility.UrlEncode(text2), true);
                }
                else
                {
                    this.Page.Response.Redirect("Login?action=" + text + "&returnUrl=" + HttpUtility.UrlEncode(text2), true);
                }
            }
            else
            {
                HttpCookie httpCookie4 = HiContext.Current.Context.Request.Cookies[WAPMemberTemplatedWebControl.autoSetTags + "_" + user.UserId];
                if (httpCookie4 == null)
                {
                    IList <MemberTagInfo> list = MemberTagHelper.AutoTagsByMember(user.UserId, user.OrderNumber, user.Expenditure);
                    if (list.Count > 0)
                    {
                        string text5 = user.TagIds;
                        foreach (MemberTagInfo item in list)
                        {
                            if (string.IsNullOrEmpty(text5))
                            {
                                text5 = text5 + "," + item.TagId + ",";
                            }
                            if (!("," + text5 + ",").Contains("," + item.TagId + ","))
                            {
                                text5 = ((text5.LastIndexOf(",") != text5.Length - 1) ? (text5 + "," + item.TagId + ",") : (text5 + item.TagId + ","));
                            }
                        }
                        if (MemberTagHelper.UpdateSingleMemberTags(user.UserId, text5) > 0)
                        {
                            httpCookie4          = new HttpCookie(WAPMemberTemplatedWebControl.autoSetTags + "_" + user.UserId);
                            httpCookie4.HttpOnly = true;
                            HttpCookie httpCookie5 = httpCookie4;
                            now = DateTime.Now;
                            httpCookie5.Expires = now.AddDays(1.0);
                            httpCookie4.Value   = Globals.UrlEncode(user.UserId.ToString());
                            HttpContext.Current.Response.Cookies.Add(httpCookie4);
                        }
                    }
                }
                HttpCookie httpCookie6 = HiContext.Current.Context.Request.Cookies["openId"];
                if (httpCookie6 != null && !string.IsNullOrEmpty(httpCookie6.Value))
                {
                    lock (this.lockCopyRedEnvelope)
                    {
                        this.CopyRedEnvelope(httpCookie6.Value, user);
                    }
                }
            }
        }
        protected MemberTemplatedWebControl()
        {
            MemberInfo user = HiContext.Current.User;

            if (HiContext.Current.User.UserId == 0)
            {
                this.Page.Response.Redirect($"/User/login?ReturnUrl={this.Page.Request.RawUrl}", true);
            }
            DateTime now;

            if (user != null && user.UserId > 0)
            {
                HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["PC-Member"];
                if (httpCookie != null)
                {
                    HttpCookie httpCookie2 = httpCookie;
                    now = DateTime.Now;
                    httpCookie2.Expires = now.AddMinutes(30.0);
                    HttpContext.Current.Response.Cookies.Add(httpCookie);
                }
                if (!user.CellPhoneVerification)
                {
                    string text = HttpContext.Current.Request.Url.ToString().ToLower();
                    if (text.IndexOf("/user/usercellphoneverification") == -1)
                    {
                        if (MemberProcessor.IsTrustLoginUser(user) && HiContext.Current.SiteSettings.QuickLoginIsForceBindingMobbile)
                        {
                            HttpContext.Current.Response.Redirect("/User/UserCellPhoneVerification");
                        }
                        else if (HiContext.Current.SiteSettings.UserLoginIsForceBindingMobbile)
                        {
                            HttpContext.Current.Response.Redirect("/User/UserCellPhoneVerification");
                        }
                    }
                }
            }
            if (user != null)
            {
                HttpCookie httpCookie3 = HiContext.Current.Context.Request.Cookies[MemberTemplatedWebControl.autoSetTags + "_" + user.UserId];
                if (httpCookie3 == null)
                {
                    IList <MemberTagInfo> list = MemberTagHelper.AutoTagsByMember(user.UserId, user.OrderNumber, user.Expenditure);
                    if (list.Count > 0)
                    {
                        string text2 = user.TagIds;
                        foreach (MemberTagInfo item in list)
                        {
                            if (string.IsNullOrEmpty(text2))
                            {
                                text2 = text2 + "," + item.TagId + ",";
                            }
                            if (!("," + text2 + ",").Contains("," + item.TagId + ","))
                            {
                                text2 = ((text2.LastIndexOf(",") != text2.Length - 1) ? (text2 + "," + item.TagId + ",") : (text2 + item.TagId + ","));
                            }
                        }
                        if (MemberTagHelper.UpdateSingleMemberTags(user.UserId, text2) > 0)
                        {
                            httpCookie3 = new HttpCookie(MemberTemplatedWebControl.autoSetTags + "_" + user.UserId)
                            {
                                HttpOnly = true
                            };
                            HttpCookie httpCookie4 = httpCookie3;
                            now = DateTime.Now;
                            httpCookie4.Expires = now.AddDays(1.0);
                            httpCookie3.Value   = Globals.UrlEncode(user.UserId.ToString());
                            HttpContext.Current.Response.Cookies.Add(httpCookie3);
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void LoadMemberInfo()
        {
            MemberInfo user = Users.GetUser(this.userId);

            if (user == null)
            {
                string text = base.Request.UrlReferrer.ToNullString();
                if (string.IsNullOrEmpty(text))
                {
                    text = "/Admin/member/managemembers";
                }
                this.ShowMsg("会员已被删除", false, text);
            }
            else
            {
                if (!string.IsNullOrEmpty(user.Picture.ToNullString()))
                {
                    this.userPicture.ImageUrl = user.Picture;
                }
                else
                {
                    this.userPicture.ImageUrl = HiContext.Current.GetSkinPath() + "/images/users/hyzx_25.jpg";
                }
                Literal literal  = this.litUserName;
                Literal literal2 = this.litShowUserName;
                string  text3    = literal.Text = (literal2.Text = user.UserName);
                this.litGrade.Text    = MemberHelper.GetMemberGrade(user.GradeId).Name;
                this.litRealName.Text = user.RealName;
                this.litEmail.Text    = user.Email;
                if (user.Gender == Gender.Female)
                {
                    this.litGender.Text = "女";
                }
                else if (user.Gender == Gender.Male)
                {
                    this.litGender.Text = "男";
                }
                else
                {
                    this.litGender.Text = "保密";
                }
                this.litCellPhone.Text = user.CellPhone;
                Literal  literal3 = this.litBirthDate;
                DateTime dateTime;
                object   text4;
                if (user.BirthDate.HasValue)
                {
                    dateTime = user.BirthDate.Value;
                    text4    = dateTime.ToString("yyyy-MM-dd");
                }
                else
                {
                    text4 = "";
                }
                literal3.Text         = (string)text4;
                this.litNickName.Text = user.NickName;
                this.litQQ.Text       = user.QQ;
                Literal literal4 = this.litCreateDate;
                dateTime             = user.CreateDate;
                literal4.Text        = dateTime.ToString();
                this.litAddress.Text = RegionHelper.GetFullRegion(user.RegionId, "", true, 0) + user.Address;
                if (user.ReferralUserId > 0)
                {
                    MemberInfo user2 = Users.GetUser(user.ReferralUserId);
                    if (user2 != null)
                    {
                        this.litReferral.Text = user2.UserName;
                    }
                }
                string tagIds = user.TagIds;
                if (!string.IsNullOrWhiteSpace(tagIds))
                {
                    if (tagIds == ",")
                    {
                        tagIds = "";
                    }
                    else
                    {
                        tagIds = tagIds.TrimStart(',');
                        tagIds = tagIds.TrimEnd(',');
                    }
                    if (tagIds != "")
                    {
                        IList <MemberTagInfo> tagByMember   = MemberTagHelper.GetTagByMember(tagIds);
                        StringBuilder         stringBuilder = new StringBuilder();
                        foreach (MemberTagInfo item in tagByMember)
                        {
                            stringBuilder.AppendFormat("<span>{0}</span>", item.TagName);
                        }
                        this.divTags.InnerHtml = stringBuilder.ToString();
                    }
                }
                this.litConsumeAmount.Text = user.Expenditure.F2ToString("f2");
                Literal literal5 = this.litConsumeTimes;
                int     num      = user.OrderNumber;
                literal5.Text      = num.ToString();
                this.litMoney.Text = user.Balance.F2ToString("f2");
                Literal literal6 = this.litPoints;
                num           = user.Points;
                literal6.Text = num.ToString();
                Literal literal7 = this.litCouponCount;
                num           = CouponHelper.GetUserObtainCouponNum(user.UserId);
                literal7.Text = num.ToString();
                Literal literal8 = this.litDormancyDay;
                num           = MemberHelper.GetUserDormancyDays(user.UserId);
                literal8.Text = num.ToString();
            }
        }
Exemplo n.º 10
0
        private void ExportExcel(HttpContext context)
        {
            string         parameter  = base.GetParameter(context, "FileFormat", false);
            string         parameter2 = base.GetParameter(context, "Fields", false);
            string         parameter3 = base.GetParameter(context, "Headers", false);
            IList <string> list       = new List <string>();
            IList <string> list2      = new List <string>();
            IList <string> list3      = new List <string>();

            string[] array = (from d in parameter2.Split(',')
                              where !string.IsNullOrWhiteSpace(d)
                              select d).ToArray();
            string[] array2 = (from d in parameter3.Split(',')
                               where !string.IsNullOrWhiteSpace(d)
                               select d).ToArray();
            if (array.Count() != array2.Count())
            {
                throw new HidistroAshxException("字段与字段描述数量不对");
            }
            int num = array.Count();

            for (int i = 0; i < num; i++)
            {
                string text = array[i];
                string item = array2[i];
                if (!string.IsNullOrWhiteSpace(text))
                {
                    list2.Add(text);
                    if (text == "Address")
                    {
                        list2.Add("RegionId");
                    }
                    list.Add(text);
                    list3.Add(item);
                }
            }
            MemberQuery   dataQuery     = this.GetDataQuery(context);
            DataTable     membersNopage = MemberHelper.GetMembersNopage(dataQuery, list2);
            StringBuilder stringBuilder = new StringBuilder();

            foreach (string item2 in list3)
            {
                stringBuilder.Append(item2 + ",");
                if (item2 == list3[list3.Count - 1])
                {
                    stringBuilder = stringBuilder.Remove(stringBuilder.Length - 1, 1);
                    stringBuilder.Append("\r\n");
                }
            }
            string text2 = "";
            int    num2  = 0;
            string text3 = "";

            foreach (DataRow row in membersNopage.Rows)
            {
                foreach (string item3 in list)
                {
                    if (item3 == "Address" && row["RegionId"] != DBNull.Value)
                    {
                        int.TryParse(row["RegionId"].ToString(), out num2);
                        text3 = ((num2 <= 0) ? "" : (RegionHelper.GetFullRegion(num2, " ", true, 0) + " "));
                        text2 = text3 + row[item3].ToString() + ",";
                    }
                    else if (item3 == "TagIds")
                    {
                        string str   = "";
                        string text4 = row["TagIds"].ToString();
                        if (!string.IsNullOrWhiteSpace(text4))
                        {
                            if (text4 == ",")
                            {
                                text4 = "";
                            }
                            else
                            {
                                text4 = text4.TrimStart(',');
                                text4 = text4.TrimEnd(',');
                            }
                            if (text4 != "")
                            {
                                IList <MemberTagInfo> tagByMember = MemberTagHelper.GetTagByMember(text4);
                                str = string.Join("|", (from t in tagByMember
                                                        select t.TagName).ToArray());
                            }
                        }
                        text2 = str + ",";
                    }
                    else if (item3 == "BirthDate")
                    {
                        string text5 = row["BirthDate"].ToString();
                        text2 = (string.IsNullOrEmpty(text5) ? " ," : (DateTime.Parse(text5).ToShortDateString() + ","));
                    }
                    else
                    {
                        text2 = row[item3].ToString() + ",";
                    }
                    stringBuilder.Append(text2);
                    if (item3 == list[list3.Count - 1])
                    {
                        stringBuilder = stringBuilder.Remove(stringBuilder.Length - 1, 1);
                        stringBuilder.Append("\r\n");
                    }
                }
            }
            context.Response.Clear();
            context.Response.Buffer  = false;
            context.Response.Charset = "GB2312";
            if (parameter == "csv")
            {
                context.Response.AppendHeader("Content-Disposition", "attachment;filename=MemberInfo.csv");
                context.Response.ContentType = "application/octet-stream";
            }
            else
            {
                context.Response.AppendHeader("Content-Disposition", "attachment;filename=MemberInfo.txt");
                context.Response.ContentType = "application/vnd.ms-word";
            }
            context.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
            context.Response.Write(stringBuilder.ToString());
            context.Response.End();
        }
Exemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.LoadParameters();
     if (!this.Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["orderBy"]))
         {
             this.dropSortBy.SelectedValue = this.Page.Request.QueryString["orderBy"];
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["GradeId"]))
         {
             this.rankId = this.Page.Request.QueryString["GradeId"].ToInt(0);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["RegisteredSource"]))
         {
             this.RegisteredSource = this.Page.Request.QueryString["RegisteredSource"].ToInt(0);
         }
         var dataSource = from item in MemberTagHelper.GetAllTags()
                          select new
         {
             item.TagId,
             item.TagName
         };
         this.ddlMemberTags.DataSource     = dataSource;
         this.ddlMemberTags.DataTextField  = "TagName";
         this.ddlMemberTags.DataValueField = "TagId";
         this.ddlMemberTags.DataBind();
         this.ddlMemberTags.Items.Insert(0, new ListItem("请选择标签", ""));
         int num;
         if (this.Page.Request.QueryString["TagsId"].ToInt(0) > 0)
         {
             DropDownList dropDownList = this.ddlMemberTags;
             num = this.Page.Request.QueryString["TagsId"].ToInt(0);
             dropDownList.SelectedValue = num.ToString();
         }
         this.rankList.DataBind();
         this.rankList.SelectedValue = this.rankId;
         this.sourceList.DataBind();
         this.sourceList.SelectedValue = this.RegisteredSource;
         SiteSettings siteSetting = this.GetSiteSetting();
         if (siteSetting.SMSEnabled)
         {
             Literal literal = this.litsmscount;
             num                    = this.GetAmount(siteSetting);
             literal.Text           = num.ToString();
             this.hdenablemsg.Value = "1";
         }
         if (siteSetting.EmailEnabled)
         {
             this.hdenableemail.Value = "1";
         }
         HiddenField hiddenField = this.hidIsOpenApp;
         num = siteSetting.OpenMobbile;
         hiddenField.Value = num.ToString();
         foreach (ListItem item in this.exportFieldsCheckBoxList.Items)
         {
             item.Attributes.Add("data-field", item.Value);
             item.Attributes.Add("data-header", item.Text);
             item.Attributes.Add("data-type", "field");
             item.Selected = true;
         }
     }
 }