/// <summary> /// 新增项目并将其添加至列表 /// </summary> internal void m_mthSaveItemsToList() { if (string.IsNullOrEmpty(m_objViewer.m_txtReason.Text)) { System.Windows.Forms.MessageBox.Show("请先输入作废原因", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); return; } clsMS_RejectReason objReason = new clsMS_RejectReason(); objReason.m_intSORTNUM_INT = m_objViewer.m_lsvReasonList.Items.Count + 1; objReason.m_strREASONDESC_VCHR = m_objViewer.m_txtReason.Text; int intReasonID = 0; long lngRes = m_objDomain.m_lngAddNewRejectReason(objReason, out intReasonID); if (lngRes > 0) { objReason.m_intREASONID_INT = intReasonID; System.Windows.Forms.ListViewItem lsi = new System.Windows.Forms.ListViewItem(objReason.m_intSORTNUM_INT.ToString()); lsi.SubItems.Add(objReason.m_strREASONDESC_VCHR); lsi.Tag = objReason; m_objViewer.m_lsvReasonList.Items.Add(lsi); m_objViewer.m_txtReason.Clear(); m_objViewer.m_txtReason.Tag = null; System.Windows.Forms.MessageBox.Show("保存成功", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } else { System.Windows.Forms.MessageBox.Show("保存失败", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
/// <summary> /// 修改作废原因 /// </summary> internal void m_mthModifyReason() { clsMS_RejectReason objReason = m_objViewer.m_txtReason.Tag as clsMS_RejectReason; if (objReason == null) { System.Windows.Forms.MessageBox.Show("请选双击选择一项作废原因", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); return; } objReason.m_strREASONDESC_VCHR = m_objViewer.m_txtReason.Text; long lngRes = m_objDomain.m_lngModifyRejectReason(objReason); if (lngRes > 0) { m_objViewer.m_lsvReasonList.SelectedItems[0].SubItems[1].Text = objReason.m_strREASONDESC_VCHR; m_objViewer.m_txtReason.Clear(); m_objViewer.m_txtReason.Tag = null; System.Windows.Forms.MessageBox.Show("保存成功", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } else { System.Windows.Forms.MessageBox.Show("保存失败", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
/// <summary> /// 修改作废原因 /// </summary> /// <param name="p_objReason">作废原因</param> /// <returns></returns> internal long m_lngModifyRejectReason(clsMS_RejectReason p_objReason) { long lngRes = 0; com.digitalwave.iCare.middletier.MedicineStoreService.clsRejectOutStorageSVC objSvc = (com.digitalwave.iCare.middletier.MedicineStoreService.clsRejectOutStorageSVC)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(com.digitalwave.iCare.middletier.MedicineStoreService.clsRejectOutStorageSVC)); lngRes = objSvc.m_lngModifyRejectReason(objPrincipal, p_objReason); return(lngRes); }
private void m_lsvReasonList_DoubleClick(object sender, EventArgs e) { if (m_lsvReasonList.SelectedItems.Count == 1) { clsMS_RejectReason objReason = m_lsvReasonList.SelectedItems[0].Tag as clsMS_RejectReason; if (objReason != null) { m_txtReason.Text = objReason.m_strREASONDESC_VCHR; m_txtReason.Tag = objReason; } } }
/// <summary> /// 重新设定已启用项目顺序 /// </summary> private void m_mthReSetAcitveItemOrderID() { for (int i = 0; i < m_objViewer.m_lsvReasonList.Items.Count; i++) { m_objViewer.m_lsvReasonList.Items[i].SubItems[0].Text = (i + 1).ToString(); clsMS_RejectReason objReason = m_objViewer.m_lsvReasonList.Items[i].Tag as clsMS_RejectReason; if (objReason != null) { objReason.m_intSORTNUM_INT = i + 1; } } }
/// <summary> /// 保存顺序变更 /// </summary> internal long m_lngSaveSort() { if (m_objViewer.m_lsvReasonList.Items.Count == 0) { return(1); } List <clsMS_RejectReason> lstReasons = new List <clsMS_RejectReason>(); for (int iItem = 0; iItem < m_objViewer.m_lsvReasonList.Items.Count; iItem++) { clsMS_RejectReason objReason = m_objViewer.m_lsvReasonList.Items[iItem].Tag as clsMS_RejectReason; if (objReason != null) { lstReasons.Add(objReason); } } long lngRes = m_objDomain.m_lngUpdateReasonSort(lstReasons.ToArray()); return(lngRes); }
public long m_lngGetAllRejectReason(System.Security.Principal.IPrincipal p_objPrincipal, out clsMS_RejectReason[] p_objReason) { p_objReason = null; long lngRes = 0; try { string strSQL = @"select reasonid_int, reasondesc_vchr, sortnum_int from t_ms_rejectreasonset order by sortnum_int"; clsHRPTableService objHRPServ = new clsHRPTableService(); DataTable dtbValue = null; lngRes = objHRPServ.lngGetDataTableWithoutParameters(strSQL, ref dtbValue); if (lngRes > 0 && dtbValue != null) { int intRowsCount = dtbValue.Rows.Count; if (intRowsCount > 0) { p_objReason = new clsMS_RejectReason[intRowsCount]; DataRow drTemp = null; for (int iRow = 0; iRow < intRowsCount; iRow++) { drTemp = dtbValue.Rows[iRow]; p_objReason[iRow] = new clsMS_RejectReason(); p_objReason[iRow].m_intREASONID_INT = Convert.ToInt32(drTemp["reasonid_int"]); p_objReason[iRow].m_intSORTNUM_INT = Convert.ToInt32(drTemp["sortnum_int"]); p_objReason[iRow].m_strREASONDESC_VCHR = drTemp["reasondesc_vchr"].ToString(); } } } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
/// <summary> /// 删除选定项目 /// </summary> internal void m_mthDeleteSeletedItems() { if (m_objViewer.m_lsvReasonList.SelectedItems.Count == 0) { System.Windows.Forms.MessageBox.Show("请先选择要删除的作废原因", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); return; } List <System.Windows.Forms.ListViewItem> lstReasons = new List <System.Windows.Forms.ListViewItem>(); List <long> lstIDs = new List <long>(); for (int iR = 0; iR < m_objViewer.m_lsvReasonList.SelectedItems.Count; iR++) { clsMS_RejectReason objReason = m_objViewer.m_lsvReasonList.SelectedItems[iR].Tag as clsMS_RejectReason; if (objReason != null) { lstIDs.Add(objReason.m_intREASONID_INT); lstReasons.Add(m_objViewer.m_lsvReasonList.SelectedItems[iR]); } } long lngRes = m_objDomain.m_lngDeleteRejectReason(lstIDs.ToArray()); if (lngRes > 0) { foreach (System.Windows.Forms.ListViewItem lsi in lstReasons) { m_objViewer.m_lsvReasonList.Items.Remove(lsi); } m_mthReSetAcitveItemOrderID(); m_lngSaveSort(); System.Windows.Forms.MessageBox.Show("删除成功", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } else { System.Windows.Forms.MessageBox.Show("删除失败", "作废原因设置", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
public long m_lngModifyRejectReason(System.Security.Principal.IPrincipal p_objPrincipal, clsMS_RejectReason p_objReason) { if (p_objReason == null) { return(-1); } long lngRes = -1; try { string strSQL = @"update t_ms_rejectreasonset set reasondesc_vchr = ? where reasonid_int = ?"; clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(2, out objDPArr); objDPArr[0].Value = p_objReason.m_strREASONDESC_VCHR; objDPArr[1].Value = p_objReason.m_intREASONID_INT; long lngEff = -1; lngRes = objHRPServ.lngExecuteParameterSQL(strSQL, ref lngEff, objDPArr); p_objReason = null; } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngAddNewRejectReason(System.Security.Principal.IPrincipal p_objPrincipal, clsMS_RejectReason p_objReason, out int p_intReasonID) { p_intReasonID = 1; if (p_objReason == null) { return(-1); } long lngRes = 0; try { int intReasonID = 0; clsHRPTableService objHRPServ = new clsHRPTableService(); string strGetMaxID = @"select max(reasonid_int) from t_ms_rejectreasonset"; DataTable dtbValue = null; lngRes = objHRPServ.lngGetDataTableWithoutParameters(strGetMaxID, ref dtbValue); if (dtbValue == null || dtbValue.Rows.Count == 0) { intReasonID = 1; } else if (dtbValue.Rows.Count == 1) { int intMax = 0; if (!int.TryParse(dtbValue.Rows[0][0].ToString(), out intMax)) { intReasonID = 1; } else { intReasonID = intMax + 1; } } p_intReasonID = intReasonID; string strSQL = @"insert into t_ms_rejectreasonset (reasonid_int, reasondesc_vchr, sortnum_int) values (?, ?, ?)"; IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(3, out objDPArr); objDPArr[0].Value = intReasonID; objDPArr[1].Value = p_objReason.m_strREASONDESC_VCHR; objDPArr[2].Value = p_objReason.m_intSORTNUM_INT; long lngEff = -1; lngRes = objHRPServ.lngExecuteParameterSQL(strSQL, ref lngEff, objDPArr); p_objReason = null; } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }