예제 #1
0
        private string SendMailToMutiUser(string strTitle, string strCont, string strCondition)
        {
            string text  = string.Empty;
            string text2 = " SELECT AutoID,UserName,Email,Mobile FROM cms_User WHERE Email<>'' ";

            if (!strCondition.IsNullOrEmpty())
            {
                text2 = text2 + " AND " + strCondition;
            }
            DataTable dataTable = PageBase.dbo.GetDataTable(text2);

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    string empty = string.Empty;
                    MsgService.SendMail(dataRow["Email"].ToString(), strTitle, strCont, out empty);
                    if (empty != "success")
                    {
                        text = text + "发送" + dataRow["Email"].ToString() + "邮件失败;";
                    }
                }
            }
            return(text);
        }
예제 #2
0
        private static void startServer()
        {
            Console.WriteLine("Starting server...");
            int port;

            try {
                port = 9000; // Hard code test
                if (port <= 0 || port > 65536)
                {
                    throw new Exception(port + " is not a valid TCP port number.");
                }
            } catch (Exception ex) {
                Console.WriteLine("TCP port must be a positive number. Exception detail: " + ex.Message);
                return;
            }

            try {
                Console.WriteLine("Listening on " + port);
                _serviceApplication = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(port));
                _msgService         = new MsgService();
                _serviceApplication.AddService <IMsgService, MsgService>(_msgService);
                _msgService.UserListChanged += msgService_UserListChanged;
                _serviceApplication.Start();

                Console.WriteLine("Started.");
            } catch (Exception ex) {
                Console.WriteLine("Service can not be started. Exception detail: " + ex.Message);
                return;
            }
        }
예제 #3
0
 public MsgConsumer(MsgService msgService, Type msgType)
 {
     this.msgService = msgService;
     this.msgType = msgType;
     if (this.msgService != null)
         this.msgService.init(this);
 }
예제 #4
0
파일: Sources.cs 프로젝트: adesproject/ADES
            public FileVisionSource(string FileName, MsgService msgService)
                : base(msgService)
            {
                try
                {
                    Globals.SOURCE_NAME = FileName.Split(Path.DirectorySeparatorChar).Last().Split('.').First();
                    if (Constants.EVALUATE_SUCCESS_ENABLED /*&& Globals.FRAME_SIGN_HASH.Keys.Count==0*/ )
                    {
                        Globals.FRAME_SIGN_HASH = new Hashtable();
                        String line = null;
                        System.IO.StreamReader file = new System.IO.StreamReader(Constants.base_folder + "labels_" + Globals.SOURCE_NAME + ".txt");
                        while ((line = file.ReadLine()) != null)
                        {
                            string[] frameno_signno = line.Split(',');
                            if (frameno_signno.Length < 2)
                            {
                                file.Close();
                                throw new Exception("Invalid label file for " + Globals.SOURCE_NAME);
                            }

                            Globals.FRAME_SIGN_HASH.Add(frameno_signno[0], line);
                            Globals.FRAME_COUNT = long.Parse(line.Split(',').First())-1;
                        }
                        file.Close();
                    }

                    // Set up the capture graph
                    Configure(FileName);
                }
                catch
                {
                    Dispose();
                    throw;
                }
            }
예제 #5
0
        public ActionResult Send(string ToUserName, string ContentBody, string MsgType)
        {
            MsgParams msgParams = new MsgParams();


            msgParams.touser = ToUserName;

            msgParams.msgtype = MsgType;

            MsgContent msgContent = new MsgContent();

            msgContent.content = ContentBody;

            msgParams.text = msgContent;

            string req0 = JsonConvert.SerializeObject(msgParams);

            string r1 = MsgService.Send(msgParams);

            return(Content(req0 + r1));

            //SendMsgResponse response =(SendMsgResponse)JsonConvert.DeserializeObject(MsgService.Send(msgParams),typeof(SendMsgResponse));
            //if (response.errcode == "0")
            //{
            //    return View("SendForm");
            //}else
            //{
            //    return View("SendError");
            //}
        }
예제 #6
0
        private string SendSMSToMutiUser(string strCont, string strCondition)
        {
            ISMS   iSMS  = SMSProvider.Create();
            string text  = string.Empty;
            string text2 = " SELECT AutoID,UserName,Email,Mobile FROM cms_User WHERE Mobile<>'' ";

            if (!strCondition.IsNullOrEmpty())
            {
                text2 = text2 + " AND " + strCondition;
            }
            DataTable dataTable = PageBase.dbo.GetDataTable(text2);

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    string text3 = dataRow["Mobile"].ToString();
                    if (!string.IsNullOrEmpty(text3) && text3.Length.Equals(11))
                    {
                        if (MsgService.SendSMS(text3, strCont) == 0)
                        {
                            text = text + "发送" + text3 + "短信失败;";
                        }
                    }
                }
            }
            return(text);
        }
