Esempio n. 1
0
        static void Main(string[] args)
        {
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>("score", "50"));
            SendInfo.Send(list);
        }
 public override void Send(SendInfo info)
 {
     if (info.connections != null)
     {
         foreach (Connection connection in info.connections)
         {
             MemoryStream memoryStream = this.stream;
             if (memoryStream.Length > (long)1 && this.net.cryptography != null && this.net.cryptography.IsEnabledOutgoing(connection))
             {
                 memoryStream = this.net.cryptography.EncryptCopy(connection, memoryStream, 1);
             }
             this.peer.SendStart();
             this.peer.WriteBytes(memoryStream);
             this.peer.SendTo(connection.guid, info.priority, info.method, info.channel);
         }
     }
     if (info.connection != null)
     {
         Connection   connection1   = info.connection;
         MemoryStream memoryStream1 = this.stream;
         if (memoryStream1.Length > (long)1 && this.net.cryptography != null && this.net.cryptography.IsEnabledOutgoing(connection1))
         {
             this.net.cryptography.Encrypt(connection1, memoryStream1, 1);
         }
         this.peer.SendStart();
         this.peer.WriteBytes(memoryStream1);
         this.peer.SendTo(connection1.guid, info.priority, info.method, info.channel);
     }
 }
Esempio n. 3
0
 public override void Disconnect(string reason, bool sendReasonToServer)
 {
     if (sendReasonToServer && this.write != null && this.write.Start())
     {
         this.write.PacketID(Message.Type.DisconnectReason);
         this.write.String(reason);
         Write    write    = this.write;
         SendInfo sendInfo = new SendInfo(base.Connection)
         {
             method   = SendMethod.ReliableUnordered,
             priority = Priority.Immediate
         };
         write.Send(sendInfo);
     }
     if (this.peer != null)
     {
         this.peer.Close();
         this.peer = null;
     }
     this.write            = null;
     this.connectedAddress = "";
     this.connectedPort    = 0;
     base.Connection       = null;
     base.OnDisconnected(reason);
 }
Esempio n. 4
0
        public static bool AddUi(BasePlayer player, string json)
        {
            bool flag;

            if (player != null)
            {
                flag = player.net;
            }
            else
            {
                flag = false;
            }
            if (!flag || Interface.CallHook("CanUseUI", player, json) != null)
            {
                return(false);
            }
            CommunityEntity serverInstance = CommunityEntity.ServerInstance;
            SendInfo        sendInfo       = new SendInfo()
            {
                connection = player.net.connection
            };

            serverInstance.ClientRPCEx <string>(sendInfo, null, "AddUI", json);
            return(true);
        }
Esempio n. 5
0
        public static bool DestroyUi(BasePlayer player, string elem)
        {
            bool flag;

            if (player != null)
            {
                flag = player.net;
            }
            else
            {
                flag = false;
            }
            if (!flag)
            {
                return(false);
            }
            Interface.CallHook("OnDestroyUI", player, elem);
            CommunityEntity serverInstance = CommunityEntity.ServerInstance;
            SendInfo        sendInfo       = new SendInfo()
            {
                connection = player.net.connection
            };

            serverInstance.ClientRPCEx <string>(sendInfo, null, "DestroyUI", elem);
            return(true);
        }
Esempio n. 6
0
        public static List <SendInfo> GetSendList()
        {
            List <SendInfo> info = new List <SendInfo>();
            SendInfo        send;
            Database        db    = DataConnect.GetConnect;
            DbCommand       cmd   = db.GetSqlStringCommand(@"select NAME,PHONE from TB_PUSHALARMSET");
            DataTable       dt    = db.ExecuteDataSet(cmd).Tables[0];
            int             Count = dt.Rows.Count;

            if (Count == 0)
            {
                return(info);
            }
            else
            {
                for (int i = 0; i < Count; i++)
                {
                    send       = new SendInfo();
                    send.Name  = dt.Rows[i]["NAME"].ToString();
                    send.Phone = dt.Rows[i]["PHONE"].ToString();
                    info.Add(send);
                }
                return(info);
            }
        }
