You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.6 KiB

using RS.BLL;
using RS.Common;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MorClient.UserFrmFrame;
using System.Diagnostics;
using RS.Module.Common;
namespace MorClient.UserControls
{
public partial class ToolsOperateMent : UserControl
{
string operator_num = null;
UIPage uIPage = new UIPage();
DataGridViewHandle gridHdl = new DataGridViewHandle();
BToolsManageInfo bToolsManageInfo = new BToolsManageInfo();
public ToolsOperateMent()
{
InitializeComponent();
LoadDataNew();
GenerateDataGridViewColumns();
}
#region 操作员管理
// 生成DataGridView列
private void GenerateDataGridViewColumns()
{
if (OperatorInfo.DataSource != null)
{
if (OperatorInfo.Columns.Count > 0)
{
OperatorInfo.Columns[0].HeaderText = "操作员ID";
OperatorInfo.Columns[1].HeaderText = "操作员名";
gridHdl._dbgrid = OperatorInfo;
gridHdl.GenerateBaseDataGridView();
}
foreach (DataGridViewColumn column in OperatorInfo.Columns)
{
column.SortMode = DataGridViewColumnSortMode.NotSortable;
}
}
}
//初始化窗口时加载工单
private void LoadDataNew()
{
try
{
//展示工单数据表
DataTable dtResult = null;
dtResult = bToolsManageInfo.GetOperatorInfo();
if (dtResult != null)
{
OperatorInfo.DataSource = dtResult;
}
}
catch (Exception ex)
{
ex.ToString();
}
}
#endregion 操作员管理
private void dgvJobOrderInfo_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (e.RowIndex >= 0)
{
OperatorInfo.ClearSelection();
OperatorInfo.Rows[e.RowIndex].Selected = true;
if (OperatorInfo.Rows.Count > 0)
{
operator_num = OperatorInfo.Rows[e.RowIndex].Cells[1].Value.ToString().Trim();
uIPage.ShowInfoTip("已选择用户" + operator_num);
}
}
}
}
/// <summary>
/// 新增
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton3_Click(object sender, EventArgs e)
{
if (PublicParams.currUserInfo.userGroup == "Operator")
{
MessageBox.Show("权限不足");
return;
}
string strName = uiTextBox1.Text.Replace(" ", "");
if (string.IsNullOrEmpty(strName))
{
uIPage.ShowWarningTip(String.Format("新增操作员编号为空,请重新输入!"));
return;
}
else
{
bool issuccess=bToolsManageInfo.SaveToolsOperatorsInfo(strName);
if(issuccess)
{
uIPage.ShowSuccessDialog(String.Format("新增操作员" + strName + "成功!"));
}
else
{
uIPage.ShowErrorDialog("新增操作员失败");
}
}
operator_num = null;
LoadDataNew();
GenerateDataGridViewColumns();
}
/// <summary>
/// 修改
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton1_Click(object sender, EventArgs e)
{
if (PublicParams.currUserInfo.userGroup == "Operator")
{
MessageBox.Show("权限不足");
return;
}
if (!string.IsNullOrEmpty(operator_num))
{
}
else
{
uIPage.ShowInfoTip("您未选择操作员");
}
operator_num = null;
LoadDataNew();
GenerateDataGridViewColumns();
}
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton2_Click(object sender, EventArgs e)
{
if (PublicParams.currUserInfo.userGroup == "Operator")
{
MessageBox.Show("权限不足");
return;
}
if (!string.IsNullOrEmpty(operator_num))
{
bool issuccess = bToolsManageInfo.DeleteToolsOperators(operator_num);
if (issuccess)
{
uIPage.ShowSuccessDialog("删除操作员成功!");
}
else
{
uIPage.ShowErrorDialog("删除操作员失败");
}
}
else
{
uIPage.ShowInfoTip("您未选择操作员");
}
operator_num = null;
LoadDataNew();
GenerateDataGridViewColumns();
}
}
}