private void btnSave_Click(object sender, EventArgs e)
        {
            if (Model.SaveMapCriteriaEvent != null)
            {
                Model.Item.SourceName     = cbSourceName.Text;
                Model.Item.SourceType     = CRUDUIService.GetEnumValue <MappingDataType>(cbSourceType);
                Model.Item.TargetName     = cbTargetName.Text;
                Model.Item.TargetType     = CRUDUIService.GetEnumValue <MappingDataType>(cbTargetType);
                Model.Item.UseSourceValue = cbSourceValue.Checked;
                Model.Item.SourceValue    = tbSourceValue.Text;
                Model.Item.UseTargetValue = cbTargetValue.Checked;
                Model.Item.TargetValue    = tbTargetValue.Text;
                Model.Item.Enabled        = cbEnabled.Checked;
                Model.Item.Operator       = cbOperator.Text;
                try
                {
                    if (string.IsNullOrEmpty(tbTimeCondition.Text))
                    {
                        Model.Item.TimeConditionMs = null;
                    }
                    else
                    {
                        Model.Item.TimeConditionMs = int.Parse(tbTimeCondition.Text);
                    }
                }
                catch (FormatException)
                {
                    Model.Item.TimeConditionMs = null;
                }

                Model.SaveMapCriteriaEvent(Model);
            }
            Close();
        }
 private void RenderFiles()
 {
     TreeViewService.BuildTreeView(new BuildFileTreeViewArgs()
     {
         Callback = RenderFilesCallback, Grouping = CRUDUIService.GetEnumValue <FileTreeViewGroupEnum>(cbGrouping)
     });
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (Model.SaveEvent != null)
     {
         Model.Item.TargetName   = cbTargetName.Text;
         Model.Item.Operator     = cbOperator.Text;
         Model.Item.SourceName   = cbSourceName.Text;
         Model.Item.TargetValue  = tbTargetValue.Text;
         Model.Item.CriteriaType = CRUDUIService.GetEnumValue <LookupTargetType>(cbCriteriaType);
         Model.SaveEvent(Model);
     }
     Close();
 }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Model.SaveEvent != null)
            {
                Model.Item.UseCategory       = ckbUseCategory.Checked;
                Model.Item.Category          = tbCategory.Text;
                Model.Item.OnlyNetworkValues = ckbOnlyNetwork.Checked;
                Model.Item.LookupDirection   = CRUDUIService.GetEnumValue <LookupDirection>(cbLookupDirection);
                CRUDUIService.SaveList(Model.Item.Criteria, lbCriteria);
                CRUDUIService.SaveList(Model.Item.ValueNames, lbValueNames);
                CRUDUIService.SaveList(Model.Item.Conditions, lbConditions);

                Model.SaveEvent(Model);
            }
            Close();
        }
Пример #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                StatusPanel.StatusUpdate(StatusModel.Update("Saving..."));
                var i = Model.Item;

                i.Categories.Clear();
                foreach (var checkedItem in clbCategory.CheckedItems)
                {
                    i.Categories.Add((Category)checkedItem);
                }
                i.SourceTypes.Clear();
                foreach (var checkedItem in clbSourceType.CheckedItems)
                {
                    i.SourceTypes.Add(checkedItem.ToString());
                }

                i.Expression  = tbExpression.Text;
                i.Name        = cbValueName.Text;
                i.Sort        = tbSort.Text;
                i.Distinct    = ckbDistinct.Checked;
                i.FileInfo    = ckbFileInfo.Checked;
                i.LazyLoad    = ckbLazyLoad.Checked;
                i.DocumentMap = ckbDocumentMap.Checked;
                i.Level       = CRUDUIService.GetEnumValue <DocumentMapLevel>(cbLevel);
                ViewModel.Save(Model);

                Close();
            }
            finally
            {
                StatusPanel.StatusUpdate(StatusModel.Completed);
                Cursor.Current = Cursors.Default;
            }
        }
        private void RefreshCriteriaType()
        {
            var value = CRUDUIService.GetEnumValue <LookupTargetType>(cbCriteriaType);

            switch (value)
            {
            case LookupTargetType.Value:
                lblSourceName.Visible  = false;
                cbSourceName.Visible   = false;
                lblTargetValue.Visible = true;
                tbTargetValue.Visible  = true;
                break;

            case LookupTargetType.Name:
                lblSourceName.Visible  = true;
                cbSourceName.Visible   = true;
                lblTargetValue.Visible = false;
                tbTargetValue.Visible  = false;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            StatusPanel.StatusUpdate(StatusModel.Update("Saving..."));

            var i = Model.Item;

            i.Documentation              = tbDocumentation.Rtf;
            i.DocumentMap                = ckbDocumentMap.Checked;
            i.Name                       = tbName.Text;
            i.Sort                       = tbSort.Text;
            i.GapNormal                  = ckbGapNormal.Checked;
            i.DisplayDurationFromParent  = ckbTimeFromParent.Checked;
            i.DisplayDurationFromSibling = ckbDurationFromSibling.Checked;
            i.Example                    = tbExample.Text;

            i.RegularExpression = tbRegularExpression.Text;

            i.Categories.Clear();
            foreach (var checkedItem in clbCategory.CheckedItems)
            {
                i.Categories.Add((Category)checkedItem);
            }
            i.SourceType = string.IsNullOrEmpty(cbSourceType.Text) ? null : cbSourceType.Text;

            i.SourceTypes.Clear();
            foreach (var checkedItem in clbSourceType.CheckedItems)
            {
                i.SourceTypes.Add(checkedItem.ToString());
            }

            if (i.SourceTypes.Count == 0)
            {
                i.SourceTypes.Add(Keywords.ALL);
            }

            if (cbFoldingEventId.SelectedItem != null)
            {
                i.FoldingEventId = ((EventLR)cbFoldingEventId.SelectedItem).EventId;
            }
            else
            {
                i.FoldingEventId = -1;
            }

            i.Network = cbNetworkCommunication.Text == "" ? NetworkDirection.Na : CRUDUIService.GetEnumValue <NetworkDirection>(cbNetworkCommunication);

            i.Level = (DocumentMapLevel)Enum.Parse(typeof(DocumentMapLevel), cbLevel.Text, true);
            i.IgnoreDocumentation       = cbIgnoreDocumentation.Checked;
            i.HighlightColor            = cbColor.Text == "" ? Color.Transparent.Name : cbColor.Text;
            i.DocumentMapHighlightColor = cbDocumentMapHighlightColor.Text == "" ? Color.Transparent.Name : cbDocumentMapHighlightColor.Text;

            CRUDUIService.SaveList(i.EventValues, lbValues);
            CRUDUIService.SaveList(i.EventLookupValues, lbLookupValues);

            i.IgnoreName = ckbIgnoreName.Checked;

            try
            {
                ViewModel.Save(Model);
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            StatusPanel.StatusUpdate(StatusModel.Completed);
        }