本文整理汇总了C#中Events.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Events.Save方法的具体用法?C# Events.Save怎么用?C# Events.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events.Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save_OnClick
protected void Save_OnClick(object sender, EventArgs e)
{
if (IsValid)
{
Events _event = new Events(this.ConnectionString);
if (ViewState["eventId"] != null)
{
_event.LitePopulate(ViewState["eventId"], false);
}
if (ViewState["parentId"] != null)
{
_event.ParentId = Convert.ToInt32(ViewState["parentId"]);
}
_event.Title = HttpUtility.HtmlEncode(txt_Title.Text);
_event.Description = HttpUtility.HtmlEncode(txt_Desc.Text);
_event.Status = Convert.ToInt32(dd_Status.SelectedValue);
String _BigImgType = "";
if (fu_BigImg.HasFile)
{
_BigImgType = fu_BigImg.FileName.Split('.')[1];
_event.BigImgType = _BigImgType;
}
String _SmlImgType = "";
if (fu_SmlImg.HasFile)
{
_SmlImgType = fu_SmlImg.FileName.Split('.')[1];
_event.SmlImgType = _SmlImgType;
}
String _ThumImgType = "";
if (fu_Thumb.HasFile)
{
_ThumImgType = fu_Thumb.FileName.Split('.')[1];
_event.ThumbnailImgType = _ThumImgType;
}
if (_event.Save())
{
String _path;
if (fu_BigImg.HasFile)
{
_path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["EventLargeImgPath"], _event.ID.ToString(), _BigImgType));
fu_BigImg.SaveAs(_path);
}
if (fu_SmlImg.HasFile)
{
_path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["EventSmallImgPath"], _event.ID.ToString(), _SmlImgType));
fu_SmlImg.SaveAs(_path);
}
if (fu_Thumb.HasFile)
{
_path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["EventThumbImgPath"], _event.ID.ToString(), _ThumImgType));
fu_Thumb.SaveAs(_path);
}
String _parent = CommonUtility.NullSafeString(ViewState["parentId"], "");
String _url = (String.IsNullOrEmpty(_parent)) ? "Events.aspx" : "EventGallery.aspx?parentId=" + _parent;
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('Record has been updated successfully.');self.location='" + _url + "';", true);
}
else
{
lbl_Error.Text = "An unexpected error has occurred. Please try again.";
lbl_Error.Visible = true;
}
}
}