using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Estsh.Web.Dal;
using System.Collections;
using Estsh.Web.Util;
using System.Data;
using ApServerProvider;
namespace Estsh.Core.Services
{
public class HourService
{
private HourDal dal = new HourDal(RemotingProxyProvider._remotingProxy);
///
/// 获取产线名称
///
///
public ArrayList GetPdlineName()
{
Hashtable result = new Hashtable();
DataTable dt = dal.GetPdlineName();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 删除数据
///
///
///
public int deleteHour(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.dal.deleteHour(id);
}
}
return count;
}
///
/// 修改数据
///
///
///
public int updateHour(Hashtable htParams)
{
return dal.updateHour(htParams);
}
///
/// 添加数据
///
///
///
public int insertHour(Hashtable htParams)
{
return dal.insertHour(htParams);
}
///
/// 查看菜单详情
///
///
///
public Hashtable getHourDetail(String ruid)
{
ruid = "a.ruid = " + ruid;
DataTable dt = dal.getList(ruid, "");
Hashtable result = new Hashtable();
result.Add("pdline_id", dt.Rows[0]["pdline_id"]);
result.Add("shift_id", dt.Rows[0]["shift_id"]);
result.Add("stop_line_working_hours_name", dt.Rows[0]["stop_line_working_hours_name"]);
result.Add("stop_line_length", dt.Rows[0]["stop_line_length"]);
result.Add("ruid", dt.Rows[0]["ruid"]);
result.Add("hour", dt.Rows[0]["hour"]);
return result;
}
///
/// 获取列表数据
///
///
///
///
///
///
///
///
//public Hashtable getHourListByPage( String ruid,String shift_id,String pdline_id, String stop_line_working_hours_name, String stop_line_length, String hour, Pager pager, String direction, String sort)
//{
// Hashtable result = new Hashtable();
// String strWhere = " 1=1 ";
// if (pdline_id != null && !pdline_id.Trim().Equals(""))
// {
// strWhere = " a.pdline_id like '%" + pdline_id.Trim() + "%' ";
// }
// if (shift_id != null && !shift_id.Trim().Equals(""))
// {
// strWhere = " shift_id like '%" + shift_id.Trim() + "%' ";
// }
// if (stop_line_working_hours_name != null && !stop_line_working_hours_name.Trim().Equals(""))
// {
// strWhere = " stop_line_working_hours_name like '%" + stop_line_working_hours_name.Trim() + "%' ";
// }
// if (stop_line_length != null && !stop_line_length.Trim().Equals(""))
// {
// strWhere += " AND stop_line_length like '%" + stop_line_length.Trim() + "%'";
// }
// if (hour != null && !hour.Trim().Equals(""))
// {
// strWhere += " AND hour like '%" + hour.Trim() + "%'";
// }
// String orderBy = "";
// if (sort != null && !"".Equals(sort.Trim()))
// {
// orderBy += sort + " " + direction;
// }
// else
// {
// orderBy += " ruid " + direction;
// }
// result = dal.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
// return result;
//}
///
/// 获取列表数据
///
///
///
///
///
///
public Hashtable getHourListByPage(Pager pager, String direction, String sort, string cbPDLine)
{
Hashtable result = new Hashtable();
String strWhere = " a.pdline_id='" + cbPDLine.ToString() + "' AND b.enabled='Y' ";
String orderBy = " a.ruid ";
result = dal.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
}
}