private int Save() { Page.Validate("AuthorLevel"); if (!Page.IsValid) { return(-1); } if (level == null) { level = new KLLevel(); } level.Name = txtName.Text; level.From = int.Parse(txtFrom.Text); level.To = txtTo.Text; level.Save(); if (level.LevelID > 0) { LogActivity.Write("Update level ", level.Name); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "UpdateSuccessMessage"); } else { LogActivity.Write("Create new level ", level.Name); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "InsertSuccessMessage"); } return(level.LevelID); }
void btnDelete_Click(object sender, EventArgs e) { try { bool isDeleted = false; foreach (GridDataItem data in grid.SelectedItems) { int levelId = Convert.ToInt32(data.GetDataKeyValue("LevelID")); KLLevel level = new KLLevel(levelId); if (level != null && level.LevelID != -1) { KLLevel.Delete(level.LevelID); isDeleted = true; } } if (isDeleted) { SiteUtils.QueueIndexing(); grid.Rebind(); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); } } catch (Exception ex) { log.Error(ex); } }
protected void btnDelete_Click(object sender, EventArgs e) { if (level != null && level.LevelID > 0) { LogActivity.Write("Delete level ", level.Name); KLLevel.Delete(level.LevelID); WebUtils.SetupRedirect(this, SiteRoot + "/News/AuthorLevelList.aspx"); } }
void grid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { bool isApplied = gridPersister.IsAppliedSortFilterOrGroup; int iCount = KLLevel.GetCount(); int startRowIndex = isApplied ? 1 : grid.CurrentPageIndex + 1; int maximumRows = isApplied ? iCount : grid.PageSize; grid.DataSource = KLLevel.GetPage(startRowIndex, maximumRows, out iCount); }
private void LoadParams() { PageId = WebUtils.ParseInt32FromQueryString("pageid", PageId); ModuleId = WebUtils.ParseInt32FromQueryString("mid", ModuleId); levelId = WebUtils.ParseInt32FromQueryString("LevelID", levelId); if (levelId > -1) { level = new KLLevel(levelId); } HideControls(); }
string UpdateLevel(int number_news) { var lstLevel = KLLevel.GetAll(); string _level = ""; int from = 0; int to = 0; int count = 1; foreach (var level in lstLevel) { from = level.From; if (int.TryParse(level.To, out to)) { to = int.Parse(level.To); } if (number_news > from && number_news <= to && count <= 1) { _level = level.Name; count++; } else if (number_news > from && number_news <= to && count <= 2) { _level = level.Name; count++; } else if (number_news > from && number_news <= to && count <= 3) { _level = level.Name; count++; } else if (number_news > from && count <= 4) { _level = level.Name; } } return(_level); }