public ActionResult Edit(EmailReturnType obj)
 {
     try
     {
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public EmailReturnType GetById(int Id)
        {
            EmailReturnType obj = NSession.Get <EmailReturnType>(Id);

            if (obj == null)
            {
                throw new Exception("返回实体为空");
            }
            else
            {
                return(obj);
            }
        }
Esempio n. 3
0
        public ActionResult EmailRe(int id)
        {
            EmailType       obj = GetById(id);
            EmailReturnType ob  = new EmailReturnType {
                REmail = obj.BuyerEmail, Subject = "Re:" + obj.Subject
            };

            ViewData["sub"]   = obj.Subject;
            ViewData["con"]   = obj.Content;
            ViewData["eid"]   = obj.Id;
            ViewData["Reply"] = obj.IsReply;
            return(View(ob));
        }
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         EmailReturnType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 5
0
        public JsonResult EmailRe(EmailReturnType obj)
        {
            try
            {
                DateTime ReTime = DateTime.Now;
                SendMail(obj.REmail, obj.Subject, obj.Content);
                obj.CreateOn = ReTime;
                obj.CreateBy = ReTime;

                NSession.Save(obj);
                IList <EmailType> mail = NSession.CreateQuery("from EmailType c where c.Id=:id").SetInt32("id", obj.EId).List <EmailType>();
                mail[0].IsReply = 1;
                mail[0].ReplyOn = ReTime;
                NSession.Update(mail[0]);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
        public ActionResult Edit(int id)
        {
            EmailReturnType obj = GetById(id);

            return(View(obj));
        }