public void DisConnect() { // save connection in database PLMPackEntities db = new PLMPackEntities(); AspNetUser aspNetUser = AspNetUser.GetByUserName(db, UserName); aspNetUser.Disconnect(db); }
public void RemoveInterest(string grpId) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); Group grp = Group.GetById(db, grpId); user.RemoveGroupOfInterest(db, grp); }
public void ShareTreeNode(DCTreeNode dcNode, DCGroup dcGroup) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); Group gp = Group.GetById(db, dcGroup.ID); TreeNode node = TreeNode.GetById(db, dcNode.ID); node.Share(db, user, gp); }
public void UpdateParamDefaultValues(Guid g, DCParamDefaultValue[] paramDefaultValue) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); Component c = Component.GetByGuid(db, g); for (int i = 0; i < paramDefaultValue.Length; ++i) { DCParamDefaultValue param = paramDefaultValue[i]; c.InsertParamDefaultValue(db, user.GroupId, param.Name, param.Value); } }
public DCCardboadFormat CreateNewCardboardFormat(string name, string description, double length, double width) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); Group gp = Group.GetById(db, user.GroupId); CardboardFormat cf = CardboardFormat.CreateNew(db, gp, name, description, length, width); return(new DCCardboadFormat() { ID = cf.Id, Name = cf.Name, Description = cf.Description, Length = cf.Length, Width = cf.Width }); }
public DCTreeNode[] GetTreeNodeChildrens(Guid nodeId) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); TreeNode node = TreeNode.GetById(db, nodeId); List <DCTreeNode> listTreeNode = new List <DCTreeNode>(); foreach (TreeNode tn in node.ChildrensByUser(db, user)) { listTreeNode.Add(Db_2_DCTreeNode(db, user, tn)); } return(listTreeNode.ToArray()); }
public DCUser GetUser() { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name); return(new DCUser() { ID = user.Id, Name = user.UserName, Email = user.Email, Phone = user.PhoneNumber, GroupID = user.GroupId }); }
public DCCardboadFormat GetCardboardFormatByID(int id) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); CardboardFormat cf = CardboardFormat.GetById(db, id); return(new DCCardboadFormat() { ID = cf.Id, Name = cf.Name, Description = cf.Description, Length = cf.Length, Width = cf.Width }); }
public DCCardboadFormat GetCardboardFormatByName(string name) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); CardboardFormat cf = CardboardFormat.GetByName(db, user.CurrentGroup(db), name); return(new DCCardboadFormat() { ID = cf.Id, Name = cf.Name, Description = cf.Description, Length = cf.Length, Width = cf.Width }); }
public DCCardboardProfile CreateNewCardboardProfile(string name, string description, string code, double thickness) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); CardboardProfile cf = CardboardProfile.CreateNew(db, user.CurrentGroup(db), name, description, code, thickness); return(new DCCardboardProfile() { ID = cf.Id, Name = cf.Name, Description = cf.Description, Code = cf.Code, Thickness = thickness }); }
public DCCardboardProfile GetCardboardProfileByName(string name) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); CardboardProfile cp = CardboardProfile.GetByName(db, user.CurrentGroup(db), name); return(new DCCardboardProfile() { ID = cp.Id, Name = cp.Name, Description = cp.Description, Code = cp.Code, Thickness = cp.Thickness }); }
public DCTreeNode GetUserRootNode() { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); TreeNode tnRoot = TreeNode.GetUserRootNode(db, user); return(new DCTreeNode() { ID = new Guid(tnRoot.Id), ParentNodeID = Guid.Empty, Name = tnRoot.Name, Description = tnRoot.Description, NodeType = DCNodeTypeEnum.NTBranch, HasChildrens = tnRoot.HasChildrens }); }
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; } }
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; } }
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; } }
public DCUser Connect() { // save connection in database PLMPackEntities db = new PLMPackEntities(); AspNetUser aspNetUser = AspNetUser.GetByUserName(db, UserName); if (null == aspNetUser) { return(null); } aspNetUser.Connect(db); return(new DCUser() { ID = aspNetUser.Id, Name = aspNetUser.UserName, Email = aspNetUser.Email, Phone = aspNetUser.PhoneNumber, GroupID = aspNetUser.GroupId }); }
public DCParamDefaultValue[] GetParamDefaultValues(Guid g) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); Component c = Component.GetByGuid(db, g); Dictionary <string, double> dictDefaultValues = c.GetParamDefaultValues(db, user.GroupId); DCParamDefaultValue[] paramDefaultValue = new DCParamDefaultValue[dictDefaultValues.Count]; int iCount = 0; foreach (KeyValuePair <string, double> entry in dictDefaultValues) { paramDefaultValue[iCount++] = new DCParamDefaultValue() { Name = entry.Key, Value = entry.Value } } ; return(paramDefaultValue); }
public DCMajorationSet UpdateMajorationSet(Guid g, DCMajorationSet majorationSet) { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); CardboardProfile cp = CardboardProfile.GetByID(db, majorationSet.Profile.ID); Component comp = Component.GetByGuid(db, g); Dictionary <string, double> dict = new Dictionary <string, double>(); foreach (DCMajoration maj in majorationSet.Majorations) { dict.Add(maj.Name, maj.Value); } comp.UpdateMajorationSet(db, cp, dict); // retrieve majoration set Dictionary <string, double> dictOut = comp.GetMajorationSet(db, cp); DCMajorationSet majoSetOut = new DCMajorationSet() { Profile = new DCCardboardProfile() { ID = cp.Id, Name = cp.Name, Description = cp.Description, Code = cp.Code, Thickness = cp.Thickness }, Majorations = new DCMajoration[dictOut.Count] }; int iCount = 0; foreach (KeyValuePair <string, double> v in dictOut) { majoSetOut.Majorations[iCount] = new DCMajoration() { Name = v.Key, Value = v.Value }; ++iCount; } return(majoSetOut); }
public DCCardboadFormat[] GetAllCardboardFormats() { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); CardboardFormat[] cardboardFormats = CardboardFormat.GetAll(db, user.CurrentGroup(db)); List <DCCardboadFormat> listCardboardFormat = new List <DCCardboadFormat>(); foreach (CardboardFormat cf in cardboardFormats) { listCardboardFormat.Add(new DCCardboadFormat() { ID = cf.Id, Name = cf.Name, Description = cf.Description, Length = cf.Length, Width = cf.Width } ); } return(listCardboardFormat.ToArray()); }
public DCTreeNode[] GetRootNodes() { PLMPackEntities db = new PLMPackEntities(); AspNetUser user = AspNetUser.GetByUserName(db, UserName); TreeNode[] rootNodes = TreeNode.GetRootNodes(db, user); List <DCTreeNode> listTreeNode = new List <DCTreeNode>(); foreach (TreeNode tn in rootNodes) { listTreeNode.Add(new DCTreeNode() { ID = new Guid(tn.Id), ParentNodeID = Guid.Empty, Name = tn.Name, Description = tn.Description, NodeType = DCNodeTypeEnum.NTBranch, HasChildrens = tn.HasChildrens } ); } return(listTreeNode.ToArray()); }