Beispiel #1
0
        public MultipleDecodeItem(string code, IDecoder decoder, params object[] args)
        {
            fDecodeData = new MultipleDecoderData();
            QuoteStringList list  = QuoteStringList.FromString(code);
            var             items = list.CreateEnumerable();

            foreach (string item in items)
            {
                IDecoderItem dItem = decoder.Decode(item, args);
                fDecodeData.AddItem(dItem);
            }
            Name        = fDecodeData.ToJson();
            DisplayName = Name;
        }
Beispiel #2
0
        protected override OutputData DoGet(IInputData input)
        {
            string oper             = input.QueryString["Operation"];
            string dataXml          = null;
            string tagFieldName     = null;
            string dataXmlFieldName = null;
            Func <CorpTagMembers, IEnumerable <string> > getMembers = null;

            switch (oper)
            {
            case "User":
                dataXml          = @"Weixin\CorpTagUser.xml";
                tagFieldName     = "UserList";
                dataXmlFieldName = "UserId";
                getMembers       = GetUserMembers;
                break;

            case "Dept":
                dataXml          = @"Weixin\CorpTagDept.xml";
                tagFieldName     = "DepartmentList";
                dataXmlFieldName = "DeparmentId";
                getMembers       = GetDeptMembers;
                break;

            default:
                TkDebug.ThrowImpossibleCode(this);
                break;
            }
            Tk5TableResolver getResovler = new Tk5TableResolver(dataXml, this);

            using (getResovler)
            {
                DataTable table = getResovler.CreateVirtualTable();
                string    tagId = input.QueryString["TagId"];
                DataRow   row   = fResolver.TrySelectRowWithKeys(tagId);
                if (row != null)
                {
                    QuoteStringList list = row[tagFieldName].Value <QuoteStringList>();
                    if (list != null)
                    {
                        var userList = list.CreateEnumerable();
                        foreach (string item in userList)
                        {
                            DataRow userRow = table.NewRow();
                            userRow[dataXmlFieldName] = item;
                            table.Rows.Add(userRow);
                        }
                    }
                }
                else
                {
                    CorpTag              tag     = new CorpTag(tagId.Value <int>());
                    CorpTagMembers       members = tag.GetMembers();
                    IEnumerable <string> memList = getMembers(members);
                    if (memList != null)
                    {
                        foreach (var item in memList)
                        {
                            DataRow userRow = table.NewRow();
                            userRow[dataXmlFieldName] = item;
                            table.Rows.Add(userRow);
                        }
                    }
                }

                getResovler.Decode(input.Style);
                getResovler.FillCodeTable(input.Style);
                input.CallerInfo.AddInfo(DataSet);
            }
            return(OutputData.Create(DataSet));
        }