160 lines
5.9 KiB
C#
160 lines
5.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using WMS.Model.Base;
|
|
using WMS.DBUtility;
|
|
using System.Data;
|
|
using WMS.Common;
|
|
using WMS.IData.IBase;
|
|
using WMS.IData;using Oracle.ManagedDataAccess.Client;
|
|
|
|
|
|
namespace WMS.SqlServerData.BaseData
|
|
{
|
|
public class SystemMenuFucData:ISystemMenuFuc
|
|
{
|
|
string sqlstr;
|
|
|
|
/// <summary>
|
|
/// 获取系统功能
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<MenuFuctionModel> GetMenuDataFuc()
|
|
{
|
|
List<MenuFuctionModel> listMenuFuc = new List<MenuFuctionModel>();
|
|
string sqlStr =@"select a.*,b.menu_name from t_base_functioninfo a,t_base_menu b where a.menu_id = b.menu_id";
|
|
|
|
try
|
|
{
|
|
DataTable table = SystemDataObject.Instance.GetDataTable(sqlStr, null);
|
|
if (table != null)
|
|
{
|
|
listMenuFuc = ConvertHelper<MenuFuctionModel>.ConvertToList(table);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
return listMenuFuc;
|
|
}
|
|
/// <summary>
|
|
/// 获取系统功能
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<MenuFuctionModel> GetMenuDataFuc(MenuFuctionModel model)
|
|
{
|
|
List<MenuFuctionModel> listMenuFuc = new List<MenuFuctionModel>();
|
|
StringBuilder sqlStr = new StringBuilder();
|
|
sqlStr.Append("select a.*,b.menu_name");
|
|
sqlStr.Append(" from t_base_functioninfo a ");
|
|
sqlStr.Append(" left join t_base_menu b on a.menu_id = b.menu_id");
|
|
sqlStr.Append(" where 1=1 ");
|
|
if (!string.IsNullOrEmpty(model.MENU_ID))
|
|
{
|
|
sqlStr.Append(" and a.MENU_ID = '" + model.MENU_ID + "'");
|
|
}
|
|
|
|
try
|
|
{
|
|
DataTable table = SystemDataObject.Instance.GetDataTable(sqlStr.ToString(), null);
|
|
if (table != null)
|
|
{
|
|
listMenuFuc = ConvertHelper<MenuFuctionModel>.ConvertToList(table);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
return listMenuFuc;
|
|
}
|
|
/// <summary>
|
|
/// 更新系统菜单及菜单功能
|
|
/// </summary>
|
|
/// <param name="upmenu"></param>
|
|
/// <param name="upFuc"></param>
|
|
/// <param name="insertFuc"></param>
|
|
/// <param name="delFuc"></param>
|
|
/// <returns></returns>
|
|
public bool newSystemMenuFuc(List<BaseMenuModel> upmenu, List<MenuFuctionModel> upFuc, List<MenuFuctionModel> insertFuc, List<MenuFuctionModel> delFuc)
|
|
{
|
|
List<string> etsql= new List<string>();
|
|
List<OracleParameter[]> lo = new List<OracleParameter[]>();
|
|
string msg = "";
|
|
//系统菜单需要修改
|
|
if (upmenu.Count > 0)
|
|
{
|
|
foreach (BaseMenuModel fuc in upmenu)
|
|
{
|
|
sqlstr = string.Format(@"update t_base_menu set MENU_NAME='{0}',MENU_FORM='{1}',MENU_TAG='{2}',MENU_IMAGE='{3}',
|
|
FRM_TYPE='{4}',REMARK='{6}', p_menu_id='{7}' where MENU_ID='{5}' ", fuc.MENU_NAME,fuc.MENU_FORM,fuc.MENU_TAG,
|
|
fuc.MENU_IMAGE,fuc.FRM_TYPE,fuc.MENU_ID,fuc.REMARK,fuc.P_MENU_ID);
|
|
etsql.Add(sqlstr);
|
|
}
|
|
}
|
|
//菜单功能删除
|
|
if (delFuc.Count > 0)
|
|
{
|
|
foreach (MenuFuctionModel fuc in delFuc)
|
|
{
|
|
sqlstr = string.Format(@"delete from t_base_functioninfo where FUN_ID='{0}' and MENU_ID='{1}'", fuc.FUN_ID, fuc.MENU_ID);
|
|
etsql.Add(sqlstr);
|
|
}
|
|
}
|
|
//菜单功能更改
|
|
if (upFuc.Count > 0)
|
|
{
|
|
foreach (MenuFuctionModel fuc in upFuc)
|
|
{
|
|
sqlstr = string.Format(@"update t_base_functioninfo set FUN_NAME='{0}',FUN_DICTORY='{1}',
|
|
FUN_IMAGE='{2}',FUN_SORT='{3}',FUN_TAG='{4}' where MENU_ID='{5}' and FUN_ID='{6}'", fuc.FUN_NAME, fuc.FUN_DICTORY,
|
|
fuc.FUN_IMAGE,fuc.FUN_SORT,fuc.FUN_TAG, fuc.MENU_ID, fuc.FUN_ID);
|
|
etsql.Add(sqlstr);
|
|
}
|
|
}
|
|
//菜单功能添加
|
|
if (insertFuc.Count > 0)
|
|
{
|
|
foreach (MenuFuctionModel fuc in insertFuc)
|
|
{
|
|
sqlstr = string.Format(@"insert into t_base_functioninfo(FUN_NAME,FUN_DICTORY,FUN_TAG,FUN_IMAGE,FUN_METHOD,MENU_ID,FUN_SORT,FUN_ID)
|
|
values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", fuc.FUN_NAME, fuc.FUN_DICTORY, fuc.FUN_NAME, fuc.FUN_IMAGE, "1", fuc.MENU_ID, fuc.FUN_SORT, fuc.FUN_ID);
|
|
etsql.Add(sqlstr);
|
|
}
|
|
}
|
|
if (etsql.Count > 0)
|
|
{
|
|
int i = OracleHelper.ExecuteNonSQLList(CommandType.Text, etsql, ref msg);
|
|
if (i > 0)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public bool updateSystemMenuData(MenuFuctionModel[] menuFuc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取菜单功能
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataTable GetMenuFunDataTable()
|
|
{
|
|
string strSQL = "select FUN_ID,FUN_DICTORY,MENU_ID,'0' as ISCHECK from T_BASE_FUNCTIONINFO";
|
|
DataTable dt = SystemDataObject.Instance.GetDataTable(strSQL);
|
|
return dt;
|
|
}
|
|
}
|
|
}
|