Ejemplo n.º 1
0
        private void m_cmdDelete_Click(object sender, EventArgs e)
        {
            if (this.m_lsvYBPayTypes.FocusedItem == null)
            {
                return;
            }

            Cursor.Current           = Cursors.WaitCursor;
            this.m_cmdDelete.Enabled = false;

            clsYBDefPayTypeVO objYBDefPayType = (clsYBDefPayTypeVO)this.m_lsvYBPayTypes.FocusedItem.Tag;
            clsYBDefPayTypeVO objCopy         = new clsYBDefPayTypeVO();

            objYBDefPayType.m_mthCopyTo(objCopy);

            long lngRes = clsDcl_YBDefPayTypeSmp.s_object.m_lngDelete(objCopy);

            if (lngRes > 0)
            {//成功
                int intIdx = this.m_lsvYBPayTypes.FocusedItem.Index;

                this.m_lsvYBPayTypes.FocusedItem.Remove();

                //设置新的具有焦点的 ListView 项


                if (intIdx < this.m_lsvYBPayTypes.Items.Count)
                {
                    this.m_lsvYBPayTypes.Items[intIdx].Selected = true;
                    this.m_lsvYBPayTypes.Items[intIdx].Focused  = true;
                    this.m_lsvYBPayTypes_Click(null, null);
                }
                else if (intIdx - 1 >= 0)
                {
                    this.m_lsvYBPayTypes.Items[intIdx - 1].Selected = true;
                    this.m_lsvYBPayTypes.Items[intIdx - 1].Focused  = true;
                    this.m_lsvYBPayTypes_Click(null, null);
                }
            }
            else
            {//失败
                MessageBox.Show("删除失败!");
            }

            this.m_cmdDelete.Enabled = true;
            Cursor.Current           = Cursors.Default;
        }
Ejemplo n.º 2
0
        //保存
        private void m_cmdSave_Click(object sender, EventArgs e)
        {
            if (m_lsvYBPayTypes.FocusedItem == null && !this.m_blnNewYBDefPayTypes)
            {
                return;
            }

            Cursor.Current         = Cursors.WaitCursor;
            this.m_cmdSave.Enabled = false;

            if (this.m_blnNewYBDefPayTypes)
            {//新增的保存
                clsYBDefPayTypeVO ybDefPayTypeVO = new clsYBDefPayTypeVO();

                clsPatientType_VO patientPayType = this.m_cboTypeName.SelectedItem as clsPatientType_VO;
                if (patientPayType == null)
                {
                    MessageBox.Show("请选择患者身份类型!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                ybDefPayTypeVO.m_strPayTypeId   = patientPayType.m_strPayTypeID;
                ybDefPayTypeVO.m_strYBJslx      = GetJslxId(this.m_cboYBJslxName.SelectedIndex);
                ybDefPayTypeVO.m_strYBRylb      = GetRylxId(this.m_cboYBRylxName.SelectedIndex);
                ybDefPayTypeVO.m_strPayTypeName = patientPayType.m_strPayTypeName;

                clsYBDefPayTypeVO temp = null;
                clsDcl_YBDefPayTypeSmp.s_object.m_lngFind(ybDefPayTypeVO.m_strPayTypeId, out temp);
                if (temp != null)
                {
                    MessageBox.Show("该患者身份类型已经添加!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                long lngRes = clsDcl_YBDefPayTypeSmp.s_object.m_lngInsert(ybDefPayTypeVO);
                if (lngRes > 0)
                {//成功
                 //更新状态标志


                    this.m_blnNewYBDefPayTypes = false;
                    //加入到集合


                    clsYBDefPayTypeVO[] objGroupArr    = (clsYBDefPayTypeVO[])this.m_lsvYBPayTypes.Tag;
                    clsYBDefPayTypeVO[] objGroupNewArr = new clsYBDefPayTypeVO[objGroupArr.Length + 1];
                    objGroupArr.CopyTo(objGroupNewArr, 0);
                    objGroupNewArr[objGroupNewArr.Length - 1] = ybDefPayTypeVO;
                    this.m_lsvYBPayTypes.Tag = objGroupNewArr;

                    //添加新项
                    ListViewItem item = new ListViewItem(ybDefPayTypeVO.m_strPayTypeId);
                    item.SubItems.Add(ybDefPayTypeVO.m_strPayTypeName);
                    item.SubItems.Add(ybDefPayTypeVO.m_strYBJslxName());
                    item.SubItems.Add(ybDefPayTypeVO.m_strYBRylbName());
                    item.Tag = ybDefPayTypeVO;

                    this.m_lsvYBPayTypes.Items.Add(item);

                    item.Selected            = true;
                    item.Focused             = true;
                    this.m_txtTypeId.Enabled = false;
                    this.m_lsvYBPayTypes_Click(null, null);
                }
                else
                {//失败
                    MessageBox.Show("新增数据失败!");
                }
            }
            else
            {//修改的保存
                clsPatientType_VO patientPayType = this.m_cboTypeName.SelectedItem as clsPatientType_VO;
                if (patientPayType == null)
                {
                    MessageBox.Show("请选择患者身份类型!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                clsYBDefPayTypeVO objYBDefPayType = (clsYBDefPayTypeVO)this.m_lsvYBPayTypes.FocusedItem.Tag;

                clsYBDefPayTypeVO objGroup = new clsYBDefPayTypeVO();
                objYBDefPayType.m_mthCopyTo(objGroup);

                objYBDefPayType.m_strPayTypeName = patientPayType.m_strPayTypeName;
                objYBDefPayType.m_strYBJslx      = GetJslxId(this.m_cboYBJslxName.SelectedIndex);
                objYBDefPayType.m_strYBRylb      = GetRylxId(this.m_cboYBRylxName.SelectedIndex);

                long lngRes = clsDcl_YBDefPayTypeSmp.s_object.m_lngUpdate(objYBDefPayType);

                if (lngRes > 0)
                {//成功
                    //objGroup.m_mthCopyTo(objYBDefPayType);
                    this.m_lsvYBPayTypes.FocusedItem.Text             = objYBDefPayType.m_strPayTypeId;
                    this.m_lsvYBPayTypes.FocusedItem.SubItems[1].Text = objYBDefPayType.m_strPayTypeName;
                    this.m_lsvYBPayTypes.FocusedItem.SubItems[2].Text = objYBDefPayType.m_strYBJslxName();
                    this.m_lsvYBPayTypes.FocusedItem.SubItems[3].Text = objYBDefPayType.m_strYBRylbName();
                    m_lsvYBPayTypes.Tag = objYBDefPayType;
                }
                else
                {//失败
                    MessageBox.Show("修改数据失败!");
                }
                this.m_txtTypeId.Enabled = false;
            }
            this.m_cmdSave.Enabled = true;
            Cursor.Current         = Cursors.Default;
        }