using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.Generic; using System.Data.SqlClient; using ApServerProvider; using System.Collections; using DbCommon; using Estsh.Web.Util; using System.Data; namespace Estsh.Core.Repositories { public class HourDal : BaseApp { public HourDal(RemotingProxy remotingProxy) : base(remotingProxy) { } /// /// 获取产线名称 /// /// public DataTable GetPdlineName() { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT DISTINCT pdline_id as [value],pdline_name as [key] from sys_pdline WHERE enabled = 'Y'"); return _remotingProxy.GetDataTable(strSql.ToString()); } /// /// 删除数据 /// /// /// public int deleteHour(String ruid) { String delStr = " DELETE FROM dbo.g_stop_line_working_hours WHERE ruid = @ruid "; Hashtable htparams = new Hashtable(); htparams.Add("@ruid", ruid); return _remotingProxy.ExecuteNonQuery(delStr, htparams); } /// /// 添加数据 /// /// /// public int insertHour(Hashtable htParams) { StringBuilder SqlStringBuilder = new StringBuilder(1024); SqlStringBuilder.Append("INSERT INTO dbo.g_stop_line_working_hours "); SqlStringBuilder.Append(" ( "); SqlStringBuilder.Append(" pdline_id , "); SqlStringBuilder.Append(" shift_id , "); SqlStringBuilder.Append(" stop_line_working_hours_name , "); SqlStringBuilder.Append(" stop_line_length , "); SqlStringBuilder.Append(" hour "); SqlStringBuilder.Append(" ) "); SqlStringBuilder.Append("VALUES ( @pdline_id ,"); SqlStringBuilder.Append("@shift_id ,"); SqlStringBuilder.Append("@stop_line_working_hours_name ,"); SqlStringBuilder.Append("@stop_line_length ,"); SqlStringBuilder.Append("@hour "); SqlStringBuilder.Append(" ) "); return _remotingProxy.ExecuteNonQuery(SqlStringBuilder.ToString(), htParams); } /// /// 修改数据 /// /// /// public int updateHour(Hashtable htParams) { StringBuilder SqlStringBuilder = new StringBuilder(1024); SqlStringBuilder.Append("UPDATE dbo.g_stop_line_working_hours "); SqlStringBuilder.Append("SET pdline_id = @pdline_id , "); SqlStringBuilder.Append(" stop_line_length = @stop_line_length , "); SqlStringBuilder.Append(" stop_line_working_hours_name = @stop_line_working_hours_name , "); SqlStringBuilder.Append(" shift_id = @shift_id , "); SqlStringBuilder.Append(" hour = @hour "); SqlStringBuilder.Append("WHERE ruid = @ruid "); return _remotingProxy.ExecuteNonQuery(SqlStringBuilder.ToString(), htParams); } /// /// 获取菜单列表数据 /// /// /// /// public DataTable getList(string strWhere, string filedOrder) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * "); strSql.Append("FROM g_stop_line_working_hours as a "); strSql.Append(" LEFT JOIN sys_pdline as b ON a.pdline_id = b.pdline_id "); if (!strWhere.Trim().Equals("")) { strSql.Append(" where " + strWhere); } if (filedOrder != null && !filedOrder.Trim().Equals("")) { strSql.Append(" order by " + filedOrder); } return this._remotingProxy.GetDataTable(strSql.ToString()); } /// /// 根据分页条件获取分页数据列表 /// public Hashtable getListByPage(int PageSize, int PageIndex, string strWhere, string OrderBy) { Hashtable result = new Hashtable(); List parameters = new List(); parameters.Add(new StoreProcedureParameter(DbType.Int32, ParameterDirection.Output, "@TotalCount", 100)); parameters.Add(new StoreProcedureParameter(DbType.Int32, ParameterDirection.Output, "@TotalPage", 100)); parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@Table", "g_stop_line_working_hours a left join sys_pdline b on a.pdline_id=b.pdline_id ")); parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@Column", "*")); parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@OrderColumn", OrderBy)); parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@GroupColumn", "")); parameters.Add(new StoreProcedureParameter(DbType.Int32, ParameterDirection.Input, "@PageSize", PageSize)); parameters.Add(new StoreProcedureParameter(DbType.Int32, ParameterDirection.Input, "@CurrentPage", PageIndex)); parameters.Add(new StoreProcedureParameter(DbType.Int32, ParameterDirection.Input, "@Group", 0)); parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@Condition", strWhere)); Hashtable values = new Hashtable(2); DataTable dt = new DataTable(); dt = _remotingProxy.ExecuteSotreProcedure("Com_Pagination", parameters, ref values); ArrayList dataList = DataTypeConvert.NewObject.DataTableToArrayList(dt); result.Add("dataList", dataList); result.Add("totalCount", values["@TotalCount"].ToString()); return result; } } }