コード例 #1
0
        /// <summary>
        /// 账单明细
        /// </summary>
        public void AccountDetail(int first, string accWays, DateTime?sd, DateTime?ed)
        {
            int rows  = 10;
            int count = 0;

            PropertyBag["cur_page_account"] = true;
            U_UserInfo logonUser = base.GetUser();

            Service.Bll.Order.AccountLogBLL abll = new TMM.Service.Bll.Order.AccountLogBLL();
            PropertyBag["sumIncome"] = abll.SumIncome(logonUser.UserId);
            //可用余额
            Service.Bll.User.MAccountBLL accBll = new TMM.Service.Bll.User.MAccountBLL();
            PropertyBag["acc"] = accBll.GetByUserId(logonUser.UserId);

            int[] accountWays = null;
            if (accWays == "receipt")
            {
                accountWays = new int[] { (int)AmountWay.In, (int)AmountWay.INCOME, (int)AmountWay.MIn, (int)AmountWay.INCOME_TG };
            }
            if (accWays == "payout")
            {
                accountWays = new int[] { (int)AmountWay.Out, (int)AmountWay.ROut };
            }
            IList <AccountLog> list = abll.GetList(logonUser.UserId, accountWays, sd, ed, first, rows, out count);
            ListPage           lp   = new ListPage((IList)list, first, rows, count);

            PropertyBag["lp"] = lp;
            PropertyBag["sd"] = sd;
            PropertyBag["ed"] = ed;
        }
コード例 #2
0
ファイル: MessageController.cs プロジェクト: uvbs/tumumi
        /// <summary>
        /// 普通消息列表
        /// </summary>
        /// <param name="direct">1:发送 2:接收</param>
        public void UserMsg(int first, int direct, string email, int userId)
        {
            //AdminService ams = Context.GetService<AdminService>();
            UserService us    = Context.GetService <UserService>();
            int         rows  = 20;
            int         count = 0;
            Hashtable   p     = new Hashtable();

            if (userId == 0 && !string.IsNullOrEmpty(email))
            {
                U_UserInfo u = us.UserInfoBll.FindUserByEmail(email);
                if (u != null)
                {
                    userId = u.UserId;
                }
            }
            if (direct == 1 && userId != 0)
            {
                p.Add("SenderId", userId);
            }
            if (direct == 2 && userId != 0)
            {
                p.Add("RecieverId", userId);
            }

            p.Add("Mtype", (int)Model.Enums.MessageType.Message);

            count = us.MessageBll.GetCount(p);
            IList <M_Message> mlist = us.MessageBll.GetList(p, null, first, rows);

            //mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            Common.ListPage lp = new TMM.Core.Common.ListPage((IList)mlist, first, rows, count);
            PropertyBag["listPage"] = lp;
        }
コード例 #3
0
        /// <summary>
        /// 我的收藏
        /// </summary>
        public void MyFav(int first, int?favCataId)
        {
            int rows = 10;

            PropertyBag["cur_page_fav"] = true;
            UserService us        = Context.GetService <UserService>();
            U_UserInfo  logonUser = base.GetUser();
            int         count     = 0;

            IList <MFavorite> list = us.MFavoriteBll.GetListByUserId(first, rows, out count, logonUser.UserId, favCataId);
            ListPage          lp   = new ListPage((IList)list, first, rows, count);

            PropertyBag["lp"] = lp;

            //未分类文档总数
            PropertyBag["unCatalogDocCount"] = us.MFavoriteBll.GetCataDocCount(logonUser.UserId, 0);

            //我的文件夹列表
            PropertyBag["folders"] = us.MCatalogBll.GetListByUser(logonUser.UserId, 2);
            if (favCataId.HasValue)
            {
                if (favCataId.Value != 0)
                {
                    MCatalog mc = us.MCatalogBll.Get(favCataId.Value);
                    PropertyBag["mc"] = mc;
                }
            }
        }
コード例 #4
0
ファイル: OrderCallBack.cs プロジェクト: uvbs/tumumi
        protected void CheckOrder(TOrder m, OrderStatus[] status, U_UserInfo u)
        {
            if (m == null)
            {
                throw new Exception("无效的订单");
            }

            bool checkStatus = false;

            foreach (OrderStatus os in status)
            {
                if (m.Status == (int)os)
                {
                    checkStatus = true;
                    break;
                }
            }
            if (!checkStatus)
            {
                throw new Exception("错误的订单状态");
            }

            if (m.UserId != u.UserId)
            {
                throw new Exception("请从正确的地址访问");
            }
        }