예제 #7
0
 public static void Start()
 {
     _server = new Server
     {
         Services = { MsgService.BindService(new MsgServiceImpl()) },
         Ports    = { new ServerPort("localhost", 40001, ServerCredentials.Insecure) }
     };
     _server.Start();
 }
예제 #8
0
        private void SendMobileOnFH(OrdersInfo order, UserInfo user)
        {
            bool   @bool       = WebUtils.GetBool(base.GetConfigValue("IsSendSMSOnGoodsSend"));
            string configValue = base.GetConfigValue("SMSTmpOnGoodsSend");

            if (@bool && !string.IsNullOrEmpty(configValue) && !string.IsNullOrEmpty(user.Mobile) && user.Mobile.Length == 11 && user != null)
            {
                MsgService.SendSMS(user.Mobile, configValue.Replace("${username}", user.UserName).Replace("${orderno}", order.OrderNo));
            }
        }
예제 #9
0
        /// <summary>
        /// 开始侦听
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnListen_Click(object sender, EventArgs e)
        {
            AddMsg("正在创建服务器...");
            server = new MsgService(10, 7000);
            server.DoClientHandler += Receive;
            AddMsg("建服务器创建成功!");

            Task.Run(() => { server.Receive(); });
            AddMsg("服务器开始侦听...");
        }
예제 #10
0
        private void SendEmailOnFH(OrdersInfo order, UserInfo user)
        {
            bool   @bool       = WebUtils.GetBool(base.GetConfigValue("IsSendMailOnGoodsSend"));
            string configValue = base.GetConfigValue("MailTmpOnGoodsSend");

            if (@bool && !string.IsNullOrEmpty(configValue) && !string.IsNullOrEmpty(user.Email) && ValidateUtils.IsEmail(user.Email) && user != null)
            {
                MsgService.SendMail(user.Email, "您的订单已经发货", configValue.Replace("${username}", user.UserName).Replace("${orderno}", order.OrderNo).Replace("${sitename}", PageBase.config.SiteName).Replace("${send_date}", System.DateTime.Now.ToString()));
            }
        }
예제 #11
0
 protected void btnok_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp("Reply"))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else
     {
         string text = base.Server.HtmlEncode(this.txtReply.Text);
         if (string.IsNullOrEmpty(text))
         {
             base.ShowMsg("请输入回复内容");
         }
         else
         {
             FeedbackInfo dataById = SinGooCMS.BLL.Feedback.GetDataById(base.OpID);
             dataById.Replier      = base.LoginAccount.AccountName;
             dataById.ReplyContent = text;
             dataById.ReplyDate    = System.DateTime.Now;
             if (SinGooCMS.BLL.Feedback.Update(dataById))
             {
                 string @string     = WebUtils.GetString(this.txtMail.Text);
                 string strMailBody = string.Concat(new string[]
                 {
                     "来自管理员的回复:<br/><div style='border-bottom:1px solid #ccc'>",
                     text,
                     "</div><br/>",
                     PageBase.config.SiteName,
                     "(",
                     PageBase.config.SiteDomain,
                     ")"
                 });
                 string empty = string.Empty;
                 if (this.chkReply2Mail.Checked && ValidateUtils.IsEmail(@string))
                 {
                     MsgService.SendMail(@string, "来自管理员的回复", strMailBody, out empty);
                 }
                 if (!string.IsNullOrEmpty(empty) && "success" != empty)
                 {
                     base.ShowMsg(empty);
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "回复留言[" + this.feedback.Title + "] thành công,但发送邮件失败");
                 }
                 else
                 {
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "回复留言[" + dataById.Title + "] thành công");
                     MessageUtils.DialogCloseAndParentReload(this);
                 }
             }
             else
             {
                 base.ShowMsg("回复留言失败");
             }
         }
     }
 }
예제 #12
0
        public void Start()
        {
            _server = new Server
            {
                Services = { MsgService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort(GrpcSettings.Value.IP, GrpcSettings.Value.Port, ServerCredentials.Insecure) }
            };
            _server.Start();

            Console.WriteLine($"Grpc ServerListening On Port {GrpcSettings.Value.Port}");
        }
