/// <summary> /// 用户添加二维码 /// </summary> /// <param name="WQR"></param> /// <returns></returns> public ActionResult CreateQR(WX_QR WQR) { SYS_User SYSUSER = Session["SYSUSER"] as SYS_User; WX_QR q = new WX_QR(); q.AppId = SYSUSER.WX_App.AppId; q.UserId = SYSUSER.UserId; q.QRName = WQR.QRName; q.Expire_Seconds = 2592000; QRService qrSvr = new QRService(SYSUSER.WX_App.AppId, SYSUSER.WX_App.AppSecret); string json = qrSvr.Create(2592000, "QR_SCENE", SYSUSER.UserId, ""); JObject jo = (JObject)JsonConvert.DeserializeObject(json); string ticket = jo["ticket"].ToString(); q.Ticket = ticket; string url = qrSvr.ShowQR(ticket); q.QR_URL = url; q.CreateTime = DateTime.Now; var date = new WXDataBLL.WXQR.WX_QRManager().Add(q); return(Redirect(url)); }
public ActionResult getExamDetail(int eid) { int uid = 0; int did = 0; int rid = 0; if (Session["UserId"] != null) { uid = Convert.ToInt32(Session["UserId"].ToString()); did = Convert.ToInt32(Session["DID"].ToString()); rid = Convert.ToInt32(Session["RoleID"].ToString()); } ExamModel objModel = new ExamModel(); QRService objService = new QRService(); objModel = objService.getByID(eid); List <ExamTranModel> lstShedule = new List <ExamTranModel>(); lstShedule = objService.getExamShedule(eid); objModel.ListSchedule = new List <ExamTranModel>(); objModel.ListSchedule.AddRange(lstShedule); //return Json(objModel, JsonRequestBehavior.AllowGet); return(PartialView("_ExamDetail", objModel)); }
public ActionResult Index(QRModel model) { QRService objService = new QRService(); QRModel objModel = new QRModel(); List <ExamTranModel> lstShedule = new List <ExamTranModel>(); lstShedule = objService.getExamShedule(Convert.ToInt32(model.EID)); if (lstShedule.Count() > 0) { int stdID = Convert.ToInt32(lstShedule[0].StdID); var lstStud = Dbcontext.StudentMasters.Where(m => m.StdID == stdID).ToList(); foreach (var i in lstShedule) { foreach (var st in lstStud) { var std = Dbcontext.StandardMasters.Where(m => m.StdID == st.StdID).SingleOrDefault(); var sub = Dbcontext.SubjectMasters.Where(m => m.SubID == i.SubID).SingleOrDefault(); string code = "Registration# : " + st.Prefix + "" + st.StudID + ",Roll No. : " + st.RollNo + ",Name : " + st.FirstName + ' ' + st.MiddleName + ' ' + st.LastName + ",Subject : " + sub.Subject + ",Standard : " + std.Standard; QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q); System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image(); imgBarCode.Height = 150; imgBarCode.Width = 150; using (Bitmap bitMap = qrCode.GetGraphic(20)) { using (MemoryStream ms = new MemoryStream()) { bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] byteImage = ms.ToArray(); imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage); model.QRCodeImage = byteImage; } //plBarCode.Controls.Add(imgBarCode); model.QRCode = Convert.ToString(imgBarCode.ImageUrl); model.StudID = st.StudID; model.SubID = i.SubID; model.ETID = i.ETID; model.SchoolID = i.SchoolID; model.EID = i.EID; objService.Insert(model); } } } return(RedirectToAction("Print", new { @SchoolID = model.SchoolID, @StdID = model.StdID })); } else { TempData["AMsg"] = "QR Code not Generated! First you should to arrange shedule."; return(RedirectToAction("Index")); } }
public ActionResult Print(int SchoolID, int StdID) { QRService objService = new QRService(); List <QRModel> lstQR = new List <QRModel>(); QRModel objModel = new QRModel(); lstQR = objService.getQRBySChoolNStd(SchoolID, StdID); objModel.ListQR = new List <QRModel>(); objModel.ListQR.AddRange(lstQR); return(View(objModel)); }
public ActionResult QR() { QRService qrSvr = new QRService("wxb51501fa9702675f", "a56e69ded9b5eab3579ce771f2f9a668"); string json = qrSvr.Create(2592000, "QR_SCENE", 1, ""); JObject jo = (JObject)JsonConvert.DeserializeObject(json); string ticket = jo["ticket"].ToString(); string url = qrSvr.ShowQR(ticket); return(Redirect(url)); }
public ActionResult Index() { QRService objService = new QRService(); QRModel objModel = new QRModel(); List <QRModel> lstQR = new List <QRModel>(); CommonService objCService = new CommonService(); int did = 0; int acid = 0; if (Session["DID"] != null) { did = Convert.ToInt32(Session["DID"].ToString()); acid = Convert.ToInt32(Session["ACID"].ToString()); } lstQR = objService.getQR(); objModel.ListQR = new List <QRModel>(); objModel.ListQR.AddRange(lstQR); List <SchoolModel> lstSchool = new List <SchoolModel>(); lstSchool = objCService.getActiveSchool(did); objModel.ListSchool = new List <SchoolModel>(); objModel.ListSchool.AddRange(lstSchool); List <StandardModel> lstStd = new List <StandardModel>(); lstStd = objCService.getActiveStd(); objModel.ListStd = new List <StandardModel>(); objModel.ListStd.AddRange(lstStd); List <ExamModel> lstExam = new List <ExamModel>(); lstExam = objCService.getActiveExam(); objModel.ListExam = new List <ExamModel>(); objModel.ListExam.AddRange(lstExam); return(View(objModel)); }
private void generate_Btn_Click(object sender, EventArgs e) { var encodeModel = new QRInfo { TaxID = txtTaxID.Text, Suffix = txtSuffix.Text, Ref1 = txtRef1.Text, Ref2 = txtRef2.Text, Amount = txtAmount.Text, Currency = txtCurrency.Text, CountryCode = txtCountryCode.Text, MerchantName = txtMerchantName.Text, TerminalNo = txtTerminalNumber.Text, PointOfInherite = cbUsese.Text }; var encode = new QRService(); string qrString = encode.CreateQRString(encodeModel); ID.Text = qrString; var imageQR = PromptPayQR.PromptPayQR.QRCodeImage(qrString); QRBox.Image = imageQR; }
public async Task <ActionResult> Create(ProductViewModel vm) { try { if (!ModelState.IsValid) { return(View(vm)); } var message = SecurityService.Encrypt(vm.ToString()); var qr = QRService.GenerateQRCodeByUrl(message); var html = GetContentEmail(qr); await emailService.SendQR(vm.Email, "Nuevo QR generado", html); SetFlash(FlashMessageType.Success, "El codigo fue enviado al correo"); return(View()); } catch { SetFlash(FlashMessageType.Danger, "Error: No se generar el codigo QR"); return(View()); } }