コード例 #5
0
        /// <summary>
        /// 我的文档
        /// </summary>
        public void MyDoc(int first, string keyword, int?userCataId)
        {
            PropertyBag["cur_page_index"] = true;
            int rows = 10;

            PropertyBag["cur_page_index"] = true;
            UserService      us        = Context.GetService <UserService>();
            U_UserInfo       logonUser = base.GetUser();
            int              count     = 0;
            IList <DDocInfo> list      = us.DocInfoBll.GetListByUser(logonUser.UserId, out count, first, rows, keyword, userCataId, null);
            ListPage         lp        = new ListPage((IList)list, first, rows, count);

            PropertyBag["lp"] = lp;
            //总文档量
            PropertyBag["allDocCount"] = count;
            //未分类文档总数
            PropertyBag["unCatalogDocCount"] = us.DocInfoBll.GetCataDocCount(logonUser.UserId, 0);
            //总浏览量
            PropertyBag["allViewCount"] = us.DocInfoBll.GetViewCount(logonUser.UserId);
            //我的文件夹列表
            PropertyBag["folders"] = us.MCatalogBll.GetListByUser(logonUser.UserId, 1);
            if (userCataId.HasValue)
            {
                if (userCataId.Value != 0)
                {
                    MCatalog mc = us.MCatalogBll.Get(userCataId.Value);
                    PropertyBag["mc"] = mc;
                }
            }

            RenderView("mydoc");
        }
コード例 #6
0
 /// <summary>
 /// 删除投稿
 /// </summary>
 /// <param name="joinId"></param>
 public void DeleteContribute(int joinId)
 {
     try
     {
         DocService  ds = Context.GetService <DocService>();
         UserService us = Context.GetService <UserService>();
         U_UserInfo  u  = base.GetUser();
         //投稿对象
         TJoinDoc tj = ds.TJoinDocBll.Get(joinId);
         if (tj.UserId != u.UserId)
         {
             throw new TmmException("操作失败,您不是该投稿的所有者");
         }
         if (tj.IsWin)
         {
             throw new TmmException("操作失败,该投稿已中标");
         }
         //删除文档
         ds.DDocInfoBll.Delete(tj.DocId);
         //删除投稿记录
         ds.TJoinDocBll.Delete(joinId);
         //更新悬赏的投稿数
         TReqDoc trDoc = ds.TReqDocBll.Get(tj.TId);
         trDoc.DocCount -= 1;
         ds.TReqDocBll.Update(trDoc);
     }
     catch (TmmException te)
     {
         AddError(te.Message);
     }
     RedirectToReferrer();
 }
コード例 #7
0
ファイル: UploadController.cs プロジェクト: uvbs/tumumi
        public void UploadSuccessReward(Guid fileId, int reqId)
        {
            DocService ds  = Context.GetService <DocService>();
            U_UserInfo u   = base.GetUser();
            DDocInfo   doc = ds.DDocInfoBll.GetByFileId(fileId);
            //更新悬赏列表的加入文档数量
            TReqDoc trdoc = ds.TReqDocBll.Get(reqId);

            trdoc.DocCount += 1;
            ds.TReqDocBll.Update(trdoc);
            //新增到加入列表
            TJoinDoc jd = new TJoinDoc()
            {
                DocId  = doc.DocId,
                TId    = reqId,
                Title  = doc.Title,
                UserId = u.UserId,
                IsWin  = false
            };

            ds.TJoinDocBll.Insert(jd);
            //转至我的投稿页面
            AddSuccess("投稿成功");
            Redirect("/my/MyContribute.do");
        }