예제 #13
0
        public static void Main(string[] args)
        {
            Server _server = new Server
            {
                Services = { MsgService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort("127.0.0.1", 40001, ServerCredentials.Insecure) }
            };

            _server.Start();

            CreateWebHostBuilder(args)
            .UseUrls($"http://127.0.0.1:8080")
            .Build().Run();
        }
예제 #14
0
        private void GetMobildCode(string strSMSType)
        {
            string randomNumber = StringUtils.GetRandomNumber(5, true);
            string strContent   = string.Empty;

            if (strSMSType == "reg")
            {
                strContent = base.GetConfigValue("RegSMSCheckCode").Replace("${checkcode}", randomNumber);
            }
            else if (strSMSType == "findpwd")
            {
                strContent = base.GetConfigValue("GetPwdSMSCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            else if (strSMSType == "bind")
            {
                strContent = base.GetConfigValue("BindSMSCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            string queryString = WebUtils.GetQueryString("paramval");
            string s           = "{\"ret\":\"fail\",\"timeout\":0,\"msg\":\"短信验证码发送失败\"}";
            bool   flag        = true;

            if (!string.IsNullOrEmpty(queryString))
            {
                if ((strSMSType == "reg" || strSMSType == "bind") && SinGooCMS.BLL.User.IsExistsByMobile(queryString))
                {
                    s = "{\"ret\":\"exists\",\"timeout\":0,\"msg\":\"手机号码已经存在\"}";
                }
                else
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(queryString);
                    if (lastCheckCode != null)
                    {
                        System.TimeSpan timeSpan = System.DateTime.Now - lastCheckCode.AutoTimeStamp;
                        if (timeSpan.TotalSeconds < 60.0)
                        {
                            flag = false;
                            s    = "{\"ret\":\"fail\",\"timeout\":" + (60.0 - timeSpan.TotalSeconds).ToString("f0") + ",\"msg\":\"发送间隔太短\"}";
                        }
                    }
                    if (flag)
                    {
                        if (MsgService.SendSMSCheckCode(queryString, strContent, randomNumber) > 0)
                        {
                            s = "{\"ret\":\"success\",\"timeout\":60,\"msg\":\"短信验证码发送成功,请注意查收!\"}";
                        }
                    }
                }
            }
            base.Response.Write(s);
        }
예제 #15
0
        public static void Start()
        {
            _server = new Server
            {
                Services = { MsgService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort("localhost", 40001, ServerCredentials.Insecure) }
            };
            _server.Start();

            Console.WriteLine("grpc ServerListening On Port 40001");
            Console.WriteLine("任意键退出...");
            Console.ReadKey();

            _server?.ShutdownAsync().Wait();
        }
예제 #16
0
        public static async Task RegisterAccountForPNS(UserInfo userInfo)
        {
            var isConnected = await ConnectivityManager.Instance.IsConnected();

            if (isConnected)
            {
                MsgService mfaService     = new MsgService();
                string     platformType   = GetPlatformType();
                var        registrationId = await mfaService.Register(msgServiceUri, userInfo.PushRegistrationId, Settings.Current.DeviceToken, platformType, userInfo.PushTag);

                if (!string.IsNullOrEmpty(registrationId) && userInfo.PushRegistrationId != registrationId)
                {
                    Settings.Current.RegistrationId = registrationId;
                }
            }
        }
예제 #17
0
        public ActionResult PublishHtml(string itemID, string toUserName, string genHtml)
        {
            var mdb   = Sitecore.Configuration.Factory.GetDatabase("master");
            var mItem = mdb.GetItem(new Sitecore.Data.ID(itemID));

            if (mItem == null)
            {
                return(Content("Item is not existing!"));
            }
            WCArticles articles   = new WCArticles();
            NewsParams newsParams = new NewsParams();

            newsParams.show_cover_pic        = 1;
            newsParams.need_open_comment     = 1;
            newsParams.only_fans_can_comment = 1;
            newsParams.title              = mItem.Fields["Title"].ToString();
            newsParams.author             = mItem.Fields["Author"].ToString();
            newsParams.digest             = mItem.Fields["Summary"].ToString();
            newsParams.thumb_media_id     = mItem.Fields["thumbnailID"].ToString();
            newsParams.content_source_url = Sitecore.Links.LinkManager.GetItemUrl(mItem);
            newsParams.content            = MsgService.Base64Decode(Request.Params["genHtml"]);

            articles.Add(newsParams);

            NewsResponse newsResponse = (NewsResponse)JsonConvert.DeserializeObject(MsgService.AddNews(articles), typeof(NewsResponse));

            using (new Sitecore.SecurityModel.SecurityDisabler())
            {
                mItem.Editing.BeginEdit();
                mItem["NewsID"] = newsResponse.Media_ID;

                mItem.Editing.EndEdit();
            }

            RTMsgID rtMsgID = new RTMsgID();

            rtMsgID.media_id = newsResponse.Media_ID;

            RTMessageInt rtMessageInt = new RTMessageInt();

            rtMessageInt.touser  = toUserName;
            rtMessageInt.msgtype = "mpnews";
            rtMessageInt.mpnews  = rtMsgID;
            string r = MsgService.SendRTMsg(rtMessageInt);

            return(Content(r));
        }
예제 #18
0
        private string SendSMSToCustom(string strRevicer, string strCont)
        {
            string text = string.Empty;

            string[] array = strRevicer.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                if (MsgService.SendSMS(array[i], strCont) == 0)
                {
                    text = text + "发送" + array[i] + "短信失败;";
                }
            }
            return(text);
        }
예제 #19
0
        public ActionResult UploadImage()
        {
            HttpPostedFileBase file      = Request.Files["file"];
            MediaParams        imgParams = new MediaParams();

            imgParams.filename    = file.FileName;
            imgParams.filelength  = file.ContentLength;
            imgParams.contenttype = file.ContentType;
            imgParams.media       = new byte[file.InputStream.Length];
            file.InputStream.Read(imgParams.media, 0, (int)file.InputStream.Length);
            file.InputStream.Close();
            string req0 = JsonConvert.SerializeObject(imgParams) + "\r\n";
            //string req0 = file.FileName.ToString();
            string r1 = MsgService.UploadImg(imgParams);

            return(Content(HttpUtility.UrlDecode(r1)));
        }
예제 #20
0
        private static int SendMail(string strTitle, string strBody)
        {
            string str = string.Empty;
            int    num = 0;

            System.Collections.Generic.IList <DingYueInfo> list = SinGooCMS.BLL.DingYue.GetList(0, " IsTuiDing=0 ", "AutoID asc");
            if (list != null && list.Count > 0)
            {
                string empty = string.Empty;
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                for (int i = 0; i < list.Count; i++)
                {
                    if (ValidateUtils.IsEmail(list[i].Email))
                    {
                        stringBuilder.Append(list[i].Email + ",");
                    }
                    if ((i + 1) % 5 == 0 || i >= list.Count - 1)
                    {
                        string empty2        = string.Empty;
                        string strReciveMail = stringBuilder.ToString().Trim().TrimEnd(new char[]
                        {
                            ','
                        });
                        MsgService.SendMail(strReciveMail, strTitle, strBody, out empty2);
                        if (empty2 != "success")
                        {
                            str = str + empty2 + ";";
                        }
                        else
                        {
                            num += stringBuilder.ToString().Trim().TrimEnd(new char[]
                            {
                                ','
                            }).Split(new char[]
                            {
                                ','
                            }).Length;
                        }
                        stringBuilder.Clear();
                    }
                }
            }
            return(num);
        }
예제 #21
0
        private string SendMailToCustom(string strRevicer, string strTitle, string strCont)
        {
            string text = string.Empty;

            string[] array = strRevicer.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string empty = string.Empty;
                MsgService.SendMail(array[i], strTitle, strCont, out empty);
                if (empty != "success")
                {
                    text = text + "发送" + array[i] + "邮件失败;";
                }
            }
            return(text);
        }
예제 #22
0
        void ThreadProc()
        {
            ClientMsg  msg2   = new ClientMsg();
            MsgService msgsvc = new MsgService();

            try
            {
                while (true)
                {
                    msg2 = msgsvc.GetMessageCS();    // get message out of receive queue - will block if queue is empty
                    if (msg2.body != null)
                    {
                        this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, OnNewMessage, msg2);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
예제 #23
0
        protected void btnSend_Click(object sender, System.EventArgs e)
        {
            string @string = WebUtils.GetString(this.txtReciver.Text);

            if (ValidateUtils.IsEmail(@string))
            {
                string empty = string.Empty;
                if (MsgService.SendMail(@string, PageBase.config.SiteName + "Các tin nhắn thử nghiệm", "Đây là một tin nhắn kiểm tra, nếu bạn nhận được thông báo này,Dịch vụ chuyển phát nhanh hiệu quả!", out empty))
                {
                    base.ShowMsg("Thư được gửi thử nghiệm thành công");
                }
                else
                {
                    base.ShowMsg(empty);
                }
            }
            else
            {
                base.ShowMsg("E-mail người nhận không phải là một địa chỉ e-mail hợp lệ");
            }
        }
예제 #24
0
        public object Any(MsgRequest request)
        {
            DTOResponseLayUI dtoResponseLayUi = new DTOResponseLayUI();
            MsgService       msgService       = new MsgService();
            DTOResponse      response;

            if (request.ACTION == 100)
            {
                response = msgService.GetList(request);
            }
            if (request.ACTION == OPAction.QUERYDETAIL1)
            {
                response = msgService.GetOplogList(request);
            }
            else
            {
                dtoResponseLayUi.code = -1;
                dtoResponseLayUi.msg  = "未定义的操作类型:" + request.ACTION.ToString();
                return((object)dtoResponseLayUi);
            }
            return(this.ConvertTo(response));
        }
예제 #25
0
        public void Process(WorkflowPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            ProcessorItem processorItem = args.ProcessorItem;

            if (processorItem != null)
            {
                Item   innerItem = processorItem.InnerItem;
                string fullPath  = innerItem.Paths.FullPath;
                string sendFrom  = GetText(innerItem, "SendFrom", args);
                string toUser    = GetText(innerItem, "ToUser", args);
                //string host = GetText(innerItem, "mail server", args);
                string messageTitle = GetText(innerItem, "MessageTitle", args);
                string messageBody  = GetText(innerItem, "MessageBody", args);
                Error.Assert(toUser.Length > 0, "The 'To' field is not specified in the mail action item: " + fullPath);
                Error.Assert(sendFrom.Length > 0, "The 'From' field is not specified in the mail action item: " + fullPath);
                Error.Assert(messageTitle.Length > 0,
                             "The 'Subject' field is not specified in the mail action item: " + fullPath);
                //Error.Assert(host.Length > 0,
                //             "The 'Mail server' field is not specified in the mail action item: " + fullPath);
                //var message = new MailMessage(from, to);
                //message.Subject = subject;
                //message.Body = body;
                //new SmtpClient(host).Send(message);
                QYMsgParams qymsgParams = new QYMsgParams();
                qymsgParams.touser  = toUser;
                qymsgParams.msgtype = "text";
                qymsgParams.agentid = AgentID;
                qymsgParams.safe    = "0";

                MsgContent msgContent = new MsgContent();
                msgContent.content = messageBody;

                qymsgParams.text = msgContent;
                string r1 = MsgService.QYSend(qymsgParams);
            }
        }
예제 #26
0
 public NN_SURFProcessor(MsgService msgService, Constants.SignType signType)
     : base(msgService, VisionMessage.msgType)
 {
     this.signType = signType;
     if (signs == null)
     {
         signs = new Bitmap[Constants.NUM_OF_SIGN_TYPES + 1];
         ResizeBicubic resizer = new ResizeBicubic(32, 32);
         for (int i = 1; i <= Constants.NUM_OF_SIGN_TYPES; i++)
         {
             String file_name = "signs\\sign_" + (i < 10 ? ("0" + i) : ("" + i)) + ".bmp";
             signs[i] = resizer.Apply((Bitmap)Bitmap.FromFile(Constants.base_folder + file_name, false));
         }
     }
     if (network == null)
     {
         network = Network.Load(Constants.base_folder + Constants.NN_SVM_SURF + "_" + (signType == Constants.SignType.circular ? "circle" : "triangle") + ".dat");
     }
 }
예제 #27
0
            public HoughLineProcessor(MsgService msgService)
                : base(msgService, VisionMessage.msgType)
            {
                redMap = new byte[256];
                greenMap = new byte[256];
                blueMap = new byte[256];

                for (int i = 0; i < 256; i++)
                {
                    redMap[i] = (byte)(i > 196 ? 255 : 0);
                    greenMap[i] = (byte)(i > 196 ? 255 : 0);
                    blueMap[i] = (byte)(i > 206 ? 255 : 0);

                }
            }
예제 #28
0
        public ActionResult ResetQuota(string appID)
        {
            string r = MsgService.ResetQuota(appID);

            return(Content(r));
        }
예제 #29
0
 public PanelDisplayProcessor(IPanelDisplay p, MsgService msgService)
     : base(msgService, VisionMessage.msgType)
 {
     this.p = p;
 }
예제 #30
0
        private Boolean UploadThumbnail(Item mItem)
        {
            MediaParams mediaParams = new MediaParams();

            mediaParams.mediatype = "thumb";

            var mField = (ImageField)mItem.Fields["Image"];

            if (mField == null)
            {
                return(false);
            }

            MediaItem mediaItem = mField.MediaItem;

            if (mediaItem == null)
            {
                return(false);
            }

            mediaParams.filename    = mediaItem.Name + "." + mediaItem.Extension;
            mediaParams.filelength  = (int)mediaItem.GetMediaStream().Length;
            mediaParams.contenttype = mediaItem.MimeType;
            mediaParams.media       = new byte[(int)mediaItem.GetMediaStream().Length];

            using (Stream stream = mediaItem.GetMediaStream())
            {
                stream.Read(mediaParams.media, 0, (int)mediaItem.GetMediaStream().Length);
            }

            MaterialResponse materialResponse = (MaterialResponse)JsonConvert.DeserializeObject(MsgService.AddMaterial(mediaParams), typeof(MaterialResponse));


            using (new Sitecore.SecurityModel.SecurityDisabler())
            {
                mItem.Editing.BeginEdit();
                mItem["ThumbnailID"]  = materialResponse.Media_Id;
                mItem["ThumbnailUrl"] = HttpUtility.UrlDecode(materialResponse.Url);
                mItem.Editing.EndEdit();
            }

            return(true);
            //return Content(JsonConvert.SerializeObject(materialResponse));
        }
예제 #31
0
파일: Sources.cs 프로젝트: adesproject/ADES
 public BitmapMemoryVisionSource(MsgService msgService)
     : base(msgService)
 {
     isStarted = false;
 }
예제 #32
0
            public LaneDetectorProcessor(MsgService msgService)
                : base(msgService, VisionMessage.msgType)
            {
                for (int i = -10; i < 190; i++)
                {
                    for (int j = -10; j < 190; j++)
                    {
                        theta_tx[(i + 180) % 180, (j + 180) % 180] = Statistics.NormalDistribution(j, i, 1, false);
                        theta_ox[(i + 180) % 180, (j + 180) % 180] = Statistics.NormalDistribution(j, i, 2, false);
                    }
                }

                for (int i = 0; i < MAX_HOUGH_RADIUS; i++)
                {
                    for (int j = 0; j < MAX_HOUGH_RADIUS; j++)
                    {
                        r_tx[i, j] = Statistics.NormalDistribution(j, i, 1, false);
                        r_ox[i, j] = Statistics.NormalDistribution(j, i, 2, false);
                    }
                }
            }
예제 #33
0
파일: Sources.cs 프로젝트: adesproject/ADES
 public DeviceVisionSource(MsgService msgService)
     : base(msgService)
 {
     try
     {
         // Set up the capture graph
         Configure();
     }
     catch
     {
         Dispose();
         throw;
     }
 }
예제 #34
0
 public AutoBrightnessProcessor(double baseLum, Rectangle baseRect, MsgService msgService)
     : base(msgService, VisionMessage.msgType)
 {
     this.baseLum = baseLum;
     this.baseRect = baseRect;
 }
예제 #35
0
        private void SaveFeedback()
        {
            string formString  = WebUtils.GetFormString("_uname");
            string formString2 = WebUtils.GetFormString("_email");
            string formString3 = WebUtils.GetFormString("_mobile");
            string formString4 = WebUtils.GetFormString("_phone");
            string formString5 = WebUtils.GetFormString("_title");
            string formString6 = WebUtils.GetFormString("_content");

            if (string.Compare(base.ValidateCode, WebUtils.GetFormString("_yzm"), true) != 0)
            {
                base.Response.Write("{\"msg\":\"" + base.GetCaption("ValidateCodeIncorrect") + "\",\"status\":\"fail\"}");
            }
            else if (string.IsNullOrEmpty(formString))
            {
                base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_UserNameEmpty") + "\",\"status\":\"fail\"}");
            }
            else if (string.IsNullOrEmpty(formString6))
            {
                base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_ContentEmpty") + "\",\"status\":\"fail\"}");
            }
            else
            {
                FeedbackInfo feedbackInfo = new FeedbackInfo
                {
                    UserName      = formString,
                    Title         = (string.IsNullOrEmpty(formString5) ? base.GetCaption("Feedback_Title").Replace("${username}", formString) : formString5),
                    Content       = formString6,
                    Email         = formString2,
                    Mobile        = formString3,
                    Telephone     = formString4,
                    IPaddress     = IPUtils.GetIP(),
                    Replier       = string.Empty,
                    ReplyContent  = string.Empty,
                    ReplyDate     = new System.DateTime(1900, 1, 1),
                    IsAudit       = true,
                    Lang          = base.cultureLang,
                    AutoTimeStamp = System.DateTime.Now
                };
                int num = Feedback.Add(feedbackInfo);
                if (num > 0)
                {
                    string empty = string.Empty;
                    if (WebUtils.GetBool(base.GetConfigValue("IsSendMailForLY")) && !string.IsNullOrEmpty(base.GetConfigValue("ReciverEMail")))
                    {
                        if (MsgService.SendMail(base.GetConfigValue("ReciverEMail"), formString5, feedbackInfo.Content, out empty))
                        {
                            base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_Success") + "\",\"status\":\"success\"}");
                        }
                        else
                        {
                            base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_SuccessButMailFail") + "\",\"status\":\"fail\"}");
                        }
                    }
                    else
                    {
                        base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_Success") + "\",\"status\":\"success\"}");
                    }
                }
                else
                {
                    base.Response.Write("{\"msg\":\"" + base.GetCaption("Feedback_Error") + "\",\"status\":\"fail\"}");
                }
            }
        }
