// // GET: /Login/ public ActionResult Message() { string id = Request["id"]; TB_MessageDal.Instance.UpdateWhatWhere(new { FState = 1 }, new { FID = id }); TB_MESSAGEMODEL model = TB_MessageDal.Instance.Get(id); TB_SahowListMessageModel Model = new TB_SahowListMessageModel(); Model.FID = model.FID; Model.FDate = model.FDATE; Model.FTitle = model.FTITLE; Model.FSenderID = model.FSENDERID; Model.FReceiverID = model.FID; Model.FState = model.FSTATE; Model.FContent = Encoding.UTF8.GetString(model.FCONTENT); Model.FType = model.FTYPE; Model.FSubType = model.FSUBTYPE; Model.FBillNo = model.FBILLNO; return(View(Model)); }
//获取链表 public List <TB_SahowListMessageModel> GetAllBT_MessageModel() { TB_MessageDal Dal = new TB_MessageDal(); List <TB_MESSAGEMODEL> list = Dal.GetAll().ToList(); //select* from (select rownum rn, *from 表名 wher rownum < 20) a where a.rn > 10 //Dal.GetWhere(new { Num:0, Num:20 }); List <String> listFSenderID = new List <string>(); List <String> listFReceiverID = new List <string>(); for (int i = 0; i < list.Count; i++) { listFSenderID.Add(list[i].FSENDERID); listFReceiverID.Add(list[i].FRECEIVERID); } listFSenderID = listFSenderID.Distinct().ToList(); listFReceiverID = listFReceiverID.Distinct().ToList(); List <User> listUserModel = getAllFSenderID(listFSenderID); List <TB_OrganizationModel> listOrganizeModel = getAllReceiverID(listFReceiverID); int count = listOrganizeModel.Count > listUserModel.Count ? listOrganizeModel.Count : listUserModel.Count; List <TB_SahowListMessageModel> ListOrganizeModel = new List <TB_SahowListMessageModel>(); TB_SahowListMessageModel model; for (int i = 0; i < list.Count; i++) { model = new TB_SahowListMessageModel(); model.FID = list[i].FID; model.FDate = list[i].FDATE; model.FTitle = list[i].FTITLE; model.FSenderID = list[i].FSENDERID; model.FReceiverID = list[i].FID; model.FState = list[i].FSTATE; model.FContent = Encoding.UTF8.GetString(list[i].FCONTENT); model.FType = list[i].FTYPE; model.FSubType = list[i].FSUBTYPE; model.FBillNo = list[i].FBILLNO; ListOrganizeModel.Add(model); for (int j = 0; j < count; j++) { if (j < listUserModel.Count) { if (list[i].FSENDERID.Equals(listUserModel[j].FID)) { model.FSenderName = listUserModel[j].UserName; } } if (j < listOrganizeModel.Count) { if (list[i].FRECEIVERID.Equals(listOrganizeModel[j].FID)) { model.FReceiverName = listOrganizeModel[j].FORGNAME; } } } } return(ListOrganizeModel); }