Esempio n. 7
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            SendInfo si = new SendInfo();

            si.Id      = Convert.ToInt32(this.Tag.ToString());
            si.Address = cbb_Address.Text;
            si.PName   = cbb_PName.Text;
            si.Type    = txt_Type.Text;
            si.Num     = txt_Num.Text;
            si.Driver  = txt_Driver.Text;
            si.Statu   = cbb_Statu.Text;
            si.Phone   = txt_Phone.Text;
            int i = dal.UpdInfo(si);

            if (i > 0)
            {
                MessageBox.Show("编辑成功");
                this.Close();
                _ReList();
            }
            else
            {
                MessageBox.Show("编辑失败");
            }
        }
Esempio n. 8
0
        public ActionResult ChangeNotification(bool emailChk, bool smsChk, string email, string phone,
                                               string wakeupDay, string wakeupEnd, string timezoneSelect, string timezoneOffset,
                                               WeekEndMode weekendMode, TemperatureMode temperature, string countryCode)
        {
            SendInfo info = new SendInfo()
            {
                UserName      = User.Identity.Name,
                SendEmail     = emailChk,
                SendSms       = smsChk,
                UserEmail     = email,
                UserPhone     = phone,
                TimeWeekDay   = wakeupDay,
                TimeWeekEnd   = wakeupEnd,
                TimeZoneValue = timezoneSelect,
                WeekendMode   = weekendMode,
                Temperature   = temperature,
                CountryCode   = countryCode
            };

            if (!string.IsNullOrEmpty(timezoneOffset))
            {
                info.TimeZoneOffset = settingService.ParseTimeZoneOffset(timezoneOffset);
            }

            settingService.UpdateUserSettings(info);

            return(RedirectToAction("GoToResults", "Default"));
        }
Esempio n. 9
0
    //注册
    private void EnrollBut()
    {
        //格式确认
        //if ()
        //{

        if (passwordInput.text == verifyPasswordInput.text)
        {
            UI_Login.UserInstance.user_account  = emilInput.text;
            UI_Login.UserInstance.user_password = passwordInput.text;
            UI_Login.UserInstance.user_name     = nameInput.text;
        }
        else
        {
            hintText.text            = "两次输入密码不正确!";
            verifyPasswordInput.text = "";
        }

        //}

        SendInfo.SendRequestMessage(UI_Login.UserInstance, RequestType.account_register);

        emilInput.text           = "";
        passwordInput.text       = "";
        nameInput.text           = "";
        verifyPasswordInput.text = "";
    }
Esempio n. 10
0
        /// <summary>
        /// The function sends a log command to the server.
        /// </summary>
        public void SendToServer()
        {
            string[] args = { };
            CommandRecievedEventArgs e = new CommandRecievedEventArgs((int)CommandEnum.LogCommand, args, "Empty");

            SendInfo?.Invoke(this, e);
        }
Esempio n. 11
0
    void AddButton()
    {
        //发送好友添加请求
        SendInfo.SendAddRequest(info.friend_id, RequestType.friend_add, remarksInput.text);

        Destroy(gameObject, 0.5f);
    }
Esempio n. 12
0
        /// <summary>
        /// 保存为已打印
        /// </summary>
        private void SaveSysPrint()
        {
            foreach (var SendModel in sendCollection.Where(s => s.FSelectItem == true))
            {
                SendInfo sObj = visaORM.SendInfo.FirstOrDefault(s => s.FQZID == SendModel.FQZID);
                if (sObj != null)
                {
                    if (sObj.FSysPrintNum == null)
                    {
                        sObj.FSysPrintNum = 1;
                    }
                    else
                    {
                        sObj.FSysPrintNum = sObj.FSysPrintNum + 1;
                    }

                    sObj.FSysPrint     = true;
                    sObj.FSysPrintDate = DateTime.Now;
                    sObj.FSysPrintUser = MainContext.UserID;
                    visaORM.ObjectStateManager.ChangeObjectState(sObj, System.Data.EntityState.Modified);

                    Customer cObj = visaORM.Customer.FirstOrDefault(c => c.FID == sObj.FCustomerID);
                    if (cObj != null)
                    {
                        cObj.FSysPrint     = true;
                        cObj.FSysPrintDate = DateTime.Now;
                        cObj.FSysPutUser   = MainContext.UserID;
                        visaORM.ObjectStateManager.ChangeObjectState(cObj, System.Data.EntityState.Modified);
                    }
                }
            }
            visaORM.SaveChanges();
        }