예제 #36
0
 public TriangularSignDetectorProcessor(MsgService msgService, IPanelDisplay panel)
     : base(msgService, VisionMessage.msgType)
 {
     this.panel = panel;
 }
예제 #37
0
 public VPN(APIContext c) : base(c, "vpn")
 {
     canViewAllChannels = Program.AppInfo.Owner.Id == c.User?.Id;
     DB       = Program.Services.GetRequiredService <MsgService>();
     Webhooks = Program.Services.GetRequiredService <WebhookService>();
 }
예제 #38
0
        public ActionResult UploadMedia()
        {
            List <WechatMedia> mList = new List <WechatMedia>();
            var mdb       = Sitecore.Configuration.Factory.GetDatabase("master");
            var mItem     = mdb.GetItem(Request.Params["myItem"]);
            var localItem = mdb.GetItem(Request.Params["localItem"]);

            if ((mItem == null) || (localItem == null))
            {
                return(Content("Item is not existing!"));
            }


            if (!UploadThumbnail(mItem))
            {
                //return UploadThumbnail(mItem);
                return(Content("Upload News Thumbnail failed!"));
            }
            //ChildList mChldren =(ChildList)mItem.GetChildren().Where(i => i.TemplateName == "Msg Paragraph");
            ChildList mChildren = localItem.GetChildren();

            if (mChildren == null)
            {
                return(Content("Children are empty!"));
            }

            MediaParams mediaParams = new MediaParams();



            foreach (Item i in mChildren)
            {
                var       mField    = (ImageField)i.Fields["PImage"];
                MediaItem mediaItem = mField.MediaItem;

                mediaParams.filename    = mediaItem.Name + "." + mediaItem.Extension;
                mediaParams.filelength  = (int)mediaItem.GetMediaStream().Length;
                mediaParams.contenttype = mediaItem.MimeType;
                mediaParams.media       = new byte[(int)mediaItem.GetMediaStream().Length];

                using (Stream stream = mediaItem.GetMediaStream())
                {
                    stream.Read(mediaParams.media, 0, (int)mediaItem.GetMediaStream().Length);
                }

                MediaUrl mediaUrl = (MediaUrl)JsonConvert.DeserializeObject(MsgService.UploadImg(mediaParams), typeof(MediaUrl));

                mList.Add(new WechatMedia
                {
                    itemId   = i.ID.ToString(),
                    mediaId  = null,
                    mediaUrl = HttpUtility.UrlDecode(mediaUrl.Url)
                });
            }

            if (UpdateUrl(mList))
            {
                return(Content("Update Media Urls Successfully"));
            }
            else
            {
                return(Content("Update Media Urls failed"));
            }
        }
