Exemple #1
0
        public int GetCount(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);
            Criteria      ct     = CreateQueryCriteria(data.QueryFields, data);

            return(helper.Count(ct));
        }
Exemple #2
0
        public System.Data.DataRow Get(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);
            DataTable     dt     = helper.Query(CreatePKCriteria(data.DataKey), CreateOrders(data.Orders), 0, 0);

            return(dt.Rows.Count > 0 ? dt.Rows[0] : dt.NewRow());
        }
Exemple #3
0
        public bool Delete(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);

            helper.Delete(CreatePKCriteria(data.DataKey));
            return(true);
        }
Exemple #4
0
        public bool Insert(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);

            if (data.Row.IndexByMapping("AccountID") == null)
            {
                data.Row["AccountID"] = Security.CurrentAccountID;
            }
            helper.Insert(data.Row);
            return(true);
        }
Exemple #5
0
        public System.Data.DataTable Query(PanelContext data, out int recordcount, ref int pageindex)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);
            Criteria      ct     = CreateQueryCriteria(data.QueryFields, data);

            recordcount = helper.Count(ct);

            int startindex, itemscount;

            Utils.BuidlPagerParam(recordcount, data.PageSize, ref pageindex, out startindex, out itemscount);

            return(helper.Query(ct, CreateOrders(data.Orders), startindex, itemscount));
        }