356 lines
15 KiB
C#
356 lines
15 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 SOH.BLL;
|
|
using EAS.Services;
|
|
using SOH.Kernel;
|
|
using SOH.Entities;
|
|
using SOH.Common;
|
|
using SOH.Data;
|
|
|
|
namespace SOH.BasicSettings
|
|
{
|
|
[ModuleAttribute(ModuleID = "15DBB786-5001-45F7-ACB0-F7E4B8924EEA", ModuleName = "用户基本信息")]
|
|
public partial class frmYongHuJiBenXinXi : SOH.Window.baseChildForm
|
|
{
|
|
private string pathName = "";
|
|
private string pathName1 = "";
|
|
private bool imageBool = false;
|
|
public frmYongHuJiBenXinXi()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmYongHuJiBenXinXi_Load(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetList("");
|
|
//科室绑定
|
|
var vserviceks = ServiceContainer.GetService<It_ks>();
|
|
cbbks.DataSource = vserviceks.GetAllks("", -1, 0);
|
|
//分店绑定
|
|
var vservicefd = ServiceContainer.GetService<IFenDian>();
|
|
cbbfd.DataSource = vservicefd.getAllFenDian();
|
|
|
|
}
|
|
|
|
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
this.tbmc.Text = this.dataGridView1.Rows[e.RowIndex].Cells["xm"].Value.ToString();
|
|
this.tbyhbm.Text = this.dataGridView1.Rows[e.RowIndex].Cells["bm"].Value.ToString();
|
|
this.cbbfd.SelectedValue = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells["yydm"].Value);
|
|
this.cbbks.SelectedValue = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells["ssks"].Value);
|
|
this.cbbsex.SelectedIndex = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells["xb"].Value);
|
|
|
|
var czyglbll = ServiceContainer.GetService<It_czygl>();
|
|
List<t_czygl> al = czyglbll.GetczyglBybm(Convert.ToInt16(this.tbyhbm.Text));
|
|
if (al.Count > 0)
|
|
{
|
|
this.tbusername.Enabled = false;
|
|
t_czygl glmodel = al[0];
|
|
this.tbusername.Text = glmodel.czym;
|
|
this.tbuserpass.Text = glmodel.czymm;
|
|
if(glmodel.image!=null)
|
|
{
|
|
System.IO.MemoryStream ms = new System.IO.MemoryStream(glmodel.image);
|
|
pictureBox1.Image = Image.FromStream(ms);
|
|
imageBool = true;
|
|
}
|
|
else
|
|
{
|
|
pictureBox1.Image = null ;
|
|
imageBool = false;
|
|
}
|
|
|
|
if (glmodel.image1 != null)
|
|
{
|
|
System.IO.MemoryStream ms1 = new System.IO.MemoryStream(glmodel.image1);
|
|
pictureBox2.Image = Image.FromStream(ms1);
|
|
}
|
|
else
|
|
{
|
|
pictureBox2.Image = null;
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
this.tbusername.Enabled = true;
|
|
this.tbusername.Text = "";
|
|
this.tbuserpass.Text = "";
|
|
}
|
|
}
|
|
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetList(this.textBox1.Text);
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
if (tbyhbm.Text == "")
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
t_ygzd ygzdmodel = new t_ygzd();
|
|
ygzdmodel.zhuxiao = 0;
|
|
ygzdmodel.xb = Convert.ToInt16(cbbsex.SelectedIndex);
|
|
ygzdmodel.xm = tbmc.Text;
|
|
ygzdmodel.yydm = Convert.ToInt16(cbbfd.SelectedValue);
|
|
ygzdmodel.zjm = StrToPinyin.GetChineseFirstSpell(ygzdmodel.xm);
|
|
ygzdmodel.bm = Convert.ToInt16(ServiceContainer.GetService<IBasic>().GetMax(ygzdmodel.DbTableName, 1));
|
|
ygzdmodel.ssks = Convert.ToInt16(cbbks.SelectedValue);
|
|
|
|
var vservice2 = ServiceContainer.GetService<It_czygl>();
|
|
if (tbusername.Text != "" && tbuserpass.Text != "")
|
|
{
|
|
|
|
t_czygl g = new t_czygl();
|
|
g.ygbm = ygzdmodel.bm;
|
|
g.czym = this.tbusername.Text;
|
|
g.czymm = this.tbuserpass.Text;
|
|
g.jbbm = 0;//默认为0 目前不知道有什么用
|
|
g.zhuxiao = 0;
|
|
g.zt = 1;
|
|
if (pathName == "")
|
|
{
|
|
if (MessageBox.Show("没有选择电子签名,是否现在上传?!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
if (pathName != "")
|
|
{
|
|
//将图像读入到字节数组
|
|
System.IO.FileStream fs = new System.IO.FileStream(pathName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
|
byte[] buffByte = new byte[fs.Length];
|
|
fs.Read(buffByte, 0, (int)fs.Length);
|
|
fs.Close();
|
|
fs = null;
|
|
g.image = buffByte;
|
|
}
|
|
|
|
if (pathName1 != "")
|
|
{
|
|
//将图像读入到字节数组
|
|
System.IO.FileStream fs = new System.IO.FileStream(pathName1, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
|
byte[] buffByte = new byte[fs.Length];
|
|
fs.Read(buffByte, 0, (int)fs.Length);
|
|
fs.Close();
|
|
fs = null;
|
|
g.image1 = buffByte;
|
|
}
|
|
OperationResult or2 = vservice2.Insert(g);
|
|
|
|
if(or2.State==1)
|
|
{
|
|
vservice.Insert(ygzdmodel);
|
|
}
|
|
|
|
MessageBox.Show(or2.Message);
|
|
}
|
|
|
|
var vservice1 = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetList("");
|
|
pathName = "";
|
|
}
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
t_ygzd ygzdmodel = new t_ygzd();
|
|
ygzdmodel.zhuxiao = 0;
|
|
ygzdmodel.xb = Convert.ToInt16(cbbsex.SelectedIndex);
|
|
ygzdmodel.xm = tbmc.Text;
|
|
ygzdmodel.yydm = Convert.ToInt16(cbbfd.SelectedValue);
|
|
ygzdmodel.zjm = StrToPinyin.GetChineseFirstSpell(ygzdmodel.xm);
|
|
ygzdmodel.bm = Convert.ToInt16(tbyhbm.Text);
|
|
ygzdmodel.ssks = Convert.ToInt16(cbbks.SelectedValue);
|
|
OperationResult or = vservice.Update(ygzdmodel);
|
|
//OperationResult or1;
|
|
var vservice2 = ServiceContainer.GetService<It_czygl>();
|
|
string zcxx = "";
|
|
if (tbusername.Enabled == false)
|
|
{
|
|
if (tbusername.Text == "" || tbuserpass.Text == "")
|
|
{
|
|
MessageBox.Show("登陆账号和密码不能为空!");
|
|
return;
|
|
}
|
|
if (pathName == "")
|
|
{
|
|
if (!imageBool)
|
|
{
|
|
if (MessageBox.Show("没有选择【电子签名】,是否现在上传?!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if (pathName != "")
|
|
{
|
|
//将图像读入到字节数组
|
|
System.IO.FileStream fs = new System.IO.FileStream(pathName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
|
byte[] buffByte = new byte[fs.Length];
|
|
fs.Read(buffByte, 0, (int)fs.Length);
|
|
fs.Close();
|
|
fs = null;
|
|
//g.image = buffByte;
|
|
zcxx = (vservice2.SuperUpdatePass2(ygzdmodel.bm, this.tbuserpass.Text, this.tbusername.Text, buffByte).State == 2) ? "软件登陆密码修改成功!" : "软件密码修改失败!请联系管理员。";
|
|
}else
|
|
{
|
|
zcxx = (vservice2.SuperUpdatePass(ygzdmodel.bm, this.tbuserpass.Text, this.tbusername.Text).State == 2) ? "软件登陆密码修改成功!" : "软件密码修改失败!请联系管理员。";
|
|
}
|
|
|
|
if (pathName1 != "")
|
|
{
|
|
//将图像读入到字节数组
|
|
System.IO.FileStream fs = new System.IO.FileStream(pathName1, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
|
byte[] buffByte = new byte[fs.Length];
|
|
fs.Read(buffByte, 0, (int)fs.Length);
|
|
fs.Close();
|
|
fs = null;
|
|
vservice2.SuperUpdateImage1(ygzdmodel.bm, this.tbuserpass.Text, this.tbusername.Text, buffByte);
|
|
}
|
|
//说明有账号 只能修改密码
|
|
}
|
|
else
|
|
{
|
|
if (tbusername.Text == "" || tbuserpass.Text == "")
|
|
{
|
|
MessageBox.Show("登陆账号和密码不能为空!");
|
|
return;
|
|
}
|
|
t_czygl g = new t_czygl();
|
|
g.ygbm = ygzdmodel.bm;
|
|
g.czym = this.tbusername.Text;
|
|
g.czymm = this.tbuserpass.Text;
|
|
g.jbbm = 0;//默认为0 目前不知道有什么用
|
|
g.zhuxiao = 0;
|
|
g.zt = 1;
|
|
if (pathName == "")
|
|
{
|
|
if (MessageBox.Show("没有选择电子签名,是否现在上传?!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
if (pathName != "")
|
|
{
|
|
//将图像读入到字节数组
|
|
System.IO.FileStream fs = new System.IO.FileStream(pathName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
|
byte[] buffByte = new byte[fs.Length];
|
|
fs.Read(buffByte, 0, (int)fs.Length);
|
|
fs.Close();
|
|
fs = null;
|
|
g.image = buffByte;
|
|
}
|
|
|
|
if (pathName1 != "")
|
|
{
|
|
//将图像读入到字节数组
|
|
System.IO.FileStream fs = new System.IO.FileStream(pathName1, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
|
byte[] buffByte = new byte[fs.Length];
|
|
fs.Read(buffByte, 0, (int)fs.Length);
|
|
fs.Close();
|
|
fs = null;
|
|
g.image1 = buffByte;
|
|
}
|
|
zcxx = (vservice2.Insert(g).State == 2) ? "软件用户名占用!" : "软件用户注册成功!";
|
|
this.tbusername.Enabled = false;
|
|
//没账号, 直接添加一条数据可供登陆使用
|
|
}
|
|
MessageBox.Show(or.Message + zcxx);
|
|
var vservice1 = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetList("");
|
|
pathName = "";
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
t_ygzd ygzdmodel = new t_ygzd();
|
|
ygzdmodel.zhuxiao = 1;
|
|
ygzdmodel.xb = Convert.ToInt16(cbbsex.SelectedIndex);
|
|
ygzdmodel.xm = tbmc.Text;
|
|
ygzdmodel.yydm = Convert.ToInt16(cbbfd.SelectedValue);
|
|
ygzdmodel.zjm = StrToPinyin.GetChineseFirstSpell(ygzdmodel.xm);
|
|
ygzdmodel.bm = Convert.ToInt16(tbyhbm.Text);
|
|
ygzdmodel.ssks = Convert.ToInt16(cbbks.SelectedValue);
|
|
OperationResult or = vservice.Update(ygzdmodel);
|
|
MessageBox.Show(or.Message);
|
|
var vservice1 = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetList("");
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
tbyhbm.Text = "";
|
|
tbmc.Text = "";
|
|
this.tbusername.Text = "";
|
|
this.tbusername.Enabled = true;
|
|
this.tbuserpass.Text = "";
|
|
pathName = "";
|
|
}
|
|
|
|
private void radioButton2_Click(object sender, EventArgs e)
|
|
{
|
|
radioButton1.Checked = false;
|
|
radioButton2.Checked = true;
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetListByZX("");
|
|
}
|
|
|
|
private void radioButton1_Click(object sender, EventArgs e)
|
|
{
|
|
radioButton2.Checked = false;
|
|
radioButton1.Checked = true;
|
|
var vservice = ServiceContainer.GetService<It_ygzd>();
|
|
this.tygzdBindingSource.DataSource = vservice.GetList("");
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
openFileDialog1.Title = "请选择上传的图片";
|
|
//设置筛选的图片格式
|
|
openFileDialog1.Filter = "图片格式|*.PNG";
|
|
//设置是否允许多选
|
|
openFileDialog1.Multiselect = false;
|
|
if (this.openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
pathName = this.openFileDialog1.FileName;
|
|
System.Drawing.Image img = System.Drawing.Image.FromFile(pathName);
|
|
this.pictureBox1.Image = img;
|
|
}
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
openFileDialog1.Title = "请选择上传的图片";
|
|
//设置筛选的图片格式
|
|
openFileDialog1.Filter = "图片格式|*.PNG";
|
|
//设置是否允许多选
|
|
openFileDialog1.Multiselect = false;
|
|
if (this.openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
pathName1 = this.openFileDialog1.FileName;
|
|
System.Drawing.Image img = System.Drawing.Image.FromFile(pathName1);
|
|
this.pictureBox2.Image = img;
|
|
}
|
|
}
|
|
}
|
|
}
|