You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
256 lines
7.9 KiB
C#
256 lines
7.9 KiB
C#
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 System.IO;
|
|
using System.Text;
|
|
|
|
|
|
namespace Estsh.Core.Services
|
|
{
|
|
/**
|
|
* 工站管制信息管理
|
|
*
|
|
* NOAH
|
|
*
|
|
*/
|
|
public class ViewBoardService
|
|
{
|
|
private ViewBoardDal dal = new ViewBoardDal(RemotingProxyProvider._remotingProxy);
|
|
|
|
/// <summary>
|
|
/// 获取菜单列表
|
|
/// </summary>
|
|
/// <param name="sqlWhere"></param>
|
|
/// <param name="orderBy"></param>
|
|
/// <returns></returns>
|
|
public List<TreeNode> getMenuList(string sqlWhere, string orderBy,String rootPath)
|
|
{
|
|
DataTable ds = dal.getList(sqlWhere, orderBy);
|
|
List<TreeNode> treeNodes = new List<TreeNode>();
|
|
for (int i = 0; i < ds.Rows.Count; i++)
|
|
{
|
|
TreeNode node = new TreeNode();
|
|
node.id = ds.Rows[i]["RUID"].ToString();
|
|
node.icon = ds.Rows[i]["MenuPicLink"].ToString();
|
|
node.name = ds.Rows[i]["MenuName"].ToString();
|
|
if (ds.Rows[i]["ParentMenuID"] == null || "0".Equals(ds.Rows[i]["ParentMenuID"].ToString().Trim()))
|
|
{
|
|
node.parentId = "0";
|
|
node.iconSkin = "diy01";
|
|
}
|
|
else
|
|
{
|
|
node.parentId = ds.Rows[i]["ParentMenuID"].ToString();
|
|
node.url = rootPath + ds.Rows[i]["MenuLink"].ToString();
|
|
node.target = "frmright";
|
|
}
|
|
treeNodes.Add(node);
|
|
}
|
|
|
|
return treeNodes;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据分页条件获取分页菜单数据
|
|
/// </summary>
|
|
/// <param name="partNo"></param>
|
|
/// <param name="pager"></param>
|
|
/// <param name="direction"></param>
|
|
/// <param name="sort"></param>
|
|
/// <returns></returns>
|
|
public ArrayList getKeyDataListByPage(String lableName, Pager pager, String direction, String sort)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
|
|
String strWhere = " where 1=1 ";
|
|
if (lableName != null && !lableName.Trim().Equals(""))
|
|
{
|
|
strWhere += " and lableName like '%" + lableName.Trim() + "%'";
|
|
}
|
|
|
|
DataTable dt = dal.getListByPage(pager.pageSize, pager.pageNo, strWhere, sort + " " );
|
|
|
|
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取分页总数量
|
|
/// </summary>
|
|
/// <param name="partNo"></param>
|
|
/// <returns></returns>
|
|
public int getMenuCount(String lableName)
|
|
{
|
|
String strWhere = " where 1=1 ";
|
|
if (lableName != null && !lableName.Trim().Equals(""))
|
|
{
|
|
strWhere += " and lableName like '%" + lableName.Trim() + "%'";
|
|
}
|
|
return dal.getCountWhere(strWhere);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存菜单数据
|
|
/// </summary>
|
|
/// <param name="htParams"></param>
|
|
/// <returns></returns>
|
|
public int saveKeyData(Hashtable htParams)
|
|
{
|
|
return dal.saveKeyData(htParams);
|
|
}
|
|
/// <summary>
|
|
/// 更新菜单数据
|
|
/// </summary>
|
|
/// <param name="htParams"></param>
|
|
/// <returns></returns>
|
|
public int updateKeyData(Hashtable htParams)
|
|
{
|
|
return dal.updateKeyData(htParams);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查看菜单详情
|
|
/// </summary>
|
|
/// <param name="ruid"></param>
|
|
/// <returns></returns>
|
|
public Hashtable getKeyDataDetail(String ruid)
|
|
{
|
|
ruid = " ruid = " + ruid;
|
|
DataTable dt = dal.getList(ruid, "");
|
|
Hashtable result = new Hashtable();
|
|
result.Add("ruid", dt.Rows[0]["ruid"]);
|
|
result.Add("lableName", dt.Rows[0]["lableName"]);
|
|
result.Add("lableValue", dt.Rows[0]["lableValue"]);
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除菜单
|
|
/// </summary>
|
|
/// <param name="ids"></param>
|
|
/// <returns></returns>
|
|
public int deleteKeyData(String ids)
|
|
{
|
|
String[] idArray = ids.Split(',');
|
|
int count = 0;
|
|
foreach (String id in idArray)
|
|
{
|
|
if (!"".Equals(id))
|
|
{
|
|
count += this.dal.deleteKeyData(id);
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取 站点 信息
|
|
/// BY NOAH
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ArrayList getTerminalName()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
|
|
DataTable dt = dal.getTerminalName();
|
|
|
|
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
|
|
}
|
|
/// <summary>
|
|
/// 获取 产线 信息
|
|
/// BY NOAH
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ArrayList getBoardName()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
|
|
DataTable dt = dal.getBoardName();
|
|
|
|
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
|
|
}
|
|
/// <summary>
|
|
/// 判断是否存在 用户输入的零件号
|
|
/// BY NOAH
|
|
/// </summary>
|
|
/// <param name="part_no"></param>
|
|
/// <returns></returns>
|
|
public String isExsitPart_no(String part_no)
|
|
{
|
|
return this.dal.isExsitPart_no(part_no);
|
|
}
|
|
/// <summary>
|
|
/// 根据分页条件获取分页菜单数据
|
|
/// </summary>
|
|
/// <param name="menuName">查询条件</param>
|
|
/// <param name="pager"></param>
|
|
/// <param name="direction">排序方式</param>
|
|
/// <param name="sort">排序字段</param>
|
|
/// <returns></returns>
|
|
public DataTable getTableListByPage(String keydata_name_search, String enabled_search, Pager pager, String direction, String sort, Boolean isPage)
|
|
{
|
|
DataTable result = null;
|
|
int rowCount = 0;
|
|
|
|
String strWhere = " where 1=1 ";
|
|
if (keydata_name_search != null && !keydata_name_search.Trim().Equals(""))
|
|
{
|
|
strWhere += " and lableName like '%" + keydata_name_search.Trim() + "%'";
|
|
}
|
|
|
|
if (isPage)
|
|
{
|
|
rowCount = pager.pageSize;
|
|
}
|
|
else
|
|
{
|
|
rowCount = pager.pageSize;
|
|
}
|
|
result = dal.getListByPage(rowCount, pager.pageNo, strWhere, sort + " " );
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 读取文件并更新至数据库
|
|
/// </summary>
|
|
/// <param name="inputStream">文件全路径</param>
|
|
/// <param name="userInfo">登录用户信息</param>
|
|
public Hashtable ReadExcelFile(Stream inputStream, int userId)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
Hashtable Cache = new Hashtable();
|
|
|
|
DataTable dt = AsposeExcelTools.ExcelFileToDataTable(inputStream);
|
|
|
|
dt.Rows[0].Delete();
|
|
|
|
if (dt == null)
|
|
{
|
|
result.Add("message", "Import data is empty, please re-import!");
|
|
result.Add("flag", "error");
|
|
return result;
|
|
}
|
|
|
|
// 处理表身数据
|
|
if (dal.InsertData(dt))
|
|
{
|
|
result.Add("message", "Successfully imported");
|
|
result.Add("flag", "error");
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
result.Add("message", "Import failed");
|
|
result.Add("flag", "error");
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
} |