Esempio n. 1
0
        //初始会员密码
        public static string initialuser(int id, int comid)
        {
            var b2b      = new B2bCrmData();
            var phone    = b2b.Readuser(id, comid).Phone.ToString();
            var pass     = phone.Substring(5, 6).ToString();
            var name     = b2b.Readuser(id, comid).Name.ToString();
            var cardcode = b2b.Readuser(id, comid).Idcard.ToString();

            try
            {
                var prodata = new B2bCrmData();

                B2b_crm b2bcrm = new B2b_crm()
                {
                    Id        = id,
                    Com_id    = comid,
                    Password1 = pass
                };
                var pro = prodata.initialuser(b2bcrm);
                if (int.Parse(pro) == id)
                {
                    SendSmsHelper.GetMember_sms(phone, name, cardcode, pass, 0, "初始化密码", comid);
                }
                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 2
0
        //当客户的渠道为0时,随机自动分配一个渠道编号(优先未锁定用户的),sendtype= 当为1的时候 有渠道也发送,一般是点击我的顾问时候发送,0=则是留言的时候变更渠道发送
        public static int GetFenpeiChannel(int comid, string openid, int sendtype = 1, int companyid = 0, int channleid = 0)
        {
            var            crmdata       = new B2bCrmData();
            MemberCardData carddata      = new MemberCardData();
            var            channeldata   = new MemberChannelData();//读取渠道信息
            decimal        idcard        = 0;
            decimal        channelid     = 0;
            var            userinfo_auto = carddata.GetMemberCardByOpenId(openid);;//获取微信操作账户

            if (userinfo_auto != null)
            {
                idcard    = userinfo_auto.Cardcode;;
                channelid = userinfo_auto.IssueCard;//获取渠道ID
            }

            //判断对 微信注册,网站注册渠道进行归0
            var channeltype = channeldata.GetChannelDetail(int.Parse(channelid.ToString()));

            if (channeltype != null)
            {
                if (channeltype.Issuetype == 3 || channeltype.Issuetype == 4 || channeltype.Name == "默认渠道")
                {//如果渠道时微信注册或网站注册,渠道ID归0,下面自动重新分配有效渠道
                    channelid = 0;
                }
            }


            return(int.Parse(channelid.ToString()));
        }
Esempio n. 3
0
        private void VerifyOneOffPass(string openid, string weixinpass)
        {
            if (openid != "" && weixinpass != "")
            {
                B2bCrmData dateuser = new B2bCrmData();
                string     data     = CrmMemberJsonData.WeixinLogin(openid, weixinpass, comid, out userinfo);

                if (data == "OK")                                    //正确的一次性密码
                {
                    HttpCookie cookie = new HttpCookie("AccountId"); //实例化HttpCookie类并添加值
                    cookie.Value   = userinfo.Id.ToString();
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);
                    var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                    cookie         = new HttpCookie("AccountKey"); //实例化HttpCookie类并添加值
                    cookie.Value   = returnmd5;
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);

                    cookie         = new HttpCookie("openid"); //实例化HttpCookie类并添加值
                    cookie.Value   = openid;
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);
                    if (userinfo != null)
                    {
                        Readuser(userinfo.Idcard, comid);//读取用户信息
                    }
                }
            }
            new B2bCrmData().WeixinConPass(openid, comid);//清空微信密码
        }
Esempio n. 4
0
        public static string ViewQQpagelist(int comid, int channelcompanyid, int pageindex, int pagesize, string key = "", string openid = "", string usern = "", string usere = "")
        {
            var totalcount = 0;

            try
            {
                B2bCrmData crmdata = new B2bCrmData();
                var        prodata = new B2bCompanyManagerUserData();


                var         list   = prodata.ViewQQpagelist(comid, channelcompanyid, pageindex, pagesize, out totalcount, key, openid, usern, usere);
                IEnumerable result = "";
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        Id   = pro.Id,
                        Name = pro.Employeename,
                        QQ   = pro.QQ,
                    }
                }
                ;


                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 5
