示例#1
0
        public DCTreeNode CreateNewNodeComponent(DCTreeNode parentNode, string name, string description, DCThumbnail thumb
            , DCFile compFile, Guid compGuid, DCMajorationSet[] majorationSets, DCParamDefaultValue[] defaultValues)
        {
            try
            {
                PLMPackEntities db0 = new PLMPackEntities();
                AspNetUser user = AspNetUser.GetByUserName(db0, UserName);
                TreeNode tnParent = TreeNode.GetById(db0, parentNode.ID);
                TreeNode tnComponent = tnParent.InsertComponent(
                    db0, user.GroupId,
                    name, description,
                    compFile.Guid, compGuid,
                    Thumbnail.GetByID(db0, thumb.ID));

                // retrieve component
                PLMPackEntities db1 = new PLMPackEntities();
                Component comp = Component.GetByGuid(db1, compGuid);

                // insert default parameter values
                foreach (DCParamDefaultValue pdv in defaultValues)
                    comp.InsertParamDefaultValue(db1, user.GroupId, pdv.Name, pdv.Value);

                // set majoration set
                foreach (DCMajorationSet mjset in majorationSets)
                {
                    CardboardProfile cp = CardboardProfile.GetByID(db0, mjset.Profile.ID);
                    Dictionary<string, double> dictMajorations = new Dictionary<string,double>();
                    foreach (DCMajoration maj in mjset.Majorations)
                        dictMajorations[maj.Name] = maj.Value;
                    comp.UpdateMajorationSet(db1, cp, dictMajorations);
                }
                return Db_2_DCTreeNode(db1, user, tnComponent);
            }
            catch (Exception ex)
            {
                string message = ex.ToString();
                throw ex;
            }
        }
示例#2
0
 public DCTreeNode CreateNewNodeDocument(DCTreeNode parentNode, string name, string description, DCThumbnail thumb
     , DCFile dFile)
 {
     try
     {
         PLMPackEntities db = new PLMPackEntities();
         AspNetUser user = AspNetUser.GetByUserName(db, UserName);
         TreeNode tnParent = TreeNode.GetById(db, parentNode.ID);
         TreeNode tnDocument = tnParent.InsertDocument(db, user.GroupId, name, description, FileToDocType(dFile), dFile.Guid, dFile.Extension, Thumbnail.GetByID(db, thumb.ID));
         return Db_2_DCTreeNode(db, user, tnDocument);
     }
     catch (Exception ex)
     {
         string message = ex.ToString();
         throw ex;
     }
 }
示例#3
0
 public DCTreeNode CreateNewNodeBranch(DCTreeNode parentNode, string name, string description, DCThumbnail thumb)
 {
     try
     {
         PLMPackEntities db = new PLMPackEntities();
         AspNetUser user = AspNetUser.GetByUserName(db, UserName);
         TreeNode tnParent = TreeNode.GetById(db, parentNode.ID);
         TreeNode tnBranch = tnParent.InsertBranch(db, user.GroupId, name, description, Thumbnail.GetByID(db, thumb.ID));
         return Db_2_DCTreeNode(db, user, tnBranch);
     }
     catch (Exception ex)
     {
         string message = ex.ToString();
         throw ex;
     }
 }
示例#4
0
        public DCTreeNode CreateNewNodeComponent(DCTreeNode parentNode, string name, string description, DCThumbnail thumb
                                                 , DCFile compFile, Guid compGuid, DCMajorationSet[] majorationSets, DCParamDefaultValue[] defaultValues)
        {
            try
            {
                PLMPackEntities db0         = new PLMPackEntities();
                AspNetUser      user        = AspNetUser.GetByUserName(db0, UserName);
                TreeNode        tnParent    = TreeNode.GetById(db0, parentNode.ID);
                TreeNode        tnComponent = tnParent.InsertComponent(
                    db0, user.GroupId,
                    name, description,
                    compFile.Guid, compGuid,
                    Thumbnail.GetByID(db0, thumb.ID));

                // retrieve component
                PLMPackEntities db1  = new PLMPackEntities();
                Component       comp = Component.GetByGuid(db1, compGuid);

                // insert default parameter values
                foreach (DCParamDefaultValue pdv in defaultValues)
                {
                    comp.InsertParamDefaultValue(db1, user.GroupId, pdv.Name, pdv.Value);
                }

                // set majoration set
                foreach (DCMajorationSet mjset in majorationSets)
                {
                    CardboardProfile            cp = CardboardProfile.GetByID(db0, mjset.Profile.ID);
                    Dictionary <string, double> dictMajorations = new Dictionary <string, double>();
                    foreach (DCMajoration maj in mjset.Majorations)
                    {
                        dictMajorations[maj.Name] = maj.Value;
                    }
                    comp.UpdateMajorationSet(db1, cp, dictMajorations);
                }
                return(Db_2_DCTreeNode(db1, user, tnComponent));
            }
            catch (Exception ex)
            {
                string message = ex.ToString();
                throw ex;
            }
        }
示例#5
0
 public DCTreeNode CreateNewNodeDocument(DCTreeNode parentNode, string name, string description, DCThumbnail thumb
                                         , DCFile dFile)
 {
     try
     {
         PLMPackEntities db         = new PLMPackEntities();
         AspNetUser      user       = AspNetUser.GetByUserName(db, UserName);
         TreeNode        tnParent   = TreeNode.GetById(db, parentNode.ID);
         TreeNode        tnDocument = tnParent.InsertDocument(db, user.GroupId, name, description, FileToDocType(dFile), dFile.Guid, dFile.Extension, Thumbnail.GetByID(db, thumb.ID));
         return(Db_2_DCTreeNode(db, user, tnDocument));
     }
     catch (Exception ex)
     {
         string message = ex.ToString();
         throw ex;
     }
 }
示例#6
0
 public DCTreeNode CreateNewNodeBranch(DCTreeNode parentNode, string name, string description, DCThumbnail thumb)
 {
     try
     {
         PLMPackEntities db       = new PLMPackEntities();
         AspNetUser      user     = AspNetUser.GetByUserName(db, UserName);
         TreeNode        tnParent = TreeNode.GetById(db, parentNode.ID);
         TreeNode        tnBranch = tnParent.InsertBranch(db, user.GroupId, name, description, Thumbnail.GetByID(db, thumb.ID));
         return(Db_2_DCTreeNode(db, user, tnBranch));
     }
     catch (Exception ex)
     {
         string message = ex.ToString();
         throw ex;
     }
 }