本文整理汇总了C#中EventManager.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# EventManager.Insert方法的具体用法?C# EventManager.Insert怎么用?C# EventManager.Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventManager
的用法示例。
在下文中一共展示了EventManager.Insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
//
//verify if exists selected event type
//
if (!(rbtAlert.Checked || rbtInformation.Checked || rbtSugestion.Checked || rbtError.Checked))
{
ShowError(Resources.Exception.UnselectedEventType);
return;
}
EventManager eventManager = new EventManager(this);
Vivina.Erp.DataClasses.Event ev = new Vivina.Erp.DataClasses.Event();
Vivina.Erp.DataClasses.Event original_ev = new Vivina.Erp.DataClasses.Event();
if (Page.ViewState["EventId"] != null)
{
original_ev = eventManager.GetEvent(Convert.ToInt32(Page.ViewState["EventId"]));
ev.CopyPropertiesFrom(original_ev);
}
// ev.CompanyId = Company.CompanyId;
ev.Name = txtName.Text;
ev.Message = txtMessage.Value;
ev.ApplicationId = Application.ApplicationId;
ev.Rating = rtnPriority.CurrentRating;
//if (!String.IsNullOrEmpty(cboTechnicalUser.SelectedValue))
// ev.TechnicalUserId = Convert.ToInt32(cboTechnicalUser.SelectedValue);
if (!String.IsNullOrEmpty(cboEventStatus.SelectedValue))
ev.EventStatusId = Convert.ToInt32(cboEventStatus.SelectedValue);
//set event type
if (rbtAlert.Checked)
ev.EventType = (Int32)InfoControl.Web.Auditing.EventType.Warning;
if (rbtInformation.Checked)
ev.EventType = (Int32)InfoControl.Web.Auditing.EventType.Information;
if (rbtSugestion.Checked)
ev.EventType = (Int32)InfoControl.Web.Auditing.EventType.Sugestion;
//verify if is update or insert
if (Page.ViewState["EventId"] != null)
eventManager.Update(original_ev, ev);
else
{
//where insert mode set creator's ID
ev.UserId = User.Identity.UserId;
eventManager.Insert(ev);
}
if (Company.CompanyId == HostCompany.CompanyId)
Server.Transfer("EventViewer.aspx");
else
Server.Transfer("../Site/1/WishList.aspx");
}