Beispiel #1
0
        protected override OutputData DoGet(IInputData input)
        {
            Tk5TableResolver getResovler = new Tk5TableResolver(@"Weixin\CorpTagDept.xml", this);

            using (getResovler)
            {
                DataTable     table   = getResovler.CreateVirtualTable();
                IParamBuilder builder = SqlParamBuilder.CreateEqualSql(Context, "CU_USER_ID",
                                                                       TkDataType.Int, input.QueryString["UserId"]);
                string          dept = DbUtil.ExecuteScalar(SQL, Context, builder).ToString();
                QuoteStringList list = dept.Value <QuoteStringList>();
                if (list != null)
                {
                    List <int> deptList = list.ConvertToList <int>();
                    if (deptList != null)
                    {
                        foreach (var item in deptList)
                        {
                            DataRow userRow = table.NewRow();
                            userRow["DeparmentId"] = item;
                            table.Rows.Add(userRow);
                        }
                        getResovler.Decode(input.Style);
                    }
                }

                input.CallerInfo.AddInfo(DataSet);
            }
            return(OutputData.Create(DataSet));
        }
Beispiel #2
0
        private void GetAddDelList <T>(QuoteStringList postList, QuoteStringList srcList,
                                       out T[] addList, out T[] delList)
        {
            var postStrList = postList.ConvertToList <T>();

            if (postStrList == null)
            {
                postStrList = new List <T>();
            }
            var srcStrList = srcList.ConvertToList <T>();

            if (srcStrList == null)
            {
                srcStrList = new List <T>();
            }

            addList = postStrList.Except(srcStrList).ToArray();
            delList = srcStrList.Except(postStrList).ToArray();
        }
Beispiel #3
0
        private void AddDeptMembers(CorpTag tag, QuoteStringList postList, QuoteStringList srcList)
        {
            if (srcList == null)
            {
                List <int> list = postList.ConvertToList <int>();
                if (list.Count > 0)
                {
                    tag.AddMembers(null, list);
                }

                return;
            }

            int[] addList, delList;
            GetAddDelList(postList, srcList, out addList, out delList);
            if (addList.Length > 0)
            {
                tag.AddMembers(null, addList);
            }
            if (delList.Length > 0)
            {
                tag.RemoveMembers(null, delList);
            }
        }