Esempio n. 13
0
        public HandlerResponse SmsSend()
        {
            string mobiles     = Request.Params["mobiles"];
            string content     = Request.Params["content"];
            string batchname   = Request.Params["batchname"];
            string batchremark = Request.Params["batchremark"];
            string fkeyword    = Request.Params["fkeyword"];
            string fblack      = Request.Params["fblack"];
            string frepeat     = Request.Params["frepeat"];

            if (string.IsNullOrEmpty(mobiles) || string.IsNullOrEmpty(content))
            {
                return(CreateHandler(0, "联系人与短信内容不能为空"));
            }
            if (string.IsNullOrEmpty(batchname))
            {
                batchname = DateTime.Now.ToString("批次yyyyMMddHHmmss");
            }
            SendInfo sendinfo = new SendInfo();

            sendinfo.AccountID    = AppContent.Current.GetCurrentUser().ID;
            sendinfo.EnterpriseID = AppContent.Current.GetCurrentUser().EnterpriseID;
            sendinfo.BatchRemark  = batchremark;
            sendinfo.BatchName    = batchname;
            sendinfo.Content      = content;
            sendinfo.FBlack       = StringPlus.StrToBool(fblack, true);
            sendinfo.FKeyword     = StringPlus.StrToBool(fkeyword, true);
            sendinfo.FRepeat      = StringPlus.StrToBool(frepeat, true);
            sendinfo.Mobiles      = mobiles.Split(',');
            /*wait,batch,count三个表,mt表不需要了*/
            ThreadPool.QueueUserWorkItem(new WaitCallback(SendPool), sendinfo);
            return(CreateHandler(1, "批次提交成功,后台正在处理中..."));
        }
Esempio n. 14
0
        public ActionResult Settings(string par)
        {
            string _userName = ExtractUserName();
            Stream req       = Request.InputStream;

            req.Seek(0, SeekOrigin.Begin);
            string json      = new StreamReader(req).ReadToEnd();
            var    _userInfo = JsonConvert.DeserializeObject <ExternalSendInfo>(json);

            if (_userName != null)
            {
                SendInfo _info = mssqlDao.GetSendInfoDao().Find(_userName);
                _info.SendEmail      = _userInfo.SendEmail;
                _info.SendSms        = _userInfo.SendSms;
                _info.UserEmail      = _userInfo.UserEmail;
                _info.UserPhone      = _userInfo.UserPhone;
                _info.City           = _userInfo.City;
                _info.DataFileName   = _userInfo.DataFileName;
                _info.DataFileId     = _userInfo.DataFileId;
                _info.TimeWeekDay    = _userInfo.TimeWeekDay;
                _info.TimeWeekEnd    = _userInfo.TimeWeekEnd;
                _info.TimeZoneOffset = _userInfo.TimeZoneOffset;
                _info.WeekendMode    = _userInfo.WeekendMode;
                _info.Temperature    = _userInfo.Temperature;

                mssqlDao.GetSendInfoDao().Update(_info);

                return(Json(ExternalSendInfo.Create(_info), JsonRequestBehavior.AllowGet));
            }
            return(Json(new ExternalSendInfo(), JsonRequestBehavior.AllowGet));
        }
