protected override void Execute(CodeActivityContext context)
        {
            String Error     = "";
            String str_out   = "";
            String listofstr = Input_Value.Get(context);

            // i need to analize to what is the spliter I will go for ,

            try
            {
                IEnumerable <string> ListofLabel = Input_List_Label.Get(context);
                IEnumerable <string> ListofValue = Input_List_Value.Get(context);
                Boolean found = false;
                /// identify the splitter
                String Selected = ",";
                Int32  max      = listofstr.Split(',').Length - 1;
                if (max < (listofstr.Split(';').Length - 1))
                {
                    Selected = ";";
                    max      = listofstr.Split(';').Length - 1;
                }
                if (max < (listofstr.Split('\n').Length - 1))
                {
                    Selected = "\n";
                    max      = listofstr.Split('\n').Length - 1;
                    if (max == (listofstr.Split(new string[] { "\r\n" }, StringSplitOptions.None).Length - 1))
                    {
                        Selected = "\r\n";
                    }
                }
                String[]  splitedstr = listofstr.Split(new string[] { Selected }, StringSplitOptions.None);
                HelpMatch tmpMatch   = new HelpMatch();
                foreach (String str in splitedstr)
                {
                    foreach (String itm in ListofLabel)
                    {
                        if (str.Trim().ToUpper().Equals(itm.ToUpper()))
                        {
                            str_out += itm + ";";
                            found    = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        foreach (String itm in ListofValue)
                        {
                            if (str.Trim().ToUpper().Equals(itm.ToUpper()))
                            {
                                str_out += itm + ";";
                                found    = true;
                                break;
                            }
                        }
                    }
                    if (!found)
                    {
                        foreach (String itm in ListofLabel)
                        {
                            if (tmpMatch.Decidematch(str.Trim().ToUpper(), itm.ToUpper()))
                            {
                                str_out += itm + ";";
                                found    = true;
                                break;
                            }
                        }
                    }
                    if (!found)
                    {
                        foreach (String itm in ListofValue)
                        {
                            if (tmpMatch.Decidematch(str.Trim().ToUpper(), itm.ToUpper()))
                            {
                                str_out += itm + ";";
                                found    = true;
                                break;
                            }
                        }
                    }
                }
                str_out = str_out.Remove(str_out.Length - 1);
            }
            catch (Exception ex)
            {
                Error   = ex.ToString();
                str_out = "NO DATA";
            }
            Output_Text.Set(context, str_out);
        }
Ejemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            String Error = "";
            String str   = Input_Value.Get(context);
            IEnumerable <string> ListofLabel = Input_List_Label.Get(context);
            IEnumerable <string> ListofValue = Input_List_Value.Get(context);
            Boolean   found    = false;
            HelpMatch tmpMatch = new HelpMatch();

            try
            {
                foreach (String itm in ListofLabel)
                {
                    if (str.Trim().ToUpper().Equals(itm.ToUpper()))
                    {
                        str   = itm;
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    foreach (String itm in ListofValue)
                    {
                        if (str.Trim().ToUpper().Equals(itm.ToUpper()))
                        {
                            str   = itm;
                            found = true;
                            break;
                        }
                    }
                }
                if (!found)
                {
                    foreach (String itm in ListofLabel)
                    {
                        if (tmpMatch.Decidematch(str.Trim().ToUpper(), itm.ToUpper()))
                        {
                            str   = itm;
                            found = true;
                            break;
                        }
                    }
                }
                if (!found)
                {
                    foreach (String itm in ListofValue)
                    {
                        if (tmpMatch.Decidematch(str.Trim().ToUpper(), itm.ToUpper()))
                        {
                            str   = itm;
                            found = true;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Error = ex.ToString();
                str   = "NO DATA";
            }
            Output_Text.Set(context, str);
        }