本文整理汇总了C#中Message.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Message.Update方法的具体用法?C# Message.Update怎么用?C# Message.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.Update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendUpdate
public static void SendUpdate(DBObject parent, string id, string message, string number)
{
// Messenger.SendUpdate(App.amApp, u.Id, u.Content, u.Contact);
try
{
SmsSubmitPdu pdu;
byte dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
pdu = new SmsSubmitPdu(message, Convert.ToString(number), dcs);
int times = 1;
for (int i = 0; i < times; i++)
{
comm.SendMessage(pdu);
_message = new Message(parent);
_message.Update(id, "T");
}
// Update(string id,string sent)
}
catch(Exception r)
{
throw r;
}
}
示例2: Sender
public static bool Sender(DBObject parent, string id, string message, string number, string network)
{
foreach (CommNetwork coms in primes)
{
if (network == coms.Names)
{
try
{
SmsSubmitPdu pdu;
byte dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
pdu = new SmsSubmitPdu(message, Convert.ToString(number), dcs);
int times = 1;
for (int i = 0; i < times; i++)
{
coms.Comms.SendMessage(pdu);
_message = new Message(parent);
_message.Update(id, "T");
sent = true;
}
sent = true;
}
catch (Exception r)
{
sent = false;
_network.UpdateStatus(network, "disconnected");
Console.WriteLine("comm is already open");
}
}
}
_network = new Network(null);
return sent;
}
示例3: messagesRepeater_ItemCommand
//===============================================================
// Function: messagesRepeater_ItemCommand
//===============================================================
protected void messagesRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
{
if( e.CommandName == "markAsReadButton" )
{
int messageID = int.Parse(e.CommandArgument.ToString());
Message message = new Message(Session["loggedInUserFullName"].ToString(), messageID);
message.messageRead = true;
message.Update();
int userID = int.Parse(Session["loggedInUserID"].ToString());
PopulateMessageList(userID);
}
if (e.CommandName == "deleteButton")
{
int messageID = int.Parse(e.CommandArgument.ToString());
Message message = new Message(Session["loggedInUserFullName"].ToString(), messageID);
message.Delete();
int userID = int.Parse(Session["loggedInUserID"].ToString());
PopulateMessageList(userID);
}
if (e.CommandName == "viewThreadButton")
{
int messageID = int.Parse(e.CommandArgument.ToString());
Message message = new Message(Session["loggedInUserFullName"].ToString(), messageID);
if (message.parentMessageID > 0)
{
Response.Redirect("messageThread.aspx?MID=" + message.parentMessageID.ToString());
}
else
{
Response.Redirect("messageThread.aspx?MID=" + messageID.ToString());
}
}
}
示例4: messagesRepeater_ItemCommand
//===============================================================
// Function: messagesRepeater_ItemCommand
//===============================================================
protected void messagesRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
{
if( e.CommandName == "markAsReadButton" )
{
int messageID = int.Parse(e.CommandArgument.ToString());
Message message = new Message(Session["loggedInUserFullName"].ToString(), messageID);
message.messageRead = true;
message.Update();
int userID = int.Parse(Session["loggedInUserID"].ToString());
PopulateMessageList(userID);
}
if (e.CommandName == "deleteButton")
{
int messageID = int.Parse(e.CommandArgument.ToString());
Message message = new Message(Session["loggedInUserFullName"].ToString(), messageID);
message.Delete();
int userID = int.Parse(Session["loggedInUserID"].ToString());
PopulateMessageList(userID);
}
}
示例5: SaveData
//Save Data
private void SaveData()
{
Message message = new Message();
bool flag = true;
try
{
message.TmplCode = Cast.String(ddlTmplCode.SelectedValue);
message.MsgTypeId = Cast.Int(ddlMsgTypeId.SelectedValue);
message.Title = Cast.String(txtTitle.Text.Trim());
message.Content = Cast.String(txtContent.Value.Trim());
message.Accessibility = Cast.Enum<MessageAccessibility>(rdlAccessibility.SelectedValue);
message.CreateTime = Cast.DateTime(txtCreateTime.Text.Trim());
message.ViewEntry = Cast.String(txtViewEntry.Text.Trim());
message.SendTime = Cast.DateTime(txtSendTime.Text.Trim());
message.ExpireTime = Cast.DateTime(txtExpireTime.Text.Trim());
message.CreateBy = Cast.String(txtCreateBy.Text.Trim());
message.LastResponseTime = Cast.DateTime(txtLastResponseTime.Text.Trim());
message.Status = Cast.Enum<MessageStatus>(rdlStatus.SelectedValue);
message.ResponseEntry = Cast.String(txtResponseEntry.Text.Trim());
message.Source = Cast.String(txtSource.Text.Trim());
message.Destination = Cast.String(txtDestination.Text.Trim());
using (_session = new Session())
{
if (IsAddNew())
{
flag = message.Create(_session);
}
else
{
message.MessageId = int.Parse(this.txtMessageId.Value);
flag = message.Update(_session, "TmplCode", "MsgTypeId", "Title", "Content", "Accessibility", "CreateTime", "ViewEntry", "SendTime", "ExpireTime", "CreateBy", "LastResponseTime", "Status", "ResponseEntry", "Source", "Destination");
}
}
this.txtMessageId.Value = message.MessageId.ToString();
if(flag)
WebUtil.ShowMsg(this,"操作成功","提示");
else
WebUtil.ShowMsg(this,"操作失败","提示");
}
catch(UnauthorizedException ex)
{
WebUtil.ShowMsg(this,ex.Message,"警告");
}
catch(ApplicationException ex)
{
WebUtil.ShowMsg(this,ex.Message,"提示");
}
catch(Exception ex)
{
logger.Info("保存Message", ex);
WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
}
}
示例6: SendUpdate
public static bool SendUpdate(DBObject parent, string id, string message, string number, string network, string cb)
{
_network = new Network(null);
comm = new GsmCommMain(cb, 9600, 150);
try
{
SmsSubmitPdu pdu;
byte dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
pdu = new SmsSubmitPdu(message, Convert.ToString(number), dcs);
int times = 1;
for (int i = 0; i < times; i++)
{
if (comm.IsConnected())
{
Console.WriteLine("comm is already open");
Console.WriteLine("modem connected:" + network + "to:" + comm);
_network.UpdateStatus(network, "connected");
}
else
{
comm.Open();
_network.UpdateStatus(network, "connected");
}
comm.SendMessage(pdu);
_message = new Message(parent);
_message.Update(id, "T");
sent = true;
}
sent = true;
}
catch (Exception r)
{
sent = false;
_network.UpdateStatus(network, "disconnected");
Console.WriteLine("comm is already open");
}
return sent;
}
示例7: Send
internal async Task Send(Message msg)
{
if (_pendingSends.TryRemove(msg.Nonce, out msg)) //Remove it from pending
{
try
{
var request = new SendMessageRequest(msg.Channel.Id)
{
Content = msg.RawText,
Nonce = msg.Nonce.ToString(),
IsTTS = msg.IsTTS
};
var response = await _client.ClientAPI.Send(request).ConfigureAwait(false);
msg.Id = response.Id;
msg.Update(response);
msg.State = MessageState.Normal;
}
catch (Exception ex) { msg.State = MessageState.Failed; _logger.Error("Failed to send message", ex); }
}
}