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

            using (getResovler)
            {
                DataSet postDataSet = input.PostObject.Convert <DataSet>();
                getResovler.PrepareDataSet(postDataSet);

                FieldErrorInfoCollection errors = new FieldErrorInfoCollection();
                getResovler.CheckFirstConstraints(input, errors);
                getResovler.CheckLaterConstraints(input, errors);
                errors.CheckError();

                QuoteStringList postList  = new QuoteStringList();
                DataTable       postTable = postDataSet.Tables[getResovler.TableName];
                if (postTable != null)
                {
                    foreach (DataRow postRow in postTable.Rows)
                    {
                        postList.Add(postRow["DeparmentId"].ToString());
                    }
                }
                string tagId = input.QueryString["TagId"];

                InternalCorpUserResolver userResolver = new InternalCorpUserResolver(this);
                using (userResolver)
                {
                    DataRow  row  = userResolver.SelectRowWithKeys(input.QueryString["UserId"]);
                    CorpUser user = new CorpUser();
                    user.ReadFromDataRow(row, WeCorpConst.USER_MODE);
                    user.DepartmentList = postList;
                    row["Department"]   = postList;
                    userResolver.SetCommands(AdapterCommand.Update);
                    user.Update();

                    userResolver.UpdateDatabase();
                    return(OutputData.CreateToolkitObject(userResolver.CreateKeyData()));
                }
            }
        }
        protected override OutputData DoPost(IInputData input)
        {
            Tk5TableResolver getResovler = new Tk5TableResolver(@"Weixin\CorpTagDept.xml", this);
            using (getResovler)
            {
                DataSet postDataSet = input.PostObject.Convert<DataSet>();
                getResovler.PrepareDataSet(postDataSet);

                FieldErrorInfoCollection errors = new FieldErrorInfoCollection();
                getResovler.CheckFirstConstraints(input, errors);
                getResovler.CheckLaterConstraints(input, errors);
                errors.CheckError();

                QuoteStringList postList = new QuoteStringList();
                DataTable postTable = postDataSet.Tables[getResovler.TableName];
                if (postTable != null)
                {
                    foreach (DataRow postRow in postTable.Rows)
                        postList.Add(postRow["DeparmentId"].ToString());
                }
                string tagId = input.QueryString["TagId"];

                InternalCorpUserResolver userResolver = new InternalCorpUserResolver(this);
                using (userResolver)
                {
                    DataRow row = userResolver.SelectRowWithKeys(input.QueryString["UserId"]);
                    CorpUser user = new CorpUser();
                    user.ReadFromDataRow(row, WeCorpConst.USER_MODE);
                    user.DepartmentList = postList;
                    row["Department"] = postList;
                    userResolver.SetCommands(AdapterCommand.Update);
                    user.Update();

                    userResolver.UpdateDatabase();
                    return OutputData.CreateToolkitObject(userResolver.CreateKeyData());
                }
            }
        }