示例#1
0
 public void EGetEwm()
 {
     if (Context.Session["OpenIdE"] != null)
     {
         string     OpenId = Context.Session["OpenIdE"].ToString();
         WeChatUser wcu    = ve.WeChatUser.FirstOrDefault(x => x.OpenId == OpenId && x.State == true);
         TempBind   tb     = null;
         int        num    = 0;
         do
         {
             num = TextStr.RandomArray(1, 50000, 100000)[0];
             string str = num + "";
             tb = ve.TempBind.FirstOrDefault(q => q.SceneId == str);
         } while (tb != null);
         tb            = new TempBind();
         tb.Token      = wcu.Token;
         tb.SceneId    = num + "";
         tb.CreateDate = DateTime.Now;
         tb.DeviceId   = wcu.DeviceId;
         ve.TempBind.Add(tb);
         ve.SaveChanges();
         Context.Response.Clear();
         Context.Response.ContentType = "image/jpg";
         Context.Response.BinaryWrite(QrCodeManager.GenerateTemp(GetToken(), num));
         Context.Response.End();
     }
 }
示例#2
0
        public void GetQrCodeImg(string Token, string deviceId)
        {
            TempBind tb  = null;
            int      num = 0;

            do
            {
                num = TextStr.RandomArray(1, 50000, 100000)[0];
                string str = num + "";
                tb = ve.TempBind.FirstOrDefault(q => q.SceneId == str);
            } while (tb != null);
            tb            = new TempBind();
            tb.Token      = Token;
            tb.SceneId    = num + "";
            tb.CreateDate = DateTime.Now;
            tb.DeviceId   = deviceId;
            ve.TempBind.Add(tb);
            ve.SaveChanges();
            WriteImg(QrCodeManager.GenerateTemp(GetToken(), num));
        }
示例#3
0
        public void GetQrCodeImg(string token, string deviceId)
        {
            //TempBind temp = new TempBind();
            //var ChildBind = (from c in ve.ChildBind orderby c.ID descending select new { sceneId = c.sceneId, deviceId = c.deviceId }).FirstOrDefault().sceneId;
            ////int sceneId = Convert.ToInt32(ChildBind.sceneId);
            //int scendIdOne = Convert.ToInt32(ve.ChildBind.OrderByDescending(cb=>cb.sceneId).FirstOrDefault().sceneId);

            //string sqlStr = string.Format("select top 1 sceneId from ChildBind order by ID desc");
            //int SceneId = Convert.ToInt32(SqlHelper.ExecuteScalar(sqlStr));

            int       num   = Convert.ToInt32(ve.ChildBind.OrderByDescending(cb => cb.sceneId).First().sceneId) + 1;
            ChildBind child = new ChildBind();

            child.sceneId  = num;
            child.token    = token;
            child.deviceId = deviceId;
            child.BindDate = DateTime.Now;
            ve.ChildBind.Add(child);
            ve.SaveChanges();

            WriteImg(QrCodeManager.GenerateTemp(GetToken(), num));

            //WriteImg(QrCodeManager.GenerateTemp(GetToken(), 11));
        }