using System; using System.Collections.Generic; using System.Linq; using System.Web; using Estsh.Web.Util; using System.Data; using Estsh.Web.Dal; using System.Collections; using Estsh.Web.Models; /*************************************************************************************************** * * 作者:王勇 * * *************************************************************************************************/ namespace Estsh.Core.Services { /// /// 菜单业务处理类 /// public class UnLockQueryService { private UnLockQueryDal dal = new UnLockQueryDal(RemotingProxyProvider._remotingProxy); /// /// 根据分页条件获取分页菜单数据 /// /// /// /// /// /// public DataTable getUnLockQueryListByPage(String locationDate, String terminal_name, String Date, String Date2,ref Pager pager, String direction, String sort) { //Hashtable result = new Hashtable(); String strWhere = " 1=1 "; if (locationDate == "按站点查询") { if (terminal_name != null && !terminal_name.Trim().Equals("")) { strWhere += " and c.terminal_name = '" + terminal_name + "' "; } } else { if (terminal_name != null && !terminal_name.Trim().Equals("")) { strWhere += " and c.terminal_name = '" + terminal_name + "' "; } if (!string.IsNullOrEmpty(Date) && !string.IsNullOrEmpty(Date2)) { strWhere += " and a.create_ymd between Convert(DateTime,'" + Date + "') and Convert(DateTime,'" + Date2 + "') "; } } String orderBy = ""; if (sort != null && !"".Equals(sort.Trim())) { orderBy += sort + " " + direction; } else { orderBy += "c.terminal_name " + direction; } DataTable dt = dal.getListByPage(ref pager, strWhere, orderBy); return dt; } /// /// 保存菜单数据 /// /// /// public int saveUnLockQuery(Hashtable htParams) { return dal.saveUnLockQuery(htParams); } /// /// 更新菜单数据 /// /// /// public int updateUnLockQuery(Hashtable htParams) { return dal.updateUnLockQuery(htParams); } /// /// 查看详情 /// /// /// public ArrayList getUnLockQuery(String part_id) { part_id = "part_id = " + part_id; DataTable dt = dal.getList(part_id, ""); ArrayList result = DataTypeConvert.NewObject.DataTableToArrayList(dt); return result; } /// /// 删除菜单 /// /// /// public int deleteUnLockQuery(String ids) { String[] idArray = ids.Split(','); int count = 0; foreach (String id in idArray) { if (!"".Equals(id)) { count += this.dal.deleteUnLockQuery(id); } } return count; } /// /// 获取下拉框中的菜单数据 /// /// public ArrayList GetTerminalName() { Hashtable result = new Hashtable(); DataTable dt = dal.GetTerminalName(); return DataTypeConvert.NewObject.DataTableToArrayList(dt); } /// /// 根据分页条件获取分页客户订单数据 /// /// 查询条件 /// /// 排序方式 /// 排序字段 /// public DataTable getTableListByPage(String locationDate, String terminal_name, String Date, String Date2, Pager pager, String direction, String sort, Boolean isPage) { DataTable result = null; String strWhere = " 1=1 "; int rowCount = 0; if (locationDate == "按站点查询") { if (terminal_name != null && !terminal_name.Trim().Equals("")) { strWhere += " and c.terminal_name = '" + terminal_name + "' "; } } else if (locationDate == "按日期段查询") { if (!string.IsNullOrEmpty(Date) && !string.IsNullOrEmpty(Date2)) { strWhere += " and a.create_ymd between Convert(DateTime,'" + Date + "') and Convert(DateTime,'" + Date2 + "') "; } } else { return null; } String orderBy = ""; if (sort != null && !"".Equals(sort.Trim())) { orderBy += sort + " " + direction; } else { orderBy += " c.terminal_name " + direction; } if (isPage) { rowCount = pager.pageSize; } else { rowCount = pager.pageSize; } result = dal.getTableListByPage(rowCount, pager.pageNo, strWhere, sort + " " + direction); return result; } } }