예제 #1
0
        /// <summary>
        /// 查询列表数据
        /// </summary>
        /// <param name="nvc">参数集合</param>
        /// <returns></returns>
        public DailyAccountSnapshotListModel Query(NameValueCollection nvc)
        {
            DailyAccountSnapshotListModel model  = new DailyAccountSnapshotListModel();
            MDailyAccountSnapshot         entity = new MDailyAccountSnapshot();

            model.PageSize = CommFun.ToInt(nvc["ps"],
                                           SettingHelper.Instance.GetInt("PageSize", 10)).Value;
            model.PageIndex = CommFun.ToInt(nvc["pi"],
                                            SettingHelper.Instance.GetInt("PageIndex", 0)).Value + 1;
            entity.SetData(nvc, false);
            entity.TrimEmptyProperty();
            entity.AddData(":PS", model.PageSize);
            entity.AddData(":PI", model.PageIndex);

            DateTime st = CommFun.ToDateTime(nvc["s"], DateTime.Now).Value;
            DateTime et = CommFun.ToDateTime(nvc["e"], DateTime.Now).Value.AddDays(1);

            entity.AddData("ST", st.ToString("yyyy-MM-dd"));
            entity.AddData("ET", et.ToString("yyyy-MM-dd"));

            model.TotalCount = CommFun.ToInt(handler.GetScalarByXmlTemplate("getCount", entity), 0).GetValueOrDefault();
            if (model.TotalCount > 0)
            {
                model.Statistics = handler.GetSingleDataByTemplate("getStatistics", entity);
                model.List       = handler.GetDataListByTemplate("getList", entity);
            }
            return(model);
        }
예제 #2
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="json">json数据</param>
        /// <returns></returns>
        public List <MDailyAccountSnapshot> GetDataList(string json)
        {
            MDailyAccountSnapshot data =
                JsonData.JavaScriptDeserialize <MDailyAccountSnapshot>(json);

            return(handler.GetDataList(data, ORDER_BY, Lib4Net.DB.MatchMode.Exact));
        }