0
        private void GetOpenId(string codee, int comid)
        {
            WeiXinBasic basicc = new WeiXinBasicData().GetWxBasicByComId(comid);


            if (basicc != null)
            {
                string      st  = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + basicc.AppId + "&secret=" + basicc.AppSecret + "&code=" + codee + "&grant_type=authorization_code";
                XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + new GetUrlData().HttpGet(st) + "}");

                XmlElement rootElement = doc.DocumentElement;

                string openid = rootElement.SelectSingleNode("openid").InnerText;

                //根据微信号获取用户信息,使用户处于登录状态
                string data = new B2bCrmData().GetB2bCrm(openid, comid, out userinfo);
                if (data == "OK")
                {
                    HttpCookie cookie = new HttpCookie("AccountId");     //实例化HttpCookie类并添加值
                    cookie.Value   = userinfo.Id.ToString();
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);
                    var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                    cookie         = new HttpCookie("AccountKey"); //实例化HttpCookie类并添加值
                    cookie.Value   = returnmd5;
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);

                    cookie         = new HttpCookie("openid"); //实例化HttpCookie类并添加值
                    cookie.Value   = openid;
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);
                }
            }
        }
Esempio n. 6
0
        public static string Upchannl(int id, int comid, decimal channlcard, decimal oldcard, int uptype)
        {
            try
            {
                var pro = "";

                //获得渠道ID
                var Channeinfo = new MemberChannelData().GetSelfChannelDetailByCardNo(channlcard.ToString());

                B2bCrmData crmdate  = new B2bCrmData();
                var        Userinfo = crmdate.Readuser(id, comid);


                if (Channeinfo != null && Userinfo != null)
                {
                    pro = new MemberChannelData().UpchannlT(Userinfo.Cardid, Channeinfo.Id, uptype);
                }

                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception e)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = e.Message }));
            }
        }
Esempio n. 7
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)
            {
                AccountId = userinfo.Id;
                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());
                }

                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }
Esempio n. 8
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());
                //}
                weixinopenid = userinfo.Weixin;
                if (userinfo.Weixin != "")
                {
                    var crmdistance = dateuser.GetB2bCrmDistanceByid(userinfo.Weixin);
                    if (crmdistance != "")
                    {
                        wxzuobiao = 1;
                    }
                }


                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }
