Пример #1
0
        public int UpdateSysMessage(bx_system_message bxSystemMessage)
        {
            int count = 0;

            try
            {
                DataContextFactory.GetDataContext().bx_system_message.AddOrUpdate(bxSystemMessage);
                count = DataContextFactory.GetDataContext().SaveChanges();
            }
            catch (Exception ex)
            {
                logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException);
            }
            return(count);
        }
Пример #2
0
        //var querylist =
        //    (from msg in DataContextFactory.GetDataContext().bx_message
        //     where
        //         msg.Agent_Id == agentId && msg.Msg_Status == 0 && msg.Msg_Type != 2 && msg.Msg_Type != 1 &&
        //         msg.Send_Time.Value <= DateTime.Now
        //     select new TableMessage()
        //     {
        //         StrId = "Msg_" + msg.Id,
        //         Id = (long)msg.Id,
        //         MsgLevel = msg.Msg_Level.HasValue ? msg.Msg_Level.Value : 0,
        //         MsgStatus = msg.Msg_Status.HasValue ? msg.Msg_Status.Value : 0,
        //         MsgType = msg.Msg_Type.HasValue ? msg.Msg_Type.Value : 0,
        //         SendTime = msg.Send_Time.HasValue ? msg.Send_Time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //         Title = msg.Title,
        //         Body = msg.Body,
        //         UpdateTime =
        //             msg.Update_Time.HasValue ? msg.Update_Time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //         Url = msg.Url,
        //         AgentId = msg.Agent_Id.HasValue ? msg.Agent_Id.Value : 0,
        //         CreateAgentId = msg.Create_Agent_Id,
        //         CreateTime =
        //             msg.Create_Time.HasValue ? msg.Create_Time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //         LicenseNo = "",
        //         LastForceEndDate = "",
        //         LastBizEndDate = "",
        //         NextForceStartDate = "",
        //         NextBizStartDate = "",
        //         Source = 0,
        //         Days = 0,
        //         Buid = msg.Buid.HasValue ? msg.Buid.Value : 0
        //     })
        //.Concat(from nxb in DataContextFactory.GetDataContext().bx_notice_xb
        //        where
        //            nxb.agent_id == agentId && nxb.stauts == 0
        //        select new TableMessage()
        //        {
        //            StrId = "Xb_" + nxb.id,
        //            Id = nxb.id,
        //            MsgLevel = 1,//一般紧急
        //            MsgStatus = nxb.stauts,
        //            MsgType = 1,//1,续保消息
        //            SendTime = nxb.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
        //            Title = "到期通知",
        //            Body = string.Format("{0},车险{1}天后到期", nxb.license_no, nxb.day_num.Value.ToString()),
        //            UpdateTime = "",
        //            Url = "",
        //            AgentId = nxb.agent_id,
        //            CreateAgentId = nxb.agent_id,
        //            CreateTime = nxb.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
        //            LicenseNo = nxb.license_no,
        //            LastForceEndDate = nxb.last_force_end_date.HasValue ? nxb.last_force_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //            LastBizEndDate = nxb.Last_biz_end_date.HasValue ? nxb.Last_biz_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //            NextForceStartDate = nxb.next_force_start_date.HasValue ? nxb.next_force_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //            NextBizStartDate = nxb.next_biz_start_date.HasValue ? nxb.next_biz_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
        //            Source = nxb.source,
        //            Days = nxb.days.HasValue ? nxb.days.Value : 0,
        //            Buid = nxb.b_uid
        //        }).Concat(from cr in DataContextFactory.GetDataContext().bx_consumer_review
        //                  where cr.operatorId == agentId && cr.read_status == 0 && cr.next_review_date.HasValue && cr.next_review_date.Value <= DateTime.Now
        //                  select new TableMessage()
        //                  {
        //                      StrId = "Rw_" + cr.id,
        //                      Id = (long)cr.id,
        //                      MsgLevel = 1,//一般紧急
        //                      MsgStatus = cr.read_status.Value,
        //                      MsgType = 2,//2,回访通知
        //                      SendTime = cr.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
        //                      Title = "回访通知",
        //                      Body = string.Format("{0}月{1}日{2} 需回访{3}", cr.next_review_date.Value.Month, cr.next_review_date.Value.Day, cr.next_review_date.Value.ToString("hh:mm"), ""),//msg.LicenseNo
        //                      UpdateTime = "",
        //                      Url = "",
        //                      AgentId = cr.operatorId.HasValue ? cr.operatorId.Value : 0,
        //                      CreateAgentId = cr.operatorId.Value,
        //                      CreateTime = cr.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
        //                      LicenseNo = "",
        //                      LastForceEndDate = "",
        //                      LastBizEndDate = "",
        //                      NextForceStartDate = "",
        //                      NextBizStartDate = "",
        //                      Source = 0,
        //                      Days = 0,
        //                      Buid = (long)cr.b_uid.Value
        //                  });

        //list = querylist.ToList();
        #endregion

        #endregion

        #region bx_system_message
        public int AddSysMessage(bx_system_message bxSystemMessage)
        {
            int workOrderId = 0;

            try
            {
                var t = DataContextFactory.GetDataContext().bx_system_message.Add(bxSystemMessage);
                DataContextFactory.GetDataContext().SaveChanges();
                workOrderId = t.Id;
            }
            catch (Exception ex)
            {
                logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException);
                workOrderId = 0;
            }
            return(workOrderId);
        }