//public DataTable SelBy(int status, string flow, string skey) //{ // List<SqlParameter> sp = new List<SqlParameter>(); // string where = "1=1 "; // if (status != -100) { where += " AND Status=" + status; } // if (!string.IsNullOrEmpty(skey)) { where += " AND Tittle LIKE @skey"; sp.Add(new SqlParameter("skey", "%" + skey + "%")); } // if (!string.IsNullOrEmpty(flow)) { where += " AND Flow =@flow"; sp.Add(new SqlParameter("flow", flow)); } // return DBCenter.Sel(TbName, where, PK + " DESC", sp); //} /// <summary> /// 使用该版词条替代原有的词条 /// </summary> public void Apply(int id) { B_Baike bkBll = new B_Baike(); M_BaikeEdit source = SelReturnModel(id); M_Baike target = bkBll.SelModelByFlow(source.Flow); ConverToEdit(target, source, "all"); target.Status = 1; bkBll.UpdateByID(target); }
public ActionResult AddToFav() { M_Favorite favMod = new M_Favorite(); favMod.InfoID = DataConvert.CLng(Request["infoID"]); favMod.Owner = mu.UserID; favMod.AddDate = DateTime.Now; favMod.FavoriType = DataConvert.CLng(Request.Form["type"], 1); //--------------------------- favMod.FavItemID = ""; favMod.Title = HttpUtility.HtmlEncode(Request["title"]); favMod.FavUrl = Request.Form["url"]; switch (favMod.FavoriType) { case 1: case 3: { M_CommonData conMod = conBll.SelReturnModel(favMod.InfoID); if (conMod == null) { err = "内容ID[" + favMod.InfoID + "]不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = conMod.Title; } } break; case 2: { M_Product proMod = proBll.GetproductByid(favMod.InfoID); if (proMod == null) { err = "商品不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = proMod.Proname; } } break; case 4: { B_Ask askBll = new B_Ask(); M_Ask askMod = askBll.SelReturnModel(favMod.InfoID); if (askMod == null) { err = "问题不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = StringHelper.SubStr(askMod.Qcontent); } } break; case 5: { B_Baike bkBll = new B_Baike(); M_Baike bkMod = bkBll.SelReturnModel(favMod.InfoID); if (bkMod == null) { err = "百科不存在"; break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = bkMod.Tittle; } } break; } if (string.IsNullOrEmpty(favMod.Title)) { favMod.Title = "无标题"; } if (favMod.InfoID < 1) { err = "未指定内容ID"; } else if (favMod.Owner < 1) { err = "用户未登录"; } else { favBll.insert(favMod); } ViewBag.err = err; return(View()); }