/// <summary> /// 非咨询页面 /// </summary> /// <returns></returns> public ActionResult FalseConsultPage() { ViewData["IsHasFunRole"] = _roleManager.IsHasFunRole(EmployeeBase.e_ID, "001002001"); //是否拥有管理的权限 Model.NewsBase nb = new Model.NewsBase(); this.ViewData["otype"] = RequestBase.GetString("otype"); this.ViewData["mid"] = RequestBase.GetString("mid"); ViewData["n_id"] = RequestBase.GetString("n_id"); switch (RequestBase.GetString("otype")) { case "modify": string id = RequestBase.GetString("n_id"); nb = newsbll.GetModel(int.Parse(id)); ViewData["picurl"] = nb.n_PicUrl; return View(nb); } return View(); }
/// <summary> /// 添加友情链接方法 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult YouQingAdd(Model.NewsBase model) { bool result = false; Model.MenuBase mb = new Model.MenuBase(); try { if (Request.Form["txbotype"] == "add") { Model.NewsBase nb = new Model.NewsBase(); nb.m_ID = new Guid(RequestBase.GetString("mid").ToString());//菜单id nb.n_CreatedBy = base.EmployeeBase.e_ID; nb.n_RedirectUrl = model.n_RedirectUrl; nb.n_Sort = model.n_Sort; nb.n_Title = model.n_Title; result = newsbll.Add(nb) > 0 ? true : false; } else { Guid userid = base.EmployeeBase.e_ID;//用户id Model.NewsBase nb = newsbll.GetModel(model.n_ID); nb.n_Title = model.n_Title; nb.n_RedirectUrl = model.n_RedirectUrl; nb.n_Sort = model.n_Sort; nb.n_Synopsis = model.n_Synopsis; result = newsbll.Update(nb); } if (result) { return Content(DWZUtil.GetResultJson("200", "操作成功!!", "w_友情链接", "", "closeCurrent")); } else { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } } catch { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } }
public ActionResult NewsBaseYouQingLinkAdd() { Model.NewsBase nb = new Model.NewsBase(); this.ViewData["otype"] = RequestBase.GetString("otype"); this.ViewData["mid"] = RequestBase.GetString("mid"); switch (RequestBase.GetString("otype")) { case "modify": string nid = RequestBase.GetString("n_ID"); Model.NewsBase model = new BLL.NewsBase().GetModel(int.Parse(nid)); return View(model); default: break; } return View(); }
public ActionResult Save(Model.NewsBase model) { bool result = false; Model.MenuBase mb = new Model.MenuBase(); try { if (Request.Form["txbotype"] == "add") { Model.NewsBase nb = new Model.NewsBase(); //根据菜单id得到菜单名称供返回 mb = mebll.GetModel(new Guid(RequestBase.GetString("mid"))); //menuBase.m_ID = Guid.NewGuid(); nb.m_ID = new Guid(RequestBase.GetString("mid").ToString());//菜单id nb.n_Content = model.n_Content; nb.n_CreatedBy = base.EmployeeBase.e_ID; nb.n_PicUrl = Request.Form["FileInputEId"].ToString(); nb.n_QRCode = model.n_QRCode; nb.n_RedirectUrl = model.n_RedirectUrl; nb.n_Sort = model.n_Sort; nb.n_Title = model.n_Title; nb.n_Writer = base.EmployeeBase.e_MingC; result = newsbll.Add(nb) > 0 ? true : false; } else { Guid userid = base.EmployeeBase.e_ID;//用户id Model.NewsBase nb = newsbll.GetModel(model.n_ID); nb.n_Title = model.n_Title; nb.n_RedirectUrl = model.n_RedirectUrl; nb.n_QRCode = model.n_QRCode; nb.n_Sort = model.n_Sort; nb.n_PicUrl = Request.Form["FileInputEId"].ToString(); nb.n_Content = model.n_Content; nb.n_CreatedBy = userid; nb.n_Writer = base.EmployeeBase.e_MingC; result = newsbll.Update(nb); } if (result) { return Content(DWZUtil.GetResultJson("200", "操作成功!!", "w_" + mb.m_MingCh, "", "closeCurrent")); } else { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } } catch { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.NewsBase GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,m_ID,n_Title,n_Synopsis,n_Content,n_PicUrl,n_RedirectUrl,n_QRCode,n_IsTop,n_Sort,n_Source,n_Writer,n_CreatedOn,n_CreatedBy,n_ModifyOn,n_StatusCode,n_IsDel from NewsBase "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int,4) }; parameters[0].Value = n_ID; Model.NewsBase model = new Model.NewsBase(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["n_ID"] != null && ds.Tables[0].Rows[0]["n_ID"].ToString() != "") { model.n_ID = int.Parse(ds.Tables[0].Rows[0]["n_ID"].ToString()); } if (ds.Tables[0].Rows[0]["m_ID"] != null && ds.Tables[0].Rows[0]["m_ID"].ToString() != "") { model.m_ID = new Guid(ds.Tables[0].Rows[0]["m_ID"].ToString()); } if (ds.Tables[0].Rows[0]["n_Title"] != null && ds.Tables[0].Rows[0]["n_Title"].ToString() != "") { model.n_Title = ds.Tables[0].Rows[0]["n_Title"].ToString(); } if (ds.Tables[0].Rows[0]["n_Synopsis"] != null && ds.Tables[0].Rows[0]["n_Synopsis"].ToString() != "") { model.n_Synopsis = ds.Tables[0].Rows[0]["n_Synopsis"].ToString(); } if (ds.Tables[0].Rows[0]["n_Content"] != null && ds.Tables[0].Rows[0]["n_Content"].ToString() != "") { model.n_Content = ds.Tables[0].Rows[0]["n_Content"].ToString(); } if (ds.Tables[0].Rows[0]["n_PicUrl"] != null && ds.Tables[0].Rows[0]["n_PicUrl"].ToString() != "") { model.n_PicUrl = ds.Tables[0].Rows[0]["n_PicUrl"].ToString(); } if (ds.Tables[0].Rows[0]["n_RedirectUrl"] != null && ds.Tables[0].Rows[0]["n_RedirectUrl"].ToString() != "") { model.n_RedirectUrl = ds.Tables[0].Rows[0]["n_RedirectUrl"].ToString(); } if (ds.Tables[0].Rows[0]["n_QRCode"] != null && ds.Tables[0].Rows[0]["n_QRCode"].ToString() != "") { model.n_QRCode = ds.Tables[0].Rows[0]["n_QRCode"].ToString(); } if (ds.Tables[0].Rows[0]["n_IsTop"] != null && ds.Tables[0].Rows[0]["n_IsTop"].ToString() != "") { model.n_IsTop = Convert.ToBoolean(ds.Tables[0].Rows[0]["n_IsTop"].ToString()); } if (ds.Tables[0].Rows[0]["n_Sort"] != null && ds.Tables[0].Rows[0]["n_Sort"].ToString() != "") { model.n_Sort = int.Parse(ds.Tables[0].Rows[0]["n_Sort"].ToString()); } if (ds.Tables[0].Rows[0]["n_Source"] != null && ds.Tables[0].Rows[0]["n_Source"].ToString() != "") { model.n_Source = ds.Tables[0].Rows[0]["n_Source"].ToString(); } if (ds.Tables[0].Rows[0]["n_Writer"] != null && ds.Tables[0].Rows[0]["n_Writer"].ToString() != "") { model.n_Writer = ds.Tables[0].Rows[0]["n_Writer"].ToString(); } if (ds.Tables[0].Rows[0]["n_CreatedOn"] != null && ds.Tables[0].Rows[0]["n_CreatedOn"].ToString() != "") { model.n_CreatedOn = Convert.ToDateTime(ds.Tables[0].Rows[0]["n_CreatedOn"].ToString()); } if (ds.Tables[0].Rows[0]["n_StatusCode"] != null && ds.Tables[0].Rows[0]["n_StatusCode"].ToString() != "") { model.n_StatusCode = int.Parse(ds.Tables[0].Rows[0]["n_StatusCode"].ToString()); } if (ds.Tables[0].Rows[0]["n_IsDel"] != null && ds.Tables[0].Rows[0]["n_IsDel"].ToString() != "") { model.n_IsDel = Convert.ToBoolean(ds.Tables[0].Rows[0]["n_IsDel"].ToString()); } return model; } else { return new Model.NewsBase(); } }