Exemplo n.º 1
0
        public ExecResult Del(ContactWayQuery query)
        {
            ExecResult         execResult = new ExecResult();
            IContactWayService service    = ServiceContainer.Instance.Container.Resolve <IContactWayService>();

            Int64[] ContactIDs = query.ContactIDs;
            if (ContactIDs == null)
            {
                execResult.result = EnumJsonResult.failure.ToString();
                execResult.msg    = "没有删除任何数据!";
                return(execResult);
            }
            string msg    = string.Empty;
            bool   result = service.BatchDeleteContactWay(ContactIDs);

            if (result)
            {
                execResult.result = EnumJsonResult.success.ToString();
                execResult.msg    = "删除联系人成功!";
            }
            else
            {
                execResult.result = EnumJsonResult.failure.ToString();
                execResult.msg    = "删除联系人失败!";
            }
            return(execResult);
        }
Exemplo n.º 2
0
        public ContactWayEntity GetModel(ContactWayQuery query)
        {
            IContactWayService service = ServiceContainer.Instance.Container.Resolve <IContactWayService>();
            ContactWayEntity   model   = service.GetContactWay(query.ContactID);

            return(model);
        }
Exemplo n.º 3
0
        public IList <ContactWayEntity> GetList(ContactWayQuery query)
        {
            IContactWayService       service = ServiceContainer.Instance.Container.Resolve <IContactWayService>();
            IList <ContactWayEntity> list    = service.GetContactWayList(query);

            return(list);
        }
Exemplo n.º 4
0
        public Pager <ContactWayEntity> GetPageList(ContactWayQuery query)
        {
            IContactWayService       service = ServiceContainer.Instance.Container.Resolve <IContactWayService>();
            Pager <ContactWayEntity> pager   = service.GetContactWayPageList(query);

            return(pager);
        }
Exemplo n.º 5
0
        public ActionResult GetList(ContactWayQuery query)
        {
            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();

            query.JournalID = CurAuthor.JournalID;
            IList <ContactWayEntity> list = service.GetContactWayList(query);

            return(Json(new { list }));
        }
Exemplo n.º 6
0
        public List <ContactWayEntity> GetContactWayList(ContactWayQuery query)
        {
            string strSql   = "SELECT ContactID,JournalID,ChannelID,Company,LinkMan,Address,ZipCode,Tel,Fax,AddDate FROM dbo.ContactWay with(nolock) ORDER BY ContactID desc";
            string whereSQL = ContactWayQueryToSQLWhere(query);

            if (!string.IsNullOrWhiteSpace(whereSQL))
            {
                strSql += " WHERE " + whereSQL;
            }
            return(db.GetList <ContactWayEntity>(strSql, MakeContactWayList));
        }
Exemplo n.º 7
0
        public ActionResult Delete(Int64[] ContactIDs)
        {
            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
            ContactWayQuery          query   = new ContactWayQuery();

            query.JournalID  = CurAuthor.JournalID;
            query.ContactIDs = ContactIDs;
            ExecResult result = service.DelContactWay(query);

            return(Json(new { result = result.result, msg = result.msg }));
        }
Exemplo n.º 8
0
        public ActionResult GetPageList(ContactWayQuery query)
        {
            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();

            query.JournalID   = CurAuthor.JournalID;
            query.CurrentPage = Convert.ToInt32(Request.Params["page"]);
            query.PageSize    = Convert.ToInt32(Request.Params["pagesize"]);
            Pager <ContactWayEntity> pager = service.GetContactWayPageList(query);

            return(Json(new { Rows = pager.ItemList, Total = pager.TotalRecords }));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 将查询实体转换为Where语句
        /// <param name="query">查询实体</param>
        /// <returns>获取Where语句,不包含Where</returns>
        /// </summary>
        public string ContactWayQueryToSQLWhere(ContactWayQuery query)
        {
            StringBuilder strFilter = new StringBuilder();

            strFilter.Append(" 1=1");
            if (query.JournalID > 0)
            {
                strFilter.AppendFormat(" and JournalID={0}", query.JournalID);
            }
            if (query.ChannelID > 0)
            {
                strFilter.AppendFormat(" and ChannelID={0}", query.ChannelID);
            }
            return(strFilter.ToString());
        }
Exemplo n.º 10
0
        private ContactWayEntity GetModel(Int64 ContactID)
        {
            ContactWayEntity model = null;

            if (ContactID > 0)
            {
                ContactWayQuery query = new ContactWayQuery();
                query.JournalID = CurAuthor.JournalID;
                query.ContactID = ContactID;
                ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
                model = service.GetContactWayModel(query);
            }
            if (model == null)
            {
                model = new ContactWayEntity();
            }
            return(model);
        }
Exemplo n.º 11
0
        public Pager <ContactWayEntity> GetContactWayPageList(ContactWayQuery query)
        {
            string strSql   = "SELECT ContactID,JournalID,ChannelID,Company,LinkMan,Address,ZipCode,Tel,Fax,AddDate,ROW_NUMBER() OVER(ORDER BY ContactID DESC) AS ROW_ID FROM dbo.ContactWay with(nolock)",
                   sumStr   = "SELECT RecordCount=COUNT(1) FROM dbo.ContactWay with(nolock)";
            string whereSQL = ContactWayQueryToSQLWhere(query);

            if (!string.IsNullOrWhiteSpace(whereSQL))
            {
                strSql += " WHERE " + whereSQL;
                sumStr += " WHERE " + whereSQL;
            }
            return(db.GetPageList <ContactWayEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex)
                                                     , sumStr
                                                     , query.CurrentPage, query.PageSize
                                                     , (dr, pager) =>
            {
                pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
            }
                                                     , MakeContactWayList));
        }
Exemplo n.º 12
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string ContactWayQueryToSQLOrder(ContactWayQuery query)
 {
     return(" ContactID DESC");
 }
Exemplo n.º 13
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="contactWayQuery">ContactWayQuery查询实体对象</param>
 /// <returns>List<ContactWayEntity></returns>
 public List <ContactWayEntity> GetContactWayList(ContactWayQuery contactWayQuery)
 {
     return(ContactWayBusProvider.GetContactWayList(contactWayQuery));
 }
Exemplo n.º 14
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="contactWayQuery">ContactWayQuery查询实体对象</param>
 /// <returns>Pager<ContactWayEntity></returns>
 public Pager <ContactWayEntity> GetContactWayPageList(ContactWayQuery contactWayQuery)
 {
     return(ContactWayBusProvider.GetContactWayPageList(contactWayQuery));
 }
Exemplo n.º 15
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="contactWayQuery">ContactWayQuery查询实体对象</param>
 /// <returns>Pager<ContactWayEntity></returns>
 public Pager <ContactWayEntity> GetContactWayPageList(ContactWayQuery contactWayQuery)
 {
     return(ContactWayDataAccess.Instance.GetContactWayPageList(contactWayQuery));
 }