コード例 #8
0
ファイル: HomeController.cs プロジェクト: uvbs/tumumi
        public void MyDefault()
        {
            if (!base.IsLogin)
            {
                Redirect("/index.html");
            }

            SystemService sysService = Context.GetService <SystemService>();
            DocService    ds         = Context.GetService <DocService>();
            OrderService  os         = Context.GetService <OrderService>();

            PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode();
            //大家在阅读什么
            IList <DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12);

            PropertyBag["hotList"] = hotList;

            //最新文档
            PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10);

            //阅读top 10
            //同hotList


            //新闻公告(3条系统公告)
            Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
            IList <M_Message>             mlist  = msgBll.GetSysMessageList(0, 3);

            mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            PropertyBag["messages"] = mlist;

            UserService us = Context.GetService <UserService>();
            U_UserInfo  u  = base.GetUser();

            //账户余额
            PropertyBag["accountBalance"] = us.MAccountBll.GetByUserId(u.UserId).Amount;
            //最近账单
            PropertyBag["billList"] = os.MAccountLogBll.GetList(u.UserId, 0, 3);
            //可能喜欢的文档
            //获取最近一条购买记录
            IList <MPurchase> purchaseList = us.MPurchaseBll.GetList(u.UserId, 0, 1);

            if (purchaseList == null || purchaseList.Count == 0)
            {
                PropertyBag["maybeLikeList"] = ds.DDocInfoBll.GetRecommendList(0, 12);
            }
            else
            {
                MPurchase         mp = purchaseList[0];
                Core.Search.Index si = new TMM.Core.Search.Index();
                si.TableName = "vwDocInfo";
                ArrayList maybeLike = si.SearchMaybeLike(mp.Title, 0, 12, mp.DocId);
                if (maybeLike.Count < 12)
                {
                    maybeLike.AddRange(ds.DDocInfoBll.GetRecommendList(0, 12 - maybeLike.Count).ToArray());
                }
                PropertyBag["maybeLikeList"] = maybeLike;
            }
            RenderView("LogonDefault");
        }
コード例 #9
0
ファイル: UserHelper.cs プロジェクト: uvbs/tumumi
        public static U_UserInfo GetUserById(int userId)
        {
            UserService us = new UserService();

            us.Initialize();
            U_UserInfo u = us.UserInfoBll.Get(userId);

            return(u);
        }
コード例 #10
0
ファイル: MyHeadComponent.cs プロジェクト: uvbs/tumumi
        public override void Render()
        {
            PropertyBag["isLogin"] = this.isLogin;
            UserService us = RailsContext.GetService <UserService>();
            U_UserInfo  u  = Session["logonUser"] as U_UserInfo;

            PropertyBag["newMsgCount"] = us.MessageBll.GetNewMsgCount(u.UserId);
            base.Render();
        }
コード例 #11
0
        /// <summary>
        /// 根据用户信息生成加密cookie验证字符串
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public static string GenLoginFlagStr(U_UserInfo u)
        {
            StringBuilder s = new StringBuilder();

            s.Append(u.UserId.ToString());
            s.Append(u.Email);
            s.Append(u.Password);
            return(s.ToString().ToMd5());
        }
コード例 #12
0
 /// <summary>
 /// 设置中标
 /// </summary>
 /// <param name="joinId"></param>
 public void SetZb(int joinId)
 {
     try
     {
         DocService  ds = Context.GetService <DocService>();
         UserService us = Context.GetService <UserService>();
         U_UserInfo  u  = base.GetUser();
         //投稿对象
         TJoinDoc tj = ds.TJoinDocBll.Get(joinId);
         //是否已经中标了
         if (tj.IsWin)
         {
             throw new TmmException("此投稿已经设置为中标");
         }
         //悬赏对象
         TReqDoc trDoc = ds.TReqDocBll.Get(tj.TId);
         //余额检测
         decimal ye = us.MAccountBll.GetByUserId(u.UserId).Amount;
         if (ye < trDoc.Price)
         {
             throw new TmmException("您的余额不足,请先充值");
         }
         //扣除需求方余额
         us.MAccountBll.AccountExpend(u.UserId, trDoc.Price, Utils.TmmUtils.IPAddress(), trDoc.Title);
         //为投稿人增加余额
         us.MAccountBll.AddAmount(tj.UserId, trDoc.Price, Utils.TmmUtils.IPAddress(), trDoc.Title);
         //更改原文档的owner
         DDocInfo doc = ds.DDocInfoBll.Get(tj.DocId);
         doc.UserId    = u.UserId;
         doc.IsTaskDoc = false;
         ds.DDocInfoBll.Update(doc);
         PropertyBag["doc"] = doc;
         //更改投稿文档的状态
         tj.IsWin   = true;
         tj.WinTime = DateTime.Now;
         ds.TJoinDocBll.Update(tj);
         //发送通知
         M_Message msg = new M_Message()
         {
             Mtype      = (int)Model.Enums.MessageType.Inform,
             SenderId   = ConfigHelper.AdminUserId,
             RecieverId = tj.UserId,
             Title      = "您的投稿被选中",
             IsRead     = false,
             CreateTime = DateTime.Now,
             Content    = string.Format("您的投稿【{0}】被{1}设置中标,获得收入¥{2}",
                                        tj.Title, "<a href='/home/" + u.UserId + ".html' target='_blank'>" + u.TmmDispName + "</a>"
                                        , string.Format("{0:N2}", trDoc.Price))
         };
         us.MessageBll.Insert(msg);
     }
     catch (TmmException te)
     {
         AddError(te.Message);
         RedirectToReferrer();
     }
 }
