本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToMessage方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToMessage方法的具体用法?C# DataEntities.AddToMessage怎么用?C# DataEntities.AddToMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveMessage
public Result SaveMessage()
{
Message msg = new Message();
msg.Chat = WS.RequestString("chat");
msg.Content = WS.RequestString("content");
msg.Email = WS.RequestString("email");
msg.MessageTime = DateTime.Now;
msg.Tel = WS.RequestString("tel");
msg.Title = WS.RequestString("title");
msg.UserName = WS.RequestString("username");
if (msg.Content.IsNullOrEmpty())
{
return new Result { Success=true };
}
try
{
DataEntities ent = new DataEntities();
ent.AddToMessage(msg);
ent.SaveChanges();
return new Result { Success = true };
}
catch
{
return new Result { Success = false };
}
}
示例2: AfterEdit
public void AfterEdit(JObject obj)
{
DataEntities ent = new DataEntities();
var n = obj.ToObject<Voodoo.Basement.Message>();
//n.Content = n.Content.AsciiToNative().HtmlDeCode();
if (n.ID <= 0)
{
ent.AddToMessage(n);
}
else
{
var n_obj = (from l in ent.Message where l.ID == n.ID select l).First();
PropertyInfo[] ps = n.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo p in ps)
{
object value = p.GetValue(n, null);
if (value == null)
{
continue;
}
try
{
p.SetValue(n_obj, value, null);
}
catch { }
}
}
ent.SaveChanges();
StringBuilder sb = new StringBuilder();
this.GridPanel1.Store.Primary.CommitChanges();
this.BindData();
TabPanel1.SetActiveTab(0);
FormPanel1.Title = "新增";
FormPanel1.Reset();
X.Msg.Notify("消息", "保存成功!").Show();
}