/// <summary> /// 更新组合基金redis /// </summary> void updateFundCombinesRedis(TblFundCombines enitity, bool isDel = false) { RedisOperate redis = new RedisOperate(); List <TblFundCombines> combines = new List <TblFundCombines>(); combines.Add(enitity); redis.SetFundCombinesRedis(combines, isDel); }
/// <summary> /// 实体转换 /// </summary> /// <param name="item"></param> /// <returns></returns> private static Cache.CFundService.TblFundCombines EntityConv(TblFundCombines item) { DGBank.Cache.CFundService.TblFundCombines curItem = new Cache.CFundService.TblFundCombines(); curItem.Id = item.Id; curItem.m_create_date = item.CreateDate; curItem.m_display_field = item.DisplayField; curItem.m_display_order = item.DisplayOrder; curItem.m_funds = item.Funds; curItem.m_invest_type = item.InvestType; curItem.m_last_update_date = item.LastUpdateDate; curItem.m_min_deposit = item.MinDeposit; curItem.m_name = item.Name; curItem.m_org_code = item.OrgCode; curItem.combineType = item.CombineType; return(curItem); }
public JsonResult LinkOperate(int Id, string paramtype, int DisplayOrder, string AllIds) { switch (paramtype) { case "del": #region 除逻辑 TblFundCombines curItem = bll.GetById(Id); string delcontent = string.Format("基金组合列表:删除{0}", curItem.Name); Comm.Common.SaveLog(url, delcontent); bll.Delete(curItem); combinesRecords.DeleteByCombinesId(curItem.Id.ToString()); updateFundCombinesRedis(curItem, true); #endregion break; case "moveup": #region move up int index = AllIds.Split(',').ToList().IndexOf(Id.ToString()); int upId = int.Parse(AllIds.Split(',')[index - 1]); var content = bll.GetById(Id); content.LastUpdateDate = DateTime.Now; var upcontent = bll.GetById(upId); content.DisplayOrder = upcontent.DisplayOrder; upcontent.DisplayOrder = DisplayOrder; upcontent.LastUpdateDate = DateTime.Now; if (bll.Update(content) > 0 && bll.Update(upcontent) > 0) { List <TblFundCombines> updateList = new List <TblFundCombines>(); updateList.Add(content); updateList.Add(upcontent); updateFundCombinesRedis(updateList); string moveupcontent = string.Format("基金组合列表:上移{0}", content.Name); Comm.Common.SaveLog(url, moveupcontent); } else { return(Json(new { state = "error", message = "当前数据发生变化,请刷新网页" })); } break; #endregion case "movedown": #region move down index = AllIds.Split(',').ToList().IndexOf(Id.ToString()); int downId = int.Parse(AllIds.Split(',')[index + 1]); content = bll.GetById(Id); content.LastUpdateDate = DateTime.Now; var downcontent = bll.GetById(downId); content.DisplayOrder = downcontent.DisplayOrder; downcontent.DisplayOrder = DisplayOrder; downcontent.LastUpdateDate = DateTime.Now; if (bll.Update(content) > 0 && bll.Update(downcontent) > 0) { List <TblFundCombines> updateList = new List <TblFundCombines>(); updateList.Add(content); updateList.Add(downcontent); updateFundCombinesRedis(updateList); string movedowncontent = string.Format("基金组合列表:下移{0}", content.Name); Comm.Common.SaveLog(url, movedowncontent); } else { return(Json(new { state = "error", message = "当前数据发生变化,请刷新网页" })); } #endregion break; case "top": if (Session["Combine_TopOrder"] == null) { return(Json(new { state = "error", message = "连接已断开,请刷新网页" })); } #region top int topDisOrder = int.Parse(Session["Combine_TopOrder"].ToString()); var topcontent = bll.GetById(Id); topcontent.DisplayOrder = topDisOrder - 1; topcontent.LastUpdateDate = DateTime.Now; if (bll.Update(topcontent) > 0) { updateFundCombinesRedis(topcontent); string toplogcontent = string.Format("基金组合列表:置顶{0}", topcontent.Name); Comm.Common.SaveLog(url, toplogcontent); } else { return(Json(new { state = "error", message = "当前数据发生变化,请刷新网页" })); } #endregion break; default: return(Json(new { state = "error", message = "操作类型不存在" })); //case "history": // hfCombinesID.Value = id; // ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>RecordsList();</script>"); //获取调仓历史记录 // break; } return(Json(new { state = "success", message = "成功" })); }