Esempio n. 9
0
        //微信编辑个人信息
        public static string weiUpMember(int comid, decimal cardcode, string Name, string Phone, string Sex, DateTime Birthday, decimal code)
        {
            try
            {
                var prodata = new B2bCrmData();
                var pro     = "";
                var list    = Phone_code.code_info(decimal.Parse(Phone), comid);
                if (code == list.Code)
                {
                    //把返佣日志录入渠道返佣日志表
                    B2b_crm b2bcrm = new B2b_crm()
                    {
                        Idcard   = cardcode,
                        Name     = Name,
                        Phone    = Phone,
                        Sex      = Sex,
                        Birthday = Birthday,
                        Com_id   = comid
                    };
                    pro = prodata.weiUpMember(b2bcrm);
                }
                else
                {
                    pro = "验证码错误";
                }

                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 10
0
        //当客户的渠道为0时,随机自动分配一个渠道编号(优先未锁定用户的),sendtype= 当为1的时候 有渠道也发送,一般是点击我的顾问时候发送,0=则是留言的时候变更渠道发送
        public static int AutoFenpeiChannel(int comid, string openid, int sendtype = 1, int companyid = 0, int channleid = 0)
        {
            var            crmdata       = new B2bCrmData();
            MemberCardData carddata      = new MemberCardData();
            var            channeldata   = new MemberChannelData();//读取渠道信息
            decimal        idcard        = 0;
            decimal        channelid     = 0;
            var            userinfo_auto = carddata.GetMemberCardByOpenId(openid);;//获取微信操作账户

            if (userinfo_auto != null)
            {
                idcard    = userinfo_auto.Cardcode;;
                channelid = userinfo_auto.IssueCard;//获取渠道ID
            }

            //判断对 微信注册,网站注册渠道进行归0
            var channeltype = channeldata.GetChannelDetail(int.Parse(channelid.ToString()));

            if (channeltype != null)
            {
                if (channeltype.Issuetype == 3 || channeltype.Issuetype == 4 || channeltype.Name == "默认渠道")
                {//如果渠道时微信注册或网站注册,渠道ID归0,下面自动重新分配有效渠道
                    channelid = 0;
                }
            }

            if (channelid == 0)
            {
                //查询在线渠道列表,
                int totalcount  = 0;                                                                                 //在线数量
                var channellist = channeldata.GetChannelListByComid(comid, companyid, 2, out totalcount, channleid); //先查询渠道列表 锁定客户为空的

                if (channellist != null)
                {
                    if (totalcount > 0)
                    {
                        //随机选择一个渠道
                        Random rand           = new Random();
                        var    channel_temp   = channellist[rand.Next(0, totalcount - 1)];
                        var    channelid_temp = channel_temp.Id;

                        //绑定渠道
                        int upchannel = new MemberCardData().upCardcodeChannel(idcard.ToString(), channelid_temp);
                        channelid = channelid_temp;
                    }
                }
                //只有变更时才发送顾问信息
                Sendweixinchient(openid, comid);
            }
            else
            {
                //点击顾问也发送
                if (sendtype == 1)
                {
                    Sendweixinchient(openid, comid);
                }
            }
            return(int.Parse(channelid.ToString()));
        }
Esempio n. 11
0
        public void DealUserinfo1(string openid, string weixinpass, int comid, int questtype)
        {
            if (Request.Cookies["AccountId"] != null)
            {
                string accountmd5 = "";
                int    AccountId  = int.Parse(Request.Cookies["AccountId"].Value);
                if (Request.Cookies["AccountKey"] != null)
                {
                    accountmd5 = Request.Cookies["AccountKey"].Value;
                }

                var data = CrmMemberJsonData.WeixinCookieLogin(AccountId.ToString(), accountmd5, comid, out userinfo);
                if (data != "OK")
                {
                    //当cookie错误无法登陆则清除所有COOKIE;
                    HttpCookie aCookie;
                    string     cookieName;
                    int        limit = Request.Cookies.Count;
                    for (int i = 0; i < limit; i++)
                    {
                        cookieName      = Request.Cookies[i].Name;
                        aCookie         = new HttpCookie(cookieName);
                        aCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(aCookie);
                    }

                    if (questtype == 1)
                    {
                        VerifyOneOffPass(openid, weixinpass);//重新验证一下是否是正确的一次性密码
                    }
                    else if (questtype == 2)
                    {
                        GetOpenId(weixinpass, comid);//微信授权验证
                    }
                }
                else
                {
                    //从cookie中得到微信号
                    if (Request.Cookies["openid"] != null)
                    {
                        openid = Request.Cookies["openid"].Value;
                    }

                    B2bCrmData dateuser = new B2bCrmData();
                    dateuser.WeixinConPass(openid, comid);//清空微信密码
                }
            }
            else
            {
                if (questtype == 1)
                {
                    VerifyOneOffPass(openid, weixinpass);//重新验证一下是否是正确的一次性密码
                }
                else if (questtype == 2)
                {
                    GetOpenId(weixinpass, comid);//微信授权验证
                }
            }
        }
Esempio n. 12
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)
            {
                uid = userinfo.Id;
                //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());
                //}


                //当读取用户信息的时候,判断是否有渠道转发信息
                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登陆成功,清空微信密码
            }
        }
Esempio n. 13
0
        public static string LoadingList(string comid, int pageindex, int pagesize, int userid)
        {
            var totalcount = 0;

            try
            {
                var list = new List <Member_Activity_Log>();
                B2b_company_manageuser userr = B2bCompanyManagerUserData.GetUser(userid);
                if (userr != null)
                {
                    if (userr.Channelcompanyid == 0)//总公司账户
                    {
                        list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, out totalcount);
                    }
                    else //总公司下面渠道
                    {
                        list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, int.Parse(userr.Channelcompanyid.ToString()), out totalcount);
                    }


                    IEnumerable result     = "";
                    var         memcompany = new MemberChannelcompanyData();
                    if (list != null)
                    {
                        result = from pro in list
                                 select new
                        {
                            ID     = pro.ID,
                            CardID = MemberCardData.GetCardId(pro.CardID).Cardcode.ToString(),
                            //CardID =pro.CardID,
                            ACTID               = MemberActivityData.GetActById(pro.ACTID).Title.ToString(),
                            OrderId             = pro.OrderId,
                            ServerName          = pro.ServerName,
                            Sales_admin         = pro.Sales_admin,
                            Num_people          = pro.Num_people,
                            Usesubdate          = pro.Usesubdate,
                            Per_capita_money    = pro.Per_capita_money * pro.Num_people,
                            Member_return_money = pro.Member_return_money,
                            username            = B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode) == null ? "--" : B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode).Name.ToString(),
                            channel             = memcompany.UpCompanyById(MemberCardData.GetCardId(pro.CardID).Cardcode.ToString())
                        }
                    }
                    ;

                    return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 14
