示例#1
0
        //读取用户信息
        private void Readuser(decimal idcard, int comid)
        {
            Today = DateTime.Now.ToString("yyyy-MM-dd");
            B2bCrmData dateuser = new B2bCrmData();

            var userinfo = dateuser.GetB2bCrmByCardcode(idcard);

            if (userinfo != null)
            {
                Integral = userinfo.Integral.ToString() == "" ? "0" : userinfo.Integral.ToString();
                Imprest  = userinfo.Imprest.ToString() == "" ? "0" : userinfo.Imprest.ToString();

                AccountWeixin = userinfo.Weixin;
                AccountEmail  = userinfo.Email;
                Accountphone  = userinfo.Phone;
                AccountCard   = userinfo.Idcard.ToString();
                string a = AccountCard.Substring(0, 1);
                if (a != null)
                {
                    fcard = int.Parse(a.ToString());
                }

                MemberCardData carddata = new MemberCardData();
                var            cardinfo = carddata.GetCardByCardNumber(decimal.Parse(AccountCard));
                if (cardinfo != null)
                {
                    channelid = Int32.Parse(cardinfo.IssueCard.ToString());
                }



                //获取预付款记录
                B2bFinanceData fdate      = new B2bFinanceData();
                int            totalcount = 0;
                var            list       = fdate.ImprestList(1, 10, comid, out totalcount, userinfo.Id);
                if (list != null)
                {
                    Imprestlist = "<ul>";
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].Money < 0)
                        {
                            Imprestlist += "<li>" + list[i].Subdate + "  支出:" + list[i].Money.ToString("0.00") + "元</li>";
                        }
                        else
                        {
                            Imprestlist += "<li>" + list[i].Subdate + "  获得:" + list[i].Money.ToString("0.00") + "元</li>";
                        }
                    }
                    Imprestlist += "</ul>";
                }


                //获取积分记录
                var integrallist = fdate.IntegralList(1, 10, comid, out totalcount, userinfo.Id);
                if (integrallist != null)
                {
                    Integrallist = "<ul>";
                    for (int i = 0; i < integrallist.Count; i++)
                    {
                        if (integrallist[i].Money < 0)
                        {
                            Integrallist += "<li>" + integrallist[i].Subdate + "  支出:" + integrallist[i].Money.ToString("0") + "</li>";
                        }
                        else
                        {
                            Integrallist += "<li>" + integrallist[i].Subdate + "  获得:" + integrallist[i].Money.ToString("0") + "</li>";
                        }
                    }
                    Integrallist += "</ul>";
                }


                //消费记录
                string       proname    = "";
                string       orderstate = "";
                B2bOrderData dataorder  = new B2bOrderData();
                var          prodata    = new B2bComProData();
                var          order      = dataorder.ConsumerOrderPageList("", 1, 10, userinfo.Id, out totalcount);
                if (order != null)
                {
                    Orderlist = "<ul>";
                    for (int i = 0; i < order.Count; i++)
                    {
                        var promodel = prodata.GetProById(order[i].Pro_id.ToString());
                        if (promodel != null)
                        {
                            proname = promodel.Pro_name;
                        }

                        orderstate = EnumUtils.GetName((OrderStatus)order[i].Order_state);

                        Orderlist += "<li>" + proname + "(" + order[i].U_subdate + ") " + order[i].U_num + "(" + orderstate + ")</li>";
                    }
                    Orderlist += "</ul>";
                }



                //当读取用户信息的时候,判断是否有渠道转发信息
                if (Request.Cookies["ZF_ChanneId"] != null)
                {
                    int ZF_ChanneId = 0;
                    ZF_ChanneId = int.Parse(Request.Cookies["ZF_ChanneId"].Value);
                    if (ZF_ChanneId != 0)
                    { //有转发渠道ID
                        //在这判断 用户渠道是否为微信注册过来的
                        Member_Channel channel2 = new MemberChannelData().GetChannelByOpenId(userinfo.Weixin);
                        if (channel2 != null)
                        {
                            if (channel2.Issuetype == 4)
                            {
                                //如果为微信注册过来的 ,则修改会员渠道即可
                                int upchannel = new MemberCardData().upCardcodeChannel(userinfo.Idcard.ToString(), ZF_ChanneId);
                            }
                        }
                        else
                        {
                            //没有渠道的 ,则修改会员渠道即可
                            int upchannel = new MemberCardData().upCardcodeChannel(userinfo.Idcard.ToString(), ZF_ChanneId);
                        }

                        //清除Cookies
                        HttpCookie aCookie = new HttpCookie("ZF_ChanneId");
                        aCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(aCookie);
                    }
                }


                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }