Пример #1
0
 public ExecResult DelDict(DictQuery query)
 {
     ExecResult execResult = new ExecResult();
     IDictService service = ServiceContainer.Instance.Container.Resolve<IDictService>();
     IList<Int64> dictIDs = query.DictIDs.ToList();
     if (dictIDs == null)
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "没有删除任何数据!";
         return execResult;
     }
     string msg = string.Empty;
     IList<Int64> list = service.BatchDeleteDict(dictIDs);
     if (list == null || list.Count < dictIDs.Count)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "删除数据字典成功!";
         if (list != null && list.Count > 0)
             execResult.msg += string.Format("部分编号[{0}]由于存在数据字典值,请先删除", string.Join(",", list));
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "删除数据字典失败!";
     }
     return execResult;
 }
Пример #2
0
 public ActionResult Delete(Int64[] dictIDs)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     DictQuery query = new DictQuery();
     query.JournalID = CurAuthor.JournalID;
     query.DictIDs = dictIDs;
     ExecResult result = service.DelDict(query);
     return Json(new { result = result.result, msg = result.msg });
 }
Пример #3
0
 public ActionResult GetDictPageList(DictQuery 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<DictEntity> pager = service.GetDictPageList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
Пример #4
0
 public ActionResult Create(Int64 dictId = 0)
 {
     DictEntity model=null;
     if (dictId > 0)
     {
         DictQuery query = new DictQuery();
         query.JournalID = CurAuthor.JournalID;
         query.DictID = dictId;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetDictModel(query);
     }
     if (model == null)
         model = new DictEntity();
     return View(model);
 }
Пример #5
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="dictQuery">DictQuery查询实体对象</param>
 /// <returns>List<DictEntity></returns>
 public List<DictEntity> GetDictList(DictQuery dictQuery)
 {
     return DictDataAccess.Instance.GetDictList(dictQuery);
 }
Пример #6
0
 public DictEntity GetDictModel(DictQuery query)
 {
     IDictService service = ServiceContainer.Instance.Container.Resolve<IDictService>();
     DictEntity model = service.GetDict(query.DictID);
     return model;
 }
Пример #7
0
 public Pager<DictEntity> GetDictPageList(DictQuery query)
 {
     IDictService service = ServiceContainer.Instance.Container.Resolve<IDictService>();
     Pager<DictEntity> pager = service.GetDictPageList(query);
     return pager;
 }
Пример #8
0
 public DictEntity GetDictModelByKey(DictQuery query)
 {
     IDictService service = ServiceContainer.Instance.Container.Resolve<IDictService>();
     DictEntity model = service.GetDictByKey(query.DictKey,query.JournalID);
     return model;
 }
Пример #9
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="dictQuery">DictQuery查询实体对象</param>
 /// <returns>Pager<DictEntity></returns>
 public Pager<DictEntity> GetDictPageList(DictQuery dictQuery)
 {
     Pager<DictEntity> pager = DictBusProvider.GetDictPageList(dictQuery);
     if (pager != null)
         pager.ItemList = GetDictList(pager.ItemList.ToList(), dictQuery);
     return pager;
 }
Пример #10
0
 public List<DictEntity> GetDictList(DictQuery query)
 {
     List<DictEntity> list = new List<DictEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT DictID,JournalID,DictKey,Note,InUserID,EditUserID,EditDate,AddDate FROM dbo.Dict WITH(NOLOCK)");
     string whereSQL = DictQueryToSQLWhere(query);
     string orderBy=DictQueryToSQLOrder(query);
     if(!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     if(!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using(IDataReader dr = db.ExecuteReader(cmd))
     {
         list = MakeDictList(dr);
     }
     return list;
 }
Пример #11
0
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string DictQueryToSQLWhere(DictQuery query)
 {
     if (query.JournalID > 0)
         return " JournalID=" + query.JournalID;
     return string.Empty;
 }
Пример #12
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string DictQueryToSQLOrder(DictQuery query)
 {
     return " DictID DESC";
 }
 /// <summary>
 /// 删除数据字典
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExecResult DelDict(DictQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, DictQuery>(GetAPIUrl(APIConstant.DICT_DELETE), query);
     return result;
 }
 /// <summary>
 /// 获取数据字典分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<DictEntity> GetDictPageList(DictQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<DictEntity> pager = clientHelper.Post<Pager<DictEntity>, DictQuery>(GetAPIUrl(APIConstant.DICT_GETPAGELIST), query);
     return pager;
 }
 public DictEntity GetDictModelByKey(DictQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     DictEntity model = clientHelper.Post<DictEntity, DictQuery>(GetAPIUrl(APIConstant.DICT_GETMODELBYKEY), query);
     return model;
 }
Пример #16
0
 /// <summary>
 /// 组装数据
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 private List<DictEntity> GetDictList(List<DictEntity> list, DictQuery dictQuery)
 {
     if (list == null || list.Count == 0)
         return list;
     AuthorInfoService service = new AuthorInfoService();
     AuthorInfoQuery query=new AuthorInfoQuery();
     query.JournalID=dictQuery.JournalID;
     var dict = service.AuthorInfoBusProvider.GetAuthorDict(query);
     foreach (var mode in list)
     {
         mode.InUserName = dict.GetValue(mode.InUserID, mode.InUserID.ToString());
     }
     return list;
 }
Пример #17
0
 public Pager<DictEntity> GetDictPageList(DictQuery query)
 {
     string strSql = "SELECT DictID,JournalID,DictKey,Note,InUserID,EditUserID,EditDate,AddDate,ROW_NUMBER() OVER(ORDER BY DictID DESC) AS ROW_ID FROM dbo.Dict with(nolock)",
            sumStr="SELECT RecordCount=COUNT(1) FROM dbo.Dict with(nolock)";
     string whereSQL=DictQueryToSQLWhere(query);
     if(!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql+=" WHERE "+whereSQL;
         sumStr+=" WHERE "+whereSQL;
     }
     return db.GetPageList<DictEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex)
         , sumStr
         , query.CurrentPage, query.PageSize
         , (dr, pager) =>
         {
             pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
         }
         , MakeDictList);
 }
Пример #18
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="dictQuery">DictQuery查询实体对象</param>
 /// <returns>List<DictEntity></returns>
 public List<DictEntity> GetDictList(DictQuery dictQuery)
 {
     return GetDictList(DictBusProvider.GetDictList(dictQuery), dictQuery);
 }