コード例 #1
0
        public DuplicateInfo getDuplicateCatagory(string level)
        {
            DuplicateInfo di = new DuplicateInfo();

            foreach (ValLabelMarixRow lvl in vldMatrix)
            {
                di.rowindex = vldMatrix.IndexOf(lvl);
                if (level.Equals(lvl.OriginalLevel))
                {
                    di.duplicateType = 1;//duplicate as in original list
                    break;
                }
                else if (level.Equals(lvl.ChangeDeleteLevel))
                {
                    di.duplicateType = 1;//duplicate as in Change/Del
                    break;
                }
                else if (level.Equals(lvl.NewLevel))
                {
                    di.duplicateType = 3;//duplicate as in new
                    break;
                }
                else
                {
                    di.rowindex      = -1;
                    di.duplicateType = 0; //no duplicate
                }
            }
            return(di); //no duplicate
        }
コード例 #2
0
        public bool changeLevel(string oldlevel, string newlevel) // change level
        {
            bool          changeSuccess = false;
            DuplicateInfo dupResult     = getDuplicateCatagory(newlevel);

            switch (dupResult.duplicateType)
            {
            case 1:
                break;

            case 2:
                break;

            case 3:
                break;

            default:
                foreach (ValLabelMarixRow lvl in vldMatrix)
                {
                    if (lvl.ChangeDeleteLevel.Trim().Equals(oldlevel))    //match found
                    {
                        lvl.NewLevel = "";
                        //lvl.ListboxIndex = -1;
                        lvl.ChangeDeleteLevel = newlevel;
                        changeSuccess         = true;
                    }
                }
                break;
            }

            return(changeSuccess);
        }
コード例 #3
0
        public bool addLevel(string newLevel, int atIndex, bool isExisting)// add level
        {
            bool             successfullyAdded = false;
            ValLabelMarixRow row = null;//create ref. for new row

            if (isExisting)
            {
                row = new ValLabelMarixRow(newLevel, atIndex, newLevel, "");// create new row
                vldMatrix.Add(row);
                successfullyAdded = true;
            }
            else// its a new level
            {
                DuplicateInfo dupResult = getDuplicateCatagory(newLevel);
                switch (dupResult.duplicateType)
                {
                case 1:     //duplicate found in original list. check if Change prop is blank or contains value
                    // if blank(removed earlier), then simply add newLevel in Change prop.
                    // else create new entry in Change with current prop name and overwrite current Change value
                    ValLabelMarixRow curr = vldMatrix.ElementAt(dupResult.rowindex);
                    if (curr.ChangeDeleteLevel.Trim().Length == 0)     // empty change value. That means user earlier dropped this level.
                    {
                        curr.ChangeDeleteLevel = newLevel;
                        successfullyAdded      = true;
                    }
                    else if (curr.ChangeDeleteLevel.Trim() != newLevel)                   // user changed the name of this level earlier. We need to create new level with changed name and reset old level
                    {
                        string oldLevel = newLevel;                                       // newLevel is old level actully in this case
                        newLevel = curr.ChangeDeleteLevel;
                        row      = new ValLabelMarixRow(newLevel, atIndex, "", newLevel); // create new row
                        curr.ChangeDeleteLevel = oldLevel;
                        vldMatrix.Add(row);
                        successfullyAdded = true;
                    }
                    else
                    {
                        //its a duplicate
                        successfullyAdded = false;
                    }
                    break;

                case 2:
                    //its a duplicate
                    successfullyAdded = false;
                    break;

                case 3:
                    //its a duplicate
                    successfullyAdded = false;
                    break;

                default:
                    row = new ValLabelMarixRow(newLevel, atIndex, "", newLevel);    // create new row
                    vldMatrix.Add(row);
                    successfullyAdded = true;
                    break;
                }
            }
            return(successfullyAdded);
        }
コード例 #4
0
 public DuplicateInfo getDuplicateCatagory(string level)
 {
     DuplicateInfo di = new DuplicateInfo();
     foreach (ValLabelMarixRow lvl in vldMatrix)
     {
         di.rowindex = vldMatrix.IndexOf(lvl);
         if (level.Equals(lvl.OriginalLevel))
         {
             di.duplicateType = 1;//duplicate as in original list
             break;
         }
         else if (level.Equals(lvl.ChangeDeleteLevel))
         {
             di.duplicateType = 1;//duplicate as in Change/Del
             break;
         }
         else if (level.Equals(lvl.NewLevel))
         {
             di.duplicateType = 3;//duplicate as in new
             break;
         }
         else
         {
             di.rowindex = -1;
             di.duplicateType = 0; //no duplicate
         }
     }
     return di; //no duplicate
 }