예제 #39
0
 public HistogramProcessor(MsgService msgService)
     : base(msgService, VisionMessage.msgType)
 {
 }
예제 #40
0
 public TextMsgDisplayProcessor(MsgService msgService, TextMsgHandler tmh)
     : base(msgService, TextMessage.msgType)
 {
     this.tmh = tmh;
 }
예제 #41
0
 public AForgeProcessor(IFilter filter, MsgService msgService)
     : base(msgService, VisionMessage.msgType)
 {
     if (filter == null)
         throw new NullReferenceException("Filter cannot be null");
     this.filter = filter;
 }
예제 #42
0
 public NN_Processor(MsgService msgService, Constants.SignType signType)
     : base(msgService, VisionMessage.msgType)
 {
     this.signType = signType;
     if (signs == null)
     {
         signs = new Bitmap[Constants.NUM_OF_SIGN_TYPES + 1];
         ResizeBicubic resizer = new ResizeBicubic(32, 32);
         for (int i = 1; i <= Constants.NUM_OF_SIGN_TYPES; i++)
         {
             String file_name = "signs\\sign_" + (i < 10 ? ("0" + i) : ("" + i)) + ".bmp";
             signs[i] = resizer.Apply((Bitmap)Bitmap.FromFile(Constants.base_folder + file_name, false));
         }
     }
     if (networks == null)
     {
         networks = NNTrain.loadNetworks();
     }
 }
