Ejemplo n.º 1
0
        /// <summary>
        /// 删除项目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_mthComboBox_Deleteitem(object sender, System.EventArgs e)
        {
            iCare.CustomForm.ctlComboBox cbo = ((MenuItem)sender).GetContextMenu().SourceControl as iCare.CustomForm.ctlComboBox;
            if (cbo == null)
            {
                return;
            }
            if (cbo.Text == "" || cbo.SelectedItem == null)
            {
                return;
            }
            clsComboBoxValue objValue;

            objValue                  = new clsComboBoxValue();
            objValue.m_strDeptID      = MDIParent.s_ObjDepartment.m_StrDeptID;
            objValue.m_strTypeID      = m_strTemplateID;
            objValue.m_strItemID      = cbo.Name;
            objValue.m_strItemContent = cbo.SelectedItem.ToString();
            long lngRef = new clsComboBoxDomainOld().m_lngDeleteItem(objValue);

            if (lngRef < 1)
            {
                return;
            }
            cbo.Items.Remove(cbo.SelectedItem);
            cbo.Update();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加项目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_mthComboBox_Additem(object sender, System.EventArgs e)
        {
            iCare.CustomForm.ctlComboBox cbo = ((MenuItem)sender).GetContextMenu().SourceControl as iCare.CustomForm.ctlComboBox;
            if (cbo == null)
            {
                return;
            }
            if (cbo.Text == "")
            {
                return;
            }
            clsComboBoxValue objValue = new clsComboBoxValue();

            objValue.m_strDeptID      = MDIParent.s_ObjDepartment.m_StrDeptID;
            objValue.m_strTypeID      = m_strTemplateID;
            objValue.m_strItemID      = cbo.Name;
            objValue.m_strItemContent = cbo.Text;
            long lngRef = new clsComboBoxDomainOld().m_lngAddItemToDB(objValue);

            if (lngRef < 1)
            {
                return;
            }
            cbo.Items.Insert(0, objValue.m_strItemContent);
            cbo.SelectedIndex = 0;
        }