0
        public string Servermobile = ""; //服务专员手机


        protected void Page_Load(object sender, EventArgs e)
        {
            openid     = Request["openid"];
            weixinpass = Request["weixinpass"];

            //如果SESSION有值,进行赋值
            if (openid != "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }



            //获得商户ID
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid             = companyinfo.Com_id;
                Session["Com_id"] = comid;
            }


            //已登录直接跳转
            if (Session["AccountId"] != null)
            {
                AccountId = Int32.Parse(Session["AccountId"].ToString());
                B2bCrmData dateuser1 = new B2bCrmData();
                B2b_crm    modeluser = dateuser1.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    AccountName   = modeluser.Name;
                    AccountCard   = modeluser.Idcard.ToString();
                    Servercard    = modeluser.Servercard;
                    Integral      = modeluser.Integral;
                    Imprest       = modeluser.Imprest;
                }

                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    MemberChannelData channeldate  = new MemberChannelData();
                    Member_Channel    channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }
            }
        }
Esempio n. 15
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());
                //}
                weixinopenid = userinfo.Weixin;

                if (weixinopenid == "")
                {
                    yonghustate = 0;
                }
                else if (weixinopenid != "" && zaixianzhuangtai == "我在线上")
                {
                    MemberCardData carddata  = new MemberCardData();
                    var            cardmodel = carddata.GetCardByCardNumber(decimal.Parse(idcard.ToString()));
                    if (cardmodel != null)
                    {
                        if (cardmodel.IssueCard == channelid)
                        {
                            yonghustate = 1;
                        }
                        else
                        {
                            yonghustate = 2;
                        }
                    }
                    else
                    {
                        yonghustate = 2;
                    }
                }
                else
                {
                    yonghustate = 3;
                }


                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }
Esempio n. 16
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)
            {
                AccountId = userinfo.Id;
                userid    = userinfo.Id.ToString();                //如果是登陆用户则读取用户的实际ID
                HttpCookie cookie = new HttpCookie("temp_userid"); //实例化HttpCookie类并添加值
                cookie.Value   = userinfo.Id.ToString();
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);


                var channeldata = new MemberChannelData();
                channelid = channeldata.GetChannelid(userinfo.Com_id, userinfo.Phone);



                //当读取用户信息的时候,判断是否有渠道转发信息
                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登陆成功,清空微信密码
            }
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int    comid    = Request["comid"].ConvertTo <int>();
            string crmlevel = Request["crmlevel"].ConvertTo <string>();
            string openid   = Request["openid"].ConvertTo <string>("");


            if (crmlevel != null)
            {
                B2bcrmlevels mcrmlevel = new B2bcrmlevelsData().Getb2bcrmlevel(comid, crmlevel);
                if (mcrmlevel != null)
                {
                    title  = mcrmlevel.levelname;
                    tequan = mcrmlevel.tequan;


                    decimal djf_end = mcrmlevel.dengjifen_end;
                    if (openid != "")
                    {
                        B2b_crm mcrm = new B2bCrmData().GetB2bCrmByWeiXin(openid);
                        if (mcrm != null)
                        {
                            decimal mdjf = mcrm.Dengjifen;
                            //得到会员下一级别
                            B2bcrmlevels next_mcrmlevel = new B2bcrmlevelsData().Getb2bcrmlevel(comid, djf_end + 1);
                            if (next_mcrmlevel != null)
                            {
                                if (next_mcrmlevel.isavailable == 0)
                                {
                                    //当前会员级别为最高级别
                                    tishi = "您现在等积分:" + mdjf.ToString("F0") + "分;";
                                }
                                else
                                {
                                    //判断是否是最高级别会员
                                    decimal diff = djf_end - mdjf + 1;
                                    if (diff > 0)
                                    {
                                        tishi = "您现在等积分:" + mdjf.ToString("F0") + "分,还需" + diff.ToString("F0") + "分可以升级为" + next_mcrmlevel.levelname;
                                    }
                                }
                            }
                            else
                            {
                                //当前会员级别为最高级别
                                tishi = "您现在等积分:" + mdjf.ToString("F0") + "分;";
                            }
                        }
                    }
                }
            }
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string     openid   = "asdasdfasdfasdfas1223aad88";
            B2bCrmData userdate = new B2bCrmData();

            //var setpass = userdate.WeixinSetPass(openid, 101);



            pass = userdate.WeixinGetPass(openid, 101);

            //userdate.WeixinConPass(openid, 101);
        }
