397 lines
14 KiB
C#
397 lines
14 KiB
C#
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;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SOH.Entities;
|
|
using SOH;
|
|
using SOH.Common;
|
|
using SOH.Data;
|
|
using SOH.BasicSettings;
|
|
|
|
namespace SOH.BasicSettings
|
|
{
|
|
public partial class frmNewMoBan : Form
|
|
{
|
|
public int xmbm;
|
|
frmSetTiJianXiangMu fstjxm;
|
|
public DataTable Dt;
|
|
|
|
public frmNewMoBan()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public frmNewMoBan(int jcxmbm, frmSetTiJianXiangMu fstjxm)
|
|
{
|
|
InitializeComponent();
|
|
xmbm = jcxmbm;
|
|
this.fstjxm = fstjxm;
|
|
}
|
|
|
|
private void frmNewMoBan_Load(object sender, EventArgs e)
|
|
{
|
|
if (LoginUser.yydm == "2")
|
|
{
|
|
//if (LoginUser.xm != "系统管理员" && LoginUser.username != "trwdc")
|
|
//{
|
|
// button2.Visible = false;
|
|
// button3.Visible = false;
|
|
// button5.Visible = false;
|
|
// button6.Visible = false;
|
|
// button11.Visible = false;
|
|
// button9.Visible = false;
|
|
//}
|
|
}
|
|
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
adviceBindingSource.DataSource = vservice.GetAdviceByItemindexId(xmbm);
|
|
|
|
familiarDiagnoseBindingSource.DataSource = vservice.GetFamiliarDiagnoseByItemindexId(xmbm);
|
|
|
|
itemIndexResultTempletBindingSource.DataSource = vservice.GeitemIndexResultTempletByItemindexId(xmbm);
|
|
}
|
|
|
|
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex == -1)
|
|
{
|
|
return;
|
|
}
|
|
this.tb_jymc.Text = dataGridView1.Rows[e.RowIndex].Cells["建议名称"].Value.ToString();
|
|
|
|
this.tb_jynr.Text = dataGridView1.Rows[e.RowIndex].Cells["建议内容"].Value.ToString();
|
|
|
|
this.tb_jyID.Text = dataGridView1.Rows[e.RowIndex].Cells["id"].Value.ToString();
|
|
|
|
}
|
|
|
|
int ztz = 0;
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
ztz = 1;
|
|
this.tb_jymc.Text = "";
|
|
this.tb_jynr.Text = "";
|
|
}
|
|
|
|
private void button10_Click(object sender, EventArgs e)
|
|
{
|
|
Advice advice = new Advice();
|
|
advice.ID = ServiceContainer.GetService<IBasic>().GetMax(advice.DbTableName, 1);
|
|
advice.Name = this.tb_jymc.Text;
|
|
advice.Description = this.tb_jynr.Text;
|
|
advice.PY = SOH.Common.ChnToPinYin.HeadFirst(this.tb_jymc.Text);
|
|
advice.RecordDate = DateTime.Now;
|
|
|
|
if (ztz == 1 && CommitJY(advice))
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.InsertAdvice(advice);
|
|
MessageBox.Show(or.Message);
|
|
textBox1_TextChanged(sender, e);
|
|
//frmNewMoBan_Load(sender, e);
|
|
ztz = 0;
|
|
}
|
|
}
|
|
|
|
private bool CommitJY(Advice advice)
|
|
{
|
|
if (advice.Name == "")
|
|
{
|
|
MessageBox.Show("建议名称不能为空!");
|
|
return false;
|
|
}
|
|
if (advice.Description == "")
|
|
{
|
|
MessageBox.Show("建议内容不能为空!");
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
}
|
|
|
|
private bool CommitMS(ItemIndexResultTemplet iirt)
|
|
{
|
|
if (iirt.Description == "")
|
|
{
|
|
MessageBox.Show("描述内容不能为空!");
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
}
|
|
|
|
private bool CommitZD(FamiliarDiagnose fd)
|
|
{
|
|
if (fd.Name == "")
|
|
{
|
|
MessageBox.Show("诊断名称不能为空!");
|
|
return false;
|
|
}
|
|
if (fd.Content == "")
|
|
{
|
|
MessageBox.Show("诊断内容不能为空!");
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
}
|
|
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
dataGridView1.DataSource = vservice.GetAdviceList(this.tb_jyPY.Text);
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
Advice advice = new Advice();
|
|
advice.ID = Convert.ToInt64(this.tb_jyID.Text);
|
|
advice.Name = this.tb_jymc.Text;
|
|
advice.Description = this.tb_jynr.Text;
|
|
advice.PY = SOH.Common.ChnToPinYin.HeadFirst(this.tb_jymc.Text);
|
|
advice.RecordDate = DateTime.Now;
|
|
|
|
if (CommitJY(advice))
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.UpdateAdvice(advice);
|
|
MessageBox.Show(or.Message);
|
|
textBox1_TextChanged(sender, e);
|
|
//frmNewMoBan_Load(sender, e);
|
|
}
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
Advice advice = new Advice();
|
|
advice.ID = Convert.ToInt64(this.tb_jyID.Text);
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.DelAdvice(advice);
|
|
MessageBox.Show(or.Message);
|
|
textBox1_TextChanged(sender, e);
|
|
//frmNewMoBan_Load(sender, e);
|
|
}
|
|
|
|
int zdztz = 0;
|
|
private void button7_Click(object sender, EventArgs e)
|
|
{
|
|
zdztz = 1;
|
|
this.tb_zdmc.Text = "";
|
|
this.tb_zdnr.Text = "";
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
FamiliarDiagnose fd = new FamiliarDiagnose();
|
|
fd.ID = ServiceContainer.GetService<IBasic>().GetMax(fd.DbTableName, 1);
|
|
fd.Name = this.tb_zdmc.Text;
|
|
fd.Content = this.tb_zdnr.Text;
|
|
fd.PY = SOH.Common.ChnToPinYin.HeadFirst(this.tb_zdmc.Text);
|
|
fd.RecordDate = DateTime.Now;
|
|
|
|
if (zdztz == 1 && CommitZD(fd))
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.InsertFd(fd);
|
|
MessageBox.Show(or.Message);
|
|
tb_zdPY_TextChanged(sender, e);
|
|
zdztz = 0;
|
|
}
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
FamiliarDiagnose fd = new FamiliarDiagnose();
|
|
fd.ID = Convert.ToInt64(this.tb_zdID.Text);
|
|
fd.Name = this.tb_zdmc.Text;
|
|
fd.Content = this.tb_zdnr.Text;
|
|
fd.PY = SOH.Common.ChnToPinYin.HeadFirst(this.tb_zdmc.Text);
|
|
fd.RecordDate = DateTime.Now;
|
|
|
|
if (CommitZD(fd))
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.UpdateFd(fd);
|
|
MessageBox.Show(or.Message);
|
|
tb_zdPY_TextChanged(sender, e);
|
|
}
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
FamiliarDiagnose fd = new FamiliarDiagnose();
|
|
fd.ID = Convert.ToInt64(this.tb_zdID.Text);
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.DelFd(fd);
|
|
MessageBox.Show(or.Message);
|
|
tb_zdPY_TextChanged(sender, e);
|
|
}
|
|
|
|
private void tb_zdPY_TextChanged(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
dataGridView2.DataSource = vservice.GetFamiliarDiagnoseList(this.tb_zdPY.Text);
|
|
}
|
|
|
|
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
|
|
if (e.RowIndex == -1)
|
|
{
|
|
return;
|
|
}
|
|
this.tb_zdmc.Text = dataGridView2.Rows[e.RowIndex].Cells["zdmc"].Value.ToString();
|
|
|
|
this.tb_zdnr.Text = dataGridView2.Rows[e.RowIndex].Cells["zdnr"].Value.ToString();
|
|
|
|
this.tb_zdID.Text = dataGridView2.Rows[e.RowIndex].Cells["zdid"].Value.ToString();
|
|
}
|
|
|
|
private void tb_msPY_TextChanged(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
dataGridView3.DataSource = vservice.GetItemIndexResultTempletList(this.tb_msPY.Text);
|
|
}
|
|
|
|
private void shuaxin3()
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
dataGridView3.DataSource = vservice.GeitemIndexResultTempletByItemindexId(xmbm);
|
|
}
|
|
|
|
|
|
int msztz=0;
|
|
private void button12_Click(object sender, EventArgs e)
|
|
{
|
|
msztz = 1;
|
|
this.tb_msjy.Text = "";
|
|
this.tb_mszd.Text = "";
|
|
this.tb_msnr.Text = "";
|
|
}
|
|
private void button8_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
ItemIndexResultTemplet iirt = new ItemIndexResultTemplet();
|
|
iirt.ID = ServiceContainer.GetService<IBasic>().GetMax(iirt.DbTableName, 1);
|
|
iirt.ItemIndexID = xmbm;
|
|
iirt.AdviceID = Convert.ToInt32(this.tb_msjyID.Text);
|
|
iirt.Description = this.tb_msnr.Text;
|
|
iirt.ShowIndex = Convert.ToInt32(this.txbShowIndex.Text);
|
|
iirt.FamiliarDiagnoseID = Convert.ToInt32(this.tb_mszdID.Text);
|
|
iirt.DescriptionPY = SOH.Common.ChnToPinYin.HeadFirst(this.tb_msnr.Text);
|
|
iirt.RecordDate = DateTime.Now;
|
|
|
|
if (msztz == 1 && CommitMS(iirt))
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.InsertItemIndexResultTemplet(iirt);
|
|
MessageBox.Show(or.Message);
|
|
//tb_msPY_TextChanged(sender, e);
|
|
shuaxin3();
|
|
msztz = 0;
|
|
}
|
|
}
|
|
|
|
private void button13_Click(object sender, EventArgs e)
|
|
{
|
|
frmJianYiMoBan fjymb = new frmJianYiMoBan(this);
|
|
fjymb.ShowDialog();
|
|
}
|
|
|
|
public void getZd(FamiliarDiagnose fd)
|
|
{
|
|
this.tb_mszd.Text = fd.Name;
|
|
this.tb_mszdID.Text = fd.ID.ToString();
|
|
}
|
|
|
|
public void getJY(Advice ad)
|
|
{
|
|
this.tb_msjy.Text = ad.Name;
|
|
this.tb_msjyID.Text = ad.ID.ToString();
|
|
}
|
|
|
|
private void button14_Click(object sender, EventArgs e)
|
|
{
|
|
frmXianMuMiaoShuWeiHu fxmmswh = new frmXianMuMiaoShuWeiHu(this);
|
|
fxmmswh.ShowDialog();
|
|
}
|
|
|
|
private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex == -1)
|
|
{
|
|
return;
|
|
}
|
|
this.tb_mszdID.Text = dataGridView3.Rows[e.RowIndex].Cells["zhenduanId"].Value.ToString();
|
|
|
|
this.tb_msjyID.Text = dataGridView3.Rows[e.RowIndex].Cells["jianyiId"].Value.ToString();
|
|
|
|
this.tb_msID.Text = dataGridView3.Rows[e.RowIndex].Cells["miaoshuId"].Value.ToString();
|
|
|
|
this.tb_msnr.Text = dataGridView3.Rows[e.RowIndex].Cells["msnr"].Value.ToString();
|
|
|
|
this.txbShowIndex.Text = dataGridView3.Rows[e.RowIndex].Cells["ShowIndex"].Value.ToString();
|
|
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
if (this.tb_mszdID.Text != "" && this.tb_mszdID.Text != "0")
|
|
{
|
|
FamiliarDiagnose fd = vservice.GetFDById(Convert.ToInt32(this.tb_mszdID.Text));
|
|
this.tb_mszd.Text = fd.Name;
|
|
}
|
|
else
|
|
{
|
|
this.tb_mszd.Text = "";
|
|
}
|
|
if (this.tb_msjyID.Text != "" && this.tb_msjyID.Text != "0")
|
|
{
|
|
Advice ad = vservice.GetADById(Convert.ToInt32(this.tb_msjyID.Text));
|
|
this.tb_msjy.Text = ad.Name;
|
|
}
|
|
else
|
|
{
|
|
this.tb_msjy.Text = "";
|
|
}
|
|
|
|
}
|
|
|
|
private void button11_Click(object sender, EventArgs e)
|
|
{
|
|
ItemIndexResultTemplet iirt = new ItemIndexResultTemplet();
|
|
iirt.ID = Convert.ToInt64(this.tb_msID.Text);
|
|
iirt.ItemIndexID = xmbm;
|
|
iirt.AdviceID = Convert.ToInt32(this.tb_msjyID.Text);
|
|
iirt.Description = this.tb_msnr.Text;
|
|
iirt.ShowIndex = Convert.ToInt32(this.txbShowIndex.Text);
|
|
iirt.FamiliarDiagnoseID = Convert.ToInt32(this.tb_mszdID.Text);
|
|
iirt.DescriptionPY = SOH.Common.ChnToPinYin.HeadFirst(this.tb_msnr.Text);
|
|
iirt.RecordDate = DateTime.Now;
|
|
|
|
if (CommitMS(iirt))
|
|
{
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.UpdateIirt(iirt);
|
|
MessageBox.Show(or.Message);
|
|
//tb_msPY_TextChanged(sender, e);
|
|
shuaxin3();
|
|
}
|
|
}
|
|
|
|
private void button9_Click(object sender, EventArgs e)
|
|
{
|
|
ItemIndexResultTemplet iirt = new ItemIndexResultTemplet();
|
|
iirt.ID = Convert.ToInt64(this.tb_msID.Text);
|
|
var vservice = ServiceContainer.GetService<IZongJian>();
|
|
OperationResult or = vservice.DelIirt(iirt);
|
|
MessageBox.Show(or.Message);
|
|
//tb_msPY_TextChanged(sender, e);
|
|
shuaxin3();
|
|
}
|
|
}
|
|
}
|