Exemplo n.º 1
0
        private void ucButtonAdd_Click(object sender, System.EventArgs e)
        {
            foreach (ListViewItem addedItem in this.listViewSelect.SelectedItems)
            {
                string errorCodeGroup = this.ucLabelComboxErrorGroup.SelectedItemValue.ToString();
                string errorCode      = ((ErrorCodeA)addedItem.Tag).ErrorCode;

                bool found = false;
                foreach (ListViewItem item in this.listViewSelected.Items)
                {
                    if (((TSErrorCode)item.Tag).ErrorCodeGroup == errorCodeGroup &&
                        ((TSErrorCode)item.Tag).ErrorCode == errorCode)
                    {
                        found = true;
                        break;
                    }
                }

                TSErrorCode tsErrorCode = _TSFacade.CreateNewTSErrorCode();
                tsErrorCode.TSId           = CurrentTS.TSId;
                tsErrorCode.ErrorCodeGroup = errorCodeGroup;
                tsErrorCode.ErrorCode      = errorCode;
                tsErrorCode.MaintainUser   = ApplicationService.Current().UserCode;

                ListViewItem newItem = new ListViewItem(string.Format("{0}:{1}", tsErrorCode.ErrorCodeGroup, tsErrorCode.ErrorCode));
                newItem.Tag = tsErrorCode;

                if (!found)
                {
                    this.listViewSelected.Items.Add(newItem);
                    _ListHelper.Add(tsErrorCode);
                }
            }
        }