/// <summary> /// 删除别名信息 /// </summary> /// <param name="p_objVO"></param> /// <returns></returns> public long m_lngDeleteMultiUnit(clsMultiunit_drug_VO p_objVO) { com.digitalwave.iCare.middletier.HIS.clsMedicineLimitSVC m_objService = (com.digitalwave.iCare.middletier.HIS.clsMedicineLimitSVC)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType (typeof(com.digitalwave.iCare.middletier.HIS.clsMedicineLimitSVC)); return(m_objService.m_lngDeleteMultiUnit(p_objVO)); }
/// <summary> /// 增加单位 /// </summary> /// <returns></returns> public bool m_blnAddMultiUnit() { //实例化VO并住其字段中赋值 clsMultiunit_drug_VO objVO = m_objGetVOFromText(); string strSeledMedId = this.m_objViewer.dtgMedicineList.SelectedRows[0].Cells["ColumnMedicineId"].Value.ToString(); if (this.m_objDomain.m_blnQueryByIndex(strSeledMedId, objVO.m_strUnit, objVO.m_intPackage, objVO.m_intCurruseFlag_Int)) { MessageBox.Show("当前药品单位中已存在此单位!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); m_objViewer.txtUnitName.Focus(); m_objViewer.txtUnitName.SelectAll(); return(false); } //往数据库中增加别名 long lngRes = this.m_objDomain.m_lngAddMultiUnit(objVO); //如果往数据库中增加别名成功 if (lngRes > 0) { //往视图中增加所添加的数据 this.m_mthLoadDvMultiUnit(); this.m_mthDgvMultiUnitDataBind(); this.m_objViewer.dtgMultiUnitList.Rows[this.m_objViewer.dtgMultiUnitList.Rows.Count - 1].Selected = true; m_mthTxtLoadData(); return(true); } else { return(false); } }
/// <summary> /// 删除单位 /// </summary> /// <returns></returns> public bool m_blnDeleteMultiUnit() { if (this.m_objViewer.dtgMultiUnitList.Rows.Count <= 0) { return(false); } //实例化VO并住其字段中赋值 clsMultiunit_drug_VO objVO = m_objGetVOFromText(); //从数据库中删除单位 long lngRes = this.m_objDomain.m_lngDeleteMultiUnit(objVO); //如果从数据库中删除别名成功 if (lngRes > 0) { MessageBox.Show("单位删除成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } else { MessageBox.Show("单位删除失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } }
/// <summary> /// 更新单位信息 /// </summary> /// <param name="p_objVO"></param> /// <param name="p_strMedicineId"></param> /// <param name="p_strUnitName"></param> /// <param name="p_intPackAge"></param> /// <param name="p_intCurruseFlag"></param> /// <returns></returns> public long m_lngUpdateMultiUnit(clsMultiunit_drug_VO p_objVO, string p_strMedicineId, string p_strUnitName, int p_intPackAge, int p_intCurruseFlag, int intStatus) { com.digitalwave.iCare.middletier.HIS.clsMedicineLimitSVC m_objService = (com.digitalwave.iCare.middletier.HIS.clsMedicineLimitSVC)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType (typeof(com.digitalwave.iCare.middletier.HIS.clsMedicineLimitSVC)); return(m_objService.m_lngUpdateMultiUnit(p_objVO, p_strMedicineId, p_strUnitName, p_intPackAge, p_intCurruseFlag, intStatus)); }
public long m_lngAddMultiUnit(clsMultiunit_drug_VO p_objVO) { string strSQL = @"insert into t_bse_itemmultiunit_drug a (a.itemid_chr, a.unit_vchr, a.package_dec, a.curruseflag_int, status_int ) values (?, ?, ?, ?, ? ) "; long lngRes = -1; long recordAffect = 0; try { clsHRPTableService objHRPSvc = new clsHRPTableService(); IDataParameter[] ParamArr = null; objHRPSvc.CreateDatabaseParameter(5, out ParamArr); ParamArr[0].Value = p_objVO.m_strItemId.Trim(); ParamArr[1].Value = p_objVO.m_strUnit.Trim(); ParamArr[2].DbType = DbType.Int16; ParamArr[2].Value = p_objVO.m_intPackage; ParamArr[3].DbType = DbType.Int16; ParamArr[3].Value = p_objVO.m_intCurruseFlag_Int; ParamArr[4].Value = p_objVO.m_intStauts; lngRes = objHRPSvc.lngExecuteParameterSQL(strSQL, ref recordAffect, ParamArr); objHRPSvc.Dispose(); } catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngDeleteMultiUnit(clsMultiunit_drug_VO p_objVO) { string strSQL = @"delete from t_bse_itemmultiunit_drug a where a.itemid_chr = ? and a.unit_vchr= ? and a.package_dec= ?"; long lngRes = -1; long lngAffter = -1; //DataTable dtbValue = new DataTable(); try { clsHRPTableService objHRPSvc = new clsHRPTableService(); IDataParameter[] ParamArr = null; objHRPSvc.CreateDatabaseParameter(3, out ParamArr); ParamArr[0].Value = p_objVO.m_strItemId; ParamArr[1].Value = p_objVO.m_strUnit; ParamArr[2].DbType = DbType.Int16; ParamArr[2].Value = p_objVO.m_intPackage; lngRes = objHRPSvc.lngExecuteParameterSQL(strSQL, ref lngAffter, ParamArr); //lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref dtbValue, ParamArr); objHRPSvc.Dispose(); } catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
/// <summary> /// 删除别名信息 /// </summary> /// <param name="p_objVO"></param> /// <returns></returns> public long m_lngDeleteMultiUnit(clsMultiunit_drug_VO p_objVO) { com.digitalwave.iCare.middletier.HIS.clsMultiunit_drug_Svc m_objService = (com.digitalwave.iCare.middletier.HIS.clsMultiunit_drug_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType (typeof(com.digitalwave.iCare.middletier.HIS.clsMultiunit_drug_Svc)); long lngRes = m_objService.m_lngDeleteMultiUnit(p_objVO); m_objService.Dispose(); return(lngRes); }
/// <summary> /// 维护文本加载选定的单位信息 /// </summary> public void m_mthTxtLoadData() { //列表没有单位,不可保存与删除 if (this.m_objViewer.dtgMultiUnitList.Rows.Count < 1) { //清空维护中的textbox m_mthClearTXT(); return; } //把当前选中的单位加载到txt上 DataGridViewRow dgvrSelectedRow = this.m_objViewer.dtgMultiUnitList.SelectedRows[0]; this.m_objViewer.txtUnitName.Text = dgvrSelectedRow.Cells["ColumnUnitName"].Value.ToString(); this.m_objViewer.txtPackage.Text = dgvrSelectedRow.Cells["ColumnPackageNum"].Value.ToString(); if (dgvrSelectedRow.Cells[3].Value.ToString() == "是") { m_objViewer.ckbCurruseFlag.Checked = true; } else { m_objViewer.ckbCurruseFlag.Checked = false; } //this.m_objViewer.cboStatus.SelectedIndex = int.Parse(dgvrSelectedRow.Cells["Status"].Value.ToString()); if (dgvrSelectedRow.Cells["Status"].Value.ToString() == "启用") { this.m_objViewer.cboStatus.SelectedIndex = 1; } else { this.m_objViewer.cboStatus.SelectedIndex = 0; } clsMultiunit_drug_VO objTmp = new clsMultiunit_drug_VO(); objTmp.m_strItemId = dgvrSelectedRow.Cells["ColumnItemID"].Value.ToString(); objTmp.m_strUnit = dgvrSelectedRow.Cells["ColumnUnitName"].Value.ToString(); objTmp.m_intPackage = int.Parse(dgvrSelectedRow.Cells["ColumnPackageNum"].Value.ToString()); if (dgvrSelectedRow.Cells[3].Value.ToString() == "是") { objTmp.m_intCurruseFlag_Int = 1; } else { objTmp.m_intCurruseFlag_Int = 0; } if (dgvrSelectedRow.Cells["Status"].Value.ToString() == "启用") { objTmp.m_intStauts = 1; } else { objTmp.m_intStauts = 0; } this.m_objViewer.cmdSave.Tag = objTmp; }
/// <summary> /// 实例化clsMultiunit_drug_VO对象 /// </summary> /// <returns>clsMultiunit_drug_VO对象</returns> private clsMultiunit_drug_VO m_objGetVOFromText() { clsMultiunit_drug_VO objVO = new clsMultiunit_drug_VO(); objVO.m_strItemId = this.m_objViewer.dtgMedicineList.SelectedRows[0].Cells["ColumnMedicineId"].Value.ToString(); objVO.m_strUnit = this.m_objViewer.txtUnitName.Text.ToString().Trim(); objVO.m_intPackage = Convert.ToInt16(this.m_objViewer.txtPackage.Text.ToString().Trim()); if (m_objViewer.ckbCurruseFlag.Checked) { objVO.m_intCurruseFlag_Int = 1; } else { objVO.m_intCurruseFlag_Int = 0; } objVO.m_intStauts = this.m_objViewer.cboStatus.SelectedIndex; return(objVO); }
public long m_lngUpdateMultiUnit(clsMultiunit_drug_VO p_objVO, string strMedicineId, string strUnitName, int intPackAge, int intCurruseFlag, int intStatus) { long lngRes = -1; string strSQL = @"update t_bse_itemmultiunit_drug set unit_vchr = ?, package_dec = ?, curruseflag_int = ?, status_int = ? where itemid_chr = ? and unit_vchr = ? and package_dec = ? "; long lngAffect = -1; try { clsHRPTableService objHRPSvc = new clsHRPTableService(); IDataParameter[] ParamArr = null; objHRPSvc.CreateDatabaseParameter(7, out ParamArr); ParamArr[0].Value = p_objVO.m_strUnit; ParamArr[1].DbType = DbType.Int16; ParamArr[1].Value = p_objVO.m_intPackage; ParamArr[2].DbType = DbType.Int16; ParamArr[2].Value = p_objVO.m_intCurruseFlag_Int; ParamArr[3].Value = intStatus; ParamArr[4].Value = strMedicineId; ParamArr[5].Value = strUnitName; ParamArr[6].DbType = DbType.Int16; ParamArr[6].Value = intPackAge; //ParamArr[6].DbType = DbType.Int16; //ParamArr[6].Value = intCurruseFlag; lngRes = objHRPSvc.lngExecuteParameterSQL(strSQL, ref lngAffect, ParamArr); objHRPSvc.Dispose(); } catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
/// <summary> /// 保存单位 /// </summary> /// <returns></returns> public bool m_blnUpdateMultiUnit() { //更新的条件 string strMedicineId = this.m_objViewer.dtgMedicineList.SelectedRows[0].Cells["ColumnMedicineId"].Value.ToString(); string strUnitName = this.m_objViewer.dtgMultiUnitList.SelectedRows[0].Cells["ColumnUnitName"].Value.ToString(); int intPackAge = Convert.ToInt16(this.m_objViewer.dtgMultiUnitList.SelectedRows[0].Cells["ColumnPackageNum"].Value.ToString()); int intCurruseFlag = -1; if (this.m_objViewer.dtgMultiUnitList.SelectedRows[0].Cells["ColumnCurruseFlag"].Value.ToString() == "是") { intCurruseFlag = 1; } else { intCurruseFlag = 0; } int intCurruseFlag_Int = intCurruseFlag; //实例化VO并住其字段中赋值 clsMultiunit_drug_VO objVO = m_objGetVOFromText(); //判断单位是否已经存在 //if (this.m_objDomain.m_blnQueryByIndex(strMedicineId, objVO.m_strUnit, objVO.m_intPackage)) //{ // MessageBox.Show("当前药品单位中已存在此单位!\n请更改数量单位!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // m_objViewer.txtPackage.Focus(); // m_objViewer.txtPackage.SelectAll(); // return false; //} //else //{ // if (this.m_objDomain.m_blnQueryByIndex(strMedicineId, objVO.m_strUnit, objVO.m_intPackage, objVO.m_intCurruseFlag_Int)) // { // MessageBox.Show("当前药品单位中已存在此单位!\n请更改数量单位!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // m_objViewer.txtPackage.Focus(); // m_objViewer.txtPackage.SelectAll(); // return false; // } // else // { // //从数据库中更新单位 // long lngRes = this.m_objDomain.m_lngUpdateMultiUnit(objVO, strMedicineId, strUnitName, intPackAge, intCurruseFlag_Int); // if (lngRes > 0) // { // return true; // } // else // { // return false; // } // } //} DataGridViewRow dgvr; int intCount = this.m_objViewer.dtgMultiUnitList.Rows.Count; int intCurRow = this.m_objViewer.dtgMultiUnitList.SelectedRows[0].Cells[0].RowIndex; if (intCurRow != 0) { for (int i1 = 0; i1 < intCount && i1 != intCurRow; i1++) { dgvr = this.m_objViewer.dtgMultiUnitList.Rows[i1]; if (objVO.m_strItemId == dgvr.Cells[0].Value.ToString() && objVO.m_strUnit == dgvr.Cells[1].Value.ToString() && objVO.m_intPackage == int.Parse(dgvr.Cells[2].Value.ToString())) { MessageBox.Show("当前药品单位中已存在此单位!\n请更改数量单位!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); m_objViewer.txtPackage.Focus(); m_objViewer.txtPackage.SelectAll(); return(false); } } } else { for (int i1 = 1; i1 < intCount; i1++) { dgvr = this.m_objViewer.dtgMultiUnitList.Rows[i1]; if (objVO.m_strItemId == dgvr.Cells[0].Value.ToString() && objVO.m_strUnit == dgvr.Cells[1].Value.ToString() && objVO.m_intPackage == int.Parse(dgvr.Cells[2].Value.ToString())) { MessageBox.Show("当前药品单位中已存在此单位!\n请更改数量单位!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); m_objViewer.txtPackage.Focus(); m_objViewer.txtPackage.SelectAll(); return(false); } } } long lngRes = this.m_objDomain.m_lngUpdateMultiUnit(objVO, strMedicineId, strUnitName, intPackAge, intCurruseFlag_Int, this.m_objViewer.cboStatus.SelectedIndex); if (lngRes > 0) { return(true); } else { return(false); } //if (this.m_objDomain.m_blnQueryByIndex(strMedicineId, objVO.m_strUnit, objVO.m_intPackage, objVO.m_intCurruseFlag_Int,this.m_objViewer.cboStatus.SelectedIndex)) //{ // MessageBox.Show("当前药品单位中已存在此单位!\n请更改数量单位!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // m_objViewer.txtPackage.Focus(); // m_objViewer.txtPackage.SelectAll(); // return false; //} //从数据库中更新单位 }
/// <summary> /// 点击保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdSave_Click(object sender, EventArgs e) { //如果是新增状态 if (this.blnisCmdNewOpen) { bool blnIsNum = ((clsCtl_Multiunit_drug)this.objController).m_blnIsNum(); //判断textbox是否为空,是否符合数据类型 if (txtUnitName.Text.ToString().Trim().Equals("") || txtPackage.Text.ToString().Trim().Equals("") || blnIsNum) { MessageBox.Show("填入信息不完整或者数据格式错误!\n请填写完整", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPackage.Focus(); } else { //判断是否设为当前药品单位 if (ckbCurruseFlag.Checked == true) { if (((clsCtl_Multiunit_drug)this.objController).m_BlnQueryByIndex() == false) { return; } //把其他的药品设为非当前药品 if (((clsCtl_Multiunit_drug)objController).m_lngSetAllCurruseFlag_0ByItemId() > -1) { //调用增新 if (((clsCtl_Multiunit_drug)objController).m_blnAddMultiUnit()) { //关闭新增状态 this.blnisCmdNewOpen = false; //关闭txtUnitName //this.txtUnitName.ReadOnly = true; //重新为单位列表绑定数据 ((clsCtl_Multiunit_drug)this.objController).m_mthDgvMultiUnitDataBind(); //重新把单位列表的选择行数据显示在textbox上 ((clsCtl_Multiunit_drug)objController).m_mthTxtLoadData(); m_mthSetBtnStatus(); } } else { MessageBox.Show("把其他药品单位设为非当前单位失败", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { if (((clsCtl_Multiunit_drug)this.objController).m_BlnQueryByIndex() == false) { return; } //如果新增为第1个药品单位,而用户却没有把它设为当前药品。把新增单位设为默认当前药品单位 if (this.dtgMultiUnitList.Rows.Count <= 0) { ckbCurruseFlag.Checked = true; } //调用增新 if (((clsCtl_Multiunit_drug)objController).m_blnAddMultiUnit()) { //关闭新增状态 this.blnisCmdNewOpen = false; //关闭txtUnitName //this.txtUnitName.ReadOnly = true; //重新为单位列表绑定数据 ((clsCtl_Multiunit_drug)this.objController).m_mthDgvMultiUnitDataBind(); //重新把单位列表的选择行数据显示在textbox上 ((clsCtl_Multiunit_drug)objController).m_mthTxtLoadData(); m_mthSetBtnStatus(); } } } } //更新数据 else { clsMultiunit_drug_VO objTmp = this.cmdSave.Tag as clsMultiunit_drug_VO; bool blnCurr = false; if (objTmp.m_intCurruseFlag_Int == 1) { blnCurr = true; } else { blnCurr = false; } if (objTmp.m_strUnit == this.txtUnitName.Text.Trim() && objTmp.m_intPackage.ToString() == this.txtPackage.Text && blnCurr == this.ckbCurruseFlag.Checked && objTmp.m_intStauts == this.cboStatus.SelectedIndex) { return; } //作数据判断 //判断是否设为当前药品单位 if (ckbCurruseFlag.Checked == true) { //if (dtgMultiUnitList.Rows.Count != 1) //{ //处理:发生在更新时,当txtUnitName与其中当前药品使用单位相同时引发异常(违反唯一约束) //// 正在处理ing /////////////////// //// 正在处理ing /////////////////// //把其他的药品设为非当前药品 if (((clsCtl_Multiunit_drug)objController).m_lngSetAllCurruseFlag_0ByItemId() > -1) { if (((clsCtl_Multiunit_drug)objController).m_blnUpdateMultiUnit()) { //更新成功 MessageBox.Show("更新成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //重新为单位列表绑定数据 ((clsCtl_Multiunit_drug)this.objController).m_mthLoadDvMultiUnit(); ((clsCtl_Multiunit_drug)this.objController).m_mthDgvMultiUnitDataBind(); //重新把单位列表的选择行数据显示在textbox上 if (this.dtgMultiUnitList.Rows.Count > 0) { this.dtgMultiUnitList.Rows[0].Selected = true; ((clsCtl_Multiunit_drug)objController).m_mthTxtLoadData(); } m_mthSetBtnStatus(); } else { //更新失败 MessageBox.Show("更新失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } //} //else //{ // MessageBox.Show("把其他药品单位设为非当前单位失败", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //} } else { MessageBox.Show("当前是唯一单位\n不能设为非当前药品单位", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { //if (dtgMultiUnitList.Rows.Count != 1) //{ //调用更新 if (((clsCtl_Multiunit_drug)objController).m_blnUpdateMultiUnit()) { //更新成功 MessageBox.Show("更新成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //重新为单位列表绑定数据 ((clsCtl_Multiunit_drug)this.objController).m_mthLoadDvMultiUnit(); ((clsCtl_Multiunit_drug)this.objController).m_mthDgvMultiUnitDataBind(); //重新把单位列表的选择行数据显示在textbox上 if (this.dtgMultiUnitList.Rows.Count > 0) { this.dtgMultiUnitList.Rows[0].Selected = true; ((clsCtl_Multiunit_drug)objController).m_mthTxtLoadData(); } m_mthSetBtnStatus(); } else { //更新失败 MessageBox.Show("更新失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } //} //else //{ // MessageBox.Show("当前是唯一单位\n不能设为非当前药品单位", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //} } } }