/// <summary> /// 项目转化接口 /// </summary> /// <param name="xm_id">项目ID</param> /// <param name="xm_name">项目名称</param> /// <param name="xm_type">项目类型(参考枚举)</param> /// <param name="xm_summary">项目描述</param> /// <returns></returns> public static bool TransformatFromXM(int xm_id, string xm_name, int xm_type, string xm_summary) { using(GGZBTQPT_PRO.Models.GGZBTQPTDBContext db = new GGZBTQPT_PRO.Models.GGZBTQPTDBContext()) { try { T_XM_Case t_xm_case = new T_XM_Case(); t_xm_case.GenerateFromID = xm_id; t_xm_case.Type = xm_type; t_xm_case.GenerateType = (int)GenerateTypes.FromSystem; t_xm_case.Name = xm_name; t_xm_case.Summary = xm_summary; t_xm_case.Analysis = "无"; t_xm_case.CreatedAt = DateTime.Now; t_xm_case.UpdatedAt = DateTime.Now; db.T_XM_Case.Add(t_xm_case); db.SaveChanges(); return true; } catch { return false; } } }
public static bool SendMessageFromManage(T_HY_Member receive_member, string content, string title) { using(GGZBTQPT_PRO.Models.GGZBTQPTDBContext db = new GGZBTQPT_PRO.Models.GGZBTQPTDBContext()) { try { T_HY_Member send_member = db.T_HY_Member.Find(9999); T_HY_Message message = new T_HY_Message(); message.RelateID = 0; message.Content = content; message.SendMember = send_member; message.ReceiveMember = receive_member; message.Title = title; db.T_HY_Message.Add(message); db.SaveChanges(); return true; } catch { return false; } } }
//在Action执行之后执行 public override void OnActionExecuted(ActionExecutedContext filterContext) { //更新用户的操作时间,写入用户的在线记录 if(filterContext.HttpContext.Session["OnlineID"] != null) { using(GGZBTQPTDBContext db = new GGZBTQPTDBContext()) { T_ZC_OnlineLog online_log = db.T_ZC_OnlineLog.Find(Convert.ToInt32(filterContext.HttpContext.Session["OnlineID"].ToString())); online_log.LoginOutDate = DateTime.Now; db.SaveChanges(); } } base.OnActionExecuted(filterContext); }