private void m_lsvProperty_SelectedIndexChanged(object sender, System.EventArgs e) { if (this.m_lsvProperty.SelectedItems.Count == 0) { return; } clsApplyUnitProperty objProperty = (clsApplyUnitProperty)this.m_lsvProperty.SelectedItems[0].Tag; this.m_txtPropertyName.Text = objProperty.PropertyVO.m_strPROPERTY_NAME_VCHR; this.m_txtPropertySummary.Text = objProperty.PropertyVO.m_strSUMMARY_VCHR; m_mthResetProperty(); if (objProperty.PropertyVO.m_intINUSE_FLAG_NUM == 0) { this.m_btnDeleteProperty.Text = "起用"; this.m_btnPriorityDown.Enabled = false; this.m_btnPriorityUp.Enabled = false; } else { this.m_btnDeleteProperty.Text = "删除"; this.m_btnPriorityDown.Enabled = true; this.m_btnPriorityUp.Enabled = true; } m_mthShowValueList(); }
private void m_btnAddProperty_Click(object sender, System.EventArgs e) { clsApplyUnitProperty objPorperty = new clsApplyUnitProperty(); objPorperty.PropertyVO = new clsUnitProperty_VO(); objPorperty.State = enmRecordState.New; objPorperty.PropertyVO.m_intINUSE_FLAG_NUM = 1; int intIdx = this.m_intGetTheLastUsingIndex() + 1; ListViewItem lvi = new ListViewItem(); lvi.Text = null; lvi.SubItems.Add(""); lvi.Tag = objPorperty; this.m_lsvProperty.Items.Insert(intIdx, lvi); this.m_objDoc.Properties.Add(objPorperty); this.m_lsvProperty.SelectedItems.Clear(); lvi.Selected = true; lvi.Focused = true; this.m_mthResetProperty(); this.m_txtPropertyName.Clear(); this.m_txtPropertySummary.Clear(); this.m_txtPropertyName.ReadOnly = false; this.m_txtPropertySummary.ReadOnly = false; this.m_btnEditProperty.Enabled = false; this.m_txtPropertyName.Focus(); this.m_btnDeleteProperty.Text = "删除"; this.m_btnPriorityUp.Enabled = true; this.m_btnPriorityDown.Enabled = true; this.m_mthSortPriority(); }
private void m_mthShowValueList() { this.m_lsvValue.Items.Clear(); if (this.m_lsvProperty.SelectedItems.Count == 0) { return; } clsApplyUnitProperty objProperty = (clsApplyUnitProperty)this.m_lsvProperty.SelectedItems[0].Tag; this.m_lsvValue.BeginUpdate(); foreach (clsPropertyValue objValue in objProperty.Values) { if (objValue.ValueVO.m_intINUSE_FLAG_NUM == 0 && !this.m_chkShowDeleteValue.Checked) { continue; } ListViewItem lvi = new ListViewItem(); if (objValue.ValueVO.m_intINUSE_FLAG_NUM == 0) { lvi.ForeColor = Color.Red; } lvi.Text = objValue.ValueVO.m_strVLAUE_VCHR; lvi.Tag = objValue; this.m_lsvValue.Items.Add(lvi); } this.m_lsvValue.EndUpdate(); }
private void m_btnPriorityDown_Click(object sender, System.EventArgs e) { if (this.m_lsvProperty.SelectedItems.Count == 0) { return; } ListViewItem lvi = this.m_lsvProperty.SelectedItems[0]; int intIdx = lvi.Index + 1; if (intIdx == this.m_lsvProperty.Items.Count) { return; } clsApplyUnitProperty objNext = (clsApplyUnitProperty)this.m_lsvProperty.Items[intIdx].Tag; if (objNext.PropertyVO.m_intINUSE_FLAG_NUM == 0) { return; } lvi.Remove(); this.m_lsvProperty.Items.Insert(intIdx, lvi); lvi.Focused = true; this.m_mthSortPriority(); }
private void m_btnDeleteProperty_Click(object sender, System.EventArgs e) { if (this.m_lsvProperty.SelectedItems.Count == 0) { return; } clsApplyUnitProperty objProperty = (clsApplyUnitProperty)this.m_lsvProperty.SelectedItems[0].Tag; if (this.m_btnDeleteProperty.Text == "删除") { if (objProperty.State == enmRecordState.New) { this.m_objDoc.Properties.Remove(objProperty); this.m_lsvProperty.SelectedItems[0].Remove(); this.m_mthResetProperty(); } else { objProperty.PropertyVO.m_intINUSE_FLAG_NUM = 0; objProperty.State = enmRecordState.Modify; if (this.m_chkShowPropertyDelete.Checked) { ListViewItem lvi = this.m_lsvProperty.SelectedItems[0]; lvi.ForeColor = Color.Red; lvi.Remove(); this.m_lsvProperty.Items.Add(lvi); lvi.Focused = true; this.m_btnDeleteProperty.Text = "起用"; this.m_btnPriorityUp.Enabled = false; this.m_btnPriorityDown.Enabled = false; } else { this.m_lsvProperty.SelectedItems[0].Remove(); this.m_mthResetProperty(); } } } else { int intIdx = this.m_intGetTheLastUsingIndex() + 1; objProperty.PropertyVO.m_intINUSE_FLAG_NUM = 1; objProperty.State = enmRecordState.Modify; ListViewItem lvi = this.m_lsvProperty.SelectedItems[0]; lvi.ForeColor = SystemColors.ControlText; lvi.Remove(); this.m_lsvProperty.Items.Insert(intIdx, lvi); lvi.Focused = true; this.m_btnDeleteProperty.Text = "删除"; this.m_btnPriorityUp.Enabled = true; this.m_btnPriorityDown.Enabled = true; } this.m_mthSortPriority(); }
private void m_mthShowPropertyList() { this.m_lsvProperty.Items.Clear(); if (m_objDoc == null) { return; } this.m_lsvProperty.BeginUpdate(); foreach (clsApplyUnitProperty objProperty in m_objDoc.Properties) { if (objProperty.PropertyVO.m_intINUSE_FLAG_NUM == 0 && !this.m_chkShowPropertyDelete.Checked) { continue; } ListViewItem lvi = new ListViewItem(); if (objProperty.PropertyVO.m_intINUSE_FLAG_NUM == 0) { lvi.ForeColor = Color.Red; } lvi.Text = objProperty.PropertyVO.m_strPROPERTY_NAME_VCHR; lvi.SubItems.Add(objProperty.PropertyVO.m_strSUMMARY_VCHR); lvi.Tag = objProperty; int intIdx = 0; if (objProperty.PropertyVO.m_intINUSE_FLAG_NUM == 0) { intIdx = this.m_lsvProperty.Items.Count; } else { for (int i = 0; i < this.m_lsvProperty.Items.Count; i++) { clsApplyUnitProperty objP = (clsApplyUnitProperty)this.m_lsvProperty.Items[i].Tag; if (objP.PropertyVO.m_intINUSE_FLAG_NUM == 0) { intIdx = i; break; } if (objP.PropertyVO.m_intPROPERTY_PRIORITY_NUM > objProperty.PropertyVO.m_intPROPERTY_PRIORITY_NUM) { intIdx = i; break; } if (i + 1 == this.m_lsvProperty.Items.Count) { intIdx = this.m_lsvProperty.Items.Count; break; } } } this.m_lsvProperty.Items.Insert(intIdx, lvi); } this.m_lsvProperty.EndUpdate(); }
private int m_intGetTheLastUsingIndex() { for (int i = 0; i < this.m_lsvProperty.Items.Count; i++) { clsApplyUnitProperty objProperty = (clsApplyUnitProperty)this.m_lsvProperty.Items[i].Tag; if (objProperty.PropertyVO.m_intINUSE_FLAG_NUM == 0) { return(i - 1); } } return(this.m_lsvProperty.Items.Count - 1); }
public long m_lngConstructDoc(out clsApplyUnitPropertyDoc p_objDoc) { p_objDoc = null; clsUnitProperty_VO[] objPropertyArr; clsUnitPropertyValue_VO[] objValueArr; long lngRes = m_lngGetAllUnitPropertyData(out objPropertyArr, out objValueArr); if (lngRes <= 0) { return(lngRes); } p_objDoc = new clsApplyUnitPropertyDoc(); Hashtable hasPorperty = new Hashtable(); if (objPropertyArr != null) { foreach (clsUnitProperty_VO objPropertyVO in objPropertyArr) { clsApplyUnitProperty objProperty = new clsApplyUnitProperty(); objProperty.PropertyVO = objPropertyVO; objProperty.State = enmRecordState.Original; p_objDoc.Properties.Add(objProperty); if (!hasPorperty.ContainsKey(objPropertyVO.m_strPROPERTY_ID_CHR)) { hasPorperty.Add(objPropertyVO.m_strPROPERTY_ID_CHR, objProperty); } } } if (objValueArr != null) { foreach (clsUnitPropertyValue_VO objValueVO in objValueArr) { clsPropertyValue objValue = new clsPropertyValue(); objValue.ValueVO = objValueVO; objValue.State = enmRecordState.Original; if (hasPorperty.ContainsKey(objValueVO.m_strPROPERTY_ID_CHR)) { ((clsApplyUnitProperty)hasPorperty[objValueVO.m_strPROPERTY_ID_CHR]).Values.Add(objValue); } } } return(lngRes); }
private void m_btnEditProperty_Click(object sender, System.EventArgs e) { if (this.m_lsvProperty.SelectedItems.Count == 0) { return; } clsApplyUnitProperty objProperty = (clsApplyUnitProperty)this.m_lsvProperty.SelectedItems[0].Tag; if (objProperty.State == enmRecordState.Original) { objProperty.State = enmRecordState.Modify; } this.m_txtPropertyName.ReadOnly = false; this.m_txtPropertySummary.ReadOnly = false; this.m_btnEditProperty.Enabled = false; this.m_txtPropertyName.Focus(); }
private void m_btnDeleteValue_Click(object sender, System.EventArgs e) { if (this.m_lsvValue.SelectedItems.Count == 0 || this.m_lsvProperty.SelectedItems.Count == 0) { return; } clsPropertyValue objValue = (clsPropertyValue)this.m_lsvValue.SelectedItems[0].Tag; clsApplyUnitProperty objProperty = (clsApplyUnitProperty)this.m_lsvProperty.SelectedItems[0].Tag; if (this.m_btnDeleteValue.Text == "删除") { if (objValue.State == enmRecordState.New) { objProperty.Values.Remove(objProperty); this.m_lsvValue.SelectedItems[0].Remove(); this.m_mthResetValue(); } else { objValue.ValueVO.m_intINUSE_FLAG_NUM = 0; objValue.State = enmRecordState.Modify; if (this.m_chkShowDeleteValue.Checked) { this.m_lsvValue.SelectedItems[0].ForeColor = Color.Red; this.m_btnDeleteValue.Text = "起用"; } else { this.m_lsvValue.SelectedItems[0].Remove(); this.m_mthResetValue(); } } } else { objValue.ValueVO.m_intINUSE_FLAG_NUM = 1; objValue.State = enmRecordState.Modify; this.m_btnDeleteValue.Text = "删除"; this.m_lsvValue.SelectedItems[0].ForeColor = SystemColors.ControlText; } }
private void m_mthSortPriority() { foreach (ListViewItem lvt in this.m_lsvProperty.Items) { clsApplyUnitProperty objProperty = (clsApplyUnitProperty)lvt.Tag; if (objProperty.PropertyVO.m_intINUSE_FLAG_NUM == 0) { break; } int intIdx = lvt.Index; if (objProperty.PropertyVO.m_intPROPERTY_PRIORITY_NUM != intIdx) { objProperty.PropertyVO.m_intPROPERTY_PRIORITY_NUM = intIdx; if (objProperty.State == enmRecordState.Original) { objProperty.State = enmRecordState.Modify; } } } }