示例#1
0
        public bool UpdateDetails(MaterialHierarchyType argsType)
        {
            MaterialHierarchy matGroup;

            switch (argsType)
            {
            case MaterialHierarchyType.Class:
            {
                // Assign new action if action is empty or view
                if (ClassAction == string.Empty || ClassAction == Constants.ViewAction)
                {
                    ClassAction = Constants.InsertAction;
                }
                matGroup = new MaterialClass
                {
                    Id          = ClassId.ToUpper(),
                    Description = ClassName,
                    Action      = ClassAction,
                    CreatedDate = ClassCreatedDate
                };
                break;
            }

            case MaterialHierarchyType.Type:
            {
                // Assign new action if action is empty or view
                if (TypeAction == string.Empty || TypeAction == Constants.ViewAction)
                {
                    TypeAction = Constants.InsertAction;
                }
                matGroup = new MaterialType
                {
                    Id            = TypeId.ToUpper(),
                    MaterialClass = new MaterialClass {
                        Id = TypeClassId
                    },
                    Description = TypeName,
                    Action      = TypeAction,
                    CreatedDate = TypeCreatedDate
                };
                break;
            }

            default:
            {
                // Assign new action if action is empty or view
                if (GroupAction == string.Empty || GroupAction == Constants.ViewAction)
                {
                    GroupAction = Constants.InsertAction;
                }
                matGroup = new MaterialGroup
                {
                    Id            = GroupId.ToUpper(),
                    MaterialClass = new MaterialClass {
                        Id = GroupClassId
                    },
                    MaterialType = new MaterialType {
                        Id = GroupTypeId
                    },
                    Description = GroupName,
                    Action      = GroupAction,
                    CreatedDate = GroupCreatedDate,
                    //Margin = Margin
                };
                break;
            }
            }
            matGroup.DataBaseInfo          = UserContext.DataBaseInfo;
            matGroup.MaterialHierarchyType = argsType;
            return(_controlPanel.SetMaterialHierarchies(new MaterialHierarchies {
                matGroup
            }));
        }