/// <summary> /// 获取界面上的信息 /// </summary> /// <returns></returns> private Neusoft.HISFC.Models.HealthRecord.ReadCard Getinfo() { Neusoft.HISFC.Models.HealthRecord.ReadCard info = new Neusoft.HISFC.Models.HealthRecord.ReadCard(); info.CardID = this.txCardNo.Text; info.EmployeeInfo.Name = this.comperson.Text; if (this.comperson.Tag != null) { info.EmployeeInfo.ID = this.comperson.Tag.ToString(); } if (this.comDept.Tag != null) { info.DeptInfo.ID = this.comDept.Tag.ToString(); } info.DeptInfo.Name = this.comDept.Text; info.User01 = this.card.Operator.ID; info.EmployeeInfo.OperTime = System.DateTime.Now; //ftp每天同步服务器和本地的时间,所以这样写没有关系 if (this.ckValue.Checked) { info.ValidFlag = "1"; } else { info.ValidFlag = "2"; info.CancelDate = System.DateTime.Now;//ftp每天同步服务器和本地的时间,所以这样写没有关系 info.CancelOperInfo.ID = card.Operator.ID; info.CancelOperInfo.Name = card.Operator.Name; } return(info); }
private void CardNO_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyData == Keys.Enter) { this.caseDetail.RowCount = 0; this.caseMain.RowCount = 0; if (CardNO.Text == "") { CardNO.Focus(); MessageBox.Show("请输入卡号"); return; } Cardinfo = null; Cardinfo = card.GetCardInfo(this.CardNO.Text); if (Cardinfo == null) { MessageBox.Show("查询出错"); return; } if (Cardinfo.CardID == null || Cardinfo.CardID == "") { MessageBox.Show("没有查到该卡号的相关信息"); return; } CardNO.Text = Cardinfo.CardID; comPerson.Text = Cardinfo.EmployeeInfo.Name; comPerson.Tag = Cardinfo.EmployeeInfo.ID; comType.Text = "内借"; // this.txDays.Focus(); this.comType.Focus(); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, System.EventArgs e) { if (CheckValue() == -1) { return; } Neusoft.HISFC.Models.HealthRecord.ReadCard obj = this.Getinfo(); Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction trans = new Neusoft.FrameWork.Management.Transaction(card.Connection); //trans.BeginTransaction(); card.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); int iReturn = 0; #region 保存数据 //如果是增加的 则插入 if (editType == Neusoft.HISFC.Models.HealthRecord.EnumServer.EditTypes.Add) { //插入I信息 iReturn = card.Insert(obj); if (iReturn < 0) { //回退数据 Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("保存失败 " + card.Err); } } else if (editType == Neusoft.HISFC.Models.HealthRecord.EnumServer.EditTypes.Modify) //其他的执行更新操作。 { iReturn = card.Update(obj); if (iReturn == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("更新信息失败! " + card.Err); } if (iReturn == 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("没有找到可更新的信息"); } } #endregion //提交数据 Neusoft.FrameWork.Management.PublicTrans.Commit(); MessageBox.Show("保存成功"); if (this.ckContinue.Checked && this.ckContinue.Enabled) { this.ClearInfo(); } else { this.Visible = false; } SaveHandle(obj); }
/// <summary> /// 加载数据 /// </summary> /// <param name="obj"></param> /// <returns></returns> public int SetInfo(Neusoft.HISFC.Models.HealthRecord.ReadCard obj) { this.txCardNo.Text = obj.CardID; //卡号 this.comperson.Tag = obj.EmployeeInfo.ID; //员工号 this.comperson.Text = obj.EmployeeInfo.Name; //员工姓名 this.comDept.Tag = obj.DeptInfo.ID; //科室代码 this.comDept.Text = obj.DeptInfo.Name; //科室名称 if (obj.ValidFlag == "1" || obj.ValidFlag == "有效") { this.ckValue.Checked = true; } else { this.ckValue.Checked = false; } return(1); }
/// <summary> /// /// </summary> /// <param name="obj"></param> private void frm_SaveHandle(Neusoft.HISFC.Models.HealthRecord.ReadCard obj) { if (frm.EditType == Neusoft.HISFC.Models.HealthRecord.EnumServer.EditTypes.Add) { int i = this.fpSpread1_Sheet1.Rows.Count; this.fpSpread1_Sheet1.Rows.Add(i, 1); this.fpSpread1_Sheet1.Cells[i, 0].Text = obj.CardID; //卡号 this.fpSpread1_Sheet1.Cells[i, 1].Text = obj.EmployeeInfo.ID; //员工号 this.fpSpread1_Sheet1.Cells[i, 2].Text = obj.EmployeeInfo.Name; //员工姓名 this.fpSpread1_Sheet1.Cells[i, 3].Text = obj.DeptInfo.ID; //科室代码 this.fpSpread1_Sheet1.Cells[i, 4].Text = obj.DeptInfo.Name; //科室名称 this.fpSpread1_Sheet1.Cells[i, 5].Text = obj.User01; //操作员 this.fpSpread1_Sheet1.Cells[i, 6].Text = obj.EmployeeInfo.OperTime.ToString(); //操作时间 if (obj.ValidFlag == "1") { this.fpSpread1_Sheet1.Cells[i, 7].Text = "有效";//有效 } else { this.fpSpread1_Sheet1.Cells[i, 7].Text = "无效"; //有效 } this.fpSpread1_Sheet1.Cells[i, 8].Text = obj.CancelOperInfo.Name; //作废人 this.fpSpread1_Sheet1.Cells[i, 9].Text = obj.CancelDate.ToString(); //作废时间 } else { int i = fpSpread1_Sheet1.ActiveRowIndex; this.fpSpread1_Sheet1.Cells[i, 0].Text = obj.CardID; //卡号 this.fpSpread1_Sheet1.Cells[i, 1].Text = obj.EmployeeInfo.ID; //员工号 this.fpSpread1_Sheet1.Cells[i, 2].Text = obj.EmployeeInfo.Name; //员工姓名 this.fpSpread1_Sheet1.Cells[i, 3].Text = obj.DeptInfo.ID; //科室代码 this.fpSpread1_Sheet1.Cells[i, 4].Text = obj.DeptInfo.Name; //科室名称 this.fpSpread1_Sheet1.Cells[i, 5].Text = obj.User01; //操作员 this.fpSpread1_Sheet1.Cells[i, 6].Text = obj.EmployeeInfo.OperTime.ToString(); //操作时间 if (obj.ValidFlag == "1") { this.fpSpread1_Sheet1.Cells[i, 7].Text = "有效";//有效 } else { this.fpSpread1_Sheet1.Cells[i, 7].Text = "无效"; //有效 } this.fpSpread1_Sheet1.Cells[i, 8].Text = obj.CancelOperInfo.Name; //作废人 this.fpSpread1_Sheet1.Cells[i, 9].Text = obj.CancelDate.ToString(); //作废时间 } }
private int CheckValue() { if (this.comperson.Tag == null || comperson.Tag.ToString() == "") { this.comperson.Focus(); MessageBox.Show("请选择人员"); return(-1); } if (this.comDept.Tag == null || comDept.Tag.ToString() == "") { this.comDept.Focus(); MessageBox.Show("请选择科室"); return(-1); } if (this.txCardNo.Text == "") { this.txCardNo.Focus(); MessageBox.Show("请选择输入借阅证号"); return(-1); } if (!Neusoft.FrameWork.Public.String.ValidMaxLengh(txCardNo.Text, 14)) { this.txCardNo.Focus(); MessageBox.Show("卡号输入过长"); return(-1); } if (this.editType == Neusoft.HISFC.Models.HealthRecord.EnumServer.EditTypes.Add) { Neusoft.HISFC.Models.HealthRecord.ReadCard obj1 = card.GetCardInfo(txCardNo.Text); if (obj1 == null) { this.txCardNo.Focus(); MessageBox.Show("查询出错"); return(-1); } if (obj1.CardID != "") { this.txCardNo.Focus(); MessageBox.Show("借阅证号已经存在"); return(-1); } } return(1); }
/// <summary> /// 修改 /// </summary> private void ModifyInfo() { if (this.fpSpread1_Sheet1.Rows.Count == 0) { return; } string str = this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.ActiveRowIndex, 0].Text; Neusoft.HISFC.Models.HealthRecord.ReadCard info = card.GetCardInfo(str); if (info.CardID == null || info.CardID == "") { MessageBox.Show("查询数据库失败"); return; } frm.EditType = Neusoft.HISFC.Models.HealthRecord.EnumServer.EditTypes.Modify; frm.SetInfo(info); frm.Text = "修改"; frm.Visible = true; }
/// <summary> /// 更新 /// </summary> /// <param name="info"></param> /// <returns></returns> public int Update(Neusoft.HISFC.Models.HealthRecord.ReadCard info) { try { string strSql = ""; if (this.Sql.GetSql("Case.CaseCard.Update", ref strSql) == -1) { return(-1); } string[] Str = GetInfo(info); strSql = string.Format(strSql, Str); //查询 return(this.ExecNoQuery(strSql)); } catch (Exception ex) { this.Err = ex.Message; return(-1); } }
/// <summary> /// 根据卡号获取信息 /// </summary> /// <param name="CardID"></param> /// <returns></returns> public Neusoft.HISFC.Models.HealthRecord.ReadCard GetCardInfo(string CardID) { Neusoft.HISFC.Models.HealthRecord.ReadCard info = new Neusoft.HISFC.Models.HealthRecord.ReadCard(); try { string strSql = ""; string strSql1 = GeCardSql(); if (strSql1 == null) { return(null); } if (this.Sql.GetSql("Case.CaseCard.GetCardInfo.1", ref strSql) == -1) { return(null); } strSql1 += strSql; strSql1 = string.Format(strSql1, CardID); //查询 this.ExecQuery(strSql1); while (this.Reader.Read()) { info.CardID = this.Reader[0].ToString(); //卡号 info.EmployeeInfo.ID = this.Reader[1].ToString(); //员工号 info.EmployeeInfo.Name = this.Reader[2].ToString(); //员工姓名 info.DeptInfo.ID = this.Reader[3].ToString(); //科室代码 info.DeptInfo.Name = this.Reader[4].ToString(); //科室名称 info.User01 = this.Reader[5].ToString(); //操作员 info.EmployeeInfo.OperTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[6].ToString()); //操作时间 info.ValidFlag = this.Reader[7].ToString(); //有效 info.CancelOperInfo.Name = this.Reader[8].ToString(); //作废人 info.CancelDate = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[9].ToString()); //作废时间 } this.Reader.Close(); return(info); } catch (Exception ex) { this.Err = ex.Message; return(null); } }
private string[] GetInfo(Neusoft.HISFC.Models.HealthRecord.ReadCard obj) { string[] str = new string[10]; try { str[0] = obj.CardID; //卡号 str[1] = obj.EmployeeInfo.ID; //员工号 str[2] = obj.EmployeeInfo.Name; //员工姓名 str[3] = obj.DeptInfo.ID; //科室代码 str[4] = obj.DeptInfo.Name; //科室名称 str[5] = obj.User01; //操作员 str[6] = obj.EmployeeInfo.OperTime.ToString(); //操作时间 str[7] = obj.ValidFlag; //有效 str[8] = obj.CancelOperInfo.Name; //作废人 str[9] = obj.CancelDate.ToString(); //作废时间 } catch (Exception ex) { this.Err = ex.Message; return(null); } return(str); }