Esempio n. 19
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)
            {
                //当读取用户信息的时候,判断是否有渠道转发信息
                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);
                    }
                }

                //读取渠道商户名称

                var channelcompany = new MemberChannelcompanyData().GetChannelCompanyByCrmId(userinfo.Id);
                if (channelcompany != null)
                {
                    tel = channelcompany.Companyphone;
                }


                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }
Esempio n. 20
0
        public static string GetMemberCardList(int comid, decimal cardcode, int pageindex, int pagesize, int issueid, int channelid, int actid, int isopencard)
        {
            var totalcount = 0;

            try
            {
                var prodata = new MemberCardData();
                if (cardcode.ToString().Trim().Length == 11)//会员电话号码
                {
                    var carddata = new B2bCrmData().GetB2bCrmByPhone(comid, cardcode.ToString());
                    if (carddata != null)
                    {
                        cardcode = carddata.Idcard;
                    }
                }


                var         list   = prodata.GetMemberCardList(comid, cardcode, pageindex, pagesize, issueid, channelid, actid, isopencard, out totalcount);
                IEnumerable result = "";
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        CardCode     = pro.Cardcode,
                        Name         = pro.Openstate == 0 ? "--" : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode) == null ? "" : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode).Name,
                        Phone        = pro.Openstate == 0 ? "--" : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode) == null ? "" : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode).Phone,
                        Imprest      = pro.Openstate == 0 ? 0 : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode) == null ? 0 : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode).Imprest,
                        Integral     = pro.Openstate == 0 ? 0 : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode) == null ? 0 : new B2bCrmData().GetB2bCrmByCardcode(pro.Cardcode).Integral,
                        OpenSubDate  = pro.Openstate == 0 ? "--" : pro.Opensubdate.ToString("yyyy-MM-dd") == "1900-01-01" ? "--" : pro.Opensubdate.ToString("yyyy-MM-dd"),
                        ChannelName  = pro.IssueCard == 0 ? "--" : new MemberChannelData().GetChannelDetail(int.Parse(pro.IssueCard.ToString())).Name,
                        ActStr       = pro.IssueCard == 0 ? "--" : new MemberIssueActivityData().GetIssueActStr(pro.IssueId),
                        IssueTitle   = pro.IssueCard == 0 ? "--" : new MemberIssueData().GetIssueDetailById(pro.IssueId) == null ? "" : new MemberIssueData().GetIssueDetailById(pro.IssueId).Title,
                        EnteredState = pro.IssueCard == 0 ? "未录入" : "已录入",
                        OpenState    = pro.Openstate == 0 ? "未开卡" : "已开卡"
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 21
0
        public static string Logdetails(int id, int comid)
        {
            try
            {
                var prodata = new B2bCrmData();
                var list    = prodata.Logdetails(id, comid);

                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 22
0
        public static int GetMember_sms(string phone, string name, string card, string password, decimal money, string key, int comid, int sendnum)
        {
            string msg     = "";
            string content = "";

            using (var helper = new SqlHelper())
            {
                B2b_crm surplus = null;
                if (card != "")
                {
                    surplus = new B2bCrmData().GetB2bCrmByCardcode(decimal.Parse(card));
                }
                var pro = new SendSmsHelper(helper).member_sms(phone, name, card, password, money, key);
                if (pro != null)
                {
                    if (pro.Remark.ToString() != "" || pro.Remark.ToString() != null)
                    {
                        content = pro.Remark.ToString();
                        if (sendnum > 1)
                        {
                            content = "R" + (sendnum - 1).ToString() + pro.Remark.ToString();
                        }
                        content = content.Replace("$name$", name);
                        content = content.Replace("$phone$", phone);
                        content = content.Replace("$card$", card);
                        content = content.Replace("$pass$", password);
                        content = content.Replace("$money$", System.Math.Abs(money).ToString());
                        if (surplus != null)
                        {
                            content = content.Replace("$Ysurplus$", surplus.Imprest.ToString());
                            content = content.Replace("$Xsurplus$", surplus.Integral.ToString());
                        }
                    }
                }
            }

            try
            {
                var backContent = SendSms(phone, content, comid, out msg);
                return(backContent);
            }
            catch (Exception ex)
            {
                msg = "短信发送错误" + ex.Message;
                return(-9);
            }
        }
Esempio n. 23
0
        public static string Readuser(int id, int comid)
        {
            try
            {
                var prodata = new B2bCrmData();
                var list    = prodata.Readuser(id, comid);
                var rename  = MemberChannelData.GetChannelinfo(int.Parse(MemberCardData.GetCardNumber(list.Idcard).IssueCard.ToString()));
                var memcard = MemberChannelData.GetChannelinfo(int.Parse(MemberCardData.GetCardNumber(list.Idcard).ServerCard.ToString()));

                return(JsonConvert.SerializeObject(new { type = 100, msg = list, Namechannl = rename, Mem = memcard }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 24
0
        public static string ChannelcompanyOrderlocation(string comid, int pageindex, int pagesize, string key, int channelcompanyid = 0, string channelcompanytype = "0,1,3,4", string openid = "", string n1 = "", string e1 = "")
        {
            try
            {
                int totalcount = 0;
                var crmdata    = new B2bCrmData();

                List <Member_Channel_company> list = new MemberChannelcompanyData().ChannelcompanyOrderlocation(comid, pageindex, pagesize, key, out totalcount, channelcompanyid, channelcompanytype, n1, e1);

                IEnumerable result = "";
                if (list != null)
                {
                    result = from pro in list
                             //orderby pro.Distance
                             select new
                    {
                        Id                  = pro.Id,
                        Com_id              = pro.Com_id,
                        Companyname         = pro.Companyname,
                        Issuetype           = pro.Issuetype,
                        Whethercreateqrcode = pro.Whethercreateqrcode,
                        Companyaddress      = pro.Companyaddress,
                        Companyphone        = pro.Companyphone,
                        CompanyCoordinate   = pro.CompanyCoordinate,
                        CompanyLocate       = pro.CompanyLocate,
                        Companyimgurl       = FileSerivce.GetImgUrl(pro.Companyimg),
                        Companyintro        = pro.Companyintro,
                        Companyproject      = pro.Companyproject,
                        Distance            = crmdata.CalculateTheCoordinates(openid, pro.Id),
                        m = new WxSubscribeSourceData().GetWXSourceByChannelcompanyid(pro.Id)
                    }
                }


                ;
                return(JsonConvert.SerializeObject(new { type = 100, totalcount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// 验证微信一次性密码
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="weixinpass"></param>
        private bool VerifyOneOffPass(string openid, string weixinpass)
        {
            if (openid != null && openid != "" && weixinpass != "" && weixinpass != null)
            {
                B2b_crm b2bcrm = new B2b_crm();

                B2bCrmData dateuser = new B2bCrmData();
                string     data     = CrmMemberJsonData.WeixinLogin(openid, weixinpass, comid, out b2bcrm);


                //清空微信一次性密码
                new B2bCrmData().WeixinConPass(openid, comid);

                if (data == "OK")
                {
                    HttpCookie cookie = new HttpCookie("AccountId");     //实例化HttpCookie类并添加值
                    cookie.Value   = b2bcrm.Id.ToString();
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);

                    var returnmd5 = EncryptionHelper.ToMD5(b2bcrm.Idcard.ToString() + b2bcrm.Id.ToString(), "UTF-8");
                    cookie         = new HttpCookie("AccountKey"); //实例化HttpCookie类并添加值
                    cookie.Value   = returnmd5;
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);

                    cookie         = new HttpCookie("openid"); //实例化HttpCookie类并添加值
                    cookie.Value   = openid;
                    cookie.Expires = DateTime.Now.AddDays(120);
                    Response.Cookies.Add(cookie);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 26
0
        public string openid = "";//微信号
        protected void Page_Load(object sender, EventArgs e)
        {
            //从cookie中得到微信号
            if (Request.Cookies["openid"] != null)
            {
                openid = Request.Cookies["openid"].Value;
            }

            B2bCrmData b2b_crm = new B2bCrmData();

            if (openid != "")
            {
                B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                if (b2bmodle != null)
                {
                    comid = b2bmodle.Com_id;
                }
            }
        }
Esempio n. 27
0
        public static string IntegralList(int pageindex, int pagesize, int comid, string key = "")
        {
            int totalcount = 0;

            try
            {
                B2bFinanceData fdate   = new B2bFinanceData();
                var            crmdata = new B2bCrmData();
                var            list    = fdate.IntegralList(pageindex, pagesize, comid, out totalcount, 0, key);

                IEnumerable result = "";
                if (list != null)
                {
                    result = from finance in list
                             select new
                    {
                        Id        = finance.Id,
                        OrderId   = finance.OrderId,
                        Mid       = finance.Mid,
                        Money     = finance.Money,
                        OrderName = finance.OrderName,
                        Subdate   = finance.Subdate,
                        Comid     = finance.Comid,
                        Ptype     = finance.Ptype,
                        Admin     = finance.Admin,
                        Ip        = finance.Ip,
                        Crm       = crmdata.GetB2bCrmById(finance.Mid)
                    }
                }
                ;



                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, totalCount = 0, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 28
0
        public static string fuwuPageList(string comid, int pageindex, int pagesize, int user)
        {
            var totalcount = 0;

            try
            {
                var         prodata    = new B2bCrmData();
                var         list       = prodata.fuwuPageList(comid, pageindex, pagesize, user, out totalcount);
                IEnumerable result     = "";
                var         memcompany = new MemberChannelcompanyData();
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        id           = pro.Id,
                        comid        = pro.Com_id,
                        phone        = pro.Phone,
                        registerdate = pro.Regidate,
                        customername = pro.Name,
                        imprest      = pro.Imprest,
                        integral     = pro.Integral,
                        idcard       = pro.Idcard,
                        email        = pro.Email,
                        serverid     = pro.Servercard,
                        winxin       = pro.Weixin == null || pro.Weixin == "" ? "" : "yes",
                        channel      = memcompany.UpCompanyById(pro.Idcard.ToString()),
                        referrer     = MemberChannelData.Upstring(pro.Idcard.ToString()).Name.ToString()
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 29
0
        public static string UpMember(int id, int comid, string Name, string Phone, string Sex, string Email, int Age)
        {
            try
            {
                //根据手机得到公司会员信息
                B2b_crm crm = new B2bCrmData().GetB2bCrmByPhone(comid, Phone);
                if (crm != null)
                {
                    if (crm.Id != id)
                    {
                        return(JsonConvert.SerializeObject(new { type = 1, msg = "当前手机已经绑定,请更换手机" }));
                    }
                }


                var prodata = new B2bCrmData();

                //把返佣日志录入渠道返佣日志表
                B2b_crm b2bcrm = new B2b_crm()
                {
                    Id     = id,
                    Name   = Name,
                    Phone  = Phone,
                    Sex    = Sex,
                    Email  = Email,
                    Age    = Age,
                    Com_id = comid
                };
                var pro = prodata.UpMember(b2bcrm);

                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Esempio n. 30
0
        public static string GetCrmStatistics(int comid, int userid)
        {
            try
            {
                B2b_company_manageuser userr = B2bCompanyManagerUserData.GetUser(userid);
                if (userr != null)
                {
                    DataTable dt = new B2bCrmData().GetCrmStatistics(comid, int.Parse(userr.Channelcompanyid.ToString()));
                    return(JsonConvert.SerializeObject(new { type = 100, msg = dt }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }