示例#1
0
 public List <unitDataModel> GetAllUnit(QueryUnitListParameter parameter)
 {
     this.ExecuteSQL = string.Format("SELECT * FROM dbo.unit WHERE name LIKE '%{0}%' AND ISNULL(parentid,'')<>'' AND [status]={1} AND deleted={2}",
                                     parameter.Name,
                                     (short)CommonStatus.Used,
                                     (short)CommonDeleted.NotDeleted);
     return(this.ExecuteReadSqlTounitDataModelList());
 }
示例#2
0
 public PageData <unitDataModel> GetQueryUnitList(QueryUnitListParameter parameter)
 {
     this.ExecuteSQL = string.Format("SELECT * FROM dbo.unit WHERE name LIKE '%{0}%' AND [status] IN({1}) AND deleted IN({2})",
                                     parameter.Name,
                                     parameter.Status == (short)CommonStatus.Default ? string.Concat((short)CommonStatus.Used, ",", (short)CommonStatus.Stopped) : parameter.Status.ToString(),
                                     parameter.Deleted == (short)CommonDeleted.Default ? string.Concat((short)CommonDeleted.Deleted, ",", (short)CommonDeleted.NotDeleted) : parameter.Deleted.ToString()
                                     );
     return(this.ExecuteReadSqlTounitDataModelPageData("unitid", parameter.PageIndex, parameter.PageSize, "[sort] DESC"));
 }
示例#3
0
        public bool CheckUnitIsExist(QueryUnitListParameter parameter)
        {
            this.ExecuteSQL    = string.Format("SELECT * FROM dbo.unit WHERE name=@name{0}", parameter.UnitId == 0 ? string.Empty : string.Concat(" AND unitid<>", parameter.UnitId));
            this.DataParameter = new IDbDataParameter[]
            {
                new SqlParameter("@name", parameter.Name)
            };
            var unit = this.ExecuteReadSqlTounitDataModel();

            return(unit != null);
        }
示例#4
0
        public RespondWebViewData <List <RespondQueryUnitViewModel> > GetQueryUnitList(RequestWebViewData <RequestQueryUnitViewModel> request)
        {
            if (request.data == null)
            {
                request.data = new RequestQueryUnitViewModel();
            }
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondQueryUnitViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetQueryUnitList"),

                #region =================
                CallBackFunc = () =>
                {
                    var parameter = new QueryUnitListParameter
                    {
                        Deleted = request.data.Deleted,
                        Name = request.data.Name,
                        PageIndex = request.page,
                        PageSize = request.rows,
                        Status = request.data.Status
                    };
                    var pageDataList = this.mUnitDataAccess.GetQueryUnitList(parameter);
                    var respond = new RespondWebViewData <List <RespondQueryUnitViewModel> >
                    {
                        total = pageDataList.DataCount,
                        rows = pageDataList.Datas.Select(item => new RespondQueryUnitViewModel
                        {
                            UnitId = item.unitid,
                            Name = item.name,
                            Deleted = item.deleted,
                            Status = item.status,
                            Sort = item.sort.ToString()
                        }).ToList()
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicUnit,
                ParamsKeys = new object[]
                {
                    request.data.Name,
                    request.data.Status,
                    request.data.Deleted,
                    request.page,
                    request.rows
                }
            }));
        }