コード例 #13
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="obj">对象</param>
        /// <returns>返回:该条数据的主键Id</returns>
        public int Insert(U_UserInfo obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "U_UserInfo.Insert";

            return(SqlMapper.Instance().QueryForObject <int>(stmtId, obj));
        }
コード例 #14
0
ファイル: UserHelper.cs プロジェクト: uvbs/tumumi
        /// <summary>
        /// 格式化“回复消息”
        /// </summary>
        /// <returns></returns>
        public static string GetReplyMsg(M_Message msg, U_UserInfo sender)
        {
            string m = string.Empty;

            m = string.Format(
                "\r\n\r\n\r\n{3}以下是历史消息{3}\r\n{0},原发件人:{1}\r\n\r\n{2}",
                msg.CreateTime.ToString(), sender.TmmDispName, msg.Content,
                ConfigHelper.MsgSepChar);
            return(m);
        }
コード例 #15
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>返回:ture 成功,false 失败</returns>
        public bool Update(U_UserInfo obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "U_UserInfo.Update";
            int    result = SqlMapper.Instance().QueryForObject <int>(stmtId, obj);

            return(result > 0 ? true : false);
        }
コード例 #16
0
        /// <summary>
        /// 兑换
        /// </summary>
        public void Exchange()
        {
            PropertyBag["cur_page_account"] = true;
            OrderService os = Context.GetService <OrderService>();
            U_UserInfo   u  = base.GetUser();

            PropertyBag["amount"]      = os.MAccountBll.GetByUserId(u.UserId).Amount;
            PropertyBag["minExchange"] = ConfigHelper.MinExchange;
            PropertyBag["ratio"]       = ConfigHelper.ExchangeRatio;
            PropertyBag["exAccList"]   = os.ExchangeAccountBll.GetList(u.UserId);
        }
コード例 #17
0
        /// <summary>
        /// 接收到的消息
        /// </summary>
        public void RecieveMsg(int first)
        {
            PropertyBag["cur_page_msg"] = true;
            U_UserInfo        logonUser = base.GetUser();
            UserService       us        = Context.GetService <UserService>();
            int               count     = 0;
            IList <M_Message> mlist     = us.MessageBll.GetUserMsgList(first, 10, out count, logonUser.UserId);

            ListPage lp = new ListPage((IList)mlist, first, 10, count);

            PropertyBag["listPage"] = lp;
        }
コード例 #18
0
        public void CheckEmail(string email)
        {
            email = email.ToUrlDecode();
            UserService userService = Context.GetService <UserService>();
            U_UserInfo  u           = userService.UserInfoBll.FindUserByEmail(email);

            if (u != null)
            {
                RenderText("0");
            }
            RenderText("1");
        }
コード例 #19
0
        /// <summary>
        /// 我的投稿
        /// </summary>
        public void MyContribute(int first)
        {
            PropertyBag["cur_page_addreward"] = true;
            DocService       ds    = Context.GetService <DocService>();
            U_UserInfo       u     = base.GetUser();
            int              rows  = 10;
            int              count = 0;
            IList <TJoinDoc> list  = ds.TJoinDocBll.GetList(u.UserId, out count, first, rows);
            ListPage         lp    = new ListPage((IList)list, first, rows, count);

            PropertyBag["lp"] = lp;
        }
コード例 #20
0
        public void UpdatePwd(string oldPwd, string newPwd, string newPwdAgain)
        {
            if (Context.Request.HttpMethod.ToLower() == "post")
            {
                try
                {
                    if (string.IsNullOrEmpty(oldPwd))
                    {
                        throw new TmmException("旧密码不能为空");
                    }
                    U_UserInfo lu = base.GetUser();
                    if (oldPwd.ToMd5() == lu.Password)
                    {
                        if (string.IsNullOrEmpty(newPwd))
                        {
                            throw new TmmException("新密码不能为空");
                        }
                        if (string.IsNullOrEmpty(newPwdAgain))
                        {
                            throw new TmmException("确认新密码不能为空");
                        }
                        if (newPwd.Length < 6)
                        {
                            throw new TmmException("新密码长度不能小于6位");
                        }
                        if (newPwd != newPwdAgain)
                        {
                            throw new TmmException("两次密码输入不一致");
                        }

                        UserService us = Context.GetService <UserService>();
                        U_UserInfo  u  = us.UserInfoBll.Get(lu.UserId);
                        u.Password = newPwd.ToMd5();
                        us.UserInfoBll.Update(u);
                        Session["logonUser"] = u;
                        AddSuccess("密码修改成功");
                    }
                    else
                    {
                        throw new TmmException("旧密码不正确");
                    }
                }
                catch (TmmException te) {
                    AddError(te.Message);
                }
                RedirectToReferrer();
            }
            else
            {
                RedirectToAction("Security");
            }
        }
