ArcGISCompare.frmMaster.CheckDomainsAndValues C# (CSharp) Method

CheckDomainsAndValues() public method

public CheckDomainsAndValues ( TreeNode &N, FeatureData theS, FeatureData theD ) : void
N TreeNode
theS FeatureData
theD FeatureData
return void
        public void CheckDomainsAndValues(ref TreeNode N, FeatureData theS, FeatureData theD)
        {
            ISubtypes theSS;
            ISubtypes theDS;
            IEnumSubtype theE;
            int theV, theQ;
            string strV, strQ;
            TreeNode FDV = null;
            Boolean firstTime = false;
            Boolean isFound;
            IDomain theSDVal, theDDVal;
            string theVText;

            theSS = theS.theST;
            theDS = theD.theST;

            if (theSS.HasSubtype == theDS.HasSubtype && theSS.HasSubtype)
            {
                TreeNode S = new TreeNode("Constraints");
                theE = theSS.Subtypes;
                theVText = theE.Next(out theV);
                while (theV != 0)
                {
                    firstTime = true;
                    IFields theFlds = theS.theFlds;
                    IFields destFlds = theD.theFlds;

                    for (int C = 0; C < theFlds.FieldCount; C++)
                    {
                        if (theFlds.get_Field(C).Editable)
                        {
                            theDDVal = null;
                            theSDVal = theSS.get_Domain(theV, theFlds.get_Field(C).Name);
                            if (destFlds.FindField(theFlds.get_Field(C).Name) >= 0)
                            {
                                theDDVal = theDS.get_Domain(theV, theFlds.get_Field(C).Name);
                            }
                            if (theSDVal != null && theDDVal != null)
                            {
                                if (theSDVal.Name != theDDVal.Name)
                                {
                                    if (firstTime)
                                    {
                                        FDV = new TreeNode("For Feature Type - " + theVText);
                                    }
                                    TreeNode DV = new TreeNode("Domain " + theSDVal.Name + " for Field " + theFlds.get_Field(C).Name + " unmatched"){ ImageIndex = 1, SelectedImageIndex = 1};
                                    DV.Nodes.Add(new Guid().ToString(), "Template is " + theSDVal.Name, 1, 1);
                                    DV.Nodes.Add(new Guid().ToString(), "Implementation is " + theDDVal.Name, 1, 1);
                                    TreeNode V = new TreeNode("Domain Values Comparison"){ImageIndex = 1, SelectedImageIndex = 1};
                                    DomainValueComparison(ref V, theSDVal, theDDVal);
                                    FDV.ImageIndex = 1;
                                    FDV.SelectedImageIndex = 1;
                                    //V.ImageIndex = 1;
                                    FDV.Nodes.Add(DV);
                                    DV.Nodes.Add(V);
                                    if (firstTime)
                                    {
                                        S.Nodes.Add(FDV);
                                        firstTime = false;
                                    }
                                }
                                else
                                {
                                    TreeNode DV = new TreeNode("Domain " + theSDVal.Name + " for Field " + theFlds.get_Field(C).Name + " is Valid");
                                    TreeNode V = new TreeNode("Domain Values Comparison");
                                    //DomainValueComparison(ref V, theSDVal, theDDVal);
                                    ////FDV.Nodes.Add(DV);
                                    //DV.Nodes.Add(V);
                                    //S.Nodes.Add(DV);
                                    if (DomainValueComparison(ref V, theSDVal, theDDVal))
                                    {
                                        DV.Text = "Domain " + theSDVal.Name + " for Field " + theFlds.get_Field(C).Name + " is not Valid";
                                        DV.ImageIndex = 1;
                                        DV.SelectedImageIndex = 1;
                                        V.ImageIndex = 1;
                                        V.SelectedImageIndex = 1;
                                        DV.Nodes.Add(V);
                                        S.Nodes.Add(DV);
                                    }
                                }
                            }
                            else if (theSDVal == null && theDDVal == null) { }
                            else if (theSDVal == null)
                            {
                                TreeNode DV = new TreeNode("Domain " + theSDVal + " for Field " + theFlds.get_Field(C).Name + " Missing in Implementation"){ImageIndex = 1, SelectedImageIndex = 1};
                                S.Nodes.Add(DV);
                            }
                            else
                            {
                                TreeNode DV = new TreeNode("Domain " + theDDVal + " for Field " + theFlds.get_Field(C).Name + " Missing in Template"){ ImageIndex = 1, SelectedImageIndex = 1};
                                S.Nodes.Add(DV);
                            }
                        }
                    }
                    theVText = theE.Next(out theV);
                }
                if (S.Nodes.Count == 0)
                {
                    S.Nodes.Add("All Domains and Values Agree between Template and Implementation");
                }
                else
                {
                    N.ImageIndex = 1;
                    N.SelectedImageIndex = 1;
                    S.ImageIndex = 1;
                    S.SelectedImageIndex = 1;
                }
                N.Nodes.Add(S);
            }
        }