Exemplo n.º 1
0
        /// <summary>
        /// 创建组织机构的树节点
        /// </summary>
        /// <param name="unitID"></param>
        /// <param name="child"></param>
        /// <param name="imgName"></param>
        /// <returns></returns>
        private PortalTreeNode BuildOrgChildNode(string unitID, OThinker.Organization.Unit child, string imgName, string pagePath)
        {
            //组织机构没有Code使用ObjectIDea,user对象使用Code
            string Code = child.ObjectID;

            if (child.UnitType == OThinker.Organization.UnitType.User)
            {
                Code = ((OThinker.Organization.User)child).Code;
            }

            PortalTreeNode node = new PortalTreeNode()
            {
                Text     = "_" + child.Name,//在资源文件解析的时候,如果以_开头,则返回_之后的字符串,否则会根据资源文件里面的字符串替换,组织结构名称会找不到
                ObjectID = child.ObjectID,
                Code     = Code,
                IsLeaf   = child.UnitType == OThinker.Organization.UnitType.User,
                //Icon = this.PortalImageRoot + imgName,
                Icon        = imgName,
                ParentID    = unitID,
                ShowPageUrl = GetOrgTreeNodeEditUrl(pagePath, child.UnitID, unitID),
                NodeType    = FunctionNodeType.Organization
            };

            if (!node.IsLeaf)
            {
                //if (string.IsNullOrWhiteSpace(LoadDataUrl))
                node.LoadDataUrl = GetLoadDataUrl(node.ObjectID, node.Code, FunctionNodeType.Organization);
                //else
                //    node.LoadDataUrl = LoadDataUrl + node.ObjectID;
            }
            return(node);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取组织机构类型
        /// </summary>
        /// <param name="ParameterValueStr">参数</param>
        /// <returns>组织机构类型</returns>
        public JsonResult GetOrgText(string ParameterValueStr)
        {
            string orgId = string.IsNullOrWhiteSpace(ParameterValueStr) ? this.UserValidator.User.ParentID : ParameterValueStr;

            OThinker.Organization.Unit Unit = this.Engine.Organization.GetUnit(orgId);
            return(Json(new { Name = Unit.Name, OrgID = orgId }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 5
0
        public static object LoadMvcInstanceData(string InsID, string SchemaCode)
        {
            InstanceContext context = AppUtility.Engine.InstanceManager.GetInstanceContext(InsID);

            if (context == null)
            {
                return new { Success = false, Data = "", Msg = "InstanceID错误或不存在" }
            }
            ;
            if (SchemaCode != context.BizObjectSchemaCode)
            {
                return(new { Success = false, Data = "", Msg = "SchemaCode不一致,不能进行复制" });
            }
            var schema = AppUtility.Engine.BizObjectManager.GetPublishedSchema(context.BizObjectSchemaCode);

            var fields             = schema.Fields;
            MvcDataItemTable items = new MvcDataItemTable();
            InstanceData     data  = new InstanceData(AppUtility.Engine, InsID, "");

            string[] sys_fields = new string[] { "ObjectID", "Name", "CreatedBy", "CreatedByParentId", "OwnerId", "OwnerParentId", "CreatedTime", "ModifiedBy", "ModifiedTime", "RunningInstanceId" };
            foreach (FieldSchema field in fields)
            {
                if (items.ContainsKey(field.Name))
                {
                    continue;
                }
                if (sys_fields.Contains(field.Name))
                {
                    continue;
                }
                MvcDataItem dataItem = new MvcDataItem(data[field.Name], false);
                switch (field.LogicType)
                {
                case DataLogicType.BizObject:     // 业务对象
                    dataItem.V = LoadBizObjectData(data, field);
                    break;

                case DataLogicType.BizObjectArray:    //业务对象数组
                    dataItem.V = LoadBizObjectArrayData(data, field);
                    break;

                //case DataLogicType.Comment://处理审批意见逻辑
                //    dataItem.V = LoadCommentData(field.Name);
                //    break;
                //case DataLogicType.Attachment://处理附件逻辑
                //    dataItem.V = LoadAttachmentData(field);
                //    break;
                case DataLogicType.MultiParticipant:    //处理多人参与者逻辑
                    dataItem.V = LoadMultiParticipantData(data, field);
                    break;

                case DataLogicType.SingleParticipant:    //处理单人参与者逻辑
                    string v = data[field.Name].Value + string.Empty;
                    if (!string.IsNullOrEmpty(v))
                    {
                        OThinker.Organization.Unit unit = AppUtility.Engine.Organization.GetUnit(v);
                        if (unit != null)
                        {
                            string type = string.Empty;
                            if (unit.UnitType == OThinker.Organization.UnitType.OrganizationUnit)
                            {
                                type = "O";
                            }
                            else if (unit.UnitType == OThinker.Organization.UnitType.Group)
                            {
                                type = "G";
                            }
                            else if (unit.UnitType == OThinker.Organization.UnitType.User)
                            {
                                type = "U";
                            }
                            // dataItem.V = new MvcListItem(v, this.ActionContext.Engine.Organization.GetName(v));
                            dataItem.V = new MvcListItem(v, unit.Name, null, 0, type);
                        }
                    }
                    break;
                    //case DataLogicType.Association:
                    //    dataItem.V = LoadAssociationData(field, dataItem.V + string.Empty);
                    //    break;
                }
                items.Add(field.Name, dataItem);
            }
            return(new { Success = true, Data = items, Msg = "Sucess" });
        }