void ApplyChanges(MergeControl mergeControl, DataTable localDataTable, string idColumnNameCountry, string idColumnNameYear, bool local)
        {
            foreach (MergeControl.NodeInfo nodeInfo in local ? mergeControl.GetNodeInfoLocal() : mergeControl.GetNodeInfoRemote())
            {
                if (nodeInfo.changeType != MergeControl.ChangeType.changed ||
                    nodeInfo.changeHandling == (local ? MergeControl.ChangeHandling.accept : MergeControl.ChangeHandling.reject))
                {
                    continue; //not relevant, because neither changed nor locally accepted nor remotely rejected
                }
                string country = nodeInfo.ID.Substring(0, nodeInfo.ID.IndexOf("_"));
                string year    = nodeInfo.ID.Substring(nodeInfo.ID.IndexOf("_") + 1);

                //the existence of the component in local/remote/parent country reflects whether it is added (loc/rem), changed (loc/rem), ...
                string whereClause = idColumnNameCountry + " = '" + country + "' AND " + idColumnNameYear + " = '" + year + "'";


                DataRow dataRow = localDataTable.Select(whereClause).First();

                foreach (MergeControl.CellInfo cellInfo in nodeInfo.cellInfo)
                {
                    if (!cellInfo.isChanged || (local ? cellInfo.acceptChange : !cellInfo.acceptChange))
                    {
                        continue; //not relevant, because neither changed nor locally accepted nor remotely rejected
                    }
                    MergeControl.CellInfo cellInfoRemote = local ? mergeControl.GetTwinCellInfo(cellInfo) : cellInfo;
                    dataRow.SetField <string>(cellInfo.columnID, cellInfoRemote.text);
                }
            }
        }
Esempio n. 2
0
 void ApplyRemovals(MergeControl mergeControl, DataTable localDataTable, string idColumnName, bool local)
 {
     foreach (string ID in GetRelevantIDs(mergeControl, local, false))
     {
         DataRow dataRow = localDataTable.Select(idColumnName + " = '" + ID + "'").First();
         dataRow.Delete();
     }
     _vcFacLocal.GetVarConfig().AcceptChanges();
 }
        internal HICPConfigApplyAdministrator(MergeAdministrator mergeAdministrator, HICPConfigMergeForm mergeForm,
                                              HICPConfigFacade vcFacLocal, HICPConfigFacade vcFacRemote)
        {
            _mergeAdministrator = mergeAdministrator;

            _vcFacLocal  = vcFacLocal; _vcLocal = _vcFacLocal.GetHICPConfig();
            _vcFacRemote = vcFacRemote; _vcRemote = _vcFacRemote.GetHICPConfig();

            _mergeForm    = mergeForm;
            _mcHICPConfig = _mergeForm.GetMergeControlByName(EMPath.EM2_FILE_HICP);
        }
        internal SwitchablePolicyConfigApplyAdministrator(MergeAdministrator mergeAdministrator, SwitchablePolicyConfigMergeForm mergeForm,
                                                          SwitchablePolicyConfigFacade vcFacLocal, SwitchablePolicyConfigFacade vcFacRemote)
        {
            _mergeAdministrator = mergeAdministrator;

            _vcFacLocal  = vcFacLocal; _vcLocal = _vcFacLocal.GetSwitchablePolicyConfig();
            _vcFacRemote = vcFacRemote; _vcRemote = _vcFacRemote.GetSwitchablePolicyConfig();

            _mergeForm = mergeForm;
            _mcSwitchablePolicyConfig = _mergeForm.GetMergeControlByName(EMPath.EM2_FILE_EXTENSIONS);
        }
