init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,898 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using CommonLib;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
/// <summary>
|
||||
/// 业务基类
|
||||
/// </summary>
|
||||
public class BaseImpl
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>说明:检查数据库表是否包含某列</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-16 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <param name="colName">Name of the col.</param>
|
||||
/// <returns><c>true</c> if [has contain column]; otherwise, <c>false</c>.</returns>
|
||||
public static bool HasExistsColumn(string tableName, string colName)
|
||||
{
|
||||
string sqlValue = string.Format("select 1 from sys.columns where object_id=object_id('{0}') and name='{1}'", tableName, colName);
|
||||
return SqlHelper.ExecuteDataTable(sqlValue).Rows.Count > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:检查数据库表是否包含某列,不存在则创建</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-16 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <param name="colName">Name of the col.</param>
|
||||
/// <returns><c>true</c> if [has contain column]; otherwise, <c>false</c>.</returns>
|
||||
public static bool HasExistsColumn(string tableName, string colName, string colType)
|
||||
{
|
||||
if (!HasExistsColumn(tableName, colName))
|
||||
{
|
||||
return ExecSqlValue(string.Format("ALTER TABLE {0} ADD {1} {2}", tableName, colName, colType)) > 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:是否存在xxx表</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-01 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <returns><c>true</c> if [has exists table] [the specified table name]; otherwise, <c>false</c>.</returns>
|
||||
public static bool HasExistsTable(string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sqlValue = "select 1 from " + tableName + " where 1<>1";
|
||||
return SqlHelper.ExecuteDataTable(sqlValue).Rows.Count >= 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取树节点配置表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-12-22 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <returns><c>true</c> if [has exists table] [the specified table name]; otherwise, <c>false</c>.</returns>
|
||||
public static DataRow TreeNodeSetTab(string treeTable)
|
||||
{
|
||||
string sqlValue = string.Format("select * from p_systemTreeNodeSetTab" + " where treeTable='{0}'", treeTable);
|
||||
DataTable dt = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
return dt != null ? dt.Rows.Count > 0 ? dt.Rows[0] : null : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:是否包含某条数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-01 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="row">The row.</param>
|
||||
/// <returns><c>true</c> if [has exists data row] [the specified table name]; otherwise, <c>false</c>.</returns>
|
||||
public static bool HasExistsDataRow(string tableName, string key, string value, out DataRow row)
|
||||
{
|
||||
return HasExistsDataRow(tableName, key, value, "", out row);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:是否包含某条数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-08-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="whereCond">The where cond.</param>
|
||||
/// <param name="row">The row.</param>
|
||||
/// <returns><c>true</c> if [has exists data row] [the specified table name]; otherwise, <c>false</c>.</returns>
|
||||
public static bool HasExistsDataRow(string tableName, string key, string value, string whereCond, out DataRow row)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sqlValue = string.Format("select * from {0} where {1}='{2}' {3}", tableName, key, value, whereCond);
|
||||
row = GetDataRowResult(sqlValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
row = null;
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:修改某个表字段</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-02 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <param name="fieldName">Name of the field.</param>
|
||||
/// <param name="fieldType">Type of the field.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public static bool UpdateTableField(string tableName, string fieldName, string fieldType)
|
||||
{
|
||||
string sqlValue = string.Format("ALTER TABLE {0} ALTER COLUMN {1} {2}", tableName, fieldName, fieldType);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:添加业务异常数据到lscrm系统</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-03-28 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="msg">The MSG.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
//public static bool AddExceptionToLsCrm(string msg)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlConnection conn = new SqlConnection(DBConfig.Instance.GetLsCrmConnection()))
|
||||
// {
|
||||
// conn.Open();
|
||||
// DataTable sysTable = SqlHelper.ExecuteDataTable("select * from P_systemtab");
|
||||
// string commText = string.Format("insert into Crm_ProblemTab(OperatorName,ProDesc,CusName,CusConnection) values('{0}','{1}','{2}','{3}')",
|
||||
// ERPInfo.Instance.EmployeeName, msg, sysTable.Rows[0]["ClientName"], DBConfig.Instance.GetConnection());
|
||||
// using (SqlCommand comm = new SqlCommand(commText, conn))
|
||||
// {
|
||||
// int result = comm.ExecuteNonQuery();
|
||||
// comm.Dispose();
|
||||
|
||||
// return result > 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// LogHelper.Instance.WriteError(ex);
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
/// <summary>
|
||||
/// <para>说明:通过模块ID获取用户模块权限</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-18 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="subId">The sub identifier.</param>
|
||||
/// <param name="menuId">The menu identifier.</param>
|
||||
/// <returns>1.有操作权限.0.无权限.2.只读权限</returns>
|
||||
public static int GetUserPurviewsByMenuId(string menuId)
|
||||
{
|
||||
if (ERPInfo.Instance.EmployeeName == "管理员")
|
||||
return 1;
|
||||
string readPurview = "," + menuId + "|,";
|
||||
string editPurview = "," + menuId + ",";
|
||||
|
||||
string allPurview = ",";
|
||||
|
||||
string sqlValue = "select top 1 * from p_SubsysPurviewTab where employeeid=@employeeid";
|
||||
DataTable tablePurviews = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@employeeid", ERPInfo.Instance.EmployeeId) });
|
||||
|
||||
for (int i = 0; i < tablePurviews.Columns.Count; i++)
|
||||
{
|
||||
DataColumn col = tablePurviews.Columns[i];
|
||||
if (col.ColumnName.ToLower().Contains("purview"))
|
||||
{
|
||||
DataRow item = tablePurviews.Rows[0];
|
||||
allPurview += item[col.ColumnName] + ",";
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(allPurview)) return 0;
|
||||
if (allPurview.Contains(editPurview)) return 1;
|
||||
if (allPurview.Contains(readPurview)) return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:通过模块编号获取用户模块权限</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-14 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int GetUserPurviewsByMenuCode(string menuCode)
|
||||
{
|
||||
string sqlValue = string.Format("select top 1 MenuId from P_FormMenuConfigTab where UrlParams='{0}' and lower(DllFileName) not like '%accraditation%' and subsysid in (select SubSysId from P_SubSystemTab where UseEd=1)", menuCode);
|
||||
string menuId = SqlHelper.ExecuteString("MenuId", sqlValue);
|
||||
|
||||
return GetUserPurviewsByMenuId(menuId);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取单据是否有多表头</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-07-31 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>0.普通表格、1.多表头、2.树结构表格</returns>
|
||||
public static int GetBillDetailType(string menuCode)
|
||||
{
|
||||
if (HasExistsColumn("p_systembillDetail", "bandTitle") && HasExistsColumn("p_systembillDetail", "bandFields"))
|
||||
{
|
||||
string sqlValue = "select 1 from p_systembillDetail where typeCode=@tab and ISNULL(bandTitle,'')<>'' and ISNULL(bandFields,'')<>''";
|
||||
bool isBanded = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) }).Rows.Count > 0;
|
||||
return isBanded ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取基础档案、报表模版类型</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>0.普通表格、1.多表头、2.树结构表格</returns>
|
||||
public static int GetBaseType(string menuCode)
|
||||
{
|
||||
// 是否为多表头
|
||||
string sqlValue = "select 1 from p_systemwordbooktab where tab=@tab and ISNULL(bandTitle,'')<>'' and ISNULL(bandFields,'')<>''";
|
||||
bool isBanded = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) }).Rows.Count > 0;
|
||||
|
||||
if (isBanded) return 1;
|
||||
|
||||
// 是否为树结构表格
|
||||
sqlValue = "select 1 from P_FormMenuConfigTab where PurviewId=@tab and ISNULL(TRCReport,0)=1";
|
||||
bool isTreeGrid = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) }).Rows.Count > 0;
|
||||
|
||||
return isTreeGrid ? 2 : 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取扫码控件表格</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2021-06-16 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>控件为扫码框且内容隐藏就为扫码控件</returns>
|
||||
public static DataTable GetSweepCode(string menuCode)
|
||||
{
|
||||
// 是否为存在扫码控件
|
||||
string sqlValue = "select * from p_systemwordbooktab where tab=@tab and vislble='1' and fieldsqlTag='98' ORDER BY orderid";
|
||||
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取扫码控件表格</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2021-06-16 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>扫码控件的提醒</returns>
|
||||
public static DataTable GetSweepCodeTips(string menuCode)
|
||||
{
|
||||
// 是否为多表头
|
||||
string sqlValue = "select * from p_systemwordbooktab where tab=@tab and TM_tagID=-1 ORDER BY orderid";
|
||||
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:验证是否允许删除记录</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-01-04 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <param name="fieldKey">The key value.</param>
|
||||
/// <param name="tipMsg">The tip MSG.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int VerifyCanDelete(string menuCode, string fieldKey, out string tipMsg)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
SqlParameter[] param =
|
||||
{
|
||||
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
||||
new SqlParameter("@keyvalue",SqlDbType.VarChar,40),
|
||||
pMsg,
|
||||
returnValue
|
||||
};
|
||||
param[0].Value = menuCode;
|
||||
param[1].Value = fieldKey;
|
||||
|
||||
SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_VerifyCanDelete", "baseSave", param);
|
||||
tipMsg = pMsg.Value + "";
|
||||
|
||||
return Convert.ToInt32(returnValue.Value + "");
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:树结构自定义配置功能</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-12-22 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <param name="fieldKey">The key value.</param>
|
||||
/// <param name="tipMsg">The tip MSG.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int ReBuildTreeNode(string treeModid, int operType, out string tipMsg)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
SqlParameter[] param =
|
||||
{
|
||||
new SqlParameter("@treeModid",SqlDbType.VarChar,20),
|
||||
new SqlParameter("@operType",SqlDbType.Int),
|
||||
new SqlParameter("@operatorid",SqlDbType.Int),
|
||||
new SqlParameter("@operatorname",SqlDbType.VarChar,20),
|
||||
pMsg,
|
||||
returnValue
|
||||
};
|
||||
param[0].Value = treeModid;
|
||||
param[1].Value = operType;
|
||||
param[2].Value = ERPInfo.Instance.EmployeeId;
|
||||
param[3].Value = ERPInfo.Instance.EmployeeName;
|
||||
|
||||
SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_system_ReBuildTreeNode", "treeDrop", param);
|
||||
tipMsg = pMsg.Value + "";
|
||||
return Convert.ToInt32(returnValue.Value + "");
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行SQL语句返回受影响行</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int ExecSqlValue(string sqlValue, params SqlParameter[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlValue, parameters);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static int ExecSqlValue(string sqlValue, bool isTip, params SqlParameter[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlValue, parameters);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (isTip) throw;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行存储过程</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-10-31 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static int ExecProcedure(string sqlValue, params SqlParameter[] parameters)
|
||||
{
|
||||
|
||||
return SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, sqlValue, parameters);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取列前缀</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
public static string GetColumnPrefix(string tableName)
|
||||
{
|
||||
string sqlValue = "select column_prefix from p_systemtables where lower(table_name)=@tableName";
|
||||
return SqlHelper.ExecuteString("column_prefix", sqlValue, new SqlParameter[] { new SqlParameter("@tableName", tableName) });
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取主键</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-10-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
public static string GetBasePrimaryKey(string menuCode)
|
||||
{
|
||||
string sqlValue = "select top 1 fieldname from P_systemwordbooktab where tab=@tab order by orderid";
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
||||
|
||||
return (dtTable.Rows.Count > 0) ? dtTable.Rows[0]["fieldname"] + "" : string.Empty;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取当前登录用户权限</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-14 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string GetPurviewCond()
|
||||
{
|
||||
string operColumn = string.Empty;
|
||||
string viewColumn = string.Empty;
|
||||
string targetColumn = string.Empty;
|
||||
string sqlValue = "select name from sys.columns where object_id=object_id('p_SubsysPurviewTab') and name like '%purview'";
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
|
||||
if (dtTable.Rows.Count == 0)
|
||||
{
|
||||
operColumn = @"','+isnull([KcPurview],'')+','+isnull([crmPurview],'')+','+isnull([bomPurview],'')+','+
|
||||
isnull([mrpPurview],'')+','+isnull([scmPurview],'')+','+isnull([sellPurview],'')+','+
|
||||
isnull([RdmPurview],'')+','+isnull([hrPurview],'')+','+isnull([costPurview],'')+','+
|
||||
isnull([eamPurview],'')+','+isnull([FmPurview],'')+','+isnull([oaPurview],'')+','+
|
||||
isnull([BiPurview],'')+','+isnull([QmsPurview],'')+','";
|
||||
viewColumn = @"','+isnull([KcPurview],'')+'|,'+isnull([crmPurview],'')+'|,'+isnull([bomPurview],'')+'|,'+
|
||||
isnull([mrpPurview],'')+'|,'+isnull([scmPurview],'')+'|,'+isnull([sellPurview],'')+'|,'+
|
||||
isnull([RdmPurview],'')+'|,'+isnull([hrPurview],'')+'|,'+isnull([costPurview],'')+'|,'+
|
||||
isnull([eamPurview],'')+'|,'+isnull([FmPurview],'')+'|,'+isnull([oaPurview],'')+'|,'+
|
||||
isnull([BiPurview],'')+'|,'+isnull([QmsPurview],'')+'|,'";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DataRow item in dtTable.Rows)
|
||||
{
|
||||
operColumn += "','+isnull(" + item["name"] + ",'')+','";
|
||||
viewColumn += "','+isnull(" + item["name"] + ",'')+'|,'";
|
||||
}
|
||||
}
|
||||
return @"and (CHARINDEX(','+CAST(menuid as varchar)+',',(select top 1
|
||||
" + operColumn + @"
|
||||
from [p_SubsysPurviewTab]
|
||||
where employeeid=" + ERPInfo.Instance.EmployeeId + "))>0 " +
|
||||
@" or CHARINDEX(','+CAST(menuid as varchar)+'|,',(select top 1
|
||||
" + viewColumn + @"
|
||||
from [p_SubsysPurviewTab]
|
||||
where employeeid=" + ERPInfo.Instance.EmployeeId + "))>0 " +
|
||||
"or len(menustruct)=2 or " + ERPInfo.Instance.EmployeeId + "=1 or '" + ERPInfo.Instance.EmployeeName + "'='管理员')";
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:替换默认值</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="defaultValue">The default value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string GetDefaultValue(string defaultValue, string parentValue = "", string[] otherParams = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(defaultValue)) return defaultValue;
|
||||
|
||||
defaultValue = defaultValue.TrimStart(new char[] { '\r', '\n' }); // 去除前后空格、制表符等
|
||||
defaultValue = ReplaceHelper.ReplaceUserInfo(defaultValue);//
|
||||
defaultValue = ReplaceHelper.ReplaceTreeViewParentKeyCond(defaultValue, parentValue);
|
||||
|
||||
if ("guid".Equals(defaultValue))
|
||||
return Guid.NewGuid().ToString();
|
||||
|
||||
if (defaultValue.StartsWith("@"))
|
||||
return GetResult(defaultValue.Replace("@", "")) + "";
|
||||
|
||||
if (defaultValue.StartsWith("!"))
|
||||
{
|
||||
defaultValue = "exec " + defaultValue.Replace("!", "").Replace("(", " ").Replace(")", "");
|
||||
return GetResult(defaultValue) + "";
|
||||
}
|
||||
if (defaultValue.ToLower().Contains("{#p_"))
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> paramList = ReplaceHelper.GetParamFields(defaultValue);
|
||||
|
||||
foreach (var item in paramList)
|
||||
{
|
||||
string index = item.Replace("{#p_", "").Replace("}", "");
|
||||
int i = 0;
|
||||
if (int.TryParse(index, out i))
|
||||
{
|
||||
defaultValue = defaultValue.Replace(item, otherParams != null ? otherParams[i - 1] : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取记录</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <param name="fieldName">Name of the field.</param>
|
||||
/// <param name="condKey">The cond key.</param>
|
||||
/// <param name="condValue">The cond value.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static object GetRecord(string tableName, string fieldName, string condKey, string condValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tableName) ||
|
||||
string.IsNullOrEmpty(fieldName) ||
|
||||
string.IsNullOrEmpty(condKey) ||
|
||||
string.IsNullOrEmpty(condValue))
|
||||
return new object();
|
||||
|
||||
string sqlValue = string.Format("select top 1 {0} from {1} where {2}='{3}'", fieldName, tableName, condKey, condValue);
|
||||
return GetResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行sql语句返回数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static object GetResult(string sqlValue)
|
||||
{
|
||||
return SqlHelper.ExecuteScalar(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行sql语句返回数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-01-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static object GetResult(string sqlValue, SqlParameter[] parameters)
|
||||
{
|
||||
return SqlHelper.ExecuteScalar(CommandType.Text, sqlValue, parameters);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取菜单其他配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="moduleId">The module identifier.</param>
|
||||
/// <returns>DataRow.</returns>
|
||||
public static DataRow GetMenuConfigTab(int moduleId)
|
||||
{
|
||||
string sqlValue = "select * from P_FormMenuConfigTab where menuid=@menuid";
|
||||
DataTable table = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@menuid", moduleId) });
|
||||
|
||||
return table != null && table.Rows.Count > 0 ? table.Rows[0] : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取系统配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataRow.</returns>
|
||||
public static DataRow GetSystemTab()
|
||||
{
|
||||
string sqlValue = "select * from dbo.p_systemtab";
|
||||
return GetDataRowResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取验证系统配置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-12-10 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataRow.</returns>
|
||||
public static DataRow GetVeriSystemTab()
|
||||
{
|
||||
string sqlValue = "select isnull(clientcode,'') AS coid,ClientName,* from p_systemtab";
|
||||
return GetDataRowResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行SQL语句返回第一行</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-04 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <returns>DataRow.</returns>
|
||||
public static DataRow GetDataRowResult(string sqlValue)
|
||||
{
|
||||
DataTable table = GetDataTableResult(sqlValue);
|
||||
return table.Rows.Count > 0 ? table.Rows[0] : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取某个表的列</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-10 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">Name of the table.</param>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetTableColumns(string tableName)
|
||||
{
|
||||
string sqlValue = string.Format("select * from {0} where 1<>1", tableName);
|
||||
return SqlHelper.ExecuteDataTable(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行SQL语句返回结果集</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:2017-10-25</para>
|
||||
/// <para>修改备注:1. 2017-10-25增加传入参数为空处理,返回空DataTable</para>
|
||||
/// <para>版本:1.1</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetDataTableResult(string sqlValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sqlValue)) return new DataTable();
|
||||
sqlValue = GetDefaultValue(sqlValue);
|
||||
sqlValue = ReplaceHelper.ReplaceParam(sqlValue);
|
||||
return SqlHelper.ExecuteDataTable(sqlValue);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return new DataTable();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:执行SQL语句返回结果集</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-10-10 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <returns>SqlDataAdapter.</returns>
|
||||
public static SqlDataAdapter GetAdapterResult(string sqlValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sqlValue)) return new SqlDataAdapter();
|
||||
sqlValue = GetDefaultValue(sqlValue);
|
||||
sqlValue = ReplaceHelper.ReplaceParam(sqlValue);
|
||||
return SqlHelper.ExecuteAdapter(CommandType.Text, sqlValue);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return new SqlDataAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取打印配置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-07-31 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetPrintTemp70(string key)
|
||||
{
|
||||
string sqlValue = string.Format(@"select * from p_systemPrintDesignTab where modid='{0}'", key);
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行删除存储过程
|
||||
/// </summary>
|
||||
/// <param name="modid"></param>
|
||||
/// <param name="tagid"></param>
|
||||
/// <param name="mid"></param>
|
||||
/// <returns></returns>
|
||||
public static int deleteFlow(int tagid, string Dllcode, string stepCode, int typeID, out string tipMsg)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
SqlParameter[] param =
|
||||
{
|
||||
new SqlParameter("@tagid",SqlDbType.Int),
|
||||
new SqlParameter("@Dllcode",SqlDbType.VarChar,50),
|
||||
new SqlParameter("@stepCode",SqlDbType.VarChar,50),
|
||||
new SqlParameter("@typeID",SqlDbType.Int),
|
||||
pMsg,
|
||||
returnValue
|
||||
};
|
||||
param[0].Value = tagid;
|
||||
param[1].Value = Dllcode;
|
||||
param[2].Value = stepCode;
|
||||
param[3].Value = typeID;
|
||||
BaseImpl.ExecProcedure("[p_systemDeleteFlowInfo]", param);
|
||||
tipMsg = pMsg.Value + "";
|
||||
return Convert.ToInt32(returnValue.Value.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行通过人员id获取权限菜单存储过程
|
||||
/// </summary>
|
||||
/// <param name="modid"></param>
|
||||
/// <param name="tagid"></param>
|
||||
/// <param name="mid"></param>
|
||||
/// <returns></returns>
|
||||
public static DataSet getAuthorityByEmpid(int typeId, string empid, string operatorId, string operatorName, out string tipMsg)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
SqlParameter[] param =
|
||||
{
|
||||
new SqlParameter("@typeId",SqlDbType.Int),
|
||||
new SqlParameter("@empid",SqlDbType.VarChar,50),
|
||||
new SqlParameter("@operatorId",SqlDbType.VarChar,50),
|
||||
new SqlParameter("@operatorName",SqlDbType.VarChar,50),
|
||||
pMsg,
|
||||
returnValue
|
||||
};
|
||||
param[0].Value = typeId;
|
||||
param[1].Value = empid;
|
||||
param[2].Value = operatorId;
|
||||
param[3].Value = operatorName;
|
||||
tipMsg = pMsg.Value + "";
|
||||
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_getAuthorityByEmpid", "#ba_firstpage", param);
|
||||
return ds;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取表的主键值</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-05-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetPrimaryKey(string TableName)
|
||||
{
|
||||
string sqlValue = string.Format("SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME='{0}'", TableName);
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
return (dtTable.Rows.Count > 0) ? dtTable.Rows[0]["COLUMN_NAME"] + "" : string.Empty;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取表中是否包含其主键列</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2021-04-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool GetIsContainKey(string TableName, string ParmaryKey, string ids)
|
||||
{
|
||||
int idCount = ids.Split(',').Count();
|
||||
string sqlValue = string.Format("SELECT * from {0} where {1} in({2})", TableName, ParmaryKey, ids);
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
return dtTable != null ? dtTable.Rows.Count == idCount : false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
partial class BaseUserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// BaseUserControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Name = "BaseUserControl";
|
||||
this.Size = new System.Drawing.Size(260, 40);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public partial class BaseUserControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Label填充值
|
||||
/// </summary>
|
||||
protected int PaddingLeft = 7;
|
||||
/// <summary>
|
||||
/// 一个字符占用宽度
|
||||
/// </summary>
|
||||
private int CharWidth = 22;
|
||||
private float DefaultFontSize = 12;
|
||||
/// <summary>
|
||||
/// 只读颜色
|
||||
/// </summary>
|
||||
protected Color ReadOnlyLabelForceColor = Color.FromArgb(160, 160, 160);
|
||||
/// <summary>
|
||||
/// 必填颜色
|
||||
/// </summary>
|
||||
protected Color RequiredLabelForceColor = Color.Blue;
|
||||
/// <summary>
|
||||
/// Label 默认颜色
|
||||
/// </summary>
|
||||
protected Color DefaultLabelForceColor = Color.Black;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the is empty.
|
||||
/// </summary>
|
||||
/// <value>The is empty.</value>
|
||||
public virtual bool IsEmpty()
|
||||
{
|
||||
return this.Model != null && this.Model.IsEmpty && string.IsNullOrWhiteSpace(this.EditText);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:数据是否修改</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-06 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if this instance is update; otherwise, <c>false</c>.</returns>
|
||||
public virtual bool IsUpdate()
|
||||
{
|
||||
string UpdContrast = this.EditText;
|
||||
|
||||
return this.Model == null || this.Model.Text == null || !this.Model.Text.Equals(UpdContrast, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
/// <summary>
|
||||
/// LebelText
|
||||
/// </summary>
|
||||
public virtual string LabelText { get; set; }
|
||||
/// <summary>
|
||||
/// Label、TextEdit Size
|
||||
/// </summary>
|
||||
/// <value>The size of the control.</value>
|
||||
public virtual float FontSize { get; set; }
|
||||
/// <summary>
|
||||
/// 控件值
|
||||
/// </summary>
|
||||
public virtual string EditText { get; set; }
|
||||
/// <summary>
|
||||
/// 控件提示信息
|
||||
/// </summary>
|
||||
public virtual string NullText { get; set; }
|
||||
/// <summary>
|
||||
/// 只读控件是否可编辑
|
||||
/// </summary>
|
||||
/// <value>The color of the read only label.</value>
|
||||
public virtual bool ReadOnly { get; set; }
|
||||
/// <summary>
|
||||
/// 必填文本颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the required label.</value>
|
||||
public virtual bool Required { get; set; }
|
||||
/// <summary>
|
||||
/// 控件Model
|
||||
/// </summary>
|
||||
public virtual ControlModel Model { get; set; }
|
||||
|
||||
protected int GetCharWidth()
|
||||
{
|
||||
return Convert.ToInt32(CharWidth + (FontSize > DefaultFontSize ? FontSize - DefaultFontSize : 0));
|
||||
}
|
||||
|
||||
|
||||
public BaseUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,207 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public class ControlModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否为回车新增控件
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is search control; otherwise, <c>false</c>.</value>
|
||||
public bool IsAddControl { get; set; }
|
||||
/// <summary>
|
||||
/// 是否为查询条件创建控件
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is search control; otherwise, <c>false</c>.</value>
|
||||
public bool IsSearchControl { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is empty.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is empty; otherwise, <c>false</c>.</value>
|
||||
public bool IsEmpty { get; set; }
|
||||
/// <summary>
|
||||
/// 获取是否是特殊int值.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is empty; otherwise, <c>false</c>.</value>
|
||||
public bool Isintordecimal { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is save.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is save; otherwise, <c>false</c>.</value>
|
||||
public bool IsSave { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is clear.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is clear; otherwise, <c>false</c>.</value>
|
||||
public bool CanClear { get; set; }
|
||||
/// <summary>
|
||||
/// 是否显示****,1:显示0.不显示
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is visible; otherwise, <c>false</c>.</value>
|
||||
public bool Visible { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is copy.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is copy; otherwise, <c>false</c>.</value>
|
||||
public bool CanCopy { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is readonly.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is read only; otherwise, <c>false</c>.</value>
|
||||
public bool ReadOnly { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the field.
|
||||
/// </summary>
|
||||
/// <value>The type of the field.</value>
|
||||
public int FieldType { get; set; }
|
||||
/// <summary>
|
||||
/// 刷新来源
|
||||
/// </summary>
|
||||
public int IsRefreshSource { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the tip MSG.
|
||||
/// </summary>
|
||||
/// <value>The tip MSG.</value>
|
||||
public string TipMsg { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the null text.
|
||||
/// </summary>
|
||||
/// <value>The null text.</value>
|
||||
public string NullText { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the field.
|
||||
/// </summary>
|
||||
/// <value>The name of the field.</value>
|
||||
public string FieldName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the label text.
|
||||
/// </summary>
|
||||
/// <value>The label text.</value>
|
||||
public string LabelText { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the field text.
|
||||
/// </summary>
|
||||
/// <value>The field text.</value>
|
||||
public string Text { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the default value.
|
||||
/// </summary>
|
||||
/// <value>The default value.</value>
|
||||
public string DefaultValue { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the default.
|
||||
/// </summary>
|
||||
/// <value>The default value.</value>
|
||||
public string Default { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the data format.
|
||||
/// </summary>
|
||||
/// <value>The data format.</value>
|
||||
public string DataFormat { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the value member.
|
||||
/// </summary>
|
||||
/// <value>The value member.</value>
|
||||
public string ValueMember { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the text member.
|
||||
/// </summary>
|
||||
/// <value>The text member.</value>
|
||||
public string TextMember { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the source SQL.
|
||||
/// </summary>
|
||||
/// <value>The source SQL.</value>
|
||||
public string SourceSql { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the union fields.
|
||||
/// </summary>
|
||||
/// <value>The union fields.</value>
|
||||
public string UnionFields { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the union values.
|
||||
/// </summary>
|
||||
/// <value>The union values.</value>
|
||||
public string UnionValues { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the calculate expr.
|
||||
/// </summary>
|
||||
/// <value>The calculate expr.</value>
|
||||
public string CalcExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the calculate order.
|
||||
/// </summary>
|
||||
/// <value>The calculate order.</value>
|
||||
public int CalcOrder { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the tab order.
|
||||
/// </summary>
|
||||
/// <value>The tab order.</value>
|
||||
public int TabOrder { get; set; }
|
||||
/// <summary>
|
||||
/// 标识字段(用于身份证阅读器)
|
||||
/// </summary>
|
||||
/// <value>The sign.</value>
|
||||
public int Sign { get; set; }
|
||||
/// <summary>
|
||||
/// 自动搜索框添加模块ID
|
||||
/// </summary>
|
||||
/// <value>The add module identifier.</value>
|
||||
public string AddModuleId { get; set; }
|
||||
/// <summary>
|
||||
/// 自动搜索框添加模块Spec
|
||||
/// </summary>
|
||||
/// <value>The add module spec.</value>
|
||||
public string AddModuleSpec { get; set; }
|
||||
/// <summary>
|
||||
/// 自动搜索框添加模块返回
|
||||
/// </summary>
|
||||
/// <value>The add module result.</value>
|
||||
public string AddModuleResult { get; set; }
|
||||
/// <summary>
|
||||
/// 字体大小
|
||||
/// </summary>
|
||||
/// <value>The size of the font.</value>
|
||||
public int FontSize { get; set; }
|
||||
/// <summary>
|
||||
/// 可用条件
|
||||
/// </summary>
|
||||
/// <value>The enable cond.</value>
|
||||
public string DisableCond { get; set; }
|
||||
/// <summary>
|
||||
/// 可以方式
|
||||
/// </summary>
|
||||
/// <value>The type of the enable.</value>
|
||||
public string DisableType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the only value.
|
||||
/// </summary>
|
||||
/// <value>The location.</value>
|
||||
public string FormKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the size.
|
||||
/// </summary>
|
||||
/// <value>The size.</value>
|
||||
public Size Size { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the location.
|
||||
/// </summary>
|
||||
/// <value>The location.</value>
|
||||
public Point Location { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the tag.
|
||||
/// </summary>
|
||||
/// <value>The tag.</value>
|
||||
public object Tag { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
using DevExpress.XtraEditors;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询条件执行前
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
public delegate void SearchEventHandler(object sender, SearchArgs e);
|
||||
/// <summary>
|
||||
/// 表格拖拽树节点完成后调用
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
public delegate void GridDragTreeCompleteEventHandler(object sender, GridDragTreeArgs e);
|
||||
/// <summary>
|
||||
/// 表格拖拽表格完成后调用
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
public delegate void GridFragGridCompleteEventHandler(object sender, GridDragGridArgs e);
|
||||
/// <summary>
|
||||
/// 表格拖拽控件完成后调用
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
public delegate void GridFragControlCompleteEventHandler(object sender, GridDragControlArgs e);
|
||||
/// <summary>
|
||||
/// 表格拖拽文本框完成后调用
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
public delegate void GridFragMemoEditCompleteEventHandler(object sender, GridDragMemoArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// 扫码回调函数
|
||||
/// </summary>
|
||||
/// <param name="e">The e.</param>
|
||||
public delegate void OnScanCodeCallBackEventHandler(ScanCodeArgs e);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询事件参数
|
||||
/// </summary>
|
||||
public class SearchArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 代表事件后续操作是否继续执行
|
||||
/// </summary>
|
||||
/// <value><c>true:继续执行,false 不执行</value>
|
||||
public bool Continue = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表格拖拽树事件参数
|
||||
/// </summary>
|
||||
public class GridDragTreeArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 表格对象
|
||||
/// </summary>
|
||||
public GridView GridViewObj;
|
||||
/// <summary>
|
||||
/// 树对象
|
||||
/// </summary>
|
||||
public TreeView TreeViewObj;
|
||||
/// <summary>
|
||||
/// 表格拖动选中行数据
|
||||
/// </summary>
|
||||
public DataRow[] GridViewSelectRows;
|
||||
/// <summary>
|
||||
/// 拖动目标树选中节点
|
||||
/// </summary>
|
||||
public TreeNode SelectTreeNode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表格拖拽表格事件参数
|
||||
/// </summary>
|
||||
public class GridDragGridArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 源表格对象
|
||||
/// </summary>
|
||||
public GridView SourceGridViewObj;
|
||||
/// <summary>
|
||||
/// 目标表格
|
||||
/// </summary>
|
||||
public GridView TargetGridViewObj;
|
||||
/// <summary>
|
||||
/// 表格拖动选中行数据
|
||||
/// </summary>
|
||||
public DataRow[] GridViewSelectRows;
|
||||
/// <summary>
|
||||
/// 拖动目标选中行
|
||||
/// </summary>
|
||||
public DataRow SelectGridRow;
|
||||
}
|
||||
/// <summary>
|
||||
/// 表格拖拽表格事件参数
|
||||
/// </summary>
|
||||
public class GridDragMemoArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 源表格对象
|
||||
/// </summary>
|
||||
public GridView SourceGridViewObj;
|
||||
/// <summary>
|
||||
/// 目标控件
|
||||
/// </summary>
|
||||
public MemoEdit TargetMemoEditObj;
|
||||
/// <summary>
|
||||
/// 表格拖动选中行数据
|
||||
/// </summary>
|
||||
public DataRow[] GridViewSelectRows;
|
||||
}
|
||||
public class GridDragControlArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 源表格对象
|
||||
/// </summary>
|
||||
public GridView SourceGridViewObj;
|
||||
/// <summary>
|
||||
/// 目标控件
|
||||
/// </summary>
|
||||
public System.Windows.Forms.Control TargetControlObj;
|
||||
/// <summary>
|
||||
/// 表格拖动选中行数据
|
||||
/// </summary>
|
||||
public DataRow[] GridViewSelectRows;
|
||||
/// <summary>
|
||||
/// 拖动目标选中行
|
||||
/// </summary>
|
||||
public DataRow SelectGridRow;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 常用工具执行参数
|
||||
/// </summary>
|
||||
public class ScanCodeArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 提示信息
|
||||
/// </summary>
|
||||
public string TipMsg;
|
||||
/// <summary>
|
||||
/// 条码值
|
||||
/// </summary>
|
||||
public string ScanCode;
|
||||
/// <summary>
|
||||
/// 是否取消执行
|
||||
/// </summary>
|
||||
public bool CancelFlag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.UserSkins;
|
||||
using DevExpress.Skins;
|
||||
using DevExpress.LookAndFeel;
|
||||
using CommonLib.utils;
|
||||
using CommonLib;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
/// <summary>
|
||||
/// c#库被调用统一接口类
|
||||
/// </summary>
|
||||
public sealed class DllBaseClass : IForm
|
||||
{
|
||||
public DllBaseClass()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DllBaseClass(string[] obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
DynamicPowerModel moduleModel = new DynamicPowerModel(obj);
|
||||
FrmMain main = new FrmMain();
|
||||
this.SubForm = main;
|
||||
main.PubPowerModel = moduleModel;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PubUtil.WriteLog("Lskj.Workflow.dll--参数错误-->" + ex);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 窗口
|
||||
/// </summary>
|
||||
public Form SubForm { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
using CommonLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
/// <summary>
|
||||
/// 动态链接库对象
|
||||
/// </summary>
|
||||
public class DynamicModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单ID
|
||||
/// </summary>
|
||||
/// <value>The module identifier.</value>
|
||||
public int ModuleId { get; protected set; }
|
||||
/// <summary>
|
||||
/// 窗口标题
|
||||
/// </summary>
|
||||
/// <value>The form text.</value>
|
||||
public string FormText { get; protected set; }
|
||||
/// <summary>
|
||||
/// 权限(1.有操作权限.0.无权限.2.只读权限.3.右键配置权限全部开放)
|
||||
/// </summary>
|
||||
/// <value>The privilege.</value>
|
||||
public string Privilege { get; set; }
|
||||
/// <summary>
|
||||
/// 模块编号
|
||||
/// </summary>
|
||||
/// <value>The module code.</value>
|
||||
public string ModuleCode { get; protected set; }
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
/// <value>The user identifier.</value>
|
||||
public string UserId { get { return ERPInfo.Instance.EmployeeId+""; } private set { ERPInfo.Instance.EmployeeId =int.Parse( value); } }
|
||||
/// <summary>
|
||||
/// 用户名称
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
public string UserName { get { return ERPInfo.Instance.EmployeeName; } private set { ERPInfo.Instance.EmployeeName = value; } }
|
||||
/// <summary>
|
||||
/// 是否是配置查询明细
|
||||
/// </summary>
|
||||
/// <value>The state of the save.</value>
|
||||
public bool IsDetailSearch { get; set; }
|
||||
/// <summary>
|
||||
/// <para>说明:是否有操作权限</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-14 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if this instance has privilege; otherwise, <c>false</c>.</returns>
|
||||
public bool HasOperPrivilege()
|
||||
{
|
||||
return "1".Equals(this.Privilege) || "3".Equals(this.Privilege);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:是否有只读权限</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-14 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if [has read privilege]; otherwise, <c>false</c>.</returns>
|
||||
public bool HasReadPrivilege()
|
||||
{
|
||||
return "2".Equals(this.Privilege);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:是否有权限、包含只读和可操作权限</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if this instance has privilege; otherwise, <c>false</c>.</returns>
|
||||
public bool HasPrivilege()
|
||||
{
|
||||
return HasOperPrivilege() || HasReadPrivilege();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否为基础档案
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is base module; otherwise, <c>false</c>.</value>
|
||||
public virtual bool IsBaseModule { get { return false; } }
|
||||
/// <summary>
|
||||
/// 其他参数
|
||||
/// </summary>
|
||||
/// <value>The parameters.</value>
|
||||
public string[] Params;
|
||||
/// <summary>
|
||||
/// <para>说明:传入特殊参数处理</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-22 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <returns>System.String[].</returns>
|
||||
public virtual string[] OtherParams()
|
||||
{
|
||||
return this.Params;
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化默认参数(1.标题、2、用户ID、3.用户名、4.权限、5.模块编号、6.菜单ID)
|
||||
/// </summary>
|
||||
/// <param name="args">The arguments.</param>
|
||||
public DynamicModel(string[] args)
|
||||
{
|
||||
this.FormText = args[0];
|
||||
this.UserId = args[1];
|
||||
this.UserName = args[2];
|
||||
this.Privilege = args[3];
|
||||
this.ModuleCode = args[4];
|
||||
this.ModuleId = 0;
|
||||
this.Params = new string[args.Length];
|
||||
for (int i = 8; i < args.Length; i++)
|
||||
{
|
||||
Params[i - 8] = args[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 权限设置入口对象
|
||||
/// </summary>
|
||||
public class DynamicPowerModel : DynamicModel
|
||||
{
|
||||
public DynamicPowerModel(string[] args)
|
||||
: base(args)
|
||||
{
|
||||
// 右键菜单打开的模块没有moduleId,部分特殊模块没有moduleId比如添加界面.
|
||||
if (!string.IsNullOrEmpty(args[5]))
|
||||
{
|
||||
base.ModuleId = Convert.ToInt32(args[5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+108
@@ -0,0 +1,108 @@
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
partial class FrmAddRole
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAddRole));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnOK = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.txtEdit = new DevExpress.XtraEditors.TextEdit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtEdit.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(13, 13);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(101, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "请输入角色名称:";
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnCancel.Appearance.Options.UseFont = true;
|
||||
this.btnCancel.Location = new System.Drawing.Point(132, 79);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(80, 28);
|
||||
this.btnCancel.TabIndex = 20;
|
||||
this.btnCancel.TabStop = false;
|
||||
this.btnCancel.Text = "取消(&C)";
|
||||
this.btnCancel.Click += new System.EventHandler(this.OnBtnCancelClick);
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnOK.Appearance.Options.UseFont = true;
|
||||
this.btnOK.Location = new System.Drawing.Point(40, 79);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(80, 28);
|
||||
this.btnOK.TabIndex = 19;
|
||||
this.btnOK.TabStop = false;
|
||||
this.btnOK.Text = "确定(&O)";
|
||||
this.btnOK.Click += new System.EventHandler(this.OnBtnOKClick);
|
||||
//
|
||||
// txtEdit
|
||||
//
|
||||
this.txtEdit.Location = new System.Drawing.Point(40, 38);
|
||||
this.txtEdit.Name = "txtEdit";
|
||||
this.txtEdit.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.txtEdit.Properties.Appearance.Options.UseFont = true;
|
||||
this.txtEdit.Size = new System.Drawing.Size(172, 28);
|
||||
this.txtEdit.TabIndex = 21;
|
||||
//
|
||||
// FrmAddRole
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(219, 114);
|
||||
this.Controls.Add(this.txtEdit);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnOK);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FrmAddRole";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtEdit.Properties)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private DevExpress.XtraEditors.SimpleButton btnCancel;
|
||||
private DevExpress.XtraEditors.SimpleButton btnOK;
|
||||
private DevExpress.XtraEditors.TextEdit txtEdit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public partial class FrmAddRole : Form
|
||||
{
|
||||
public string RoleName;
|
||||
public Label LabelObj { get { return label1; } }
|
||||
|
||||
public FrmAddRole()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:确定事件</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-06-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnBtnOKClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtEdit.Text))
|
||||
{
|
||||
MessageBox.Show(this.label1.Text.Replace(":", "!"));
|
||||
return;
|
||||
}
|
||||
|
||||
this.RoleName = this.txtEdit.Text;
|
||||
this.Close();
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:取消事件</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-06-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnBtnCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Generated
+509
@@ -0,0 +1,509 @@
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
partial class FrmMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.employeeName = new Lskj.PubPower.LabelTextEdit();
|
||||
this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl();
|
||||
this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.gridControlEx2 = new Lskj.MyControl.GridControlEx();
|
||||
this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
|
||||
this.btn_deleteRole = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btn_Add = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.gridControlEx3 = new Lskj.MyControl.GridControlEx();
|
||||
this.MenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.btn_delete = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage();
|
||||
this.gridControlEx4 = new Lskj.MyControl.GridControlEx();
|
||||
this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.复制权限ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.清空ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panelControl2 = new DevExpress.XtraEditors.PanelControl();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.xtraTabControl2 = new DevExpress.XtraTab.XtraTabControl();
|
||||
this.xtraTabPage3 = new DevExpress.XtraTab.XtraTabPage();
|
||||
this.treeList1 = new DevExpress.XtraTreeList.TreeList();
|
||||
this.repositoryItemCheckEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
|
||||
this.xtraTabPage4 = new DevExpress.XtraTab.XtraTabPage();
|
||||
this.gridControlEx1 = new Lskj.MyControl.GridControlEx();
|
||||
this.panelControl4 = new DevExpress.XtraEditors.PanelControl();
|
||||
this.employeeId = new Lskj.PubPower.LabelTextEdit();
|
||||
this.btn_save = new DevExpress.XtraEditors.SimpleButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
|
||||
this.xtraTabControl1.SuspendLayout();
|
||||
this.xtraTabPage1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
|
||||
this.panelControl1.SuspendLayout();
|
||||
this.MenuStrip.SuspendLayout();
|
||||
this.xtraTabPage2.SuspendLayout();
|
||||
this.contextMenuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl2)).BeginInit();
|
||||
this.panelControl2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
this.splitContainer2.Panel1.SuspendLayout();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl2)).BeginInit();
|
||||
this.xtraTabControl2.SuspendLayout();
|
||||
this.xtraTabPage3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.treeList1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).BeginInit();
|
||||
this.xtraTabPage4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl4)).BeginInit();
|
||||
this.panelControl4.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// employeeName
|
||||
//
|
||||
this.employeeName.BackColor = System.Drawing.Color.Transparent;
|
||||
this.employeeName.EditText = "";
|
||||
this.employeeName.FontSize = 0F;
|
||||
this.employeeName.LabelText = "人员";
|
||||
this.employeeName.Location = new System.Drawing.Point(12, 6);
|
||||
this.employeeName.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.employeeName.Model = null;
|
||||
this.employeeName.Name = "employeeName";
|
||||
this.employeeName.NullText = "";
|
||||
this.employeeName.ReadOnly = false;
|
||||
this.employeeName.Required = false;
|
||||
this.employeeName.Size = new System.Drawing.Size(231, 22);
|
||||
this.employeeName.TabIndex = 2;
|
||||
//
|
||||
// xtraTabControl1
|
||||
//
|
||||
this.xtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.xtraTabControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.xtraTabControl1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.xtraTabControl1.Name = "xtraTabControl1";
|
||||
this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1;
|
||||
this.xtraTabControl1.Size = new System.Drawing.Size(384, 641);
|
||||
this.xtraTabControl1.TabIndex = 0;
|
||||
this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
|
||||
this.xtraTabPage1,
|
||||
this.xtraTabPage2});
|
||||
this.xtraTabControl1.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl1_SelectedPageChanged);
|
||||
//
|
||||
// xtraTabPage1
|
||||
//
|
||||
this.xtraTabPage1.Controls.Add(this.splitContainer1);
|
||||
this.xtraTabPage1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.xtraTabPage1.Name = "xtraTabPage1";
|
||||
this.xtraTabPage1.Size = new System.Drawing.Size(378, 608);
|
||||
this.xtraTabPage1.Text = "角色";
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.gridControlEx2);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.panelControl1);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.gridControlEx3);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(378, 608);
|
||||
this.splitContainer1.SplitterDistance = 296;
|
||||
this.splitContainer1.TabIndex = 3;
|
||||
//
|
||||
// gridControlEx2
|
||||
//
|
||||
this.gridControlEx2.AdapterObj = null;
|
||||
this.gridControlEx2.bomCaption = null;
|
||||
this.gridControlEx2.bomSql = null;
|
||||
this.gridControlEx2.ConstSql = null;
|
||||
this.gridControlEx2.detailEnableCond = null;
|
||||
this.gridControlEx2.detailEnableMsg = null;
|
||||
this.gridControlEx2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridControlEx2.loadBom = null;
|
||||
this.gridControlEx2.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridControlEx2.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.gridControlEx2.Name = "gridControlEx2";
|
||||
this.gridControlEx2.pnlMain = null;
|
||||
this.gridControlEx2.RowColorCondtion = null;
|
||||
this.gridControlEx2.Size = new System.Drawing.Size(378, 262);
|
||||
this.gridControlEx2.SourceType = 0;
|
||||
this.gridControlEx2.Sql = null;
|
||||
this.gridControlEx2.sqlC = null;
|
||||
this.gridControlEx2.SumFieldsTable = null;
|
||||
this.gridControlEx2.TabIndex = 2;
|
||||
this.gridControlEx2.UnAllowEditChangeColor = false;
|
||||
//
|
||||
// panelControl1
|
||||
//
|
||||
this.panelControl1.Controls.Add(this.btn_deleteRole);
|
||||
this.panelControl1.Controls.Add(this.btn_Add);
|
||||
this.panelControl1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panelControl1.Location = new System.Drawing.Point(0, 262);
|
||||
this.panelControl1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.panelControl1.Name = "panelControl1";
|
||||
this.panelControl1.Size = new System.Drawing.Size(378, 34);
|
||||
this.panelControl1.TabIndex = 3;
|
||||
//
|
||||
// btn_deleteRole
|
||||
//
|
||||
this.btn_deleteRole.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btn_deleteRole.Location = new System.Drawing.Point(206, 2);
|
||||
this.btn_deleteRole.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btn_deleteRole.Name = "btn_deleteRole";
|
||||
this.btn_deleteRole.Size = new System.Drawing.Size(85, 30);
|
||||
this.btn_deleteRole.TabIndex = 0;
|
||||
this.btn_deleteRole.Text = "删除角色";
|
||||
this.btn_deleteRole.Click += new System.EventHandler(this.btn_deleteRole_Click);
|
||||
//
|
||||
// btn_Add
|
||||
//
|
||||
this.btn_Add.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btn_Add.Location = new System.Drawing.Point(291, 2);
|
||||
this.btn_Add.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btn_Add.Name = "btn_Add";
|
||||
this.btn_Add.Size = new System.Drawing.Size(85, 30);
|
||||
this.btn_Add.TabIndex = 0;
|
||||
this.btn_Add.Text = "新增角色";
|
||||
this.btn_Add.Click += new System.EventHandler(this.btn_Add_Click);
|
||||
//
|
||||
// gridControlEx3
|
||||
//
|
||||
this.gridControlEx3.AdapterObj = null;
|
||||
this.gridControlEx3.bomCaption = null;
|
||||
this.gridControlEx3.bomSql = null;
|
||||
this.gridControlEx3.ConstSql = null;
|
||||
this.gridControlEx3.ContextMenuStrip = this.MenuStrip;
|
||||
this.gridControlEx3.detailEnableCond = null;
|
||||
this.gridControlEx3.detailEnableMsg = null;
|
||||
this.gridControlEx3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridControlEx3.loadBom = null;
|
||||
this.gridControlEx3.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridControlEx3.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.gridControlEx3.Name = "gridControlEx3";
|
||||
this.gridControlEx3.pnlMain = null;
|
||||
this.gridControlEx3.RowColorCondtion = null;
|
||||
this.gridControlEx3.Size = new System.Drawing.Size(378, 308);
|
||||
this.gridControlEx3.SourceType = 0;
|
||||
this.gridControlEx3.Sql = null;
|
||||
this.gridControlEx3.sqlC = null;
|
||||
this.gridControlEx3.SumFieldsTable = null;
|
||||
this.gridControlEx3.TabIndex = 3;
|
||||
this.gridControlEx3.UnAllowEditChangeColor = false;
|
||||
//
|
||||
// MenuStrip
|
||||
//
|
||||
this.MenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btn_delete});
|
||||
this.MenuStrip.Name = "MenuStrip";
|
||||
this.MenuStrip.Size = new System.Drawing.Size(169, 28);
|
||||
//
|
||||
// btn_delete
|
||||
//
|
||||
this.btn_delete.Name = "btn_delete";
|
||||
this.btn_delete.Size = new System.Drawing.Size(168, 24);
|
||||
this.btn_delete.Text = "删除权限分配";
|
||||
this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click);
|
||||
//
|
||||
// xtraTabPage2
|
||||
//
|
||||
this.xtraTabPage2.Controls.Add(this.gridControlEx4);
|
||||
this.xtraTabPage2.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.xtraTabPage2.Name = "xtraTabPage2";
|
||||
this.xtraTabPage2.Size = new System.Drawing.Size(378, 608);
|
||||
this.xtraTabPage2.Text = "人员";
|
||||
//
|
||||
// gridControlEx4
|
||||
//
|
||||
this.gridControlEx4.AdapterObj = null;
|
||||
this.gridControlEx4.bomCaption = null;
|
||||
this.gridControlEx4.bomSql = null;
|
||||
this.gridControlEx4.ConstSql = null;
|
||||
this.gridControlEx4.ContextMenuStrip = this.contextMenuStrip;
|
||||
this.gridControlEx4.detailEnableCond = null;
|
||||
this.gridControlEx4.detailEnableMsg = null;
|
||||
this.gridControlEx4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridControlEx4.loadBom = null;
|
||||
this.gridControlEx4.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridControlEx4.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.gridControlEx4.Name = "gridControlEx4";
|
||||
this.gridControlEx4.pnlMain = null;
|
||||
this.gridControlEx4.RowColorCondtion = null;
|
||||
this.gridControlEx4.Size = new System.Drawing.Size(378, 608);
|
||||
this.gridControlEx4.SourceType = 0;
|
||||
this.gridControlEx4.Sql = null;
|
||||
this.gridControlEx4.sqlC = null;
|
||||
this.gridControlEx4.SumFieldsTable = null;
|
||||
this.gridControlEx4.TabIndex = 1;
|
||||
this.gridControlEx4.UnAllowEditChangeColor = false;
|
||||
//
|
||||
// contextMenuStrip
|
||||
//
|
||||
this.contextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.复制权限ToolStripMenuItem,
|
||||
this.清空ToolStripMenuItem});
|
||||
this.contextMenuStrip.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip.Size = new System.Drawing.Size(139, 52);
|
||||
//
|
||||
// 复制权限ToolStripMenuItem
|
||||
//
|
||||
this.复制权限ToolStripMenuItem.Name = "复制权限ToolStripMenuItem";
|
||||
this.复制权限ToolStripMenuItem.Size = new System.Drawing.Size(138, 24);
|
||||
this.复制权限ToolStripMenuItem.Text = "复制权限";
|
||||
this.复制权限ToolStripMenuItem.Click += new System.EventHandler(this.btn_copy_Click);
|
||||
//
|
||||
// 清空ToolStripMenuItem
|
||||
//
|
||||
this.清空ToolStripMenuItem.Name = "清空ToolStripMenuItem";
|
||||
this.清空ToolStripMenuItem.Size = new System.Drawing.Size(138, 24);
|
||||
this.清空ToolStripMenuItem.Text = "清空";
|
||||
this.清空ToolStripMenuItem.Click += new System.EventHandler(this.btn_empty_Click);
|
||||
//
|
||||
// panelControl2
|
||||
//
|
||||
this.panelControl2.Controls.Add(this.splitContainer2);
|
||||
this.panelControl2.Controls.Add(this.panelControl4);
|
||||
this.panelControl2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelControl2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelControl2.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.panelControl2.Name = "panelControl2";
|
||||
this.panelControl2.Size = new System.Drawing.Size(1161, 691);
|
||||
this.panelControl2.TabIndex = 1;
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(2, 2);
|
||||
this.splitContainer2.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.xtraTabControl1);
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.xtraTabControl2);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1157, 641);
|
||||
this.splitContainer2.SplitterDistance = 384;
|
||||
this.splitContainer2.TabIndex = 2;
|
||||
//
|
||||
// xtraTabControl2
|
||||
//
|
||||
this.xtraTabControl2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.xtraTabControl2.Location = new System.Drawing.Point(0, 0);
|
||||
this.xtraTabControl2.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.xtraTabControl2.Name = "xtraTabControl2";
|
||||
this.xtraTabControl2.SelectedTabPage = this.xtraTabPage3;
|
||||
this.xtraTabControl2.Size = new System.Drawing.Size(769, 641);
|
||||
this.xtraTabControl2.TabIndex = 3;
|
||||
this.xtraTabControl2.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
|
||||
this.xtraTabPage3,
|
||||
this.xtraTabPage4});
|
||||
//
|
||||
// xtraTabPage3
|
||||
//
|
||||
this.xtraTabPage3.Controls.Add(this.treeList1);
|
||||
this.xtraTabPage3.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.xtraTabPage3.Name = "xtraTabPage3";
|
||||
this.xtraTabPage3.Size = new System.Drawing.Size(763, 608);
|
||||
this.xtraTabPage3.Text = "权限设置表";
|
||||
//
|
||||
// treeList1
|
||||
//
|
||||
this.treeList1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeList1.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeList1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.treeList1.Name = "treeList1";
|
||||
this.treeList1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
|
||||
this.repositoryItemCheckEdit1});
|
||||
this.treeList1.Size = new System.Drawing.Size(763, 608);
|
||||
this.treeList1.TabIndex = 2;
|
||||
this.treeList1.CellValueChanging += new DevExpress.XtraTreeList.CellValueChangedEventHandler(this.treeList_CellValueChanging);
|
||||
//
|
||||
// repositoryItemCheckEdit1
|
||||
//
|
||||
this.repositoryItemCheckEdit1.AutoHeight = false;
|
||||
this.repositoryItemCheckEdit1.Caption = "Check";
|
||||
this.repositoryItemCheckEdit1.Name = "repositoryItemCheckEdit1";
|
||||
//
|
||||
// xtraTabPage4
|
||||
//
|
||||
this.xtraTabPage4.Controls.Add(this.gridControlEx1);
|
||||
this.xtraTabPage4.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.xtraTabPage4.Name = "xtraTabPage4";
|
||||
this.xtraTabPage4.Size = new System.Drawing.Size(763, 608);
|
||||
this.xtraTabPage4.Text = "添加人员";
|
||||
//
|
||||
// gridControlEx1
|
||||
//
|
||||
this.gridControlEx1.AdapterObj = null;
|
||||
this.gridControlEx1.bomCaption = null;
|
||||
this.gridControlEx1.bomSql = null;
|
||||
this.gridControlEx1.ConstSql = null;
|
||||
this.gridControlEx1.detailEnableCond = null;
|
||||
this.gridControlEx1.detailEnableMsg = null;
|
||||
this.gridControlEx1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridControlEx1.loadBom = null;
|
||||
this.gridControlEx1.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridControlEx1.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.gridControlEx1.Name = "gridControlEx1";
|
||||
this.gridControlEx1.pnlMain = null;
|
||||
this.gridControlEx1.RowColorCondtion = null;
|
||||
this.gridControlEx1.Size = new System.Drawing.Size(763, 608);
|
||||
this.gridControlEx1.SourceType = 0;
|
||||
this.gridControlEx1.Sql = null;
|
||||
this.gridControlEx1.sqlC = null;
|
||||
this.gridControlEx1.SumFieldsTable = null;
|
||||
this.gridControlEx1.TabIndex = 0;
|
||||
this.gridControlEx1.UnAllowEditChangeColor = false;
|
||||
//
|
||||
// panelControl4
|
||||
//
|
||||
this.panelControl4.Controls.Add(this.employeeId);
|
||||
this.panelControl4.Controls.Add(this.employeeName);
|
||||
this.panelControl4.Controls.Add(this.btn_save);
|
||||
this.panelControl4.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panelControl4.Location = new System.Drawing.Point(2, 643);
|
||||
this.panelControl4.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.panelControl4.Name = "panelControl4";
|
||||
this.panelControl4.Size = new System.Drawing.Size(1157, 46);
|
||||
this.panelControl4.TabIndex = 1;
|
||||
//
|
||||
// employeeId
|
||||
//
|
||||
this.employeeId.BackColor = System.Drawing.Color.Transparent;
|
||||
this.employeeId.EditText = "";
|
||||
this.employeeId.FontSize = 0F;
|
||||
this.employeeId.LabelText = "工号";
|
||||
this.employeeId.Location = new System.Drawing.Point(267, 6);
|
||||
this.employeeId.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.employeeId.Model = null;
|
||||
this.employeeId.Name = "employeeId";
|
||||
this.employeeId.NullText = "";
|
||||
this.employeeId.ReadOnly = false;
|
||||
this.employeeId.Required = false;
|
||||
this.employeeId.Size = new System.Drawing.Size(231, 22);
|
||||
this.employeeId.TabIndex = 3;
|
||||
//
|
||||
// btn_save
|
||||
//
|
||||
this.btn_save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_save.Location = new System.Drawing.Point(1061, 11);
|
||||
this.btn_save.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btn_save.Name = "btn_save";
|
||||
this.btn_save.Size = new System.Drawing.Size(85, 25);
|
||||
this.btn_save.TabIndex = 0;
|
||||
this.btn_save.Text = "保存";
|
||||
this.btn_save.Click += new System.EventHandler(this.btn_save_Click);
|
||||
//
|
||||
// FrmMain
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
this.Appearance.Options.UseFont = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1161, 691);
|
||||
this.Controls.Add(this.panelControl2);
|
||||
this.LookAndFeel.SkinName = "Office 2010 Blue";
|
||||
this.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Office2003;
|
||||
this.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.Name = "FrmMain";
|
||||
this.Text = "权限设置器";
|
||||
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).EndInit();
|
||||
this.xtraTabControl1.ResumeLayout(false);
|
||||
this.xtraTabPage1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).EndInit();
|
||||
this.panelControl1.ResumeLayout(false);
|
||||
this.MenuStrip.ResumeLayout(false);
|
||||
this.xtraTabPage2.ResumeLayout(false);
|
||||
this.contextMenuStrip.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl2)).EndInit();
|
||||
this.panelControl2.ResumeLayout(false);
|
||||
this.splitContainer2.Panel1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl2)).EndInit();
|
||||
this.xtraTabControl2.ResumeLayout(false);
|
||||
this.xtraTabPage3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.treeList1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).EndInit();
|
||||
this.xtraTabPage4.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl4)).EndInit();
|
||||
this.panelControl4.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevExpress.XtraEditors.PanelControl panelControl2;
|
||||
private PubPower.LabelTextEdit employeeName;
|
||||
private DevExpress.XtraTab.XtraTabControl xtraTabControl1;
|
||||
private DevExpress.XtraTab.XtraTabPage xtraTabPage1;
|
||||
private DevExpress.XtraTab.XtraTabPage xtraTabPage2;
|
||||
private DevExpress.XtraEditors.PanelControl panelControl4;
|
||||
private DevExpress.XtraEditors.SimpleButton btn_save;
|
||||
private MyControl.GridControlEx gridControlEx4;
|
||||
private System.Windows.Forms.ContextMenuStrip MenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem btn_delete;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private MyControl.GridControlEx gridControlEx2;
|
||||
private MyControl.GridControlEx gridControlEx3;
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private DevExpress.XtraTab.XtraTabControl xtraTabControl2;
|
||||
private DevExpress.XtraTab.XtraTabPage xtraTabPage3;
|
||||
private DevExpress.XtraTreeList.TreeList treeList1;
|
||||
private DevExpress.XtraTab.XtraTabPage xtraTabPage4;
|
||||
private MyControl.GridControlEx gridControlEx1;
|
||||
private DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit repositoryItemCheckEdit1;
|
||||
private DevExpress.XtraEditors.PanelControl panelControl1;
|
||||
private DevExpress.XtraEditors.SimpleButton btn_Add;
|
||||
private DevExpress.XtraEditors.SimpleButton btn_deleteRole;
|
||||
private PubPower.LabelTextEdit employeeId;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem 复制权限ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 清空ToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,987 @@
|
||||
using DevExpress.XtraTreeList;
|
||||
using DevExpress.XtraTreeList.Nodes;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraTreeList.Data;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using DevExpress.XtraEditors.Repository;
|
||||
using System.Data.SqlClient;
|
||||
using Lskj.MyControl;
|
||||
using CommonLib;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraTreeList.Columns;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using CommonLib.data;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public partial class FrmMain : FormBase
|
||||
{
|
||||
public DynamicModel PubPowerModel;
|
||||
/// <summary>
|
||||
/// 选中行的集合
|
||||
/// </summary>
|
||||
private List<DataRow> rows = new List<DataRow>();
|
||||
private List<string> readPurview = new List<string>();
|
||||
private List<string> editPurview = new List<string>();
|
||||
private List<string> idlist = new List<string>();
|
||||
/// <summary>
|
||||
/// 记录选中角色选中行的行号之后
|
||||
/// </summary>
|
||||
private string rolePositionAfter = string.Empty;
|
||||
/// <summary>
|
||||
/// 记录选中人员选中行的行号之后
|
||||
/// </summary>
|
||||
private string operPositionAfter = string.Empty;
|
||||
/// <summary>
|
||||
/// 记录选中角色选中行的行号之前
|
||||
/// </summary>
|
||||
private string rolePositionBefore = string.Empty;
|
||||
/// <summary>
|
||||
/// 记录选中人员选中行的行号之前
|
||||
/// </summary>
|
||||
private string operPositionBefore = string.Empty;
|
||||
/// <summary>
|
||||
/// 获取左侧选中的名称
|
||||
/// </summary>
|
||||
private string id = string.Empty;
|
||||
/// <summary>
|
||||
/// 获取临时选中的名称
|
||||
/// </summary>
|
||||
private string empid = string.Empty;
|
||||
private bool Operatorflag = false;
|
||||
/// <summary>
|
||||
/// treeList绑定的表
|
||||
/// </summary>
|
||||
DataTable dt = new DataTable();
|
||||
/// <summary>
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
DataTable Roletable = new DataTable();
|
||||
/// <summary>
|
||||
/// 员工表
|
||||
/// </summary>
|
||||
DataTable employeetable = new DataTable();
|
||||
|
||||
public FrmMain()
|
||||
{
|
||||
if (DBConfig.Instance.CreateConnection())
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
//InitializeDeps();
|
||||
InitializeColumns();
|
||||
InitializeUsers();
|
||||
creatTreeListControl();
|
||||
BindGridTreeView();
|
||||
GridDragGrid dragGrid = new GridDragGrid(this.gridControlEx1.gridView, this.gridControlEx3.gridView);
|
||||
dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
|
||||
//GridDragGrid.GridAddCheckBox(this.gridControlEx1.GridView);
|
||||
|
||||
this.gridControlEx2.gridView.Click += new EventHandler(OnGridViewClick);//角色表点击
|
||||
this.gridControlEx2.gridView.DoubleClick += new EventHandler(DoubleGridViewClick);
|
||||
|
||||
this.gridControlEx4.gridView.Click += new EventHandler(OnGridView2Click);//人员表点击
|
||||
//this.gridControlEx3.GridView.Click += new EventHandler(OnGridView3Click);//临时表人员表点击
|
||||
this.gridControlEx2.gridView.SelectRowHandler(0);//设置默认选中行
|
||||
this.gridControlEx2.gridView.BestFitColumns();//设置根据内容填充列宽
|
||||
this.gridControlEx3.gridView.BestFitColumns();//设置根据内容填充列宽
|
||||
this.gridControlEx4.gridView.BestFitColumns();//设置根据内容填充列宽
|
||||
if (Roletable.Rows.Count > 0)
|
||||
{
|
||||
First(Roletable.Rows[0]["id"] + "");
|
||||
}
|
||||
this.employeeName.TextEdit.EditValueChanged += new EventHandler(OnUserEditValueChanged);
|
||||
this.employeeId.TextEdit.EditValueChanged += new EventHandler(OnUserEditValueChanged);
|
||||
this.employeeName.Visible = false;
|
||||
this.employeeId.Visible = false;
|
||||
//this.department.TextEdit.EditValueChanged += new EventHandler(OnDepEditValueChanged);
|
||||
}
|
||||
}
|
||||
#region 私有方法
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:表格拖拽完成</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-14 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
protected void OnDragGridCompleted(object sender, GridDragGridArgs e)
|
||||
{
|
||||
string sql = string.Empty;
|
||||
try
|
||||
{
|
||||
if (MessageBox.Show("您确定要拖动选中记录?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
GridColumnCollection gridColumns = this.gridControlEx3.gridView.Columns;
|
||||
DataTable table = this.gridControlEx3.gridControl.DataSource as DataTable;
|
||||
foreach (DataRow rowItem in e.GridViewSelectRows)
|
||||
{
|
||||
DataRow newRow = table.NewRow();
|
||||
foreach (GridColumn col in gridColumns)
|
||||
{
|
||||
if ("id".Equals(col.FieldName)) continue;
|
||||
|
||||
if (rowItem.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
// 列中是否包含对应字段,包含则使用值
|
||||
newRow[col.FieldName] = rowItem[col.FieldName];
|
||||
}
|
||||
}
|
||||
PowerImpl.DropDate(int.Parse(newRow["员工ID"] + ""), newRow["员工工号"] + "", newRow["员工姓名"] + "", newRow["所属部门"] + "", id);
|
||||
table.Rows.Add(newRow);
|
||||
}
|
||||
DataTable NEWTABLE = GetNewDt(this.gridControlEx3.gridControl.DataSource as DataTable);
|
||||
this.gridControlEx1.gridControl.DataSource = NEWTABLE;
|
||||
this.gridControlEx3.gridView.ClearSelection();
|
||||
this.gridControlEx3.gridView.SelectRowHandler(table.Rows.Count - 1);
|
||||
this.gridControlEx3.gridView.UpdateCurrentRow();
|
||||
this.gridControlEx3.gridView.ShowEditor();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 筛选赋权限表
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
private DataTable GetNewDt(DataTable newdt)
|
||||
{
|
||||
idlist.Clear();
|
||||
string sqlwhere = string.Empty;
|
||||
foreach (DataRow item in newdt.Rows)
|
||||
{
|
||||
idlist.Add(item["员工ID"] + " and ");
|
||||
}
|
||||
foreach (string id in idlist)
|
||||
{
|
||||
sqlwhere = sqlwhere + string.Format("员工ID !={0}", id);
|
||||
}
|
||||
|
||||
sqlwhere = !string.IsNullOrEmpty(sqlwhere) ? sqlwhere.Trim().Substring(0, sqlwhere.Length - 4) : "1=1";
|
||||
newdt = SqlHelper.ExecuteDataTable("select * from P_employeeBaseView where " + sqlwhere);
|
||||
return newdt;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取选中行数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="node">The node.</param>
|
||||
/// <returns>DataRow.</returns>
|
||||
private DataRow GetForcedNodeDataRow(TreeListNode node)
|
||||
{
|
||||
DataRowView dataRowView = this.treeList1.GetDataRecordByNode(node) as DataRowView;
|
||||
return dataRowView != null ? dataRowView.Row : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 默认绑定列数据
|
||||
/// </summary>
|
||||
private void InitializeColumns()
|
||||
{
|
||||
this.gridControlEx2.gridView.Columns.AddVisible("roleName", "职位");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("员工ID", "员工ID");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("员工工号", "员工工号");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("员工姓名", "员工姓名");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("所属部门", "所属部门");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:默认加载表格数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-19 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void InitializeUsers()
|
||||
{
|
||||
/// <summary>
|
||||
/// 人员和角色绑定的表
|
||||
/// </summary>
|
||||
Roletable = PowerImpl.GetWorkRole("", "");
|
||||
employeetable = PowerImpl.GetWorkEmployee();
|
||||
this.gridControlEx1.gridControl.DataSource = employeetable;
|
||||
this.gridControlEx2.gridControl.DataSource = Roletable;
|
||||
this.gridControlEx4.gridControl.DataSource = employeetable;
|
||||
this.gridControlEx1.gridView.OptionsBehavior.Editable = this.gridControlEx2.gridView.OptionsBehavior.Editable = this.gridControlEx3.gridView.OptionsBehavior.Editable = this.gridControlEx4.gridView.OptionsBehavior.Editable = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 动态创建TreeList的Column,一列为图层名,一列为是否统计列Check控件
|
||||
/// </summary>
|
||||
private void creatTreeListControl()
|
||||
{
|
||||
|
||||
TreeListColumn treeListColumnName = new TreeListColumn();
|
||||
treeListColumnName.Caption = "系统名称";
|
||||
treeListColumnName.FieldName = "Caption";
|
||||
treeListColumnName.MinWidth = 38;
|
||||
treeListColumnName.Visible = true;
|
||||
treeListColumnName.VisibleIndex = 0;
|
||||
treeListColumnName.Width = 400;
|
||||
|
||||
TreeListColumn treeListColumnMenuId = new TreeListColumn();
|
||||
treeListColumnMenuId.Caption = "菜单id";
|
||||
treeListColumnMenuId.FieldName = "MenuId";
|
||||
treeListColumnMenuId.Visible = true;
|
||||
treeListColumnMenuId.VisibleIndex = 1;
|
||||
|
||||
TreeListColumn treeListColumnReadflag = new TreeListColumn();
|
||||
RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit();
|
||||
checkEdit.ValueChecked = 1;
|
||||
checkEdit.ValueUnchecked = 0;
|
||||
checkEdit.ValueGrayed = 3;
|
||||
treeListColumnReadflag.ColumnEdit = checkEdit;
|
||||
treeListColumnReadflag.Caption = "只读权限";
|
||||
treeListColumnReadflag.FieldName = "Readflag";
|
||||
treeListColumnReadflag.Name = "treeListColumnReadflagValue";
|
||||
treeListColumnReadflag.Visible = true;
|
||||
treeListColumnReadflag.VisibleIndex = 2;
|
||||
|
||||
TreeListColumn treeListColumnEditflag = new TreeListColumn();
|
||||
treeListColumnEditflag.ColumnEdit = checkEdit;
|
||||
treeListColumnEditflag.Caption = "操作权限";
|
||||
treeListColumnEditflag.FieldName = "Editflag";
|
||||
treeListColumnEditflag.Name = "treeListColumnEditflagValue";
|
||||
treeListColumnEditflag.Visible = true;
|
||||
treeListColumnEditflag.VisibleIndex = 3;
|
||||
|
||||
this.treeList1.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
|
||||
treeListColumnName,
|
||||
treeListColumnMenuId,
|
||||
treeListColumnReadflag,
|
||||
treeListColumnEditflag
|
||||
});
|
||||
this.treeList1.Nodes.Clear();
|
||||
this.treeList1.Refresh();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:绑定表格树结构</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2017-09-04 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="treeTable">The tree table.</param>
|
||||
public void BindGridTreeView()
|
||||
{
|
||||
DataTable treeTable = PowerImpl.GetMenuTreeViewData();
|
||||
//节点前显示复选框
|
||||
//this.treeList1.OptionsView.ShowCheckBoxes = true;
|
||||
// this.treeList1.OptionsBehavior.Editable = false;
|
||||
|
||||
dt.Columns.Add("ID");
|
||||
dt.Columns.Add("PARENTID");
|
||||
//(节点编码的名称)
|
||||
dt.Columns.Add("Caption");
|
||||
dt.Columns.Add("MenuId");
|
||||
dt.Columns.Add("Readflag", typeof(int));
|
||||
dt.Columns.Add("Editflag", typeof(int));
|
||||
if (treeTable != null && treeTable.Rows.Count > 0)
|
||||
{
|
||||
List<string> idlist = new List<string>();
|
||||
this.Tag = treeTable.Rows[0];
|
||||
DataColumnCollection dcc = treeTable.Columns;
|
||||
for (int i = 0; i < treeTable.Rows.Count; i++)
|
||||
{
|
||||
DataRow dr = treeTable.Rows[i];
|
||||
DataRow dr1 = dt.NewRow();
|
||||
string tnKey = dr["id"] + "";
|
||||
string tnStr = dr["MenuCaption"] + "";
|
||||
string pKey = dr["parentId"] + "";
|
||||
string MenuId = dr["MenuId"] + "";
|
||||
if (idlist.Contains(tnKey))
|
||||
{
|
||||
tnKey += "re" + i;
|
||||
}
|
||||
dr1["ID"] = tnKey;
|
||||
dr1["PARENTID"] = pKey;
|
||||
dr1["Caption"] = tnStr;
|
||||
dr1["MenuId"] = MenuId;
|
||||
dr1["Readflag"] = 0;
|
||||
dr1["editflag"] = 0;
|
||||
dt.Rows.Add(dr1);
|
||||
idlist.Add(tnKey);
|
||||
}
|
||||
this.treeList1.DataSource = dt;
|
||||
this.treeList1.KeyFieldName = "ID";
|
||||
this.treeList1.ParentFieldName = "PARENTID";
|
||||
//this.treeList1.Columns[0].Caption = "系统名称";
|
||||
//this.treeList1.Columns[0].Width = 500;
|
||||
this.treeList1.Columns[0].OptionsColumn.AllowEdit = false;
|
||||
this.treeList1.Columns[1].Visible = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行保存角色权限时候的存储过程
|
||||
/// </summary>
|
||||
/// <param name="modid"></param>
|
||||
/// <param name="tagid"></param>
|
||||
/// <param name="mid"></param>
|
||||
/// <returns></returns>
|
||||
public int saveRoledata(int roleid)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
SqlParameter[] param =
|
||||
{
|
||||
new SqlParameter("@roleid ",SqlDbType.VarChar,20),
|
||||
pMsg,
|
||||
returnValue
|
||||
};
|
||||
param[0].Value = roleid;
|
||||
BaseImpl.ExecProcedure("p_SystemSetRoleUserPurview", param);
|
||||
return Convert.ToInt32(returnValue.Value.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行保存时候的存储过程
|
||||
/// </summary>
|
||||
/// <param name="modid"></param>
|
||||
/// <param name="tagid"></param>
|
||||
/// <param name="mid"></param>
|
||||
/// <returns></returns>
|
||||
public int savedata(int operatorid)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
||||
returnValue.Direction = ParameterDirection.ReturnValue;
|
||||
SqlParameter[] param =
|
||||
{
|
||||
new SqlParameter("@operatorid",SqlDbType.VarChar,20),
|
||||
pMsg,
|
||||
returnValue
|
||||
};
|
||||
param[0].Value = operatorid;
|
||||
BaseImpl.ExecProcedure("[p_SystemSetUserPurview]", param);
|
||||
return Convert.ToInt32(returnValue.Value.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:部门下拉框值改变后</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnDepEditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
//string depid = this.department.EditValue;
|
||||
//string mf = this.employeeName.EditText;
|
||||
//DataTable table = WorkFlowBillImpl.GetWorkFlowUsers(depid, mf);
|
||||
//this.gridControlEx4.gridControl.DataSource = table;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:用户值改变后</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnUserEditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string mc = this.employeeName.EditText;
|
||||
string dc = this.employeeId.EditText;
|
||||
DataTable table = PowerImpl.GetWorkFlowUsers(mc, dc);
|
||||
this.gridControlEx4.gridControl.DataSource = table;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:初始化部门数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
//private void InitializeDeps()
|
||||
//{
|
||||
|
||||
// DataTable table = WorkFlowBillImpl.GetDeps();
|
||||
// this.department.ValueMember = "departmentid";
|
||||
// this.department.ValueField = "departmentid";
|
||||
// this.department.TextField = "departmentname";
|
||||
// this.department.SetDataSource(table);
|
||||
//}
|
||||
/// <summary>
|
||||
/// 获取所有选中的集合
|
||||
/// </summary>
|
||||
/// <param name="parentNode"></param>
|
||||
private void GetListKeyID()
|
||||
{
|
||||
editPurview.Clear();
|
||||
readPurview.Clear();
|
||||
DataTable masterdt = (DataTable)treeList1.DataSource;
|
||||
for (int i = 0; i < masterdt.Rows.Count; i++)
|
||||
{
|
||||
if (masterdt.Rows[i]["ID"].ToString().Length > 4 && masterdt.Rows[i]["Editflag"] + "" == "1")
|
||||
{
|
||||
editPurview.Add(masterdt.Rows[i]["MenuId"] + "");
|
||||
}
|
||||
else
|
||||
if (masterdt.Rows[i]["ID"].ToString().Length > 4 && masterdt.Rows[i]["Readflag"] + "" == "1")
|
||||
{
|
||||
readPurview.Add(masterdt.Rows[i]["MenuId"] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取选择状态有权限的节点集合
|
||||
/// </summary>
|
||||
/// <param name="parentNode">父级节点</param>
|
||||
private void GetNodeCheckedID(string[] ReadPurview, string[] EditPurview)
|
||||
{
|
||||
rows.Clear();
|
||||
foreach (DataRow item in dt.Rows)
|
||||
{
|
||||
if (ReadPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["Readflag"] = "1";
|
||||
}
|
||||
if (EditPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["editflag"] = "1";
|
||||
}
|
||||
if (!EditPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["editflag"] = "0";
|
||||
}
|
||||
if (!ReadPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["Readflag"] = "0";
|
||||
}
|
||||
rows.Add(item);
|
||||
}
|
||||
this.treeList1.DataSource = rows.CopyToDataTable();
|
||||
this.treeList1.CollapseAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region 点击事件
|
||||
|
||||
/// <summary>
|
||||
/// 双击角色表里的数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void DoubleGridViewClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 新增角色
|
||||
FrmAddRole frmAddRole = new FrmAddRole();
|
||||
frmAddRole.LabelObj.Text = "请输入修改角色名称:";
|
||||
if (frmAddRole.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string RoleName = frmAddRole.RoleName;
|
||||
rolePositionAfter = string.IsNullOrWhiteSpace(rolePositionAfter) ? "0" : rolePositionAfter;
|
||||
rolePositionBefore = string.IsNullOrWhiteSpace(rolePositionBefore) ? "1" : rolePositionBefore;
|
||||
if (PowerImpl.UpdOper(RoleName, id))
|
||||
{
|
||||
Roletable = PowerImpl.GetWorkRole("", "");
|
||||
this.gridControlEx2.gridControl.DataSource = Roletable;
|
||||
this.gridControlEx2.gridView.SelectRowHandler(int.Parse(rolePositionAfter));//设置默认选中行
|
||||
if (Roletable.Rows.Count > 0)
|
||||
{
|
||||
First(rolePositionBefore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 单击查询角色表里的数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnGridViewClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow mSelectRow = this.gridControlEx2.gridView.GetFocusedDataRow();
|
||||
rolePositionAfter = this.gridControlEx2.gridView.FocusedRowHandle.ToString();
|
||||
if (mSelectRow != null)
|
||||
{
|
||||
id = mSelectRow["id"] + "";
|
||||
rolePositionBefore = id;
|
||||
First(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 点击角色权限信息的方法
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
private void First(string Firstid)
|
||||
{
|
||||
id = Firstid;
|
||||
DataRow DR = PowerImpl.GetRoleRow(id);
|
||||
string[] ReadPurview = DR["ReadPurview"].ToString().Trim().TrimEnd(',').Split(',');
|
||||
string[] EditPurview = DR["EditPurview"].ToString().Trim().TrimEnd(',').Split(',');
|
||||
GetNodeCheckedID(ReadPurview, EditPurview);
|
||||
DataTable Roledetailed = PowerImpl.GetWorkUsers(DR["id"] + "");
|
||||
this.gridControlEx3.gridControl.DataSource = Roledetailed;
|
||||
DataTable NEWTABLE = GetNewDt(Roledetailed);
|
||||
this.gridControlEx1.gridControl.DataSource = NEWTABLE;
|
||||
Operatorflag = false;
|
||||
this.treeList1.CollapseAll();
|
||||
}
|
||||
/// <summary>
|
||||
/// 单击查询人员表里的数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnGridView2Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow mSelectRow = this.gridControlEx4.gridView.GetFocusedDataRow();
|
||||
operPositionAfter = this.gridControlEx4.gridView.FocusedRowHandle.ToString();
|
||||
if (mSelectRow != null)
|
||||
{
|
||||
id = mSelectRow["员工ID"] + "";
|
||||
operPositionBefore = id;
|
||||
Second(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击人员详细信息的方法
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
private void Second(string Secondid)
|
||||
{
|
||||
id = Secondid;
|
||||
// 验证删除存储过程
|
||||
string tipMsg = string.Empty;
|
||||
try
|
||||
{
|
||||
DataSet ds = BaseImpl.getAuthorityByEmpid(1, id, "", "", out tipMsg);
|
||||
string editPurview = ds.Tables.Count > 0 ? ds.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
||||
string[] EditPurview = editPurview.Trim().TrimEnd(',').Split(',');
|
||||
DataSet ds2 = BaseImpl.getAuthorityByEmpid(2, id, "", "", out tipMsg);
|
||||
string readPurview = ds2.Tables.Count > 0 ? ds2.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
||||
string[] ReadPurview = readPurview.Trim().TrimEnd(',').Split(',');
|
||||
GetNodeCheckedID(ReadPurview, EditPurview);
|
||||
Operatorflag = true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//MessageBox.Show("权限表无此人!");
|
||||
this.gridControlEx4.gridView.SelectRowHandler(0);
|
||||
Second("1");
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 点击保存权限
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btn_save_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
GetListKeyID();
|
||||
string readdate = string.Empty;
|
||||
string Editdate = string.Empty;
|
||||
foreach (string item in readPurview)
|
||||
{
|
||||
readdate = readdate + item + ",";
|
||||
}
|
||||
foreach (string item in editPurview)
|
||||
{
|
||||
Editdate = Editdate + item + ",";
|
||||
}
|
||||
if (Operatorflag)
|
||||
{
|
||||
DataRow DR = PowerImpl.GeRoleOperRow(id);
|
||||
if (PowerImpl.SaveRoleOperDate(id, DR["员工姓名"] + "", DR["所属部门"] + "", readdate, Editdate))
|
||||
{
|
||||
int rValue = savedata(int.Parse(id));
|
||||
if (rValue == 1)
|
||||
{
|
||||
MessageBox.Show("同步人员权限成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("同步人员权限失败!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PowerImpl.SaveRoleDate(id, readdate, Editdate))
|
||||
{
|
||||
|
||||
int rValue = saveRoledata(int.Parse(id));
|
||||
if (rValue == 0)
|
||||
{
|
||||
MessageBox.Show("同步人员权限成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("同步人员权限失败!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// <para>说明:分割条移动保存位置</para>
|
||||
///// <para>创建人:龚宇超</para>
|
||||
///// <para>创建日期:2018-03-06 </para>
|
||||
///// <para>修改人:</para>
|
||||
///// <para>修改日期:</para>
|
||||
///// <para>修改备注:</para>
|
||||
///// <para>版本:1.0</para>
|
||||
///// </summary>
|
||||
///// <param name="sender">The source of the event.</param>
|
||||
///// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
//private void OnTopSplitterMoved(object sender, EventArgs e)
|
||||
//{
|
||||
// if (this._isInitFinish)
|
||||
// {
|
||||
// IniHelper.Write(string.Format("bill_width_{0}", this.SysModel.ModuleCode), this.ssc_main_top.SplitterPosition + "");
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 切换人员表默认选中第一行
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
||||
{
|
||||
|
||||
if (xtraTabControl1.SelectedTabPage == xtraTabPage2)//进行tabpage位置判断
|
||||
{
|
||||
operPositionAfter = string.IsNullOrWhiteSpace(operPositionAfter) ? "0" : operPositionAfter;
|
||||
operPositionBefore = string.IsNullOrWhiteSpace(operPositionBefore) ? employeetable.Rows[0]["员工ID"] + "" : operPositionBefore;
|
||||
this.gridControlEx4.gridView.SelectRowHandler(int.Parse(operPositionAfter));//设置默认选中行
|
||||
Second(operPositionBefore);
|
||||
this.employeeName.Visible = true;
|
||||
this.employeeId.Visible = true;
|
||||
}
|
||||
if (xtraTabControl1.SelectedTabPage == xtraTabPage1)//进行tabpage位置判断
|
||||
{
|
||||
rolePositionAfter = string.IsNullOrWhiteSpace(rolePositionAfter) ? "0" : rolePositionAfter;
|
||||
rolePositionBefore = string.IsNullOrWhiteSpace(rolePositionBefore) ? Roletable.Rows[0]["id"] + "" : rolePositionBefore;
|
||||
if (Roletable.Rows.Count > 0)
|
||||
{
|
||||
First(rolePositionBefore);
|
||||
}
|
||||
this.gridControlEx2.gridView.SelectRowHandler(int.Parse(rolePositionAfter));//设置默认选中行
|
||||
this.employeeName.Visible = false;
|
||||
this.employeeId.Visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除人员权限
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btn_delete_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataTable Roledetailed = PowerImpl.GetWorkUsers(id);
|
||||
//int[] Roledrows = this.gridControlEx3.GridView.GetSelectedRows();
|
||||
DataRow[] Roledrows = this.gridControlEx3.GetViewFocusedDataRows();
|
||||
foreach (DataRow Roledrow in Roledrows)
|
||||
{
|
||||
PowerImpl.deletRoleDate(Roledrow["员工ID"] + "", id);
|
||||
savedata(int.Parse(Roledrow["员工ID"] + ""));
|
||||
}
|
||||
DataTable newRoledetailed = PowerImpl.GetWorkUsers(id);
|
||||
this.gridControlEx3.gridControl.DataSource = newRoledetailed;
|
||||
DataTable NEWTABLE = GetNewDt(newRoledetailed);
|
||||
this.gridControlEx1.gridControl.DataSource = NEWTABLE;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:添加模块</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void btn_Add_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 新增角色
|
||||
FrmAddRole frmAddRole = new FrmAddRole();
|
||||
frmAddRole.LabelObj.Text = "请输入角色名称:";
|
||||
if (frmAddRole.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string RoleName = frmAddRole.RoleName;
|
||||
rolePositionAfter = string.IsNullOrWhiteSpace(rolePositionAfter) ? "0" : rolePositionAfter;
|
||||
rolePositionBefore = string.IsNullOrWhiteSpace(rolePositionBefore) ? "1" : rolePositionBefore;
|
||||
if (PowerImpl.intnewOper(RoleName))
|
||||
{
|
||||
Roletable = PowerImpl.GetWorkRole("", "");
|
||||
this.gridControlEx2.gridControl.DataSource = Roletable;
|
||||
this.gridControlEx2.gridView.SelectRowHandler(int.Parse(rolePositionAfter));//设置默认选中行
|
||||
if (Roletable.Rows.Count > 0)
|
||||
{
|
||||
First(rolePositionBefore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除角色权限
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btn_deleteRole_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//int[] Roledrows = this.gridControlEx2.GridView.GetSelectedRows();
|
||||
DataRow[] Roledrows = this.gridControlEx2.GetViewFocusedDataRows();
|
||||
if (Roledrows.Length < 1)
|
||||
return;
|
||||
DialogResult result = MessageBox.Show(string.Format("确定要删除选中{0}条记录?", Roledrows.Length), "询问", MessageBoxButtons.YesNo);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
foreach (DataRow RoleRow in Roledrows)
|
||||
{
|
||||
//PowerImpl.deletRoleoperDate(Roletable.Rows[num]["id"] + "");
|
||||
PowerImpl.deletRoleoperDate(RoleRow["id"] + "");
|
||||
saveRoledata(int.Parse(id));
|
||||
}
|
||||
Roletable = PowerImpl.GetWorkRole("", "");
|
||||
this.gridControlEx2.gridControl.DataSource = Roletable;
|
||||
this.gridControlEx2.gridView.SelectRowHandler(0);//设置默认选中行
|
||||
if (Roletable.Rows.Count > 0)
|
||||
{
|
||||
First(Roletable.Rows[0]["id"] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获得图层名节点的Index值
|
||||
/// </summary>
|
||||
/// <param name="ParentNodeName"></param>
|
||||
/// <returns></returns>
|
||||
private int getParentID(string ParentNodeName)
|
||||
{
|
||||
int i = -1;
|
||||
for (i = 0; i < this.treeList1.Nodes.Count; i++)
|
||||
{
|
||||
if (this.treeList1.Nodes[i][0].ToString() == ParentNodeName)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当点击Node事件发生改变(点击主节点时,其子节点跟着主节点变化)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void treeList_CellValueChanging(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.Column.Name.Equals("treeListColumnReadflagValue"))
|
||||
{
|
||||
object objCol = this.treeList1.Columns[2];
|
||||
for (int i = 0; i < e.Node.Nodes.Count; i++)
|
||||
{
|
||||
e.Node.Nodes[i].SetValue(objCol, e.Value);
|
||||
for (int j = 0; j < e.Node.Nodes[i].Nodes.Count; j++)
|
||||
{
|
||||
e.Node.Nodes[i].Nodes[j].SetValue(objCol, e.Value);
|
||||
}
|
||||
}
|
||||
e.Node.SetValue(objCol, e.Value);
|
||||
SetCheckedParentNodes(e.Node, e.Value, objCol);
|
||||
}
|
||||
else if (e.Column.Name.Equals("treeListColumnEditflagValue"))
|
||||
{
|
||||
object objCol = this.treeList1.Columns[3];
|
||||
for (int i = 0; i < e.Node.Nodes.Count; i++)
|
||||
{
|
||||
e.Node.Nodes[i].SetValue(objCol, e.Value);
|
||||
for (int j = 0; j < e.Node.Nodes[i].Nodes.Count; j++)
|
||||
{
|
||||
e.Node.Nodes[i].Nodes[j].SetValue(objCol, e.Value);
|
||||
}
|
||||
}
|
||||
e.Node.SetValue(objCol, e.Value);
|
||||
SetCheckedParentNodes(e.Node, e.Value, objCol);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// 设置父节点的状态
|
||||
|
||||
private void SetCheckedParentNodes(DevExpress.XtraTreeList.Nodes.TreeListNode node, Object check, Object obj)
|
||||
{
|
||||
if (node.ParentNode != null)
|
||||
{
|
||||
bool b = false;
|
||||
int state;
|
||||
for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
|
||||
{
|
||||
state = (int)(node.ParentNode.Nodes[i].GetValue(obj));
|
||||
if ((int)check != state)
|
||||
{
|
||||
b = !b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
node.ParentNode.SetValue(obj, b ? CheckState.Indeterminate : check);
|
||||
SetCheckedParentNodes(node.ParentNode, check, obj);
|
||||
}
|
||||
}
|
||||
|
||||
//复制
|
||||
private void btn_copy_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
FrmPermissionToCopy frmPermissionToCopy = new FrmPermissionToCopy();
|
||||
if (frmPermissionToCopy.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
List<string> copyReadPurview = frmPermissionToCopy.readPurview;
|
||||
List<string> copyEditPurview = frmPermissionToCopy.editPurview;
|
||||
GetListKeyID();
|
||||
|
||||
//并集
|
||||
string[] readPurviewUnion = readPurview.Union(copyReadPurview).ToList().ToArray();
|
||||
string[] editPurviewUnion = editPurview.Union(copyEditPurview).ToList().ToArray();
|
||||
|
||||
GetNodeCheckedID(readPurviewUnion, editPurviewUnion);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//清空
|
||||
private void btn_empty_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] Read = { };
|
||||
string[] Edit = { };
|
||||
GetNodeCheckedID(Read, Edit);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>151, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
partial class FrmPermissionToCopy
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.btn_determine = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.employeeId = new Lskj.PubPower.LabelTextEdit();
|
||||
this.employeeName = new Lskj.PubPower.LabelTextEdit();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.gridControlEx4 = new Lskj.MyControl.GridControlEx();
|
||||
this.treeList1 = new DevExpress.XtraTreeList.TreeList();
|
||||
this.repositoryItemCheckEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.treeList1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.btn_determine);
|
||||
this.panel1.Controls.Add(this.employeeId);
|
||||
this.panel1.Controls.Add(this.employeeName);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 530);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(1150, 41);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// btn_determine
|
||||
//
|
||||
this.btn_determine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_determine.Location = new System.Drawing.Point(1052, 8);
|
||||
this.btn_determine.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btn_determine.Name = "btn_determine";
|
||||
this.btn_determine.Size = new System.Drawing.Size(85, 25);
|
||||
this.btn_determine.TabIndex = 6;
|
||||
this.btn_determine.Text = "确定";
|
||||
this.btn_determine.Click += new System.EventHandler(this.btn_determine_Click);
|
||||
//
|
||||
// employeeId
|
||||
//
|
||||
this.employeeId.BackColor = System.Drawing.Color.Transparent;
|
||||
this.employeeId.EditText = "";
|
||||
this.employeeId.FontSize = 0F;
|
||||
this.employeeId.LabelText = "工号";
|
||||
this.employeeId.Location = new System.Drawing.Point(269, 8);
|
||||
this.employeeId.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.employeeId.Model = null;
|
||||
this.employeeId.Name = "employeeId";
|
||||
this.employeeId.NullText = "";
|
||||
this.employeeId.ReadOnly = false;
|
||||
this.employeeId.Required = false;
|
||||
this.employeeId.Size = new System.Drawing.Size(231, 22);
|
||||
this.employeeId.TabIndex = 5;
|
||||
//
|
||||
// employeeName
|
||||
//
|
||||
this.employeeName.BackColor = System.Drawing.Color.Transparent;
|
||||
this.employeeName.EditText = "";
|
||||
this.employeeName.FontSize = 0F;
|
||||
this.employeeName.LabelText = "人员";
|
||||
this.employeeName.Location = new System.Drawing.Point(14, 8);
|
||||
this.employeeName.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.employeeName.Model = null;
|
||||
this.employeeName.Name = "employeeName";
|
||||
this.employeeName.NullText = "";
|
||||
this.employeeName.ReadOnly = false;
|
||||
this.employeeName.Required = false;
|
||||
this.employeeName.Size = new System.Drawing.Size(231, 22);
|
||||
this.employeeName.TabIndex = 4;
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.gridControlEx4);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.treeList1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1150, 530);
|
||||
this.splitContainer1.SplitterDistance = 297;
|
||||
this.splitContainer1.TabIndex = 1;
|
||||
//
|
||||
// gridControlEx4
|
||||
//
|
||||
this.gridControlEx4.AdapterObj = null;
|
||||
this.gridControlEx4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridControlEx4.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridControlEx4.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.gridControlEx4.Name = "gridControlEx4";
|
||||
this.gridControlEx4.Size = new System.Drawing.Size(297, 530);
|
||||
this.gridControlEx4.TabIndex = 2;
|
||||
//
|
||||
// treeList1
|
||||
//
|
||||
this.treeList1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeList1.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeList1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.treeList1.Name = "treeList1";
|
||||
|
||||
this.treeList1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
|
||||
this.repositoryItemCheckEdit1});
|
||||
this.treeList1.Size = new System.Drawing.Size(849, 530);
|
||||
this.treeList1.TabIndex = 3;
|
||||
//
|
||||
// repositoryItemCheckEdit1
|
||||
//
|
||||
this.repositoryItemCheckEdit1.AutoHeight = false;
|
||||
this.repositoryItemCheckEdit1.Name = "repositoryItemCheckEdit1";
|
||||
//
|
||||
// FrmPermissionToCopy
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
this.Appearance.Options.UseFont = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1150, 571);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "FrmPermissionToCopy";
|
||||
this.Text = "复制权限";
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.treeList1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private MyControl.GridControlEx gridControlEx4;
|
||||
private DevExpress.XtraTreeList.TreeList treeList1;
|
||||
private DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit repositoryItemCheckEdit1;
|
||||
private PubPower.LabelTextEdit employeeId;
|
||||
private PubPower.LabelTextEdit employeeName;
|
||||
private DevExpress.XtraEditors.SimpleButton btn_determine;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
using CommonLib;
|
||||
using CommonLib.data;
|
||||
using DevExpress.XtraEditors.Repository;
|
||||
using DevExpress.XtraTreeList.Columns;
|
||||
using DevExpress.XtraTreeList.Nodes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public partial class FrmPermissionToCopy : FormBase
|
||||
{
|
||||
|
||||
public DynamicModel PubPowerModel;
|
||||
/// <summary>
|
||||
/// 选中行的集合
|
||||
/// </summary>
|
||||
private List<DataRow> rows = new List<DataRow>();
|
||||
public List<string> readPurview = new List<string>();
|
||||
public List<string> editPurview = new List<string>();
|
||||
private List<string> idlist = new List<string>();
|
||||
/// <summary>
|
||||
/// 记录选中角色选中行的行号之后
|
||||
/// </summary>
|
||||
private string rolePositionAfter = string.Empty;
|
||||
/// <summary>
|
||||
/// 记录选中人员选中行的行号之后
|
||||
/// </summary>
|
||||
private string operPositionAfter = string.Empty;
|
||||
/// <summary>
|
||||
/// 记录选中角色选中行的行号之前
|
||||
/// </summary>
|
||||
private string rolePositionBefore = string.Empty;
|
||||
/// <summary>
|
||||
/// 记录选中人员选中行的行号之前
|
||||
/// </summary>
|
||||
private string operPositionBefore = string.Empty;
|
||||
/// <summary>
|
||||
/// 获取左侧选中的名称
|
||||
/// </summary>
|
||||
private string id = string.Empty;
|
||||
/// <summary>
|
||||
/// 获取临时选中的名称
|
||||
/// </summary>
|
||||
private string empid = string.Empty;
|
||||
private bool Operatorflag = false;
|
||||
/// <summary>
|
||||
/// treeList绑定的表
|
||||
/// </summary>
|
||||
DataTable dt = new DataTable();
|
||||
/// <summary>
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
DataTable Roletable = new DataTable();
|
||||
/// <summary>
|
||||
/// 员工表
|
||||
/// </summary>
|
||||
DataTable employeetable = new DataTable();
|
||||
|
||||
|
||||
public FrmPermissionToCopy()
|
||||
{
|
||||
if (DBConfig.Instance.CreateConnection())
|
||||
{
|
||||
InitializeComponent();
|
||||
//InitializeDeps();
|
||||
InitializeColumns();
|
||||
InitializeUsers();
|
||||
creatTreeListControl();
|
||||
BindGridTreeView();
|
||||
this.gridControlEx4.gridView.Click += new EventHandler(OnGridView2Click);//人员表点击
|
||||
this.gridControlEx4.gridView.BestFitColumns();//设置根据内容填充列宽
|
||||
xtraTabControl1_SelectedPageChanged();
|
||||
this.employeeName.TextEdit.EditValueChanged += new EventHandler(OnUserEditValueChanged);
|
||||
this.employeeId.TextEdit.EditValueChanged += new EventHandler(OnUserEditValueChanged);
|
||||
|
||||
//this.department.TextEdit.EditValueChanged += new EventHandler(OnDepEditValueChanged);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
|
||||
/// <summary>
|
||||
/// 筛选赋权限表
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
private DataTable GetNewDt(DataTable newdt)
|
||||
{
|
||||
idlist.Clear();
|
||||
string sqlwhere = string.Empty;
|
||||
foreach (DataRow item in newdt.Rows)
|
||||
{
|
||||
idlist.Add(item["员工ID"] + " and ");
|
||||
}
|
||||
foreach (string id in idlist)
|
||||
{
|
||||
sqlwhere = sqlwhere + string.Format("员工ID !={0}", id);
|
||||
}
|
||||
|
||||
sqlwhere = !string.IsNullOrEmpty(sqlwhere) ? sqlwhere.Trim().Substring(0, sqlwhere.Length - 4) : "1=1";
|
||||
newdt = SqlHelper.ExecuteDataTable("select * from P_employeeBaseView where " + sqlwhere);
|
||||
return newdt;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取选中行数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="node">The node.</param>
|
||||
/// <returns>DataRow.</returns>
|
||||
private DataRow GetForcedNodeDataRow(TreeListNode node)
|
||||
{
|
||||
DataRowView dataRowView = this.treeList1.GetDataRecordByNode(node) as DataRowView;
|
||||
return dataRowView != null ? dataRowView.Row : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 默认绑定列数据
|
||||
/// </summary>
|
||||
private void InitializeColumns()
|
||||
{
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("员工ID", "员工ID");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("员工工号", "员工工号");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("员工姓名", "员工姓名");
|
||||
this.gridControlEx4.gridView.Columns.AddVisible("所属部门", "所属部门");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:默认加载表格数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-19 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void InitializeUsers()
|
||||
{
|
||||
/// <summary>
|
||||
/// 人员和角色绑定的表
|
||||
/// </summary>
|
||||
Roletable = PowerImpl.GetWorkRole("", "");
|
||||
employeetable = PowerImpl.GetWorkEmployee();
|
||||
this.gridControlEx4.gridControl.DataSource = employeetable;
|
||||
}
|
||||
/// <summary>
|
||||
/// 动态创建TreeList的Column,一列为图层名,一列为是否统计列Check控件
|
||||
/// </summary>
|
||||
private void creatTreeListControl()
|
||||
{
|
||||
|
||||
TreeListColumn treeListColumnName = new TreeListColumn();
|
||||
treeListColumnName.Caption = "系统名称";
|
||||
treeListColumnName.FieldName = "Caption";
|
||||
treeListColumnName.MinWidth = 38;
|
||||
treeListColumnName.Visible = true;
|
||||
treeListColumnName.VisibleIndex = 0;
|
||||
treeListColumnName.Width = 400;
|
||||
|
||||
TreeListColumn treeListColumnMenuId = new TreeListColumn();
|
||||
treeListColumnMenuId.Caption = "菜单id";
|
||||
treeListColumnMenuId.FieldName = "MenuId";
|
||||
treeListColumnMenuId.Visible = true;
|
||||
treeListColumnMenuId.VisibleIndex = 1;
|
||||
|
||||
TreeListColumn treeListColumnReadflag = new TreeListColumn();
|
||||
RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit();
|
||||
checkEdit.ValueChecked = 1;
|
||||
checkEdit.ValueUnchecked = 0;
|
||||
checkEdit.ValueGrayed = 3;
|
||||
treeListColumnReadflag.ColumnEdit = checkEdit;
|
||||
treeListColumnReadflag.Caption = "只读权限";
|
||||
treeListColumnReadflag.FieldName = "Readflag";
|
||||
treeListColumnReadflag.Name = "treeListColumnReadflagValue";
|
||||
treeListColumnReadflag.Visible = true;
|
||||
treeListColumnReadflag.VisibleIndex = 2;
|
||||
|
||||
TreeListColumn treeListColumnEditflag = new TreeListColumn();
|
||||
treeListColumnEditflag.ColumnEdit = checkEdit;
|
||||
treeListColumnEditflag.Caption = "操作权限";
|
||||
treeListColumnEditflag.FieldName = "Editflag";
|
||||
treeListColumnEditflag.Name = "treeListColumnEditflagValue";
|
||||
treeListColumnEditflag.Visible = true;
|
||||
treeListColumnEditflag.VisibleIndex = 3;
|
||||
|
||||
this.treeList1.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
|
||||
treeListColumnName,
|
||||
treeListColumnMenuId,
|
||||
treeListColumnReadflag,
|
||||
treeListColumnEditflag
|
||||
});
|
||||
this.treeList1.Nodes.Clear();
|
||||
this.treeList1.Refresh();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:绑定表格树结构</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2017-09-04 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="treeTable">The tree table.</param>
|
||||
public void BindGridTreeView()
|
||||
{
|
||||
DataTable treeTable = PowerImpl.GetMenuTreeViewData();
|
||||
//节点前显示复选框
|
||||
//this.treeList1.OptionsView.ShowCheckBoxes = true;
|
||||
// this.treeList1.OptionsBehavior.Editable = false;
|
||||
|
||||
dt.Columns.Add("ID");
|
||||
dt.Columns.Add("PARENTID");
|
||||
//(节点编码的名称)
|
||||
dt.Columns.Add("Caption");
|
||||
dt.Columns.Add("MenuId");
|
||||
dt.Columns.Add("Readflag", typeof(int));
|
||||
dt.Columns.Add("Editflag", typeof(int));
|
||||
if (treeTable != null && treeTable.Rows.Count > 0)
|
||||
{
|
||||
List<string> idlist = new List<string>();
|
||||
this.Tag = treeTable.Rows[0];
|
||||
DataColumnCollection dcc = treeTable.Columns;
|
||||
for (int i = 0; i < treeTable.Rows.Count; i++)
|
||||
{
|
||||
DataRow dr = treeTable.Rows[i];
|
||||
DataRow dr1 = dt.NewRow();
|
||||
string tnKey = dr["id"] + "";
|
||||
string tnStr = dr["MenuCaption"] + "";
|
||||
string pKey = dr["parentId"] + "";
|
||||
string MenuId = dr["MenuId"] + "";
|
||||
if (idlist.Contains(tnKey))
|
||||
{
|
||||
tnKey += "re" + i;
|
||||
}
|
||||
dr1["ID"] = tnKey;
|
||||
dr1["PARENTID"] = pKey;
|
||||
dr1["Caption"] = tnStr;
|
||||
dr1["MenuId"] = MenuId;
|
||||
dr1["Readflag"] = 0;
|
||||
dr1["editflag"] = 0;
|
||||
dt.Rows.Add(dr1);
|
||||
idlist.Add(tnKey);
|
||||
}
|
||||
this.treeList1.DataSource = dt;
|
||||
this.treeList1.KeyFieldName = "ID";
|
||||
this.treeList1.ParentFieldName = "PARENTID";
|
||||
//this.treeList1.Columns[0].Caption = "系统名称";
|
||||
//this.treeList1.Columns[0].Width = 500;
|
||||
this.treeList1.Columns[0].OptionsColumn.AllowEdit = false;
|
||||
this.treeList1.Columns[1].Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:用户值改变后</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnUserEditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string mc = this.employeeName.EditText;
|
||||
string dc = this.employeeId.EditText;
|
||||
DataTable table = PowerImpl.GetWorkFlowUsers(mc, dc);
|
||||
this.gridControlEx4.gridControl.DataSource = table;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:初始化部门数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
//private void InitializeDeps()
|
||||
//{
|
||||
|
||||
// DataTable table = WorkFlowBillImpl.GetDeps();
|
||||
// this.department.ValueMember = "departmentid";
|
||||
// this.department.ValueField = "departmentid";
|
||||
// this.department.TextField = "departmentname";
|
||||
// this.department.SetDataSource(table);
|
||||
//}
|
||||
/// <summary>
|
||||
/// 获取所有选中的集合
|
||||
/// </summary>
|
||||
/// <param name="parentNode"></param>
|
||||
private void GetListKeyID()
|
||||
{
|
||||
editPurview.Clear();
|
||||
readPurview.Clear();
|
||||
DataTable masterdt = (DataTable)treeList1.DataSource;
|
||||
for (int i = 0; i < masterdt.Rows.Count; i++)
|
||||
{
|
||||
if (masterdt.Rows[i]["ID"].ToString().Length > 4 && masterdt.Rows[i]["Editflag"] + "" == "1")
|
||||
{
|
||||
editPurview.Add(masterdt.Rows[i]["MenuId"] + "");
|
||||
}
|
||||
else
|
||||
if (masterdt.Rows[i]["ID"].ToString().Length > 4 && masterdt.Rows[i]["Readflag"] + "" == "1")
|
||||
{
|
||||
readPurview.Add(masterdt.Rows[i]["MenuId"] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取选择状态有权限的节点集合
|
||||
/// </summary>
|
||||
/// <param name="parentNode">父级节点</param>
|
||||
private void GetNodeCheckedID(string[] ReadPurview, string[] EditPurview)
|
||||
{
|
||||
rows.Clear();
|
||||
foreach (DataRow item in dt.Rows)
|
||||
{
|
||||
if (ReadPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["Readflag"] = "1";
|
||||
}
|
||||
if (EditPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["editflag"] = "1";
|
||||
}
|
||||
if (!EditPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["editflag"] = "0";
|
||||
}
|
||||
if (!ReadPurview.Contains(item["MenuId"] + ""))
|
||||
{
|
||||
item["Readflag"] = "0";
|
||||
}
|
||||
rows.Add(item);
|
||||
}
|
||||
this.treeList1.DataSource = rows.CopyToDataTable();
|
||||
this.treeList1.CollapseAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region 点击事件
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单击查询人员表里的数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnGridView2Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow mSelectRow = this.gridControlEx4.gridView.GetFocusedDataRow();
|
||||
operPositionAfter = this.gridControlEx4.gridView.FocusedRowHandle.ToString();
|
||||
if (mSelectRow != null)
|
||||
{
|
||||
id = mSelectRow["员工ID"] + "";
|
||||
operPositionBefore = id;
|
||||
Second(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击人员详细信息的方法
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
private void Second(string Secondid)
|
||||
{
|
||||
id = Secondid;
|
||||
// 验证删除存储过程
|
||||
string tipMsg = string.Empty;
|
||||
try
|
||||
{
|
||||
DataSet ds = BaseImpl.getAuthorityByEmpid(1, id, "", "", out tipMsg);
|
||||
string editPurview = ds.Tables.Count > 0 ? ds.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
||||
string[] EditPurview = editPurview.Trim().TrimEnd(',').Split(',');
|
||||
DataSet ds2 = BaseImpl.getAuthorityByEmpid(2, id, "", "", out tipMsg);
|
||||
string readPurview = ds2.Tables.Count > 0 ? ds2.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
||||
string[] ReadPurview = readPurview.Trim().TrimEnd(',').Split(',');
|
||||
GetNodeCheckedID(ReadPurview, EditPurview);
|
||||
Operatorflag = true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//MessageUtil.Show("权限表无此人!");
|
||||
this.gridControlEx4.gridView.SelectRowHandler(0);
|
||||
Second("1");
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 默认选中第一行
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void xtraTabControl1_SelectedPageChanged()
|
||||
{
|
||||
operPositionAfter = string.IsNullOrWhiteSpace(operPositionAfter) ? "0" : operPositionAfter;
|
||||
operPositionBefore = string.IsNullOrWhiteSpace(operPositionBefore) ? employeetable.Rows[0]["员工ID"] + "" : operPositionBefore;
|
||||
this.gridControlEx4.gridView.SelectRowHandler(int.Parse(operPositionAfter));//设置默认选中行
|
||||
Second(operPositionBefore);
|
||||
|
||||
}
|
||||
|
||||
private void btn_determine_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetListKeyID();
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,240 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.Utils;
|
||||
using System.Data;
|
||||
using DevExpress.XtraGrid;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
/// <summary>
|
||||
/// 表格拖拽到表格
|
||||
/// </summary>
|
||||
public class GridDragGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否正在拖拽
|
||||
/// </summary>
|
||||
private bool _draging = false;
|
||||
/// <summary>
|
||||
/// 拖动位置
|
||||
/// </summary>
|
||||
private GridHitInfo _hitInfo;
|
||||
/// <summary>
|
||||
/// 当前操作的GridView
|
||||
/// </summary>
|
||||
private GridView _sourceGridView;
|
||||
/// <summary>
|
||||
/// 目标GridView
|
||||
/// </summary>
|
||||
private GridView _targetGridView;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 拖动完成后调用
|
||||
/// </summary>
|
||||
public event GridFragGridCompleteEventHandler OnDragComplete;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GridDragGrid"/> class.
|
||||
/// </summary>
|
||||
/// <param name="curGridView">当前GridView</param>
|
||||
/// <param name="tarGridView">目标GridView.</param>
|
||||
public GridDragGrid(GridView sourceView, GridView targetView)
|
||||
{
|
||||
this._sourceGridView = sourceView;
|
||||
this._targetGridView = targetView;
|
||||
|
||||
if (this._sourceGridView == null || this._targetGridView == null) return;
|
||||
|
||||
this._sourceGridView.MouseDown += new System.Windows.Forms.MouseEventHandler(sourceGridView_MouseDown);
|
||||
this._sourceGridView.MouseMove += new System.Windows.Forms.MouseEventHandler(sourceGridView_MouseMove);
|
||||
this._sourceGridView.MouseUp += new System.Windows.Forms.MouseEventHandler(sourceGridView_MouseUp);
|
||||
|
||||
this._targetGridView.GridControl.AllowDrop = true;
|
||||
this._targetGridView.GridControl.DragOver += new DragEventHandler(gridControl_DragOver);
|
||||
this._targetGridView.GridControl.DragEnter += new System.Windows.Forms.DragEventHandler(gridControl_DragEnter);
|
||||
this._targetGridView.GridControl.DragDrop += new System.Windows.Forms.DragEventHandler(gridControl_DragDrop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:获取表格选中行数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="rowHandles">The row handles.</param>
|
||||
/// <returns>DataRow[].</returns>
|
||||
private DataRow[] GetGridSelectRows(int[] rowHandles)
|
||||
{
|
||||
List<DataRow> rows = new List<DataRow>();
|
||||
|
||||
foreach (int handle in rowHandles)
|
||||
{
|
||||
DataRow row = this._sourceGridView.GetDataRow(handle);
|
||||
rows.Add(row);
|
||||
}
|
||||
|
||||
return rows.ToArray();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:源表格鼠标按下</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
|
||||
protected void sourceGridView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
this._hitInfo = null;
|
||||
if (System.Windows.Forms.Control.ModifierKeys != Keys.None) return;
|
||||
|
||||
GridView gridView = sender as GridView;
|
||||
GridHitInfo hitInfo = gridView.CalcHitInfo(new Point(e.X, e.Y));
|
||||
|
||||
if (e.Button == MouseButtons.Left && hitInfo.RowHandle >= 0)
|
||||
{
|
||||
this._draging = true;
|
||||
this._hitInfo = hitInfo;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:源表格鼠标移动</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
|
||||
protected void sourceGridView_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
GridView gridView = sender as GridView;
|
||||
if (e.Button == MouseButtons.Left && this._hitInfo != null)
|
||||
{
|
||||
Size dragSize = SystemInformation.DragSize;
|
||||
Rectangle dragRect = new Rectangle(new Point(this._hitInfo.HitPoint.X - dragSize.Width / 2,
|
||||
this._hitInfo.HitPoint.Y - dragSize.Height / 2), dragSize);
|
||||
|
||||
if (!dragRect.Contains(new Point(e.X, e.Y)))
|
||||
{
|
||||
object row = gridView.GetRow(this._hitInfo.RowHandle >= 0 ? this._hitInfo.RowHandle : 0);
|
||||
gridView.GridControl.DoDragDrop(row, DragDropEffects.Move);
|
||||
this._hitInfo = null;
|
||||
DXMouseEventArgs.GetMouseArgs(e).Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:源表格鼠标放开</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
|
||||
protected void sourceGridView_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
this._draging = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:移动到目标表格上</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
|
||||
private void gridControl_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
GridControl targetControl = (sender as GridControl);
|
||||
GridView targetGrid = targetControl.FocusedView as GridView;
|
||||
Point gcPoint = targetControl.PointToScreen((sender as GridControl).Location);
|
||||
Point pt = new Point(e.X - gcPoint.X, e.Y - gcPoint.Y);
|
||||
_hitInfo = targetGrid.CalcHitInfo(pt);
|
||||
if (_hitInfo == null || _hitInfo.RowHandle < 0) return;
|
||||
targetGrid.SelectRow(_hitInfo.RowHandle);
|
||||
targetGrid.FocusedRowHandle = _hitInfo.RowHandle;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:移动到目标表格</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
|
||||
protected void gridControl_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
|
||||
{
|
||||
e.Effect = DragDropEffects.Move;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:拖动完成时</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-13 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
|
||||
protected void gridControl_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
|
||||
{
|
||||
if (this.OnDragComplete != null && this._draging)
|
||||
{
|
||||
this._draging = false;
|
||||
|
||||
GridDragGridArgs args = new GridDragGridArgs();
|
||||
args.SourceGridViewObj = this._sourceGridView;
|
||||
args.TargetGridViewObj = this._targetGridView;
|
||||
args.GridViewSelectRows = GetGridSelectRows(this._sourceGridView.GetSelectedRows());
|
||||
args.SelectGridRow = this._targetGridView.GetDataRow(this._targetGridView.FocusedRowHandle);
|
||||
this.OnDragComplete(sender, args);
|
||||
}
|
||||
}
|
||||
#region 表格第一列添加复选框
|
||||
/// <summary>
|
||||
/// <para>说明:表格第一列添加复选框</para>
|
||||
/// <para>创建人:唐德馨</para>
|
||||
/// <para>创建日期:2021-07-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="gridColumn">The grid columnFilterPopupChecke.</param>
|
||||
public static void GridAddCheckBox(GridView gridview)
|
||||
{
|
||||
gridview.OptionsSelection.MultiSelect = true;
|
||||
gridview.OptionsSelection.MultiSelectMode = GridMultiSelectMode.RowSelect;
|
||||
gridview.OptionsSelection.EnableAppearanceFocusedCell = false;
|
||||
gridview.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDown;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public static class GridExtend
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置GridView选中行</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-05 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="gridView">The grid view.</param>
|
||||
/// <param name="handler">The handle.</param>
|
||||
public static void SelectRowHandler(this GridView gridView, int handle)
|
||||
{
|
||||
if (gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.EnableAppearanceFocusedCell == false && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.RowSelect)
|
||||
{
|
||||
if (handle != 0)
|
||||
{
|
||||
gridView.ClearSelection();
|
||||
gridView.FocusedRowHandle = handle;
|
||||
gridView.SelectRow(handle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (handle < 0) handle = 0;
|
||||
gridView.ClearSelection();
|
||||
gridView.FocusedRowHandle = handle;
|
||||
gridView.SelectRow(handle);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
partial class LabelTextEdit
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.plLeft = new System.Windows.Forms.Panel();
|
||||
this.lblText = new System.Windows.Forms.Label();
|
||||
this.plRight = new System.Windows.Forms.Panel();
|
||||
this.txtEdit = new DevExpress.XtraEditors.TextEdit();
|
||||
this.plLeft.SuspendLayout();
|
||||
this.plRight.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtEdit.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// plLeft
|
||||
//
|
||||
this.plLeft.BackColor = System.Drawing.Color.Transparent;
|
||||
this.plLeft.Controls.Add(this.lblText);
|
||||
this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.plLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.plLeft.Name = "plLeft";
|
||||
this.plLeft.Size = new System.Drawing.Size(42, 21);
|
||||
this.plLeft.TabIndex = 2;
|
||||
//
|
||||
// lblText
|
||||
//
|
||||
this.lblText.AutoSize = true;
|
||||
this.lblText.Location = new System.Drawing.Point(5, 4);
|
||||
this.lblText.Name = "lblText";
|
||||
this.lblText.Size = new System.Drawing.Size(37, 15);
|
||||
this.lblText.TabIndex = 1;
|
||||
this.lblText.Text = "名称";
|
||||
//
|
||||
// plRight
|
||||
//
|
||||
this.plRight.Controls.Add(this.txtEdit);
|
||||
this.plRight.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plRight.Location = new System.Drawing.Point(42, 0);
|
||||
this.plRight.Name = "plRight";
|
||||
this.plRight.Size = new System.Drawing.Size(122, 21);
|
||||
this.plRight.TabIndex = 3;
|
||||
//
|
||||
// txtEdit
|
||||
//
|
||||
this.txtEdit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtEdit.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtEdit.Name = "txtEdit";
|
||||
this.txtEdit.Size = new System.Drawing.Size(122, 24);
|
||||
this.txtEdit.TabIndex = 0;
|
||||
//
|
||||
// LabelTextEdit
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Controls.Add(this.plRight);
|
||||
this.Controls.Add(this.plLeft);
|
||||
this.Name = "LabelTextEdit";
|
||||
this.Size = new System.Drawing.Size(164, 21);
|
||||
this.plLeft.ResumeLayout(false);
|
||||
this.plLeft.PerformLayout();
|
||||
this.plRight.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtEdit.Properties)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel plLeft;
|
||||
private System.Windows.Forms.Panel plRight;
|
||||
private DevExpress.XtraEditors.TextEdit txtEdit;
|
||||
private System.Windows.Forms.Label lblText;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraEditors;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public partial class LabelTextEdit : BaseUserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 文本控件
|
||||
/// </summary>
|
||||
public TextEdit TextEdit { get { return txtEdit; } }
|
||||
|
||||
public LabelTextEdit()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件显示文本</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="text">显示Lebel文本</param>
|
||||
public override string LabelText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblText.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblText.Text = value;
|
||||
if (FontSize > 0)
|
||||
{
|
||||
this.plLeft.Dock = DockStyle.Left;
|
||||
this.plLeft.AutoSize = false;
|
||||
this.lblText.AutoSize = false;
|
||||
this.lblText.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblText.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.txtEdit.Properties.AutoHeight = false;
|
||||
this.plLeft.Width = value.Length * GetCharWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.plLeft.Width = this.lblText.Width + PaddingLeft;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 字体大小
|
||||
/// </summary>
|
||||
/// <value>The size of the control.</value>
|
||||
public override float FontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.FontSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.FontSize = value;
|
||||
if (value > 0)
|
||||
{
|
||||
this.lblText.Font = new Font(this.lblText.Font.FontFamily, value);
|
||||
this.TextEdit.Font = new Font(this.TextEdit.Font.FontFamily, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件值</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
public override string EditText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.txtEdit.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.txtEdit.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件提示文本</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>返回控件值</returns>
|
||||
public override string NullText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.txtEdit.Properties.NullValuePrompt;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
this.TextEdit.Properties.NullValuePromptShowForEmptyValue = true;
|
||||
this.TextEdit.Properties.NullValuePrompt = value;
|
||||
}
|
||||
base.NullText = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 只读文本颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the read only label.</value>
|
||||
public override bool ReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ReadOnly;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ReadOnly = value;
|
||||
this.txtEdit.Properties.ReadOnly = value;
|
||||
this.lblText.ForeColor = value ? base.ReadOnlyLabelForceColor : Required ? base.RequiredLabelForceColor : base.DefaultLabelForceColor;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 必填文本颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the required label.</value>
|
||||
public override bool Required
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Required;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Required = value;
|
||||
if (value)
|
||||
{
|
||||
this.lblText.ForeColor = base.RequiredLabelForceColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:格式化文本控件</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-17</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="formatString">The format string.</param>
|
||||
public void TextFormat(string formatString)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(formatString))
|
||||
{
|
||||
this.txtEdit.Properties.Mask.EditMask = "##########" + (formatString == "#" ? "0" : formatString);//#代表位数
|
||||
this.txtEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
|
||||
this.txtEdit.Properties.Mask.UseMaskAsDisplayFormat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,243 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F9D85AB9-300C-4BF6-87D6-29127755117A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Lskj.PubPower</RootNamespace>
|
||||
<AssemblyName>Lskj.PubPower</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\publish\lib\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DocumentationFile>..\..\Debug\AllMethodXml\Lskj.PubPower.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.BonusSkins.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.BonusSkins.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.Data.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Printing.v13.1.Core, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.Printing.v13.1.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.RichEdit.v13.1.Core, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.RichEdit.v13.1.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Sparkline.v13.1.Core, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.Sparkline.v13.1.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Spreadsheet.v13.1.Core, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.Spreadsheet.v13.1.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.Utils.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraBars.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraBars.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraCharts.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraCharts.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraCharts.v13.1.UI, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraCharts.v13.1.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraEditors.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraEditors.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraGrid.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraGrid.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraPrinting.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraPrinting.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraReports.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraReports.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraReports.v13.1.Extensions, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraReports.v13.1.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraRichEdit.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraRichEdit.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraScheduler.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraScheduler.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraScheduler.v13.1.Core, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraScheduler.v13.1.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraSpreadsheet.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraSpreadsheet.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraTreeList.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dev13.1\Bin\Framework\DevExpress.XtraTreeList.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="itextsharp">
|
||||
<HintPath>..\..\引用DLL\itextsharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI">
|
||||
<HintPath>..\..\引用DLL\NPOI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="O2S.Components.PDFView4NET">
|
||||
<HintPath>..\..\引用DLL\O2S.Components.PDFView4NET.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseImpl.cs" />
|
||||
<Compile Include="BaseUserControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BaseUserControl.Designer.cs">
|
||||
<DependentUpon>BaseUserControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ControlModel.cs" />
|
||||
<Compile Include="DelegateUtil.cs" />
|
||||
<Compile Include="DynamicModel.cs" />
|
||||
<Compile Include="FrmAddRole.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrmAddRole.Designer.cs">
|
||||
<DependentUpon>FrmAddRole.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FrmMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrmMain.Designer.cs">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DllBaseClass.cs" />
|
||||
<Compile Include="FrmPermissionToCopy.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrmPermissionToCopy.Designer.cs">
|
||||
<DependentUpon>FrmPermissionToCopy.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GridDragGrid.cs" />
|
||||
<Compile Include="GridExtend.cs" />
|
||||
<Compile Include="LabelTextEdit.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LabelTextEdit.Designer.cs">
|
||||
<DependentUpon>LabelTextEdit.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PowerImpl.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ReplaceHelper.cs" />
|
||||
<EmbeddedResource Include="BaseUserControl.resx">
|
||||
<DependentUpon>BaseUserControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FrmAddRole.resx">
|
||||
<DependentUpon>FrmAddRole.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FrmMain.resx">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FrmPermissionToCopy.resx">
|
||||
<DependentUpon>FrmPermissionToCopy.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="LabelTextEdit.resx">
|
||||
<DependentUpon>LabelTextEdit.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonLib\CommonLib.csproj">
|
||||
<Project>{3e8e6529-5d8a-4f17-8c41-27cd7380178d}</Project>
|
||||
<Name>CommonLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.Common\Lskj.Common.csproj">
|
||||
<Project>{de7efd7f-2dfe-4d50-a578-452a2dbfd088}</Project>
|
||||
<Name>Lskj.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.MyControl\Lskj.MyControl.csproj">
|
||||
<Project>{f6502012-9a7c-44ae-aac6-de2ad02f5c11}</Project>
|
||||
<Name>Lskj.MyControl</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,321 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public class PowerImpl : BaseImpl
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>说明:获取只读或操作权限表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetPurview(string condition)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(condition))
|
||||
{
|
||||
string allSql = string.Format("select * from p_formmenuconfigtab where len(MenuStruct)>2");
|
||||
return GetDataTableResult(allSql);
|
||||
}
|
||||
string sqlValue = string.Format("select * from p_formmenuconfigtab where len(MenuStruct)>2 and menuId in({0})", condition);
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:获取子系统表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetSystemsTitle()
|
||||
{
|
||||
string sqlValue = "select * from P_SubSystemTab where UseEd='1'";
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:获取子系统表模块</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetSystemsTable(string way, bool isChildren)
|
||||
{
|
||||
string sqlValue = isChildren ? "select * from p_formmenuconfigtab where " + way : "select * from p_formmenuconfigtab where ParentMenuId='-1' and LEN(MenuStruct)=2 " + way;
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取员工表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetWorkEmployee()
|
||||
{
|
||||
string sqlValue = "select * from P_employeeBaseView";
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取角色表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetWorkRole(string depid, string mf)
|
||||
{
|
||||
string where = string.Empty;
|
||||
if (!string.IsNullOrEmpty(depid))
|
||||
where = string.Format(" where operatorid='{0}'", depid);
|
||||
if (!string.IsNullOrEmpty(mf))
|
||||
where = string.Format(" and (loginaccount like '%{0}%' or employeename like '%{0}%' or dbo.P_getpy(employeename) like '%{0}%')", mf);
|
||||
|
||||
string sqlValue = "select * from p_systemRoleSetTab" + where;
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取人员权限表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetWorkUsers(string roleId)
|
||||
{
|
||||
string where = string.Empty;
|
||||
if (!string.IsNullOrEmpty(roleId))
|
||||
where = " where roleId=" + roleId;
|
||||
string sqlValue = "select roleOperatorId as 员工ID,JobNumber as 员工工号,emp.employeename as 员工姓名,department as 所属部门 from p_systemRoleOperSetTab ro left join p_employeetab emp on ro.roleOperatorId=emp.employeeid" + where;
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取表树形结构表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-09-27 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetMenuTreeViewData()
|
||||
{
|
||||
string sqlValue = @"
|
||||
WITH tmenu(id,MenuCaption,ParentId,menuid,SubSysId,level)
|
||||
as
|
||||
(
|
||||
SELECT convert(varchar(50), menu.SubSysId)+'_'+ MenuStruct id,MenuCaption,CONVERT(varchar(50), -CONVERT(int, menu.SubSysId)) ParentId,menu.menuid,menu.SubSysId,1 level FROM p_formmenuconfigtab menu
|
||||
inner join P_SubSystemTab sub on menu.SubSysId=sub.SubSysId and ISNULL(UseEd,0)=1
|
||||
where ISNULL(UseFlag,1)=1 and LEN(menustruct)=2
|
||||
UNION ALL
|
||||
SELECT convert(varchar(50), a.SubSysId)+'_'+A.MenuStruct id, A.MenuCaption,CONVERT(varchar(50),convert(varchar(50), a.SubSysId)+'_'+ SUBSTRING(a.MenuStruct,1,case when LEN(a.MenuStruct)>2 then LEN(a.MenuStruct)-2 else 0 end)) ParentId,a.MenuId,a.SubSysId ,b.level+1 FROM p_formmenuconfigtab A,tmenu b
|
||||
where LEN(a.MenuStruct)>2 and ISNULL(UseFlag,1)=1 and convert(varchar(50), a.SubSysId)+'_'+ SUBSTRING(a.MenuStruct,1,case when LEN(a.MenuStruct)>2 then LEN(a.MenuStruct)-2 else 0 end) = b.id and a.SubSysId=b.SubSysId
|
||||
)
|
||||
select tm.MenuId, lm.id id,tm.urlparams menucode,tm.MenuCaption,tm.DllFileName library,lm.ParentId parentId,tm.SubSysId, lm.level,'' readflag, '' writeflag
|
||||
from tmenu lm
|
||||
left join p_formmenuconfigtab tm on lm.menuid=tm.menuid
|
||||
where isnull(tm.useFlag,1)=1
|
||||
union all
|
||||
select '' menuid,convert(varchar(10), -SubSysId) MenuStruct ,'' menucode,subsysname MenuCaption,'' library,'' parentid,SubSysId,0 level,'' editflag, '' Readflag from P_SubSystemTab
|
||||
where ISNULL(UseEd,0)=1
|
||||
ORDER BY SubSysId,id";
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:保存人员权限设置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool SaveRoleOperDate(string OperId, string OperName, string departemnt, string readdate, string editdate)
|
||||
{
|
||||
string sqlValue = string.Format(" if exists (select * from p_systemRoleOperSetTab s where s.operatorid='{0}') update p_systemRoleOperSetTab set ReadPurview='{4}',EditPurview='{5}' where operatorid = '{0}' ELSE insert into p_systemRoleOperSetTab (roleId,roleOperatorId,operatorid,operatorname,operatedate,department,ReadPurview,EditPurview) values ('0','{0}','{0}','{1}','{2}','{3}','{4}','{5}')", OperId, OperName, DateTime.Now, departemnt, readdate, editdate);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取角色模块信息</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-10 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>DataRow.</returns>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
public static DataRow GetRoleRow(string id)
|
||||
{
|
||||
string sqlValue = string.Format("select * from p_systemRoleSetTab where id='{0}'", id);
|
||||
|
||||
DataTable dtTable = GetDataTableResult(sqlValue);
|
||||
|
||||
return dtTable.Rows.Count > 0 ? dtTable.Rows[0] : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取角色模块信息</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-10 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
/// <returns>DataRow.</returns>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
public static DataRow GeRoleOperRow(string id)
|
||||
{
|
||||
string sqlValue = string.Format("select * from P_employeeBaseView where 员工ID='{0}' ", id);
|
||||
|
||||
DataTable dtTable = GetDataTableResult(sqlValue);
|
||||
|
||||
return dtTable.Rows.Count > 0 ? dtTable.Rows[0] : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:拖拽人员修改权限设置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool DropDate(int OperId, string JobNumber, string OperName, string departemnt, string id)
|
||||
{
|
||||
|
||||
string sqlValue = string.Format("INSERT INTO p_systemRoleOperSetTab (roleId, roleOperatorId,operatorid,operatorname,department,operatedate,JobNumber) VALUES ('{0}','{1}','{1}','{2}','{3}','{4}','{5}')", id, OperId, OperName, departemnt, DateTime.Now, JobNumber);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:保存角色权限设置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool SaveRoleDate(string id, string readdate, string editdate)
|
||||
{
|
||||
string sqlValue = string.Format("UPDATE p_systemRoleSetTab SET ReadPurview = '{0}',EditPurview = '{1}' WHERE id = {2}", readdate, editdate, id);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:删除人员权限设置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool deletRoleDate(string id, string roleId)
|
||||
{
|
||||
string sqlValue = string.Format("DELETE FROM p_systemRoleOperSetTab WHERE operatorid = '{0}' and roleId='{1}'", id, roleId);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:删除角色权限设置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool deletRoleoperDate(string id)
|
||||
{
|
||||
string sqlValue = string.Format("DELETE FROM p_systemRoleSetTab WHERE id = '{0}'", id);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取小类设置操作员</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-06-24 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataTable.</returns>
|
||||
public static DataTable GetWorkFlowUsers(string mc, string dc)
|
||||
{
|
||||
string where = string.Empty;
|
||||
if (!string.IsNullOrEmpty(mc))
|
||||
where = string.Format(" where (员工姓名 like '%{0}%' or dbo.P_getpy(员工姓名) like '%{0}%')", mc);
|
||||
if (!string.IsNullOrEmpty(dc))
|
||||
{
|
||||
where += string.IsNullOrWhiteSpace(mc) ? string.Format(" where 员工工号 like '%{0}%'", dc) : string.Format(" and 员工工号 like '%{0}%'", dc);
|
||||
}
|
||||
string sqlValue = "select 员工ID,员工工号,员工姓名,所属部门 from P_employeeBaseView " + where;
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:添加新的角色</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool intnewOper(string OperName)
|
||||
{
|
||||
string sqlValue = string.Format("INSERT INTO p_systemRoleSetTab (roleName,operatedate) VALUES ('{0}','{1}')", OperName, DateTime.Now);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:修改角色</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-10-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static bool UpdOper(string OperName, string id)
|
||||
{
|
||||
string sqlValue = string.Format("Update p_systemRoleSetTab set roleName='{0}',operatedate='{1}' where id={2} ", OperName, DateTime.Now, id);
|
||||
return ExecSqlValue(sqlValue) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Lskj.PubPower")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Lskj.PubPower")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9006f149-aa49-4b8e-ba69-386d945fa738")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lskj.PubPower.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lskj.PubPower.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用此强类型资源类,为所有资源查找
|
||||
/// 重写当前线程的 CurrentUICulture 属性。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lskj.PubPower.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,311 @@
|
||||
using CommonLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Lskj.PubPower
|
||||
{
|
||||
public static class ReplaceHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 带参数控件替换规则
|
||||
/// </summary>
|
||||
private static readonly string _replace_param = "#[^##]+#";
|
||||
private static readonly string _replace_parent_left_key = "{#";
|
||||
private static readonly string _replace_param_first_key = "{";
|
||||
private static readonly string _replace_param_end_key = "}";
|
||||
private static readonly string _proc_first_key = "@";
|
||||
/// <summary>
|
||||
/// 树节点替换key
|
||||
/// </summary>
|
||||
private static readonly string _replace_parent_key = "{parent.key}";
|
||||
/// <summary>
|
||||
/// 替换sql语句中的对应字段
|
||||
/// </summary>
|
||||
private static readonly string _replace_field_key = "{([^{])+}";
|
||||
/// <summary>
|
||||
/// 存储过程标识
|
||||
/// </summary>
|
||||
private static readonly string _procedureFlag = "exec";
|
||||
/// <summary>
|
||||
/// 查询语句标记
|
||||
/// </summary>
|
||||
private static readonly string _selectFlag = "select";
|
||||
/// <summary>
|
||||
/// 查询条件替换值
|
||||
/// </summary>
|
||||
private static readonly string _search_control_value = "{value}";
|
||||
/// <summary>
|
||||
/// loginid 固定字段
|
||||
/// </summary>
|
||||
private static readonly string _loginid_key = "{loginid}";
|
||||
/// <summary>
|
||||
/// loginname 固定字段
|
||||
/// </summary>
|
||||
private static readonly string _loginname_key = "{loginname}";
|
||||
/// <summary>
|
||||
/// groupid 固定字段
|
||||
/// </summary>
|
||||
private static readonly string _groupid_key = "{groupid}";
|
||||
/// <summary>
|
||||
/// password 固定字段
|
||||
/// </summary>
|
||||
private static readonly string _password_key = "{password}";
|
||||
/// <summary>
|
||||
/// 车间固定字段
|
||||
/// </summary>
|
||||
private static readonly string _cj_key = "{logincj}";
|
||||
/// <summary>
|
||||
/// 机台固定字段
|
||||
/// </summary>
|
||||
private static readonly string _jt_key = "{loginjt}";
|
||||
/// <summary>
|
||||
/// 班次固定字段
|
||||
/// </summary>
|
||||
private static readonly string _bz_key = "{loginbz}";
|
||||
/// <summary>
|
||||
/// 班组固定字段
|
||||
/// </summary>
|
||||
private static readonly string _className_key = "{className}";
|
||||
/// <summary>
|
||||
/// 替换表格列标识
|
||||
/// </summary>
|
||||
private static readonly string _column_key = "{COLUMN_NAME}";
|
||||
/// <summary>
|
||||
/// 替换表格列标题标识
|
||||
/// </summary>
|
||||
private static readonly string _column_title_key = "{COLUMN_TITLE}";
|
||||
/// <summary>
|
||||
/// 取单元格值
|
||||
/// </summary>
|
||||
private static readonly string _column_value_key = "{COLUMN_VALUE}";
|
||||
/// <summary>
|
||||
/// 系统id固定字段
|
||||
/// </summary>
|
||||
private static readonly string _seriesId_id = "{SeriesId}";
|
||||
/// <summary>
|
||||
/// 系统种类固定字段
|
||||
/// </summary>
|
||||
private static readonly string _logintype = "{logintype}";
|
||||
/// <summary>
|
||||
/// UserCode 固定字段
|
||||
/// </summary>
|
||||
private static readonly string _userCode_key = "{lserpUserCode}";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 参数替换父级字符前缀
|
||||
/// </summary>
|
||||
/// <value>The replace parent left key.</value>
|
||||
public static string ReplaceParentLeftKey { get { return _replace_parent_left_key; } }
|
||||
/// <summary>
|
||||
/// 参数替换首字符
|
||||
/// </summary>
|
||||
/// <value>The replace parameter first key.</value>
|
||||
public static string ReplaceParamFirstKey { get { return _replace_param_first_key; } }
|
||||
/// <summary>
|
||||
/// 参数替换尾字符
|
||||
/// </summary>
|
||||
/// <value>The replace parameter end key.</value>
|
||||
public static string ReplaceParamEndKey { get { return _replace_param_end_key; } }
|
||||
/// <summary>
|
||||
/// 存储过程参数执行方式首字符
|
||||
/// </summary>
|
||||
/// <value>The proc first key.</value>
|
||||
public static string ProcFirstKey { get { return _proc_first_key; } }
|
||||
/// <summary>
|
||||
/// 带参数控件替换规则
|
||||
/// </summary>
|
||||
/// <value>The replace parameter.</value>
|
||||
public static string ReplaceParamKey { get { return _replace_param; } }
|
||||
/// <summary>
|
||||
/// <para>说明:替换userid、username、groupid</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-10-25 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="defaultValue">The default value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string ReplaceUserInfo(string defaultValue)
|
||||
{
|
||||
return ReplaceUserInfo(defaultValue, ERPInfo.Instance.EmployeeId+"", ERPInfo.Instance.EmployeeName, ERPInfo.Instance.GroupId, ERPInfo.Instance.Password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:替换userid、username、groupid</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="defaultValue">The default value.</param>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <param name="userName">Name of the user.</param>
|
||||
/// <param name="groupId">The group identifier.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string ReplaceUserInfo(string defaultValue, string userId, string userName, string groupId, string password)
|
||||
{
|
||||
return defaultValue = defaultValue.Replace(_loginid_key, userId, true)
|
||||
.Replace(_loginname_key, userName, true)
|
||||
.Replace(_groupid_key, groupId, true)
|
||||
.Replace(_password_key, password, true)
|
||||
//.Replace(_cj_key, ERPInfo.Instance.WorkCJ, true)
|
||||
//.Replace(_jt_key, ERPInfo.Instance.WorkJT, true)
|
||||
//.Replace(_bz_key, ERPInfo.Instance.WorkBZ, true)
|
||||
//.Replace(_seriesId_id, ERPInfo.Instance.SeriesId, true)
|
||||
//.Replace(_className_key, ERPInfo.Instance.ClassName, true)
|
||||
.Replace(_logintype, "0", true);
|
||||
//.Replace(_userCode_key, ERPInfo.Instance.LoginAccount, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:带参数替换为1=1</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string ReplaceParam(string defaultValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SubstringCount(defaultValue, "#") > 1)
|
||||
{
|
||||
return defaultValue.Replace(defaultValue.Substring(defaultValue.IndexOf('#'), defaultValue.LastIndexOf('#') + 1 - defaultValue.IndexOf('#')), " 1=1 ");
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return Regex.Replace(defaultValue, _replace_param, " 1=1 ");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:判断字符串出现次数</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期: </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="str">The string.</param>
|
||||
/// <param name="substring">The substring.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
private static int SubstringCount(string str, string substring)
|
||||
{
|
||||
if (str.Contains(substring))
|
||||
{
|
||||
string strReplaced = str.Replace(substring, "");
|
||||
return (str.Length - strReplaced.Length) / substring.Length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summaryconta
|
||||
/// <para>说明:替换树节点parentkey</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-09-04 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string ReplaceTreeViewParentKeyCond(string defaultValue, string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(defaultValue)) return defaultValue;
|
||||
|
||||
return defaultValue.Replace(_replace_parent_key, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:获取sql语句中替换</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-09-04 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>List<System.String>.</returns>
|
||||
public static List<string> GetParamFields(string defaultValue)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
Regex regex = new Regex(_replace_field_key);
|
||||
MatchCollection mcs = regex.Matches(defaultValue);
|
||||
foreach (Match item in mcs)
|
||||
{
|
||||
if (list.IndexOf(item.Value) == -1)
|
||||
list.Add(item.Value);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:{key}字符串替换</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-05-28 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="ignoreCase">是否忽略大小写</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string Replace(this string str, string key, string value, bool ignoreCase)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str)) return str;
|
||||
|
||||
return Regex.IsMatch(str, key, RegexOptions.IgnoreCase) ?
|
||||
System.Text.RegularExpressions.Regex.Replace(str, key, value, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)
|
||||
: str;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:将{xxx}格式全部替换为某个值</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-01 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>l
|
||||
/// <param name="defaultValue">The default value.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string ReplaceParamToValue(string defaultValue, string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(defaultValue)) return defaultValue;
|
||||
|
||||
var fields = GetParamFields(defaultValue);
|
||||
foreach (string item in fields)
|
||||
{
|
||||
defaultValue = defaultValue.Replace(item, value);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.1.3.1" newVersion="2.1.3.1" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user