コード例 #21
0
        /// <summary>
        /// 我的悬赏
        /// </summary>
        public void MyReward(int first)
        {
            int rows = 10;

            PropertyBag["cur_page_addreward"] = true;
            UserService     us    = Context.GetService <UserService>();
            U_UserInfo      u     = base.GetUser();
            int             count = 0;
            IList <TReqDoc> list  = us.TReqDocBll.GetList(u.UserId, out count, first, rows);
            ListPage        lp    = new ListPage((IList)list, first, rows, count);

            PropertyBag["lp"] = lp;
        }
コード例 #22
0
        /// <summary>
        /// 回复消息
        /// </summary>
        /// <param name="mid">被回复的消息id</param>
        public void Reply(int mid)
        {
            PropertyBag["cur_page_msg"] = true;
            UserService us  = Context.GetService <UserService>();
            M_Message   msg = us.MessageBll.Get(mid);
            U_UserInfo  u   = base.GetUser();

            if (msg.RecieverId != u.UserId)
            {
                throw new TmmException("错误代码:001,您未被授权");
            }
            PropertyBag["msg"] = msg;
        }
コード例 #23
0
        /// <summary>
        /// 发送的消息
        /// </summary>
        public void SentMsg(int first)
        {
            PropertyBag["cur_page_msg"] = true;
            int               rows      = 10;
            U_UserInfo        logonUser = base.GetUser();
            UserService       us        = Context.GetService <UserService>();
            int               count     = 0;
            IList <M_Message> mlist     = us.MessageBll.GetListByUser(first, rows, out count, logonUser.UserId);
            //mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            ListPage lp = new ListPage((IList)mlist, first, rows, count);

            PropertyBag["listPage"] = lp;
        }
コード例 #24
0
        public void ExchangeList(int first, DateTime?startdate, DateTime?enddate)
        {
            int rows  = 10;
            int count = 0;

            PropertyBag["cur_page_account"] = true;
            OrderService   os   = Context.GetService <OrderService>();
            U_UserInfo     u    = base.GetUser();
            IList <TOrder> list = os.TOrderBll.GetList(u.UserId, (int)OrderType.Exchange, first, rows, out count, startdate, enddate);
            ListPage       lp   = new ListPage((IList)list, first, rows, count);

            PropertyBag["lp"] = lp;
        }
コード例 #25
0
        public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Castle.MonoRail.Framework.Controller controller)
        {
            U_UserInfo u = context.Session["logonUser"] as U_UserInfo;

            if (u == null)
            {
                Hashtable p = new Hashtable();
                p.Add("backUrl", context.Request.Uri.AbsoluteUri);
                controller.Redirect("/login", p);
                return(false);
            }
            return(true);
        }
コード例 #26
0
ファイル: AutoLoginHttpModule.cs プロジェクト: uvbs/tumumi
        void httpApplication_PreRequestHandlerExecute(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;
            HttpContext     ctx         = application.Context;

            if (!IsMonoRailRequest(ctx))    //如果不是monorail请求,直接返回
            {
                return;
            }
            if (ctx.Session == null)
            {
                return;
            }
            HttpCookie cookie = ctx.Request.Cookies["tmm"];

            if (cookie != null)
            {
                int    userId = Int32.Parse(cookie["UserId"]);
                string flag   = cookie["Flag"];
                if (ctx.Session["logonUser"] != null)
                {
                    return;
                }
                else
                {
                    try
                    {
                        U_UserInfo _logonUser = Utils.TmmUtils.CheckLoginCookie(userId, flag);

                        ctx.Session["logonUser"] = _logonUser;
                    }
                    catch (Exception ex)
                    {
                        Utils.Log4Net.Error("自动登录失败");
                        Utils.Log4Net.Error(ex);
                        ctx.Response.Cookies.Remove("tmm");
                    }
                }
            }
            else
            {
                U_UserInfo _logonUser = ctx.Session["logonUser"] as U_UserInfo;
                //if (_logonUser != null)
                //{
                //    ctx.Session.Remove("logonUser");
                //    ctx.Session.Clear();
                //}
            }
        }
