Exemple #1
0
        /// <summary>
        /// 修改组织架构
        /// </summary>
        /// <param name="unit"></param>
        /// <param name="Msg"></param>
        /// <returns></returns>
        public static bool UpdateUnit(OThinker.Organization.Unit unit, string Msg)
        {
            string errMsg = "";
            bool   isTrue = true;

            OThinker.Organization.HandleResult result = OThinker.H3.Controllers.AppUtility.Engine.Organization.UpdateUnit(AdministratorID, unit);
            if (result != OThinker.Organization.HandleResult.SUCCESS)
            {
                errMsg = "更新" + unit.UnitType.ToString() + "(" + Msg + ")失败:" + result.ToString() + "," + unit.Name + ",ObjectID:" + unit.ObjectID + ",ParentID:" + unit.ParentID;

                OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(errMsg);
                isTrue = false;
            }
            else
            {
                UpdCount += 1;
                errMsg   += "更新" + unit.UnitType.ToString() + "(" + Msg + ")成功:" + result.ToString() + "," + unit.Name + ",ObjectID:" + unit.ObjectID + ",ParentID:" + unit.ParentID;
                OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(errMsg);
            }
            return(isTrue);
        }
        /// <summary>
        /// 插入组织架构
        /// </summary>
        /// <param name="unit"></param>
        /// <param name="Msg"></param>
        /// <returns></returns>
        public static bool AddUnit(OThinker.Organization.Unit unit, string Msg, SyncResult syn)
        {
            bool   isTrue = true;
            string errMsg = "";

            OThinker.Organization.HandleResult result = OThinker.H3.Controllers.AppUtility.Engine.Organization.AddUnit(AdministratorID, unit);
            if (result != OThinker.Organization.HandleResult.SUCCESS)
            {
                errMsg = "添加" + unit.UnitType.ToString() + "(" + Msg + ")失败:" + result.ToString() + "," + unit.Name + ",ObjectID:" + unit.ObjectID + ",ParentID:" + unit.ParentID;

                OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(errMsg);
                if (unit.UnitType.ToString() == "OrganizationUnit")
                {
                    syn.create_OU_Fail_Num++;
                }
                if (unit.UnitType.ToString() == "User")
                {
                    syn.create_User_Fail_Num++;
                }

                isTrue = false;
            }
            else
            {
                errMsg += "添加" + unit.UnitType.ToString() + "(" + Msg + ")成功:" + result.ToString() + "," + unit.Name + ",ObjectID:" + unit.ObjectID + ",ParentID:" + unit.ParentID;
                OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(errMsg);

                if (unit.UnitType.ToString() == "OrganizationUnit")
                {
                    syn.create_OU_Success_Num++;
                }
                if (unit.UnitType.ToString() == "User")
                {
                    syn.create_User_Success_Num++;
                }
            }


            return(isTrue);
        }