Beispiel #1
0
        public static Page <CabinetLogA> GetCabinets(CabinetLogSearchModel search, List <int> departList)
        {
            var sql = "select * from CabinetLog where DepartmentID in @DepartmentID ";

            if ((search.CabinetID ?? 0) > 0)
            {
                sql += " and CabinetID = " + search.CabinetID;
            }
            if (!string.IsNullOrEmpty(search.CabinetName))
            {
                List <Cabinet> cabinets = Cabinet.GetByLikeName(search.CabinetName);
                if (cabinets.Count == 0)
                {
                    sql += " and 1=2 ";
                }
                else
                {
                    sql += " and CabinetID in (" + string.Join(",", cabinets.Select(m => m.ID).ToList()) + ")";
                }
            }
            if (!string.IsNullOrEmpty(search.OperatorType))
            {
                sql += " and OperationType = " + search.OperatorType;
            }

            if (!string.IsNullOrEmpty(search.StartTime))
            {
                sql += " and CreateTime >= '" + search.StartTime + "'";
            }
            if (!string.IsNullOrEmpty(search.EndTime))
            {
                sql += " and CreateTime <= '" + search.EndTime + "'";
            }
            sql += " order by CreateTime desc";
            using (var cn = Database.GetDbConnection())
            {
                return(cn.PagedQuery <CabinetLogA>(search.PageIndex, search.PageSize, sql, new { DepartmentID = departList }));
            }
        }
Beispiel #2
0
 public void Update(Cabinet model)
 {
     Execute(SqlUpdateCommand, model);
 }
Beispiel #3
0
 public void Insert(Cabinet model)
 {
     Execute(SqlInsertCommand, model);
 }