Esempio n. 15
0
            private void NetworkUpdate()
            {
                if (Lift.net.group.subscribers.Count == 0)
                {
                    return;
                }

                if (Net.sv.write.Start())
                {
                    Net.sv.write.PacketID(Message.Type.GroupChange);
                    Net.sv.write.EntityID(Lift.net.ID);
                    Net.sv.write.GroupID(Lift.net.group.ID);
                    Net.sv.write.Send(new SendInfo(Lift.net.group.subscribers));
                }

                if (Net.sv.write.Start())
                {
                    Net.sv.write.PacketID(Message.Type.EntityPosition);
                    Net.sv.write.EntityID(Lift.net.ID);
                    Net.sv.write.Vector3(Lift.GetNetworkPosition());
                    Net.sv.write.Vector3(Lift.GetNetworkRotation().eulerAngles);
                    Net.sv.write.Float(Lift.GetNetworkTime());

                    SendInfo info = new SendInfo(Lift.net.group.subscribers);
                    info.method   = SendMethod.ReliableUnordered;
                    info.priority = Priority.Immediate;
                    Net.sv.write.Send(info);
                }
            }
Esempio n. 16
0
        private void SendEmailNotification(SendInfo _info, string _city, string _todayForecast, string _currentObservation, string _riskDescription,
                                           Forecast10Root _forecastRoot, TemperatureMode _mode, MandrillApi _api, string _subj)
        {
            var _sb = new StringBuilder();

            _sb.Append("<p style='text-align:center'>")
            .AppendFormat(
                "Genetically tailored notification from your <a href='{0}' class='external'>Weather My Way +RTP</a> app",
                Options.BaseSiteUrl)
            .Append("</p>");
            _sb.Append("<p style='text-align:center'><strong>");
            _sb.AppendFormat("Current weather for {0}", _city).Append("</strong></p>");
            _sb.Append("<p style='text-align:center'>");
            _sb.Append(_currentObservation).Append("</p><br/>");
            _sb.Append("<p style='text-align:center'>");
            _sb.Append("<strong>Today's forecast</strong>").Append("</p>");
            _sb.Append("<p style='text-align:center'>");
            _sb.Append(_todayForecast).Append("</p><br/>");
            _sb.Append("<p style='text-align:center'>");
            _sb.Append("<strong>Your genetically tailored forecast</strong>").Append("</p>");
            _sb.Append("<p style='text-align:center'>");
            _sb.Append(_riskDescription).Append("</p><br/>");
            _sb.Append("<p style='text-align:center'><strong>Extended forecast</strong></p>");
            for (int _idx = 1; _idx <
                 Math.Min(5, _forecastRoot.forecast.txt_forecast.forecastday.Count); _idx++)
            {
                _sb.Append("<p style='text-align:center'>");
                _sb.Append(_forecastRoot.forecast.txt_forecast.forecastday[_idx].title).Append(":");
                _sb.Append(_mode == TemperatureMode.F ?
                           _forecastRoot.forecast.txt_forecast.forecastday[_idx].fcttext :
                           _forecastRoot.forecast.txt_forecast.forecastday[_idx].fcttext_metric).Append("</p>");
            }
            SendEmail(_api, _info, _subj, _sb.ToString());
        }
Esempio n. 17
0
        public virtual void SendNetworkUpdate(SendInfo _sendInfo, Entity _entity = null)
        {
            if (_entity == null)
            {
                _entity = new Entity();
                GetEntityProtobuf(_entity);
            }

            #region [Section] Temporary FIX - Alistair has promised to resolve the issue with connection.validate.entityUpdates

            if (_sendInfo.connection == null)
            {
                var connections = _sendInfo.connections.ToArray();
                for (var i = 0; i < connections.Length; i++)
                {
                    connections[i].validate.entityUpdates++;

                    NetworkManager.BaseNetworkServer.write.Start();
                    NetworkManager.BaseNetworkServer.write.PacketID(Message.Type.Entities);
                    NetworkManager.BaseNetworkServer.write.UInt32(connections[i].validate.entityUpdates);
                    _entity.WriteToStream(NetworkManager.BaseNetworkServer.write);
                    NetworkManager.BaseNetworkServer.write.Send(new SendInfo(connections[i]));
                }
                return;
            }

            #endregion

            NetworkManager.BaseNetworkServer.write.Start();
            NetworkManager.BaseNetworkServer.write.PacketID(Message.Type.Entities);
            NetworkManager.BaseNetworkServer.write.UInt32(++_sendInfo.connection.validate.entityUpdates);
            _entity.WriteToStream(NetworkManager.BaseNetworkServer.write);
            NetworkManager.BaseNetworkServer.write.Send(_sendInfo);
        }