예제 #3
0
        public string Item()
        {
            MDailyAccountSnapshot entity = new MDailyAccountSnapshot();

            entity.SetData(Request.Form);
            entity.TrimEmptyProperty();
            string  id     = Request.Form["__id"];
            IResult result = DailyAccountSnapshotService.Instance.Save(id, entity);

            return(result.ToString());
        }
        /// <summary>
        /// 添加或修改数据,id为空时为添加,否则为修改
        /// </summary>
        /// <param name="vo">实体数据</param>
        /// <returns></returns>
        public IResult Save(MDailyAccountSnapshot vo)
        {
            IResult result = new Result(false);
            bool    status = dbAccess.Save(vo) > 0;

            if (status)
            {
                result       = new Result(true);
                result["id"] = CommFun.GetString(dbAccess.Builder.ODMapConfig.PrimaryKeyField.GetValue(vo));
            }
            return(result);
        }
        /// <summary>
        /// 添加或修改数据,id为空时为添加,否则为修改
        /// </summary>
        /// <param name="id">主键值</param>
        /// <param name="vo">实体数据</param>
        /// <returns></returns>
        public IResult Save(string id, MDailyAccountSnapshot vo)
        {
            bool    status = false;
            IResult result = new Result(status);

            if (string.IsNullOrEmpty(id))
            {
                status = dbAccess.CreateNew(vo);
            }
            else
            {
                status = dbAccess.Update(id, vo);
            }
            if (status)
            {
                result       = new Result(true);
                result["id"] = CommFun.GetString(dbAccess.Builder.ODMapConfig.PrimaryKeyField.GetValue(vo));
            }
            return(result);
        }
 /// <summary>
 /// 获取指定条件的数据集
 /// </summary>
 /// <param name="query">查询条件</param>
 /// <param name="orderBy">排序字段,{f:属性名} asc</param>
 /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param>
 /// <param name="cmode">条件连接字符串 And 或 OR</param>
 /// <returns></returns>
 public DataSet GetDataSet(MDailyAccountSnapshot query, string orderBy = "", MatchMode mmode = MatchMode.Exact,
                           ConnectMode cmode = ConnectMode.And)
 {
     return(dbAccess.GetDataSet(query, orderBy, mmode, cmode));
 }
 /// <summary>
 /// 查询单实体信息(单实体数据)
 /// </summary>
 /// <param name="id">主键编号</param>
 /// <returns></returns>
 public MDailyAccountSnapshot GetSingleDataByTemplate(string xmlTemplateName, MDailyAccountSnapshot vo)
 {
     return(dbAccess.GetSingleDataByTemplate(xmlTemplateName, vo));
 }
 /// <summary>
 /// 根据模版获取DataSet
 /// </summary>
 /// <param name="xmlTemplateName">模板名称</param>
 /// <param name="vo">实体</param>
 /// <returns></returns>
 public DataSet GetDataSetByTemplate(string xmlTemplateName, MDailyAccountSnapshot vo)
 {
     return(dbAccess.GetDataSetByTemplate(xmlTemplateName, vo));
 }
 /// <summary>
 /// 根据模板名称获取第一行一列的值
 /// </summary>
 /// <param name="xmlTemplateName">模板名称</param>
 /// <param name="vo">实体</param>
 /// <returns></returns>
 public object GetScalarByXmlTemplate(string xmlTemplateName, MDailyAccountSnapshot vo)
 {
     return(dbAccess.GetScalarByTemplate(xmlTemplateName, vo));
 }
 /// <summary>
 /// 获取指定条件的记录总数
 /// </summary>
 /// <param name="query">查询条件</param>
 /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param>
 /// <param name="cmode">条件连接字符串 And 或 OR</param>
 /// <returns></returns>
 public int GetCount(MDailyAccountSnapshot query, MatchMode mmode = MatchMode.Exact,
                     ConnectMode cmode = ConnectMode.And)
 {
     return(dbAccess.GetCount(query, mmode, cmode));
 }
 /// <summary>
 /// 根据主键值修改实体数据
 /// </summary>
 /// <param name="vo">实体数据</param>
 /// <returns></returns>
 public bool Update(MDailyAccountSnapshot vo)
 {
     return(dbAccess.Update(vo));
 }
 /// <summary>
 /// 添加新数据
 /// </summary>
 /// <param name="vo">实体数据</param>
 /// <returns></returns>
 public bool CreateNew(MDailyAccountSnapshot vo)
 {
     return(dbAccess.CreateNew(vo));
 }
 /// <summary>
 /// 获取分页数据集
 /// </summary>
 /// <param name="query">查询条件</param>
 /// <param name="pageSize">分页</param>
 /// <param name="pageIndex">页索引从1开始</param>
 /// <param name="totalCount">总条数</param>
 /// <param name="orderBy">排序字段</param>
 /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param>
 /// <param name="cmode">条件连接字符串 And 或 OR</param>
 /// <returns></returns>
 public DataSet GetPagerDataSet(MDailyAccountSnapshot query, int pageSize, int pageIndex, out int totalCount, string orderBy = "", MatchMode mmode = MatchMode.Exact,
                                ConnectMode cmode = ConnectMode.And)
 {
     totalCount = dbAccess.GetCount(query, mmode, cmode);
     return(dbAccess.GetPagerData(query, pageSize, pageIndex, orderBy, mmode, cmode));
 }
예제 #14
0
 /// <summary>
 /// 保存实体数据
 /// </summary>
 /// <param name="id">主键编号</param>
 /// <param name="entity">实体数据</param>
 /// <returns></returns>
 public IResult Save(string id, MDailyAccountSnapshot entity)
 {
     return(handler.Save(id, entity));
 }