Esempio n. 5
0
        internal ExchangeRatesConfigApplyAdministrator(MergeAdministrator mergeAdministrator, ExchangeRatesConfigMergeForm mergeForm,
                                                       ExchangeRatesConfigFacade vcFacLocal, ExchangeRatesConfigFacade vcFacRemote)
        {
            _mergeAdministrator = mergeAdministrator;

            _vcFacLocal  = vcFacLocal; _vcLocal = _vcFacLocal.GetExchangeRatesConfig();
            _vcFacRemote = vcFacRemote; _vcRemote = _vcFacRemote.GetExchangeRatesConfig();

            _mergeForm             = mergeForm;
            _mcExchangeRatesConfig = _mergeForm.GetMergeControlByName(EMPath.EM2_FILE_EXRATES);
        }
        void ApplyRemovals(MergeControl mergeControl, DataTable localDataTable, string idColumnNameCountry, string idColumnNameYear, bool local)
        {
            foreach (string ID in GetRelevantIDs(mergeControl, local, false))
            {
                string country = ID.Substring(0, ID.IndexOf("_"));
                string year    = ID.Substring(ID.IndexOf("_") + 1);

                string whereClause = idColumnNameCountry + " = '" + country + "' AND " + idColumnNameYear + " = '" + year + "'";

                DataRow dataRow = localDataTable.Select(whereClause).First();
                dataRow.Delete();
            }
            _vcFacLocal.GetHICPConfig().AcceptChanges();
        }
Esempio n. 7
0
        internal VariablesApplyAdministrator(MergeAdministrator mergeAdministrator, VariablesMergeForm mergeForm,
                                             VarConfigFacade vcFacLocal, VarConfigFacade vcFacRemote)
        {
            _mergeAdministrator = mergeAdministrator;

            _vcFacLocal  = vcFacLocal; _vcLocal = _vcFacLocal.GetVarConfig();
            _vcFacRemote = vcFacRemote; _vcRemote = _vcFacRemote.GetVarConfig();

            _mergeForm            = mergeForm;
            _mcVariables          = _mergeForm.GetMergeControlByName(VariablesMergeForm.VARIABLES);
            _mcAcronyms           = _mergeForm.GetMergeControlByName(VariablesMergeForm.ACRONYMS);
            _mcCountryLabels      = _mergeForm.GetMergeControlByName(VariablesMergeForm.COUNTRY_LABELS);
            _mcSwitchablePolicies = _mergeForm.GetMergeControlByName(VariablesMergeForm.SWITCHABLE_POLICIES);
        }
        List <string> GetRelevantIDs(MergeControl mergeControl, bool local, bool add)
        {
            List <string> relevantIDs = new List <string>();

            foreach (MergeControl.NodeInfo nodeInfo in local ? mergeControl.GetNodeInfoLocal() : mergeControl.GetNodeInfoRemote())
            {
                if (nodeInfo.changeType != (local ? (add ? MergeControl.ChangeType.removed : MergeControl.ChangeType.added)
                                                  : (add ? MergeControl.ChangeType.added : MergeControl.ChangeType.removed)) ||
                    nodeInfo.changeHandling != (local ? MergeControl.ChangeHandling.reject : MergeControl.ChangeHandling.accept))
                {
                    continue; //not relevant, because not a rejected local-remove nor an accepted remote-add
                }
                relevantIDs.Add(nodeInfo.ID);
            }
            return(relevantIDs);
        }
Esempio n. 9
0
        void AdaptView(MergeControl container, ref Point startPosition, ViewType viewType, int changeReferenceWidth)
        {
            //adapt height with respect to being invoked from node, cell or column
            switch (viewType)
            {
            case ViewType.cell: this.Height = chkVisible.Top; break; //cell-menu: accept/reject-buttons

            case ViewType.node_full: break;                          //"big" node-menu: all buttons and checkboxes

            case ViewType.node_OnlyExCol:                            //"small" node-menu: expand/collapse + include-sub-nodes-checkbox
                if (_viewSequenceElements)
                {
                    break;                            //show "big" menu if order-changes need to be cared for
                }
                //exchange the upper and the lower part of the menu (to hide accept/reject and show expand/collapse)
                chkIncludeSubNodes.Top = chkVisible.Top; chkVisible.Visible = false;
                btnExpand.Top          = btnAccept.Top; btnAccept.Visible = false;
                btnCollapse.Top        = btnReject.Top; btnReject.Visible = false;
                this.Height            = labSeparator.Top; break;

            case ViewType.column: this.Height = labSeparator.Top; break;     //accept/reject-buttons + visible-only-checkbox
            }

            if (_viewSequenceElements)
            {
                btnAccept.Text  = "Accept Order";
                btnReject.Text  = "Reject Order";
                btnAccept.Image = EM_UI.Properties.Resources.merge_accept_order;
                btnReject.Image = EM_UI.Properties.Resources.merge_reject_order;
                chkVisible.Text = "Include Sub-Nodes";
            }

            //adapt width with respect to width of reference (i.e. name of component (e.g. "tin_sl"), column (e.g. "sl_demo") or cell-identifier)
            if (changeReferenceWidth > 0 && this.Width + changeReferenceWidth < this.Width * 2) //max-width = double of original width
            {
                this.Width += changeReferenceWidth;
            }

            if (startPosition.X + this.Width > container.Width)
            {
                startPosition.X -= this.Width;
            }
            if (startPosition.Y + this.Height > container.Height)
            {
                startPosition.Y -= this.Height;
            }
        }
