public static ListModuleService Create(ListMethodType methodType) { ListModuleService listManageModule; switch (methodType) { case ListMethodType.NEWS: listManageModule = new NewsModule(); break; case ListMethodType.PRODUCT: listManageModule = new ProductModule(); break; case ListMethodType.PRODUCTKIND: listManageModule = new ProductKindModule(); break; case ListMethodType.WORKS: listManageModule = new WorksModule(); break; case ListMethodType.AGENT: listManageModule = new AgentModule(); break; default: listManageModule = null; break; } return(listManageModule); }
public ActionResult NewsSave(FormCollection form) { int?ID = Convert.ToInt32(form["pageId"]); int identityId = 0; using (var module = new NewsModule()) { identityId = module.DoSaveData(form, ID); } return(RedirectToAction("NewsEdit", new { ID = identityId })); }
public void InitCallsRunOnNewsController() { MockUnityResolver container = new MockUnityResolver(); var controller = new MockNewsController(); container.Bag.Add(typeof(INewsController), controller); var newsModule = new NewsModule(container); newsModule.Initialize(); Assert.IsTrue(controller.RunCalled); }
private void judgeagain(NewsModule imodule, string ContentID) { NewsModule lawmoduel = NewsModule.SelectByName("政策法规"); if (imodule.WBS.ToString().Substring(0, 36) == lawmoduel.Id.ToString()) { Response.Redirect("../Laws/LawDetailShow.aspx?LawContentID=" + ContentID); } else { Response.Redirect("../News/NewsInfo.aspx?id=" + ContentID); } }
public ActionResult List(int?page) { NewsListViewModel model = new NewsListViewModel(); model.Filter.CurrentPage = page ?? 1; using (var module = new NewsModule()) { model.Result = module.DoGetList(model.Filter); model.Result.Data = model.Result.Data.Where(o => o.DISABLE == false).ToList(); } return(View(model)); }
public ActionResult NewsEdit(int?ID) { if (!ID.HasValue) { return(RedirectToAction("NewsList")); } NewsDetailsDataModel model = new NewsDetailsDataModel(); using (var module = new NewsModule()) { model = module.DoGetDetailsByID((int)ID); } return(View(model)); }
public ActionResult NewsList(int?page, string qry, string sort, string disHome, string disable, string pDate) { NewsListViewModel model = new NewsListViewModel(); model.Filter.CurrentPage = page ?? 1; model.Filter.QueryString = qry ?? string.Empty; model.Filter.SortColumn = sort ?? string.Empty; model.Filter.Disable = disable ?? string.Empty; model.Filter.DisplayForHomePage = disHome ?? string.Empty; model.Filter.PublishDate = pDate ?? string.Empty; using (var module = new NewsModule()) { model.Result = module.DoGetList(model.Filter); } return(View(model)); }
public ActionResult Content(int?ID) { if (!ID.HasValue) { return(RedirectToAction("List")); } NewsDetailsDataModel model = new NewsDetailsDataModel(); using (var module = new NewsModule()) { model = module.DoGetDetailsByID((int)ID); if (model.Data == null) { return(RedirectToAction("List")); } model.Data.CONTENT = HttpUtility.HtmlDecode(model.Data.CONTENT); } return(View(model)); }
public static ListBaseModule Create(ListMethodType methodType) { ListBaseModule listManageModule = null; switch (methodType) { case ListMethodType.NEWS: listManageModule = new NewsModule <ListFilterBase, NEWS>(); break; case ListMethodType.PRODUCT: listManageModule = new ProductsModule <ListFilterBase, PRODUCT>(); break; default: listManageModule = null; break; } return(listManageModule); }
public JsonResult NewsDelete(int?ID) { bool success = true; string messages = string.Empty; try { using (var module = new NewsModule()) { module.DoDeleteByID((int)ID); } messages = "刪除成功"; } catch (Exception ex) { success = false; messages = ex.Message; } var resultJson = Json(new { success = success, messages = messages }); return(resultJson); }
public NewsContent GetEnrollSingleTon(NewsModule moduleAdmission) { IList<Core.Business.NewsContent> newsContentlist = new List<Core.Business.NewsContent>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@moduleid", SqlDbType.UniqueIdentifier, moduleAdmission.Id); SqlDataReader reader = sql.ExecuteSqlReader(Sql_GetEnrollSingleTon); Core.Business.NewsContent newsContent = null; if (reader != null && !reader.IsClosed && reader.Read()) { newsContent = new Core.Business.NewsContent(); if (!reader.IsDBNull(0)) newsContent.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) newsContent.ModuleID = reader.GetGuid(1); if (!reader.IsDBNull(2)) newsContent.Title = reader.GetString(2); if (!reader.IsDBNull(3)) newsContent.Content = reader.GetString(3); if (!reader.IsDBNull(4)) newsContent.PublishTime = reader.GetDateTime(4); if (!reader.IsDBNull(5)) newsContent.Tag = reader.GetInt32(5); if (!reader.IsDBNull(6)) newsContent.Annex = reader.GetInt32(6); if (!reader.IsDBNull(7)) newsContent.Status = reader.GetInt32(7); if (!reader.IsDBNull(8)) newsContent.Source = reader.GetString(8); if (!reader.IsDBNull(9)) newsContent.Author = reader.GetString(9); if (!reader.IsDBNull(10)) newsContent.Checker = reader.GetString(10); if (!reader.IsDBNull(11)) newsContent.CheckTime = reader.GetDateTime(11); if (!reader.IsDBNull(12)) newsContent.Index = reader.GetInt32(12); if (!reader.IsDBNull(13)) newsContent.Traffic = reader.GetInt64(13); if (!reader.IsDBNull(14)) newsContent.SortTime = reader.GetDateTime(14); if (!reader.IsDBNull(15)) newsContent.ImgUrl = reader.GetString(15); newsContent.MarkOld(); reader.Close(); } return newsContent; }
private void GetNoticeList(string NoticeWhere) { NewsModule gotNoticeModule = NewsModule.NewsModuleWhere(NoticeWhere); if (gotNoticeModule != null && !gotNoticeModule.IsNew) { System.Guid SubNoticeModuleID = gotNoticeModule.Id; string sqlwhere = "ModuleID ='" + SubNoticeModuleID + "'"; sqlwhere = sqlwhere + " and Status = '2'"; List<NewsContent> gotNewsContentList = NewsContent.GetSqlWhere(sqlwhere) as List<NewsContent>; if (gotNewsContentList != null && gotNewsContentList.Count!=0) { gotNewsContentList = gotNewsContentList.Take(14).ToList(); noticeList = gotNewsContentList; //this.RpNotice.DataSource = gotNewsContentList; //this.RpNotice.DataBind(); } } else { NewsModule creatmodule = new NewsModule(); creatmodule.Name = "通知"; creatmodule.Center = 2; creatmodule.Site = new Guid(SubCenterID); creatmodule.AddTime = DateTime.Now; creatmodule.CheckStatus = 1; creatmodule.News = 0; creatmodule.Index = 9; creatmodule.Save(); } }
/// <summary> /// 得到该分中心发表状态新闻列表 /// </summary> /// <param name="p"></param> private void GetNewsList(string SQLWhere) { try { NewsModule gotNewsModule = NewsModule.NewsModuleWhere(SQLWhere); if (gotNewsModule != null && !gotNewsModule.IsNew) { System.Guid SubNewsModuleID = gotNewsModule.Id; string sqlwhere = "ModuleID ='" + SubNewsModuleID + "'"; sqlwhere = sqlwhere + " and Status = '2'"; List<NewsContent> gotNewsContentList = NewsContent.GetSqlWhere(sqlwhere) as List<NewsContent>; if (gotNewsContentList != null && gotNewsContentList.Count != 0) { gotNewsContentList = gotNewsContentList.Take(14).ToList(); newsList = gotNewsContentList; //this.RpNews.DataSource = gotNewsContentList; //this.RpNews.DataBind(); } } else { NewsModule creatmodule = new NewsModule(); creatmodule.Name = "新闻"; creatmodule.Center = 2; creatmodule.Site = new Guid( SubCenterID); creatmodule.AddTime = DateTime.Now; creatmodule.CheckStatus = 1; creatmodule.News = 0; creatmodule.Index = 10; creatmodule.Save(); } } catch (Exception ex) { //throw ex; Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');window.location = '../Default.aspx'</script>"); return; } }
private void GetMessage(string SQLWhere) { NewsModule workmodule = NewsModule.NewsModuleWhere(SQLWhere); if (workmodule != null) { List<NewsContent> submessage = new List<NewsContent>(); System.Guid workModuleID = workmodule.Id; string sqlwhere = "ModuleID ='" + workModuleID + "'"; sqlwhere = sqlwhere + " and Status = '2'"; List<NewsContent> gotNewsContentList = NewsContent.GetSqlWhere(sqlwhere) as List<NewsContent>; if (gotNewsContentList != null && gotNewsContentList.Count != 0) { gotNewsContentList = gotNewsContentList.Take(8).ToList(); this.RpMessage.DataSource = gotNewsContentList; this.RpMessage.DataBind(); } } else { NewsModule creatmodule = new NewsModule(); creatmodule.Name = "工作动态"; creatmodule.Center = 2; creatmodule.Site = new Guid(SubCenterID); creatmodule.AddTime = DateTime.Now; creatmodule.CheckStatus = 1; creatmodule.News = 0; creatmodule.Index = 9; creatmodule.Save(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string result = string.Empty; if (context.Request.Params["name"] == null) { result = "{success:false,msg:'name不能为空'}"; } if (context.Request.Params["pId"] == null) { result = "{success:false,msg:'父模块不能为空'}"; } else { try { Guid pID = new Guid(context.Request.Params["pId"].ToString()); NewsModule NM = NewsModule.Load(pID); if (NM != null) { string name = context.Request.Params["name"].ToString();//名称 List<NewsModule> listT = NewsModule.GetAllNewsModule() as List<NewsModule>; var resTemp = from sTemp in listT where sTemp.WBS.Contains(".") select sTemp; var res = from s in resTemp.ToList<NewsModule>() where s.Name == name select s; if (res.ToList<NewsModule>() != null && (res.ToList<NewsModule>()).Count > 0) { result = "{success:false,msg:'name不能重复'}"; } else { int stype = int.Parse(context.Request.Params["type"].ToString());//类型(单/双页面) //Guid site = NM.Site; //站点 int sindex = int.Parse(context.Request.Params["sindex"].ToString());//排序 int isCenter = NM.Center;//是否中心 int isCheck = NM.CheckStatus;//是否审核 int isNew = NM.News;//是否新闻模块 NewsModule newsModule = new NewsModule(); newsModule.Name = name; //newsModule.Site = site; newsModule.TypeID = stype; newsModule.Index = sindex; newsModule.Center = isCenter; newsModule.CheckStatus = isCheck; newsModule.News = isNew; newsModule.AddTime = System.DateTime.Now; //CY.GFive.Core.Business.StaffInfo userSession = context.Session["User"] as CY.GFive.Core.Business.StaffInfo; newsModule.AddPerson = "admin"; //userSession.Name;// newsModule.Save(); NewsModule nM2 = NewsModule.Load(newsModule.Id); nM2.WBS = NM.Id.ToString() + "." + newsModule.Id.ToString(); nM2.Save(); result = "{success:true}"; } } } catch (Exception ex) { result = "{success:false,msg:'" + ex.Message + "'}"; } } context.Response.Write(result); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string result = string.Empty; if (context.Request.Params["name"] == null) { result = "{success:false,msg:'name不能为空'}"; } else { try { string name = context.Request.Params["name"].ToString();//名称 List<NewsModule> listT = NewsModule.GetNewsModuleList(" Center=1") as List<NewsModule>; var resTemp = from sTemp in listT where (!sTemp.WBS.Contains(".")) select sTemp; var res = from s in resTemp.ToList<NewsModule>() where s.Name == name select s; if (res.ToList<NewsModule>() != null && (res.ToList<NewsModule>()).Count > 0) { result = "{success:false,msg:'name不能重复'}"; } else { int isCenter = 0; int stype = 0; if (name == "服务指南") { isCenter = 1;//中心 stype=2;//单页面 } else { isCenter = int.Parse(context.Request.Params["isCenter"].ToString());//是否中心 stype = int.Parse(context.Request.Params["type"].ToString());//类型(单/双页面) } //Guid site = new Guid(context.Request.Params["site"].ToString());//站点 int sindex = int.Parse(context.Request.Params["sindex"].ToString());//排序 int isCheck = int.Parse(context.Request.Params["isCheck"].ToString());//是否审核 int isNew = 0;//是否新闻模块 if (context.Request.Params["isNew"] != null && (!string.IsNullOrEmpty(context.Request.Params["isNew"].ToString()))) { isNew = int.Parse(context.Request.Params["isNew"].ToString()); } NewsModule newsModule = new NewsModule(); newsModule.Name = name; //newsModule.Site = site; newsModule.TypeID = stype; newsModule.Index = sindex; newsModule.Center = isCenter; newsModule.CheckStatus = isCheck; newsModule.News = isNew; newsModule.AddTime = System.DateTime.Now; CY.CSTS.Core.Business.User userSession = context.Session["User"] as CY.CSTS.Core.Business.User; newsModule.AddPerson = userSession.UserID;// "u";//session["userName"]; newsModule.Save(); NewsModule nM = NewsModule.Load(newsModule.Id); nM.WBS = newsModule.Id.ToString(); nM.Save(); result = "{success:true}"; } } catch (Exception ex) { result = "{success:false,msg:'"+ex.Message+"'}"; } } context.Response.Write(result); }
private void checknewsnotice(string Subcenter) { UnitInfo unit=UnitInfo.Load(new Guid(Session["UnitID"].ToString())); if (unit != null && !unit.IsNew) { NewsModule snewsmodule = NewsModule.NewsModuleWhere(Subcenter + " and Name='新闻'"); if (snewsmodule != null && !snewsmodule.IsNew) { } else { NewsModule creatmodule = new NewsModule(); creatmodule.Name = "新闻"; creatmodule.Center = 2; creatmodule.Site = new Guid(Session["UnitID"].ToString()); creatmodule.AddTime = DateTime.Now; creatmodule.CheckStatus = 1; creatmodule.Index = 10; creatmodule.News = 0; creatmodule.Save(); } NewsModule snoticemodule = NewsModule.NewsModuleWhere(Subcenter + " and Name='通知'"); if (snoticemodule != null && !snoticemodule.IsNew) { } else { NewsModule creatmodule = new NewsModule(); creatmodule.Name = "通知"; creatmodule.Center = 2; creatmodule.Site = new Guid(Session["UnitID"].ToString()); creatmodule.AddTime = DateTime.Now; creatmodule.CheckStatus = 1; creatmodule.Index = 9; creatmodule.News = 0; creatmodule.Save(); } NewsModule workmodule = NewsModule.NewsModuleWhere(Subcenter + " and Name='工作动态'"); if (workmodule != null) { } else { NewsModule creatmodule = new NewsModule(); creatmodule.Name = "工作动态"; creatmodule.Center = 2; creatmodule.Site = new Guid(Session["UnitID"].ToString()); creatmodule.AddTime = DateTime.Now; creatmodule.CheckStatus = 1; creatmodule.Index = 9; creatmodule.News = 0; creatmodule.Save(); } } }