コード例 #1
0
 public JsonResult Create(EmailMessageType obj)
 {
     try
     {
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return Json(new { errorMsg = "出错了" });
     }
     return Json(new { IsSuccess = "true" });
 }
コード例 #2
0
        public string EmailMessageSyn(EmailMessageType obj)
        {
            try
            {
                if (Exit(obj.MessageId))
                {
                    return "该留言已存在";
                }
                NSession.Save(obj);
                NSession.Flush();
                IList<OrderType> orders = NSession.CreateQuery("from OrderType where OrderExNo='" + obj.OrderExNo + "'").List<OrderType>();
                foreach (OrderType order in orders)
                {
                    order.IsLiu = 1;
                    order.BuyerMemo = obj.RserverDate + " 有买家留言<br>" + order.BuyerMemo;
                    NSession.Update(order);
                    NSession.Flush();
                    NSession.Clear();

                    OrderRecordType orderRecord = new OrderRecordType();
                    orderRecord.OId = order.Id;
                    orderRecord.OrderNo = order.OrderNo;
                    orderRecord.RecordType = "买家留言";
                    orderRecord.CreateBy = "系统自动";
                    orderRecord.Content = "买家留言";
                    orderRecord.CreateOn = DateTime.Now;
                    NSession.Save(orderRecord);
                    NSession.Flush();
                    NSession.Clear();
                }
                return "保存成功";
            }
            catch (Exception e)
            {
                return "保存出错";
            }

        }