171 lines
5.9 KiB
C#
171 lines
5.9 KiB
C#
using AIMSBLL;
|
|
using AIMSModel;
|
|
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 AIMS.PublicUI.UI
|
|
{
|
|
public partial class frmSelectOperationOne : Form
|
|
{
|
|
private int currentPage = 0;
|
|
private int total = 0;
|
|
private int pages = 0;
|
|
private DataTable SelectLeftdt;
|
|
public List<int> SelectRightData = new List<int>();
|
|
public frmSelectOperationOne()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmSelectOperationOne_Load(object sender, EventArgs e)
|
|
{
|
|
if (AIMSExtension.PublicMethod.RoleName.Contains("增加手术"))
|
|
{
|
|
btnAddOperation.Visible = true;
|
|
}
|
|
ControlExtension.SetDgvAttribute(dgvOperation);
|
|
//ControlExtension.SetDgvAttribute(dgvSelectOperation);
|
|
|
|
SelectLeftdt = BOperation.GetDataTable("");
|
|
|
|
this.currentPage = 0;
|
|
this.total = SelectLeftdt.Rows.Count;
|
|
if (this.total % 22 == 0)
|
|
{
|
|
this.pages = this.total / 22;
|
|
}
|
|
else
|
|
{
|
|
this.pages = this.total / 22 + 1;
|
|
}
|
|
this.labPage.Text = this.currentPage + 1 + "/" + this.pages;
|
|
this.dgvOperation.DataSource = this.GetTableByCurrentPage(this.currentPage, SelectLeftdt);
|
|
|
|
//if (SelectRightData.Count > 0)
|
|
//{
|
|
// foreach (int RowId in SelectRightData)
|
|
// {
|
|
// Operation OperationObj = BOperation.GetModel(RowId);
|
|
// dgvSelectOperation.Rows.Add(OperationObj.Id, OperationObj.IcdCode, OperationObj.Name);
|
|
|
|
// }
|
|
//}
|
|
txtHelpCode.Focus();
|
|
}
|
|
private DataTable GetTableByCurrentPage(int currPage, DataTable dt)
|
|
{
|
|
DataTable dataTable = dt.Clone();
|
|
int num = currPage * 22;
|
|
for (int i = num; i < num + 22 && i != this.total; i++)
|
|
{
|
|
DataRow dataRow = dataTable.NewRow();
|
|
dataRow["Id"] = Convert.ToInt32(dt.Rows[i]["Id"]);
|
|
dataRow["IcdCode"] = dt.Rows[i]["IcdCode"].ToString();
|
|
dataRow["Name"] = dt.Rows[i]["Name"].ToString();
|
|
//dataRow["level"] = dt.Rows[i]["level"].ToString();
|
|
dataTable.Rows.Add(dataRow);
|
|
}
|
|
return dataTable;
|
|
}
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
if (dgvOperation.SelectedRows.Count > 0)
|
|
{
|
|
SelectRightData.Clear();
|
|
SelectRightData.Add(int.Parse(dgvOperation.SelectedRows[0].Cells["Id"].Value.ToString()));
|
|
|
|
}
|
|
else
|
|
{
|
|
SelectRightData.Clear();
|
|
}
|
|
Close();
|
|
}
|
|
|
|
|
|
private void txtHelpCode_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.dgvOperation.AutoGenerateColumns = false;
|
|
this.SelectLeftdt = BOperation.GetDataTable(txtHelpCode.Text.Trim());
|
|
|
|
this.dgvOperation.DataSource = this.SelectLeftdt;
|
|
this.currentPage = 0;
|
|
this.total = this.SelectLeftdt.Rows.Count;
|
|
if (this.total % 22 == 0)
|
|
{
|
|
this.pages = this.total / 22;
|
|
}
|
|
else
|
|
{
|
|
this.pages = this.total / 22 + 1;
|
|
}
|
|
this.labPage.Text = this.currentPage + 1 + "/" + this.pages;
|
|
this.dgvOperation.DataSource = this.GetTableByCurrentPage(this.currentPage, this.SelectLeftdt);
|
|
}
|
|
|
|
private void dgvOperation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dgvOperation.Rows.Count > 0)
|
|
{
|
|
SelectRightData.Clear();
|
|
SelectRightData.Add(int.Parse(dgvOperation.CurrentRow.Cells["Id"].Value.ToString()));
|
|
Close();
|
|
}
|
|
}
|
|
|
|
private void labUp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
if (this.total != 0 && this.currentPage != 0)
|
|
{
|
|
this.currentPage--;
|
|
this.dgvOperation.DataSource = this.GetTableByCurrentPage(this.currentPage, SelectLeftdt);
|
|
this.labPage.Text = this.currentPage + 1 + "/" + this.pages;
|
|
}
|
|
}
|
|
|
|
private void labDown_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
if (this.total != 0 && this.currentPage + 1 != this.pages)
|
|
{
|
|
this.currentPage++;
|
|
this.dgvOperation.DataSource = this.GetTableByCurrentPage(this.currentPage, this.SelectLeftdt);
|
|
this.labPage.Text = this.currentPage + 1 + "/" + this.pages;
|
|
}
|
|
}
|
|
private void btnAddOperation_Click(object sender, EventArgs e)
|
|
{
|
|
Operation OperationObj = new Operation();
|
|
OperationObj.Name = txtHelpCode.Text.Trim();
|
|
OperationObj.IcdCode = "";
|
|
OperationObj.HelpCode = AIMSExtension.PublicMethod.GetFirstLetter(OperationObj.Name);
|
|
OperationObj.IsValid = 1;
|
|
OperationObj.UseRate = 1;
|
|
OperationObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
|
|
OperationObj.OperatorName = AIMSExtension.PublicMethod.OperatorName;
|
|
OperationObj.OperateDate = AIMSExtension.PublicMethod.SystemDate();
|
|
if (OperationObj.Name == "")
|
|
{
|
|
MessageBox.Show("名称不能为空!");
|
|
return;
|
|
}
|
|
if (BOperation.IsExit(OperationObj.Name))
|
|
{
|
|
MessageBox.Show("该事件已存在");
|
|
return;
|
|
}
|
|
BOperation.Add(OperationObj);
|
|
|
|
txtHelpCode_TextChanged(null, null);
|
|
|
|
}
|
|
|
|
}
|
|
}
|