コード例 #27
0
        /// <summary>
        /// 给系统发消息
        /// </summary>
        public void SendTo(int first)
        {
            PropertyBag["cur_page_msg"] = true;
            //历史消息
            U_UserInfo        logonUser = base.GetUser();
            UserService       us        = Context.GetService <UserService>();
            int               count     = 0;
            IList <M_Message> mlist     = us.MessageBll.GetListSendToAdmin(
                logonUser.UserId, ConfigHelper.AdminUserId, first, 10, out count);

            mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            ListPage lp = new ListPage((IList)mlist, first, 10, count);

            PropertyBag["listPage"] = lp;
        }
コード例 #28
0
        /// <summary>
        /// 个人中心--编辑文档
        /// </summary>
        /// <param name="docId"></param>
        public void EditDoc(int docId)
        {
            UserService us  = Context.GetService <UserService>();
            U_UserInfo  u   = base.GetUser();
            DDocInfo    doc = us.DocInfoBll.Get(docId, u.UserId);

            if (doc.IsAudit)
            {
                throw new TmmException("该文档已经发布,不能修改");
            }
            PropertyBag["doc"] = doc;
            SystemService     ss    = Context.GetService <SystemService>();
            IList <S_Catalog> cates = ss.SCatalogBll.GetTopNode();

            PropertyBag["cates"] = cates;
        }
コード例 #29
0
 /// <summary>
 /// 阅读消息
 /// readType 1:发件人阅读 2:收件人阅读
 /// </summary>
 public void ReadMsg(int mid, int readType)
 {
     PropertyBag["cur_page_msg"] = true;
     try
     {
         bool        viewFlag  = true; //如果是收件人阅读为true,发件人 阅读为false
         U_UserInfo  logonUser = base.GetUser();
         UserService us        = Context.GetService <UserService>();
         M_Message   m         = us.MessageBll.Get(mid);
         M_Message   recentMsg = null;
         if (readType == 1)
         {
             viewFlag = false;
             if (m.SenderId != logonUser.UserId)
             {
                 throw new TmmException("您不能读取此消息");
             }
         }
         else if (readType == 2)
         {
             if (m.RecieverId != logonUser.UserId)
             {
                 throw new TmmException("您不能读取此消息");
             }
         }
         else
         {
             throw new TmmException("不正确的访问路径");
         }
         //最近一条记录
         if (m.RefId.HasValue)
         {
             //recentMsg = us.MessageBll.Get(m.RefId.Value);
         }
         if (!m.IsRead && viewFlag)
         {
             m.IsRead = true;
             us.MessageBll.Update(m);
         }
         m.Content          = m.Content.ReplaceEnterStr();
         PropertyBag["msg"] = m;
         //PropertyBag["recentMsg"] = recentMsg;
     }
     catch (TmmException te) {
         PropertyBag["error"] = te.Message;
     }
 }
コード例 #30
0
        public void DoReply([DataBind("M_Message")] M_Message remsg)
        {
            bool f = true;

            try
            {
                if (string.IsNullOrEmpty(remsg.Title))
                {
                    throw new TmmException("标题不能为空");
                }
                if (string.IsNullOrEmpty(remsg.Content))
                {
                    throw new TmmException("内容不能为空");
                }
                UserService us = Context.GetService <UserService>();
                U_UserInfo  u  = base.GetUser();
                remsg.CreateTime        = DateTime.Now;
                remsg.SenderId          = u.UserId;
                remsg.Mtype             = (int)Model.Enums.MessageType.Message;
                remsg.IsRead            = false;
                remsg.SendDeleteFlag    = false;
                remsg.RecieveDeleteFlag = false;

                us.MessageBll.Insert(remsg);
                AddSuccess("发送成功");
            }
            catch (TmmException te)
            {
                f = false;
                AddError(te.Message);
            }
            catch (Exception ex)
            {
                f = false;
                Utils.Log4Net.Error(ex);
                AddError("系统错误,请重试");
            }
            Flash["remsg"] = remsg;
            if (!f)
            {
                RedirectToReferrer();
            }
            else
            {
                Redirect("/my/SentMsg.do");
            }
        }