Esempio n. 18
0
        private bool IsRightTime(SendInfo info)
        {
            var _now = DateTime.Now;

            if (!info.LastSendDt.HasValue ||
                (info.LastSendDt.HasValue &&
                 DateTime.Today.Subtract(info.LastSendDt.Value.Date).TotalDays >= 1))
            {
                var _weekend = _now.DayOfWeek == DayOfWeek.Saturday || _now.DayOfWeek == DayOfWeek.Sunday;
                if (info.TimeZoneOffset.HasValue)
                {
                    var _finalOffset = -TimeZone.CurrentTimeZone.GetUtcOffset(_now).TotalHours + (double)info.TimeZoneOffset.Value;
                    _now = _now.AddHours(_finalOffset);
                }
                if (!string.IsNullOrEmpty(info.TimeWeekEnd) && _weekend)
                {
                    if (_now.Subtract(DateTime.Parse(info.TimeWeekEnd)).TotalMinutes > 0)
                    {
                        return(true);
                    }
                    return(false);
                }
                if (!string.IsNullOrEmpty(info.TimeWeekDay))
                {
                    if (_now.Subtract(DateTime.Parse(info.TimeWeekDay)).TotalMinutes > 0)
                    {
                        return(true);
                    }
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 19
0
        private void SendPushNotification(SendInfo _info, string _city, string _todayForecast, string _currentObservation, string _riskDescription)
        {
            string _msg1 = string.Format("Your genetically tailored forecast for {0}: {1} Right now it's {2}. {3}",
                                         _city, _todayForecast, _currentObservation, _riskDescription);

            notificationService.Send(_info.Id, _msg1);
        }
Esempio n. 20
0
 // Token: 0x06000083 RID: 131 RVA: 0x000038C0 File Offset: 0x00001AC0
 public override void Send(SendInfo info)
 {
     if (info.connections != null)
     {
         for (int i = 0; i < info.connections.Count; i++)
         {
             Connection   connection   = info.connections[i];
             MemoryStream memoryStream = this.stream;
             if (memoryStream.Length > 1L && this.net.cryptography != null && this.net.cryptography.IsEnabledOutgoing(connection))
             {
                 memoryStream = this.net.cryptography.EncryptCopy(connection, memoryStream, 1);
             }
             this.peer.SendStart();
             this.peer.WriteBytes(memoryStream);
             this.peer.SendTo(connection.guid, info.priority, info.method, info.channel);
         }
     }
     if (info.connection != null)
     {
         Connection   connection2   = info.connection;
         MemoryStream memoryStream2 = this.stream;
         if (memoryStream2.Length > 1L && this.net.cryptography != null && this.net.cryptography.IsEnabledOutgoing(connection2))
         {
             this.net.cryptography.Encrypt(connection2, memoryStream2, 1);
         }
         this.peer.SendStart();
         this.peer.WriteBytes(memoryStream2);
         this.peer.SendTo(connection2.guid, info.priority, info.method, info.channel);
     }
 }
Esempio n. 21
0
        private void SendLog(Thread thread)
        {
            while (true && thread.ThreadState != ThreadState.WaitSleepJoin)
            {
                var message  = m_analyseMessages.Take();
                var date     = DateTime.Now.ToString("yyyyMMdd");
                var authData = DBManager.Instance.GetAuth(message.Token, out string temeplateId);

                if (temeplateId != null)
                {
                    var sendInfo = DBManager.Instance.DBase.Query <SendInfo>().FirstOrDefault(e => e.Date == date && e.TemplateID == temeplateId);
                    if (sendInfo == null)
                    {
                        sendInfo = new SendInfo()
                        {
                            Date = date, TemplateID = temeplateId, Count = 1
                        };
                        DBManager.Instance.DBase.Insert(sendInfo);
                    }
                    else
                    {
                        sendInfo.Count++;
                        DBManager.Instance.DBase.Update(sendInfo, e => e.Count);
                    }
                }
            }
        }
Esempio n. 22
0
    /// <summary>
    /// 查找好友
    /// </summary>
    private void FindBut()
    {
        if (searchFriend != null)
        {
            Destroy(searchFriend.gameObject);
        }

        if (!UI_LobbyManager.myselfInfo.user_id.Equals(int.Parse(findInput.text)))
        {
            if (UI_LobbyManager.lobbyManager.friendInfos.ContainsKey(int.Parse(findInput.text)))
            {
                Debug.Log("已经是好友了");
            }
            else
            {
                //发送查找好友请求
                SendInfo.SendAddRequest(int.Parse(findInput.text), RequestType.friend_search, "");
                findInput.text = "";
            }
        }
        else
        {
            Debug.Log("不可以添加自己为好友");
        }
    }
Esempio n. 23
0
        // Token: 0x06000083 RID: 131 RVA: 0x000038C0 File Offset: 0x00001AC0
        public override void Send(SendInfo info)
        {
            if (info.connections != null)
            {
                foreach (var connection in info.connections)
                {
                    var memoryStream = _stream;
                    if (memoryStream.Length > 1L && _net.Cryptography != null &&
                        _net.Cryptography.IsEnabledOutgoing(connection))
                    {
                        memoryStream = _net.Cryptography.EncryptCopy(connection, memoryStream, 1);
                    }

                    _peer.SendStart();
                    _peer.WriteBytes(memoryStream);
                    _peer.SendTo(connection.guid, info.priority, info.method, info.channel);
                }
            }

            if (info.connection != null)
            {
                var connection2   = info.connection;
                var memoryStream2 = _stream;
                if (memoryStream2.Length > 1L && _net.Cryptography != null &&
                    _net.Cryptography.IsEnabledOutgoing(connection2))
                {
                    _net.Cryptography.Encrypt(connection2, memoryStream2, 1);
                }

                _peer.SendStart();
                _peer.WriteBytes(memoryStream2);
                _peer.SendTo(connection2.guid, info.priority, info.method, info.channel);
            }
        }
Esempio n. 24
0
 public void ClientRPCEx(SendInfo sendInfo, Connection sourceConnection, ERPCMethodType method)
 {
     if (NetworkManager.BaseNetworkServer.IsConnected() && this.ClientRPCStart(sourceConnection, method))
     {
         this.ClientRPCSend(sendInfo);
     }
 }
Esempio n. 25
0
        /// <summary>
        /// Creates a send info object filled with data from the data record.
        /// </summary>
        /// <param name="record">Where to get the data to fill object from.</param>
        /// <returns>A populated SendInfo object.</returns>
        private static SendInfo CreateAndFillSendInfo(IDataRecord record)
        {
            SendInfo sInfo = new SendInfo
            {
                ID                    = record.GetString("mta_send_id"),
                InternalID            = record.GetInt32("mta_send_internalId"),
                SendStatus            = (SendStatus)record.GetInt64("mta_sendStatus_id"),
                LastAccessedTimestamp = DateTime.UtcNow,
                CreatedTimestamp      = record.GetDateTime("mta_send_createdTimestamp"),
                Accepted              = record.GetInt64("Accepted"),
                Deferred              = record.GetInt64("Deferred"),
                Rejected              = record.GetInt64("Rejected"),
                Throttled             = record.GetInt64("Throttled"),
                TotalMessages         = record.GetInt64("Messages"),
                Waiting               = record.GetInt64("Waiting")
            };

            if (sInfo.Waiting < 0)
            {
                sInfo.Waiting = 0;
            }

            if (!record.IsDBNull("LastTransactionTimestamp"))
            {
                sInfo.LastTransactionTimestamp = record.GetDateTime("LastTransactionTimestamp");
            }

            return(sInfo);
        }
Esempio n. 26
0
        public SendInfo Update(SendInfo sendInfo)
        {
            SendInfo result = null;

            try
            {
                using (var dbCtx = new WeatherAppDbEntities())
                {
                    result = dbCtx.SendInfo.SingleOrDefault(info => info.UserName == sendInfo.UserName);

                    if (result != null)
                    {
                        result.Merge(sendInfo);
                        dbCtx.SaveChanges();

                        return(result);
                    }
                    else
                    {
                        throw new DaoException("No user " + sendInfo.UserName + " found in database");
                    }
                }
            }
            catch (Exception e)
            {
                throw new DaoException("Error updating user " + sendInfo.UserName + " in database. " + e.Message, e);
            }
        }
Esempio n. 27
0
        public HandlerResponse FileSend()
        {
            string filename = Request.Params["filename"];
            string isheader = Request.Params["isheader"];
            string spilter = Request.Params["isspilter"];
            string content = Request.Params["content"];
            string batchname = Request.Params["batchname"];
            string batchremark = Request.Params["batchremark"];
            string fkeyword = Request.Params["fkeyword"];
            string fblack = Request.Params["fblack"];
            string frepeat = Request.Params["frepeat"];
            if (string.IsNullOrEmpty(filename) || string.IsNullOrEmpty(content))
                return CreateHandler(0, "发送文件与短信内容不能为空");
            if (string.IsNullOrEmpty(batchname))
                batchname = DateTime.Now.ToString("批次yyyyMMddHHmmss");

            SendInfo sendinfo = new SendInfo();
            sendinfo.AccountID = AppContent.Current.GetCurrentUser().ID;
            sendinfo.EnterpriseID = AppContent.Current.GetCurrentUser().EnterpriseID;
            sendinfo.BatchRemark = batchremark;
            sendinfo.BatchName = batchname;
            sendinfo.Content = content;
            sendinfo.FBlack = StringPlus.StrToBool(fblack, true);
            sendinfo.FKeyword = StringPlus.StrToBool(fkeyword, true);
            sendinfo.FRepeat = StringPlus.StrToBool(frepeat, true);
            sendinfo.IsFileSend = true;
            sendinfo.FileName = filename;
            sendinfo.IsHeader = isheader == "1";
            sendinfo.spilter = spilter;
            /*wait,batch,count三个表,mt表不需要了*/
            ThreadPool.QueueUserWorkItem(new WaitCallback(SendPool), sendinfo);
            return CreateHandler(1, "批次提交成功,后台正在处理中...");
        }
    // sets both icons to false on close
    void CloseIcons()
    {
        onR = false;
        onZ = false;

        SendInfo?.Invoke("");
    }
Esempio n. 29
0
        public JsonResult ChangeNotification(bool emailChk, bool smsChk, string email, string phone, string wakeupDay, string wakeupEnd,
                                             string timezoneSelect, string timezoneOffset, WeekEndMode weekendMode, TemperatureMode temperature, string token, string countryCode)
        {
            GenericResponse responseObj = null;
            int             timeStart   = DateTime.Now.TimeOfDay.Seconds;

            try
            {
                string name = oauthFactory.GetOAuthTokenDao().getUser(token).username;

                if (name != null)
                {
                    SendInfo info = new SendInfo()
                    {
                        UserName      = name,
                        SendEmail     = emailChk,
                        SendSms       = smsChk,
                        UserEmail     = email,
                        UserPhone     = phone,
                        TimeWeekDay   = wakeupDay,
                        TimeWeekEnd   = wakeupEnd,
                        TimeZoneValue = timezoneSelect,
                        WeekendMode   = weekendMode,
                        Temperature   = temperature,
                        CountryCode   = countryCode,
                    };

                    if (!string.IsNullOrEmpty(timezoneOffset))
                    {
                        info.TimeZoneOffset = settingsService.ParseTimeZoneOffset(timezoneOffset);
                    }

                    settingsService.UpdateUserSettings(info);
                }

                responseObj = new GenericResponse()
                {
                    Status       = 0,
                    ResponseTime = DateTime.Now.TimeOfDay.Seconds - timeStart,
                    Message      = "Settings successfully updated for user: " + name,
                    Data         = null,
                };

                return(Json(responseObj, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                responseObj = new GenericResponse()
                {
                    Status       = 1,
                    ResponseTime = DateTime.Now.TimeOfDay.Milliseconds - timeStart,
                    Message      = e.Message,
                    Data         = null,
                };

                ResponseLogging(responseObj);
                return(Json(responseObj, JsonRequestBehavior.AllowGet));
            }
        }
 static void Main(string[] args)
 {
     SendInfo.f_WriteInfo( 
                 new Info[] { 
                     new AInfo(),
                     new BInfo()
                } );
 }
 public VisitorModel(int v_id, string v_name, SendInfo Func)
 {
     Books  = new List <BookModel>();
     Id     = v_id;
     Name   = v_name;
     ToView = Func;
     RefreshView();
 }
Esempio n. 32
0
        /// <summary>
        /// Asynchronously send a UDP payload
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="offset"></param>
        /// <param name="length"></param>
        /// <param name="dest"></param>
        /// <param name="Tag"></param>
        public void Send(Byte[] buffer, int offset, int length, IPEndPoint dest, object Tag)
        {
            bool Disconnect = false;

            SendInfo SI;

            lock (SendLock)
            {
                lock (CountLock)
                {
                    if (PendingBytesSent > 0)
                    {
                        SI = new SendInfo();
                        SI.buffer = buffer;
                        SI.offset = offset;
                        SI.count = length;
                        SI.dest = dest;
                        SI.Tag = Tag;
                        SendQueue.Enqueue(SI);
                    }
                    else
                    {
                        PendingBytesSent += length;
                        try
                        {
                            if (MainSocket.SocketType == SocketType.Stream)
                            {
                                MainSocket.BeginSend(buffer, offset, length, SocketFlags.None, SendCB, Tag);
                            }
                            else
                            {
                                MainSocket.BeginSendTo(buffer, offset, length, SocketFlags.None, dest, SendCB, Tag);
                            }
                        }
                        catch (Exception ex)
                        {
                            OpenSource.Utilities.EventLogger.Log(ex);
                            OpenSource.Utilities.EventLogger.Log(this, System.Diagnostics.EventLogEntryType.Error, "Send Failure [Normal for non-pipelined connection]");
                            Disconnect = true;
                        }
                    }
                }
            }

            if (Disconnect == true)
            {
                bool OK = false;
                lock (this)
                {
                    if (SentDisconnect == false)
                    {
                        OK = true;
                        SentDisconnect = true;
                    }
                }
                if (OK == true)
                {
                    this.MainSocket = null;
                    OnDisconnectEvent.Fire(this);
                }
            }
        }
Esempio n. 33
0
        public void SendFileInfo(string path, NetworkStream netStream)
        {
            SendInfo fileInfo = new SendInfo();
            
            using (var md5 = MD5.Create())
            {
                using (var stream = File.OpenRead(path))
                {
                    fileInfo.Hash = md5.ComputeHash(stream);
                }
            }
            
            fileInfo.FileName = Path.GetFileNameWithoutExtension(path)+Path.GetExtension(path);
            fileInfo.FileSize = (new FileInfo(path)).Length;

            byte[] bytes = ObjectToByteArray(fileInfo);
            netStream.Write(bytes,0,bytes.Length);

            //MessageBox.Show("sent");
        }