예제 #43
0
 public Controller()
 {
     //start service
     msgService = new MsgService();
 }
예제 #44
0
 public MsgInitiator(MsgService msgService)
 {
     this.msgService = msgService;
     this.msgService.init(null);
 }
예제 #45
0
 public SVM_SURFProcessor(MsgService msgService, Constants.SignType signType)
     : base(msgService, VisionMessage.msgType)
 {
     this.signType = signType;
     if (signs == null)
     {
         signs = new Bitmap[Constants.NUM_OF_SIGN_TYPES + 1];
         ResizeBicubic resizer = new ResizeBicubic(32, 32);
         for (int i = 1; i <= Constants.NUM_OF_SIGN_TYPES; i++)
         {
             String file_name = "signs\\sign_" + (i < 10 ? ("0" + i) : ("" + i)) + ".bmp";
             signs[i] = resizer.Apply((Bitmap)Bitmap.FromFile(Constants.base_folder + file_name, false));
         }
     }
     if (model == null)
     {
         BinaryFormatter formatter = new BinaryFormatter();
         FileStream stream = new FileStream(Constants.base_folder + Constants.NN_SVM_SURF + "_" + (signType == Constants.SignType.circular ? "circle" : "triangle") + ".dat", FileMode.Open, FileAccess.Read, FileShare.None);
         model = (Model)formatter.Deserialize(stream);
         stream.Close();
     }
 }