Esempio n. 10
0
        internal AcceptRejectMenu(MergeControl mergeControl, string reference, Point startPosition, ViewType viewType, bool viewSequenceElements)
        {
            InitializeComponent();

            _mergeControl         = mergeControl;
            _viewSequenceElements = viewSequenceElements;

            int changeReferenceWidth = labReference.Width;

            labReference.Text    = reference;
            changeReferenceWidth = labReference.Width - changeReferenceWidth;

            AdaptView(mergeControl, ref startPosition, viewType, changeReferenceWidth);

            this.StartPosition = FormStartPosition.Manual;
            this.Location      = startPosition;
        }
 protected void SetPositionMergeControl(MergeControl mergeControl, TabPage tabPage,
                                        //optional parameters are in fact not used (is a relict of starting with more than one MergeControl in a tab
                                        int top        = -1, int height = -1,
                                        bool topAnchor = true, bool bottomAnchor = true)
 {
     mergeControl.Anchor = AnchorStyles.Left | AnchorStyles.Right;
     if (topAnchor)
     {
         mergeControl.Anchor = mergeControl.Anchor | AnchorStyles.Top;
     }
     if (bottomAnchor)
     {
         mergeControl.Anchor = mergeControl.Anchor | AnchorStyles.Bottom;
     }
     mergeControl.Location = new Point(0, top);
     mergeControl.Size     = new Size(tabPage.Width, height == -1 ? tabPage.Height : height);
     tabPage.Controls.Add(mergeControl);
 }
Esempio n. 12
0
        //void AddSwitchPolicies(bool local)
        //{
        //    foreach (string ID in GetRelevantIDs(_mcSwitchablePolicies, local, true))
        //        SwitchablePolicyConfigFacade.CopySwitchPolicyFromAnotherConfig(_vcLocal, EM_AppContext.Instance.GetSwitchablePolicyConfigFacade().GetSwitchablePolicy(ID));
        //}

        void ApplyChanges(MergeControl mergeControl, DataTable localDataTable, string idColumnName, bool local)
        {
            foreach (MergeControl.NodeInfo nodeInfo in local ? mergeControl.GetNodeInfoLocal() : mergeControl.GetNodeInfoRemote())
            {
                if (nodeInfo.changeType != MergeControl.ChangeType.changed ||
                    nodeInfo.changeHandling == (local ? MergeControl.ChangeHandling.accept : MergeControl.ChangeHandling.reject))
                {
                    continue; //not relevant, because neither changed nor locally accepted nor remotely rejected
                }
                DataRow dataRow = localDataTable.Select(idColumnName + " = '" + nodeInfo.ID + "'").First();

                foreach (MergeControl.CellInfo cellInfo in nodeInfo.cellInfo)
                {
                    if (!cellInfo.isChanged || (local ? cellInfo.acceptChange : !cellInfo.acceptChange))
                    {
                        continue; //not relevant, because neither changed nor locally accepted nor remotely rejected
                    }
                    MergeControl.CellInfo cellInfoRemote = local ? mergeControl.GetTwinCellInfo(cellInfo) : cellInfo;
                    dataRow.SetField <string>(cellInfo.columnID, cellInfoRemote.text);
                }
            }
        }