public ActionResult Create(QrProductViewModels vm) { QrCodeInfo qr = new QrCodeInfo(); qr.ProductionDate = vm.ProductionDate; qr.SKT = vm.SKT; qr.TETT = vm.TETT; db.QrcodeInfo.Add(qr); db.SaveChanges(); int sonqr = db.QrcodeInfo.OrderByDescending(x => x.QrCodeInfoID).FirstOrDefault().QrCodeInfoID; ViewBag.CategoryID = new SelectList(db.Category, "CategoryID", "CategoryName", vm.CategoryID); Product p = new Product(); p.ProductName = vm.ProductName; //p.QrCodeInfoID = vm.QrCodeInfoID; p.Size = vm.Size; p.UnitsInStock = vm.UnitsInStock; p.CategoryID = vm.CategoryID; p.ProductID = sonqr; db.Product.Add(p); db.SaveChanges(); return(View(vm)); }
/// <summary> /// 初始化一个新的创建永久二维码模型。 /// </summary> /// <param name="sceneString">字符串型的场景Id。</param> public CreateForeverQrCodeModel(string sceneString) : base(QrCodeType.ForeverString) { ActionInfo = new QrCodeInfo { Scene = new QrCodeInfo.SceneStringInfo { SceneString = sceneString } }; }
/// <summary> /// 初始化一个新的创建永久二维码模型。 /// </summary> /// <param name="sceneId">数字型的场景Id。</param> public CreateForeverQrCodeModel(uint sceneId) : base(QrCodeType.Forever) { ActionInfo = new QrCodeInfo { Scene = new QrCodeInfo.SceneIdInfo { SceneId = sceneId } }; }
public void Edit(ISwObject pict, ISwDrawing drw) { m_CurPict = pict; m_CurInfo = FindInfo(pict, drw); m_CurInsertQrCodePageData = m_CurInfo.ToData(); HidePicture(m_CurPict, true); base.Insert(drw); }
/// <summary> /// 初始化一个新的创建临时二维码模型。 /// </summary> /// <param name="sceneId">数字型的场景Id。</param> /// <param name="expireSeconds">该二维码有效时间,以秒为单位。 最大不超过604800(即7天)。</param> public CreateTemporaryQrCodeModel(uint sceneId, uint expireSeconds = 604800) : base(QrCodeType.Temporary) { ActionInfo = new QrCodeInfo { Scene = new QrCodeInfo.SceneIdInfo { SceneId = sceneId } }; Type = QrCodeType.Temporary; ExpireSeconds = expireSeconds; }
protected virtual void OnInsertQrCode() { var pict = m_QrCodeManager.Insert(m_CurDrawing, m_CurInsertQrCodePageData.Location, m_CurInsertQrCodePageData.Source); var data = new QrCodeInfo(); data.Fill(m_CurInsertQrCodePageData, pict); var handler = m_App.Documents.GetHandler <QrCodeDrawingHandler>(m_CurDrawing); handler.QrCodes.Add(data); }
/// <summary> /// 订阅(关注)事件 /// </summary> /// <returns></returns> public override IResponseMessageBase OnEvent_SubscribeRequest(RequestMessageEvent_Subscribe requestMessage) { if (requestMessage.EventKey.Contains("qrscene")) { using (WXDBEntities db = new WXDBEntities()) { string t = requestMessage.EventKey.Replace("qrscene_", ""); var model = db.QrCodeInfo.Where(s => s.WXOpenid.Equals(requestMessage.FromUserName) && s.QrCodeReslut.Equals(t)).FirstOrDefault(); if (model != null) { } else { model = new QrCodeInfo(); try { model.WXOpenid = requestMessage.FromUserName; } catch (Exception) { model.WXOpenid = ""; } try { model.NickName = ""; model.Extent1 = ""; //UserInfoJson us = UserApi.Info(WXhelper.Instance.CurrenToken(), requestMessage.FromUserName); //model.NickName = us.nickname; //model.Extent1 = us.province + "|" + us.city; } catch (Exception) { model.NickName = ""; model.Extent1 = ""; } try { model.QrCodeReslut = requestMessage.EventKey.Replace("qrscene_", ""); } catch (Exception) { model.QrCodeReslut = "1"; } model.Status = 0; model.Orders = 0; model.AddTime = DateTime.Now; model.UpdateTime = DateTime.Now; model.Extent2 = ""; db.QrCodeInfo.AddObject(model); db.SaveChanges(); } } } else { using (WXDBEntities db = new WXDBEntities()) { var model = db.QrCodeInfo.Where(s => s.WXOpenid.Equals(requestMessage.FromUserName) && s.QrCodeReslut == "1").FirstOrDefault(); if (model != null) { } else { model = new QrCodeInfo(); try { model.WXOpenid = requestMessage.FromUserName; } catch (Exception) { model.WXOpenid = ""; } try { //UserInfoJson us = UserApi.Info(WXhelper.Instance.CurrenToken(), requestMessage.FromUserName); //model.NickName = us.nickname; //model.Extent1 = us.province + "|" + us.city; model.NickName = ""; model.Extent1 = ""; } catch (Exception) { model.NickName = ""; model.Extent1 = ""; } model.QrCodeReslut = "1"; model.Status = 0; model.Orders = 0; model.AddTime = DateTime.Now; model.UpdateTime = DateTime.Now; model.Extent2 = ""; db.QrCodeInfo.AddObject(model); db.SaveChanges(); } } } var responseMessage = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageText>(requestMessage); using (WXDBEntities db = new WXDBEntities()) { var tmp = db.WXKewWords.Where(s => s.Type == 0).FirstOrDefault(); if (tmp != null) { responseMessage.Content = tmp.Description; } else { responseMessage.Content = "你好,感谢您关注东郊罗兰 !"; } } return(responseMessage); }
private void OnQrCodeChanged(QrCodeInfo qrCode) { m_HasChanges = true; }