Esempio n. 1
0
        /// <summary>
        /// 根据模型更新
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>是否成功</returns>
        public bool Update(Colorinfo model, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var update = new LambdaUpdate <Colorinfo>();

            if (!model.Id.IsNullOrEmpty())
            {
                update.Where(p => p.Id == model.Id);
            }
            if (!model.StandardColor.IsNullOrEmpty())
            {
                update.Set(p => p.StandardColor == model.StandardColor);
            }
            if (!model.ChinaDescribe.IsNullOrEmpty())
            {
                update.Set(p => p.ChinaDescribe == model.ChinaDescribe);
            }
            if (!model.EngDescibe.IsNullOrEmpty())
            {
                update.Set(p => p.EngDescibe == model.EngDescibe);
            }
            if (!model.ParentId.IsNullOrEmpty())
            {
                update.Set(p => p.ParentId == model.ParentId);
            }
            if (!model.HtmlCode.IsNullOrEmpty())
            {
                update.Set(p => p.HtmlCode == model.HtmlCode);
            }
            if (!model.IsDelete.IsNullOrEmpty())
            {
                update.Set(p => p.IsDelete == model.IsDelete);
            }
            return(update.GetUpdateResult(connection, transaction));
        }
Esempio n. 2
0
        /// <summary>
        /// 根据模型插入
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>是否成功</returns>
        public int InsertReturnKey(Colorinfo model, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var insert = new LambdaInsert <Colorinfo>();

            if (!model.StandardColor.IsNullOrEmpty())
            {
                insert.Insert(p => p.StandardColor == model.StandardColor);
            }
            if (!model.ChinaDescribe.IsNullOrEmpty())
            {
                insert.Insert(p => p.ChinaDescribe == model.ChinaDescribe);
            }
            if (!model.EngDescibe.IsNullOrEmpty())
            {
                insert.Insert(p => p.EngDescibe == model.EngDescibe);
            }
            if (!model.ParentId.IsNullOrEmpty())
            {
                insert.Insert(p => p.ParentId == model.ParentId);
            }
            if (!model.HtmlCode.IsNullOrEmpty())
            {
                insert.Insert(p => p.HtmlCode == model.HtmlCode);
            }
            if (!model.IsDelete.IsNullOrEmpty())
            {
                insert.Insert(p => p.IsDelete == model.IsDelete);
            }
            return(insert.GetInsertResult(connection, transaction));
        }
Esempio n. 3
0
 public ColorRes(Colorinfo colorinfo)
 {
     //颜色Id
     Id = colorinfo.Id;
     //中文描述
     ChinaDescribe = colorinfo.ChinaDescribe;
     //标准色号
     StandardColor = colorinfo.StandardColor;
     //英文描述
     EngDescibe = colorinfo.EngDescibe;
     //颜色代码
     HtmlCode = colorinfo.HtmlCode;
 }
Esempio n. 4
0
        /// <summary>
        /// 数据条数
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectCount(Colorinfo model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Colorinfo>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.StandardColor.IsNullOrEmpty())
                {
                    query.Where(p => p.StandardColor == model.StandardColor);
                }
                if (!model.ChinaDescribe.IsNullOrEmpty())
                {
                    query.Where(p => p.ChinaDescribe == model.ChinaDescribe);
                }
                if (!model.EngDescibe.IsNullOrEmpty())
                {
                    query.Where(p => p.EngDescibe == model.EngDescibe);
                }
                if (!model.ParentId.IsNullOrEmpty())
                {
                    query.Where(p => p.ParentId == model.ParentId);
                }
                if (!model.HtmlCode.IsNullOrEmpty())
                {
                    query.Where(p => p.HtmlCode == model.HtmlCode);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
Esempio n. 5
0
 /// <summary>
 /// 数据条数
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public int SelectCount(Colorinfo model)
 {
     return(ColorinfoOper.Instance.SelectCount(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 筛选全部数据
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public List <Colorinfo> SelectByModel(Colorinfo model)
 {
     return(ColorinfoOper.Instance.SelectAll(model));
 }
Esempio n. 7
0
 /// <summary>
 /// 根据模型插入
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public int InsertReturnKey(Colorinfo model)
 {
     return(ColorinfoOper.Instance.InsertReturnKey(model));
 }
Esempio n. 8
0
 /// <summary>
 /// 根据模型插入
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public bool Insert(Colorinfo model)
 {
     return(ColorinfoOper.Instance.Insert(model));
 }
Esempio n. 9
0
 /// <summary>
 /// 根据模型更新
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public bool Update(Colorinfo model)
 {
     return(ColorinfoOper.Instance.Update(model));
 }
Esempio n. 10
0
 /// <summary>
 /// 根据模型删除数据
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public bool DeleteModel(Colorinfo model)
 {
     return(ColorinfoOper.Instance.DeleteModel(model));
 }
Esempio n. 11
0
 /// <summary>
 /// 根据分页筛选数据
 /// </summary>
 /// <param name="Key">主键</param>
 /// <param name="start">开始数据</param>
 /// <param name="PageSize">页面长度</param>
 /// <param name="desc">排序</param>
 /// <param name="model">对象</param>
 /// <returns>对象列表</returns>
 public List <Colorinfo> SelectByPage(string Key, int start, int PageSize, bool desc, Colorinfo model, string SelectFiled)
 {
     return(ColorinfoOper.Instance.SelectByPage(Key, start, PageSize, desc, model));
 }
Esempio n. 12
0
        /// <summary>
        /// 根据分页筛选数据
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Colorinfo> SelectByPage(string Key, int start, int PageSize, bool desc = true, Colorinfo model = null, string SelectFiled = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Colorinfo>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.StandardColor.IsNullOrEmpty())
                {
                    query.Where(p => p.StandardColor == model.StandardColor);
                }
                if (!model.ChinaDescribe.IsNullOrEmpty())
                {
                    query.Where(p => p.ChinaDescribe == model.ChinaDescribe);
                }
                if (!model.EngDescibe.IsNullOrEmpty())
                {
                    query.Where(p => p.EngDescibe == model.EngDescibe);
                }
                if (!model.ParentId.IsNullOrEmpty())
                {
                    query.Where(p => p.ParentId == model.ParentId);
                }
                if (!model.HtmlCode.IsNullOrEmpty())
                {
                    query.Where(p => p.HtmlCode == model.HtmlCode);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
            }
            if (SelectFiled != null)
            {
                SelectFiled = SelectFiled.ToLowerInvariant();
                if (SelectFiled.Contains("id,"))
                {
                    query.Select(p => new { p.Id });
                }
                if (SelectFiled.Contains("standardcolor,"))
                {
                    query.Select(p => new { p.StandardColor });
                }
                if (SelectFiled.Contains("chinadescribe,"))
                {
                    query.Select(p => new { p.ChinaDescribe });
                }
                if (SelectFiled.Contains("engdescibe,"))
                {
                    query.Select(p => new { p.EngDescibe });
                }
                if (SelectFiled.Contains("parentid,"))
                {
                    query.Select(p => new { p.ParentId });
                }
                if (SelectFiled.Contains("htmlcode,"))
                {
                    query.Select(p => new { p.HtmlCode });
                }
                if (SelectFiled.Contains("isdelete,"))
                {
                    query.Select(p => new { p.IsDelete });
                }
            }
            if (Key != null)
            {
                query.OrderByKey(Key, desc);
            }
            return(query.GetQueryPageList(start, PageSize, connection, transaction));
        }