コード例 #1
0
        public List <T1> GetByListInt <T, T1>(string path, List <int> listInt, string controller = null)
            where T : IDto
            where T1 : IDataModel <T>, new()
        {
            if (controller == null)
            {
                controller = NameManager.Instance.GetControllerName <T, T1>();
            }

            if (listInt == null || listInt.Count == 0)
            {
                return(new List <T1>());
            }

            var qe = new QueryExpression();

            qe.PageSize = _defaultPageSize;
            qe.AddWhereOption <WhereExpression.WhereOptionIntList, List <int> >(
                WhereExpression.In, path, listInt.Distinct().ToList());

            var dataProvider = DataServiceUtils.GetDataController(controller);

            var result = dataProvider.ActionInvoker(ControllerAction.SmtEntityBase.Get, qe) as PagingResultDto <T>;

            return(DataServiceUtils.ProcessPagingResult <T, T1>(result).Items);
        }
コード例 #2
0
        public void TenantLogin(string tenantLoginName, string password)
        {
            var data = new NameValueCollection();

            data["user"] = tenantLoginName;
            data["pass"] = password;

            var dataProvider = DataServiceUtils.GetDataController(ControllerAction.Smt.ControllerName);

            dataProvider.ActionInvoker(ControllerAction.Smt.TenantLogin, data);
        }
コード例 #3
0
        public string Register(string tenantLoginName, string tenantName)
        {
            var data = new NameValueCollection();

            data["user"]       = tenantLoginName;
            data["tenantname"] = tenantName;

            var dataProvider = DataServiceUtils.GetDataController(ControllerAction.Smt.ControllerName);

            var result = dataProvider.ActionInvoker(ControllerAction.Smt.Register, data) as string;

            return(result);
        }
コード例 #4
0
        public T1 GetByID <T, T1>(int ID, string controller = null)
            where T : IDto
            where T1 : IDataModel <T>, new()
        {
            if (controller == null)
            {
                controller = NameManager.Instance.GetControllerName <T, T1>();
            }

            var dataProvider = DataServiceUtils.GetDataController(controller);

            var result = (T)dataProvider.ActionInvoker(ControllerAction.SmtEntityBase.GetByID, ID);

            return(DataServiceUtils.ProcessResult <T, T1>(result));
        }
コード例 #5
0
        public string Save <T, T1>(List <T1> changedItems, string controller) where T : IDto where T1 : IDataModel <T>
        {
            if (controller == null)
            {
                controller = NameManager.Instance.GetControllerName <T, T1>();
            }

            var changedDto = new List <T>();

            foreach (var item in changedItems)
            {
                changedDto.Add(item.ToDto());
            }

            var dataProvider = DataServiceUtils.GetDataController(controller);

            return(dataProvider.ActionInvoker(ControllerAction.SmtEntityBase.Save, changedDto) as string);
        }
コード例 #6
0
        public PagingResultDto <T1> GetUpdate <T, T1>(List <WhereExpression.IWhereOption> we, string controller = null)
            where T : IDto
            where T1 : IDataModel <T>, new()
        {
            if (controller == null)
            {
                controller = NameManager.Instance.GetControllerName <T, T1>();
            }

            var dataProvider = DataServiceUtils.GetDataController(controller);

            var result = dataProvider.ActionInvoker(ControllerAction.SmtEntityBase.GetUpdate, new QueryExpression()
            {
                WhereOptions = we
            }) as PagingResultDto <T>;

            return(DataServiceUtils.ProcessPagingResult <T, T1>(result));
        }
コード例 #7
0
        public PagingResultDto <T1> Get <T, T1>(QueryExpression qe, string controller = null)
            where T : IDto
            where T1 : IDataModel <T>, new()
        {
            if (controller == null)
            {
                controller = NameManager.Instance.GetControllerName <T, T1>();
            }

            if (qe.PageSize == 0)
            {
                qe.PageSize = _defaultPageSize;
            }

            var dataProvider = DataServiceUtils.GetDataController(controller);

            var result = dataProvider.ActionInvoker(ControllerAction.SmtEntityBase.Get, qe) as PagingResultDto <T>;

            return(DataServiceUtils.ProcessPagingResult <T, T1>(result));
        }