public ActionResult Delete(int id) { AjaxResult result = new AjaxResult(); try { PublicationClass entity = m_FTISService.GetPublicationClassById(id); //檢查底下的Publication數量 IDictionary<string, string> conditions = new Dictionary<string, string>(); conditions.Add("PublicationClassId", id.ToString()); int subsCount = m_FTISService.GetPublicationCount(conditions); if (subsCount > 0) { return this.Json(new AjaxResult(AjaxResultStatus.Fail, string.Format("{0}底下尚有刊物,不可刪除。", entity.Name))); } m_FTISService.DeletePublicationClass(entity); result.ErrorCode = AjaxResultStatus.Success; result.Message = string.Format("{0}刪除成功", entity.Name); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Exception; result.Message = ex.Message; } return this.Json(result); }
public ActionResult Delete(int id) { AjaxResult result = new AjaxResult(); try { if (id.Equals(1)) { throw new Exception("admin不可刪除!"); } MasterMember entity = m_FTISService.GetMasterMemberById(id); m_FTISService.DeleteMasterMember(entity); result.ErrorCode = AjaxResultStatus.Success; result.Message = string.Format("{0}刪除成功", entity.Name); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Exception; result.Message = ex.Message; } return this.Json(result); }
public ActionResult Delete(int id) { AjaxResult result = new AjaxResult(); try { Links entity = m_FTISService.GetLinksById(id); m_FTISService.DeleteLinks(entity); result.ErrorCode = AjaxResultStatus.Success; result.Message = string.Format("{0}刪除成功", entity.Name); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Exception; result.Message = ex.Message; } return this.Json(result); }
public ActionResult Delete(int id) { AjaxResult result = new AjaxResult(); try { TemplateVO entity = m_FTISService.GetTemplateById(Convert.ToInt32(id)); entity.Flag = 0; m_FTISService.UpdateTemplate(entity); result.ErrorCode = AjaxResultStatus.Success; result.Message = string.Format("{0}刪除成功", entity.Name); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Exception; result.Message = ex.Message; } return this.Json(result); }
public ActionResult MultiDelete(string allId) { AjaxResult result = new AjaxResult(AjaxResultStatus.Success, string.Empty); StringBuilder sbMsg = new StringBuilder(); string[] ids = allId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string id in ids) { try { MasterLog entity = m_FTISService.GetMasterLogById(Convert.ToInt32(id)); m_FTISService.DeleteMasterLog(entity); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Fail; sbMsg.AppendFormat(ex.Message + "<br/>"); } } result.Message = sbMsg.ToString(); return this.Json(result); }
public ActionResult SetSort(string entityId, string sortValue) { AjaxResult result = new AjaxResult(AjaxResultStatus.Success, string.Empty); StringBuilder sbMsg = new StringBuilder(); try { Activity entity = m_FTISService.GetActivityById(Convert.ToInt32(entityId)); entity.SortId = int.Parse(sortValue); m_FTISService.UpdateActivity(entity); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Fail; sbMsg.AppendFormat(ex.Message + "<br/>"); } result.Message = sbMsg.ToString(); return this.Json(result); }
public ActionResult SetIsHome(string entityId, string checkedValue) { AjaxResult result = new AjaxResult(AjaxResultStatus.Success, string.Empty); StringBuilder sbMsg = new StringBuilder(); try { News entity = m_FTISService.GetNewsById(Convert.ToInt32(entityId)); entity.IsHome = checkedValue; m_FTISService.UpdateNews(entity); } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Fail; sbMsg.AppendFormat(ex.Message + "<br/>"); } result.Message = sbMsg.ToString(); return this.Json(result); }
public ActionResult MultiDelete(string allId) { AjaxResult result = new AjaxResult(AjaxResultStatus.Success, string.Empty); StringBuilder sbMsg = new StringBuilder(); string[] ids = allId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string id in ids) { try { PublicationClass entity = m_FTISService.GetPublicationClassById(Convert.ToInt32(id)); //檢查底下的Publication數量 IDictionary<string, string> conditions = new Dictionary<string, string>(); conditions.Add("PublicationClassId", id.ToString()); int subsCount = m_FTISService.GetPublicationCount(conditions); if (subsCount == 0) { m_FTISService.DeletePublicationClass(entity); } else { result.ErrorCode = AjaxResultStatus.Fail; sbMsg.AppendFormat("{0},底下尚有刊物,不可刪除。<br/>", entity.Name); } } catch (Exception ex) { result.ErrorCode = AjaxResultStatus.Fail; sbMsg.AppendFormat(ex.Message + "<br/>"); } } result.Message = sbMsg.ToString(); return this.Json(result); }