예제 #46
0
        private void GetMailCode(string strMailType)
        {
            string randomNumber = StringUtils.GetRandomNumber(5, true);
            string text         = string.Empty;
            string strSubject   = string.Empty;

            if (strMailType == "reg")
            {
                strSubject = "注册验证码";
                text       = base.GetConfigValue("RegMailCheckCode").Replace("${checkcode}", randomNumber);
            }
            else if (strMailType == "findpwd")
            {
                strSubject = "找回密码验证码";
                text       = base.GetConfigValue("GetPwdMailCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            else if (strMailType == "bind")
            {
                strSubject = "会员绑定验证码";
                text       = base.GetConfigValue("BindMailCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            string queryString = WebUtils.GetQueryString("paramval");
            string s           = "{\"ret\":\"fail\",\"timeout\":0,\"msg\":\"邮箱验证码发送失败\"}";
            bool   flag        = true;

            if (!string.IsNullOrEmpty(queryString))
            {
                if ((strMailType == "reg" || strMailType == "bind") && SinGooCMS.BLL.User.IsExistsByEmail(queryString))
                {
                    s = "{\"ret\":\"exists\",\"timeout\":0,\"msg\":\"邮箱地址已存在\"}";
                }
                else
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(queryString);
                    if (lastCheckCode != null)
                    {
                        System.TimeSpan timeSpan = System.DateTime.Now - lastCheckCode.AutoTimeStamp;
                        if (timeSpan.TotalSeconds < 60.0)
                        {
                            flag = false;
                            s    = "{\"ret\":\"fail\",\"timeout\":" + (60.0 - timeSpan.TotalSeconds).ToString("f0") + ",\"msg\":\"发送间隔太短\"}";
                        }
                    }
                    if (flag)
                    {
                        string empty = string.Empty;
                        if (MsgService.SendMail(queryString, strSubject, text, out empty))
                        {
                            SMSInfo entity = new SMSInfo
                            {
                                SMSMob        = queryString,
                                SMSText       = text,
                                SMSType       = "CheckCode",
                                ValidateCode  = randomNumber,
                                ReturnMsg     = empty,
                                Status        = 1,
                                AutoTimeStamp = System.DateTime.Now
                            };
                            SMS.Add(entity);
                            s = "{\"ret\":\"success\",\"timeout\":60,\"msg\":\"邮箱验证码发送成功,请登录邮箱查收!\"}";
                        }
                        else
                        {
                            s = "{\"ret\":\"fail\",\"timeout\":0,\"msg\":\"" + empty + "\"}";
                        }
                    }
                }
            }
            base.Response.Write(s);
        }