Exemple #1
0
        /// <summary>
        /// 保存角色
        /// </summary>
        public string SaveWQRCodeManagerData()
        {
            var wQRCodeManagerService = new WQRCodeManagerBLL(CurrentUserInfo);
            WQRCodeManagerEntity obj  = new WQRCodeManagerEntity();
            string content            = string.Empty;
            string error        = "";
            var    responseData = new ResponseData();

            string key = string.Empty;
            string wQRCodeManager_id = string.Empty;

            if (Request("wQRCodeManager") != null && Request("wQRCodeManager") != string.Empty)
            {
                key = Request("wQRCodeManager").ToString().Trim();
            }
            if (Request("wQRCodeManager_id") != null && Request("wQRCodeManager_id") != string.Empty)
            {
                wQRCodeManager_id = Request("wQRCodeManager_id").ToString().Trim();
            }

            obj = key.DeserializeJSONTo <WQRCodeManagerEntity>();

            //if (obj.TypeCode == null || obj.TypeCode.Trim().Length == 0)
            //{
            //    responseData.success = false;
            //    responseData.msg = "编码不能为空";
            //    return responseData.ToJSON();
            //}
            //if (obj.TypeName == null || obj.TypeName.Trim().Length == 0)
            //{
            //    responseData.success = false;
            //    responseData.msg = "名称不能为空";
            //    return responseData.ToJSON();
            //}

            if (wQRCodeManager_id.Trim().Length == 0 || wQRCodeManager_id == "null" || wQRCodeManager_id == "undefined")
            {
                obj.QRCodeId   = Guid.NewGuid();
                obj.CustomerId = CurrentUserInfo.CurrentUser.customer_id;
                wQRCodeManagerService.Create(obj);
            }
            else
            {
                obj.QRCodeId = Guid.Parse(wQRCodeManager_id);
                wQRCodeManagerService.Update(obj, false);
            }

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }
Exemple #2
0
        /// <summary>
        /// 生成关注的二维码
        /// </summary>
        /// <param name="para"></param>
        /// <param name="wapentity"></param>
        /// <param name="strQRCode"></param>
        /// <param name="QRCodeUrl"></param>
        public void CreateFocusQRCode(SetCTWEventRP para, string strLogoUrl, WApplicationInterfaceEntity wapentity, out string QRCodeUrl, out string QRCodeId, out bool IsSuccess)
        {
            QRCodeUrl = string.Empty;
            QRCodeId  = string.Empty;

            var wqrCodeManagerEntity = new WQRCodeManagerBLL(loggingSessionInfo).QueryByEntity(new WQRCodeManagerEntity()
            {
                ObjectId = strCTWEventId
            }, null).FirstOrDefault();


            //#region 生成二维码

            var wqrentity = new WQRCodeTypeBLL(loggingSessionInfo).QueryByEntity(

                new WQRCodeTypeEntity {
                TypeCode = "CreativeCode"
            }

                , null).FirstOrDefault();
            var wxCode = CretaeWxCode();


            IsSuccess = true;
            if (string.IsNullOrEmpty(wxCode.ImageUrl))
            {
                IsSuccess = false;
            }
            QRCodeUrl = wxCode.ImageUrl;
            if (!string.IsNullOrEmpty(QRCodeUrl))
            {
                if (!string.IsNullOrEmpty(strLogoUrl))        //如果有值则生成二维码中间带图
                {
                    string targetPath = HttpContext.Current.Server.MapPath("/QRCodeImage/");
                    ////二维码中奖加图片
                    string currentDomain     = "http://" + HttpContext.Current.Request.Url.Host;    //当前项目域名
                    string strFileNmae       = QRCodeUrl.Substring(QRCodeUrl.LastIndexOf("/") + 1);
                    string strQRCodeFilePath = targetPath + strFileNmae;
                    string logoImage         = "~" + strLogoUrl.Substring(currentDomain.Length);

                    System.IO.MemoryStream MStream1 = new System.IO.MemoryStream();
                    Utils.CombinImage(QRCodeUrl, HttpContext.Current.Server.MapPath(logoImage)).Save(MStream1, System.Drawing.Imaging.ImageFormat.Png);
                    Image ii = Image.FromStream(MStream1);
                    ii.Save(strQRCodeFilePath, System.Drawing.Imaging.ImageFormat.Png);
                    MStream1.Dispose();

                    QRCodeUrl = currentDomain + "/QRCodeImage/" + strFileNmae;
                }
                var WQRCodeManagerbll = new WQRCodeManagerBLL(loggingSessionInfo);

                if (wqrCodeManagerEntity == null)
                {
                    wqrCodeManagerEntity = new WQRCodeManagerEntity()
                    {
                        QRCodeId      = Guid.NewGuid(),
                        QRCode        = wxCode.MaxWQRCod.ToString(),
                        QRCodeTypeId  = wqrentity.QRCodeTypeId,
                        IsUse         = 1,
                        ObjectId      = strCTWEventId,
                        Remark        = "CTW",
                        CreateBy      = loggingSessionInfo.UserID,
                        ApplicationId = wapentity.ApplicationId,
                        IsDelete      = 0,
                        ImageUrl      = QRCodeUrl,
                        CustomerId    = loggingSessionInfo.ClientID
                    };
                    WQRCodeManagerbll.Create(wqrCodeManagerEntity);
                }
                else
                {
                    wqrCodeManagerEntity.ImageUrl = QRCodeUrl;
                    WQRCodeManagerbll.Update(wqrCodeManagerEntity);
                }
                QRCodeId = wqrCodeManagerEntity.QRCodeId.ToString();
            }
        }