コード例 #1
0
        private void BindAbilityLevelsToDoubleListBox(OccurrenceTypeAttribute ota)
        {
            LookupCollection allAbilityLevels       = new LookupCollection(Convert.ToInt32(LookupTypeIDSetting));
            LookupCollection availableAbilityLevels = new LookupCollection();
            LookupCollection selectedAbilityLevels  = new LookupCollection();

            foreach (Lookup abilityLevel in allAbilityLevels)
            {
                if (ota.AbilityLevelLookupIDs.Contains(abilityLevel.LookupID))
                {
                    selectedAbilityLevels.Add(abilityLevel);
                }
                else
                {
                    availableAbilityLevels.Add(abilityLevel);
                }
            }

            dlbAbilityLevels.ListBoxRight.DataSource     = selectedAbilityLevels;
            dlbAbilityLevels.ListBoxRight.DataTextField  = "Value";
            dlbAbilityLevels.ListBoxRight.DataValueField = "LookupID";
            dlbAbilityLevels.ListBoxRight.DataBind();

            dlbAbilityLevels.ListBoxLeft.DataSource     = availableAbilityLevels;
            dlbAbilityLevels.ListBoxLeft.DataTextField  = "Value";
            dlbAbilityLevels.ListBoxLeft.DataValueField = "LookupID";
            dlbAbilityLevels.ListBoxLeft.DataBind();
        }
コード例 #2
0
        private static LookupCollection RawFilesinFrame(binFrame frame, out int nRawfiles)
        {
            //Need the Rawfile names
            LookupCollection rawFilesColl = new LookupCollection();

            string rawFileName;

            nRawfiles = 0;
            for (int i = frame.scan.GetLowerBound(0); i <= frame.scan.GetUpperBound(0); i++)
            {
                if (frame.scan[i].rawFileName != null)
                {
                    rawFileName = frame.scan[i].rawFileName.Trim();
                    if (!rawFilesColl.Contains(rawFileName))
                    {
                        int initScansNum = 1;
                        rawFilesColl.Add(rawFileName, initScansNum);
                    }
                    else
                    {
                        int oneMore = (int)rawFilesColl[rawFileName] + 1;
                        rawFilesColl[rawFileName] = oneMore;
                    }
                }
            }

            nRawfiles = rawFilesColl.Count;

            return(rawFilesColl);
        }
コード例 #3
0
        /* public static LookupCollection countRawFiles(string fileXml,out int nRawfiles)
         * {
         *
         *  //Initialize necessary objets for XML reading
         *  XmlTextReader reader = new XmlTextReader(fileXml);
         *  XmlNodeType nType = reader.NodeType;
         *  XmlDocument xmldoc = new XmlDocument();
         *  xmldoc.Load(reader);
         *
         *  //Initialize the AminoacidList[] tAaList
         *  XmlNodeList xmlnodeMatch = xmldoc.GetElementsByTagName("peptide_match");
         *
         *  //Need the Rawfile names
         *  LookupCollection rawFilesColl = new LookupCollection();
         *
         *  string rawFileName;
         *  nRawfiles = 0;
         *  foreach (XmlNode node in xmlnodeMatch)
         *  {
         *      foreach (XmlNode chNode in node.ChildNodes)
         *      {
         *          if (chNode.Name == "RAWFileName")
         *          {
         *              rawFileName = chNode.InnerText.ToString().Trim();
         *
         *              if (!rawFilesColl.Contains(rawFileName))
         *              {
         *                  int initScansNum = 1;
         *                  rawFilesColl.Add(rawFileName, initScansNum);
         *              }
         *              else
         *              {
         *                  int oneMore = (int)rawFilesColl[rawFileName] + 1;
         *                  rawFilesColl[rawFileName] = oneMore;
         *              }
         *
         *          }
         *      }
         *  }
         *  nRawfiles = rawFilesColl.Count;
         *
         *  return rawFilesColl;
         *
         * }
         */

        public static LookupCollection countRawFiles(DataView _quiXMLv, out int nRawfiles)
        {
            //Need the Rawfile names
            LookupCollection rawFilesColl = new LookupCollection();


            string rawFileName;

            nRawfiles = 0;
            for (int i = 0; i < _quiXMLv.Count; i++)
            {
                rawFileName = _quiXMLv[i]["RAWFileName"].ToString().Trim();

                if (!rawFilesColl.Contains(rawFileName))
                {
                    int initScansNum = 1;
                    rawFilesColl.Add(rawFileName, initScansNum);
                }
                else
                {
                    int oneMore = (int)rawFilesColl[rawFileName] + 1;
                    rawFilesColl[rawFileName] = oneMore;
                }
            }

            nRawfiles = rawFilesColl.Count;

            return(rawFilesColl);
        }
 private void Project(IEventEnvelope eventEnvelope)
 {
     switch (eventEnvelope.Data)
     {
     case (NodeContainerSpecificationAdded @event):
         _nodeContainerSpecifications.Add(@event.Specification);
         break;
     }
 }
コード例 #5
0
 private void Project(IEventEnvelope eventEnvelope)
 {
     switch (eventEnvelope.Data)
     {
     case (ManufacturerAdded @event):
         _manufacturer.Add(@event.Manufacturer);
         break;
     }
 }
コード例 #6
0
ファイル: Lookup.cs プロジェクト: khateeb101/ASPHTML5
        private LookupCollection InitializeCollection(DataTable dt)
        {
            LookupCollection retVal = null;

            if (dt != null && dt.Columns.Count > 0)
            {
                retVal = new LookupCollection();
                foreach (DataRow row in dt.Rows)
                {
                    Lookup item = InitializeObject(row);
                    retVal.Add(item);
                }
            }
            return(retVal);
        }
        private void Project(IEventEnvelope eventEnvelope)
        {
            switch (eventEnvelope.Data)
            {
            case (SpanStructureSpecificationAdded @event):
                _spanStructureSpecifications.Add(@event.Specification);
                break;

            case (SpanStructureSpecificationDeprecated @event):
                _spanStructureSpecifications[@event.SpanStructureSpecificationId] = _spanStructureSpecifications[@event.SpanStructureSpecificationId] with {
                    Deprecated = true
                };
                break;
            }
        }
    }
コード例 #8
0
        public static LookupCollection countRawFiles(string fileXml, out int nRawfiles)
        {
            //Initialize necessary objets for XML reading
            XmlTextReader reader = new XmlTextReader(fileXml);
            XmlNodeType   nType  = reader.NodeType;
            XmlDocument   xmldoc = new XmlDocument();

            xmldoc.Load(reader);

            //Initialize the AminoacidList[] tAaList
            XmlNodeList xmlnodeMatch = xmldoc.GetElementsByTagName("peptide_match");

            //Need the Rawfile names
            LookupCollection rawFilesColl = new LookupCollection();

            string rawFileName;

            nRawfiles = 0;
            foreach (XmlNode node in xmlnodeMatch)
            {
                foreach (XmlNode chNode in node.ChildNodes)
                {
                    if (chNode.Name == "RAWFileName")
                    {
                        rawFileName = chNode.InnerText.ToString().Trim();

                        if (!rawFilesColl.Contains(rawFileName))
                        {
                            int initScansNum = 1;
                            rawFilesColl.Add(rawFileName, initScansNum);
                        }
                        else
                        {
                            int oneMore = (int)rawFilesColl[rawFileName] + 1;
                            rawFilesColl[rawFileName] = oneMore;
                        }
                    }
                }
            }
            nRawfiles = rawFilesColl.Count;

            return(rawFilesColl);
        }
 private void Apply(SpanEquipmentSpecificationAdded @event)
 {
     _spanEquipmentSpecifications.Add(@event.Specification);
 }
コード例 #10
0
ファイル: GenerateXML.cs プロジェクト: RefreshCache/arena-ccv
        private string CreateStaffXML()
        {
            StringBuilder sbMessages = new StringBuilder();

            AttributeGroup StaffDetailsGroup = new AttributeGroup(StaffDetailsAttributeGroupID);

            Arena.Core.Attribute departmentAttribute = new Arena.Core.Attribute(DepartmentAttributeID);
            LookupType           departments         = new LookupType(Convert.ToInt32(departmentAttribute.TypeQualifier));

            List <StaffMember> staff  = new List <StaffMember>();
            PersonCollection   people = new PersonCollection();

            people.LoadStaffMembers();
            foreach (Person person in people)
            {
                string title              = string.Empty;
                Lookup department         = null;
                Lookup departmentPosition = null;

                PersonAttribute pa = (PersonAttribute)person.Attributes.FindByID(PositionAttributeID);
                if (pa != null)
                {
                    title = pa.StringValue;
                }

                pa = (PersonAttribute)person.Attributes.FindByID(DepartmentAttributeID);
                if (pa != null && pa.IntValue != -1)
                {
                    department = new Lookup(pa.IntValue);
                }

                pa = (PersonAttribute)person.Attributes.FindByID(DepartmentPositionAttributeID);
                if (pa != null && pa.IntValue != -1)
                {
                    departmentPosition = new Lookup(pa.IntValue);
                }

                if (department != null && departmentPosition != null)
                {
                    staff.Add(new StaffMember(
                                  person.PersonID,
                                  person.PersonGUID,
                                  person.NickName,
                                  person.LastName,
                                  person.Blob != null ? person.Blob.GUID : Guid.Empty,
                                  person.Emails.FirstActive,
                                  title,
                                  department,
                                  departmentPosition));
                }
            }

            staff.Sort();

            // Delete any existing department XML files in the staff folder
            DirectoryInfo staffFolder = new DirectoryInfo(Path.Combine(XMLFolderPath, "Staff"));

            if (staffFolder.Exists)
            {
                foreach (FileInfo fi in staffFolder.GetFiles())
                {
                    try
                    {
                        fi.Delete();
                    }
                    catch (System.Exception ex)
                    {
                        sbMessages.AppendFormat("Could not delete {0} file: {1}\n", fi.FullName, ex.Message);
                    }
                }
            }
            else
            {
                staffFolder.Create();
            }

            if (staff.Count > 0)
            {
                LookupCollection activeDepartments = new LookupCollection();

                Lookup      currentDepartment = new Lookup();
                XmlDocument xdoc           = null;
                XmlNode     departmentNode = null;

                foreach (StaffMember StaffMember in staff)
                {
                    if (currentDepartment.LookupID != StaffMember.Department.LookupID)
                    {
                        if (xdoc != null)
                        {
                            string path = Path.Combine(staffFolder.FullName, currentDepartment.Guid.ToString() + ".xml");
                            try
                            {
                                xdoc.Save(path);
                            }
                            catch (System.Exception ex)
                            {
                                sbMessages.AppendFormat("Could not save {0} file: {1}\n", path, ex.Message);
                            }
                        }

                        currentDepartment = StaffMember.Department;
                        activeDepartments.Add(currentDepartment);

                        xdoc           = new XmlDocument();
                        departmentNode = xdoc.CreateNode(XmlNodeType.Element, "department", xdoc.NamespaceURI);
                        XmlAttribute xattr = xdoc.CreateAttribute("", "name", xdoc.NamespaceURI);
                        xattr.Value = currentDepartment.Value;
                        departmentNode.Attributes.Append(xattr);
                        xdoc.AppendChild(departmentNode);
                    }

                    departmentNode.AppendChild(StaffMember.XMLNode(xdoc));

                    if (StaffMember.DepartmentPosition.Qualifier2 == "1")
                    {
                        XmlDocument xdocStaff  = new XmlDocument();
                        XmlNode     xnodeStaff = StaffMember.XMLNode(xdocStaff);
                        xdocStaff.AppendChild(xnodeStaff);

                        if (_assistantTypeID != -1)
                        {
                            RelationshipCollection relationships = new RelationshipCollection(StaffMember.ID);
                            foreach (Relationship relationship in relationships)
                            {
                                if (relationship.RelationshipTypeId == _assistantTypeID)
                                {
                                    XmlNode xnodeAssistant = xdocStaff.CreateNode(XmlNodeType.Element, "assistant", xdocStaff.NamespaceURI);

                                    XmlAttribute xattr = xdocStaff.CreateAttribute("", "fn", xdocStaff.NamespaceURI);
                                    xattr.Value = relationship.RelatedPerson.NickName;
                                    xnodeAssistant.Attributes.Append(xattr);

                                    xattr       = xdocStaff.CreateAttribute("", "ln", xdocStaff.NamespaceURI);
                                    xattr.Value = relationship.RelatedPerson.LastName;
                                    xnodeAssistant.Attributes.Append(xattr);

                                    xattr       = xdocStaff.CreateAttribute("", "email", xdocStaff.NamespaceURI);
                                    xattr.Value = relationship.RelatedPerson.Emails.FirstActive;
                                    xnodeAssistant.Attributes.Append(xattr);

                                    xnodeStaff.AppendChild(xnodeAssistant);

                                    break;
                                }
                            }
                        }

                        PersonAttributeCollection pAttributes = new PersonAttributeCollection();
                        pAttributes.LoadByGroup(StaffDetailsGroup, StaffMember.ID);
                        foreach (PersonAttribute pa in pAttributes)
                        {
                            if (pa.AttributeType == Arena.Enums.DataType.Document)
                            {
                                if (BioDocumentTypeID != -1 && pa.TypeQualifier == BioDocumentTypeID.ToString())
                                {
                                    Arena.Utility.ArenaDataBlob bioDoc = new Arena.Utility.ArenaDataBlob(pa.IntValue);
                                    if (bioDoc.FileExtension == "txt")
                                    {
                                        ASCIIEncoding enc = new ASCIIEncoding();
                                        string        bio = enc.GetString(bioDoc.ByteArray);

                                        if (bio != string.Empty)
                                        {
                                            XmlNode xnodeBio = xdocStaff.CreateNode(XmlNodeType.Element, "biography", xdocStaff.NamespaceURI);
                                            xnodeBio.AppendChild(xdocStaff.CreateCDataSection(bio));
                                            xnodeStaff.AppendChild(xnodeBio);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                XmlNode xnodeAttribute = xdocStaff.CreateNode(XmlNodeType.Element, "attribute", xdocStaff.NamespaceURI);

                                XmlAttribute xattr = xdocStaff.CreateAttribute("", "name", xdocStaff.NamespaceURI);
                                xattr.Value = pa.AttributeName;
                                xnodeAttribute.Attributes.Append(xattr);

                                xattr       = xdocStaff.CreateAttribute("", "value", xdocStaff.NamespaceURI);
                                xattr.Value = pa.ToString();
                                xnodeAttribute.Attributes.Append(xattr);

                                xnodeStaff.AppendChild(xnodeAttribute);
                            }
                        }

                        string path = Path.Combine(staffFolder.FullName, StaffMember.Guid.ToString() + ".xml");
                        try
                        {
                            xdocStaff.Save(path);
                        }
                        catch (System.Exception ex)
                        {
                            sbMessages.AppendFormat("Could not save {0} file: {1}\n", path, ex.Message);
                        }
                    }
                }

                if (xdoc != null)
                {
                    string path = Path.Combine(staffFolder.FullName, currentDepartment.Guid.ToString() + ".xml");
                    try
                    {
                        xdoc.Save(path);
                    }
                    catch (System.Exception ex)
                    {
                        sbMessages.AppendFormat("Could not save {0} file: {1}\n", path, ex.Message);
                    }
                }

                XmlDocument xdocDepartments  = new XmlDocument();
                XmlNode     xnodeDepartments = xdocDepartments.CreateNode(XmlNodeType.Element, "departments", xdocDepartments.NamespaceURI);
                xdocDepartments.AppendChild(xnodeDepartments);

                foreach (Lookup activeDepartment in activeDepartments)
                {
                    XmlNode xnodeDepartment = xdocDepartments.CreateNode(XmlNodeType.Element, "department", xdocDepartments.NamespaceURI);

                    XmlAttribute xattr = xdocDepartments.CreateAttribute("", "guid", xdocDepartments.NamespaceURI);
                    xattr.Value = activeDepartment.Guid.ToString();
                    xnodeDepartment.Attributes.Append(xattr);

                    xattr       = xdocDepartments.CreateAttribute("", "name", xdocDepartments.NamespaceURI);
                    xattr.Value = activeDepartment.Value;
                    xnodeDepartment.Attributes.Append(xattr);

                    XmlNode xnodeDeptDescription = xdocDepartments.CreateNode(XmlNodeType.Element, "description", xdocDepartments.NamespaceURI);
                    xnodeDeptDescription.InnerText = activeDepartment.Qualifier8;
                    xnodeDepartment.AppendChild(xnodeDeptDescription);

                    xnodeDepartments.AppendChild(xnodeDepartment);
                }

                try
                {
                    xdocDepartments.Save(Path.Combine(staffFolder.FullName, "departments.xml"));
                }
                catch (System.Exception ex)
                {
                    sbMessages.AppendFormat("Could not save {0} file: {1}\n", Path.Combine(staffFolder.FullName, "departments.xml"), ex.Message);
                }
            }

            return(sbMessages.ToString());
        }
 private void Apply(NodeContainerSpecificationAdded @event)
 {
     _nodeContainerSpecifications.Add(@event.Specification);
 }
コード例 #12
0
ファイル: MainPage.cs プロジェクト: Snsubuga/mine
 private IList<ReturnedInfo> OrderByDateReturned(IList<ReturnedInfo> returns)
 {
     LookupCollection ordered = new LookupCollection();
     foreach (ReturnedInfo ret in returns)
     {
         ordered.Add(ret.ReturnId, Convert.ToDateTime(ret.ReturnDate));
     }
     IList<ReturnedInfo> orderedList = new List<ReturnedInfo>();
     Object[] o = new Object[ordered.Count];
     ordered.Keys.CopyTo(o, 0);
     Array.Reverse(o);
     foreach (Object oo in o)
     {
         foreach (ReturnedInfo rt in returns)
         {
             if (rt.ReturnId == (String)oo)
             {
                 orderedList.Add(rt);
             }
         }
     }
     return orderedList;
 }
コード例 #13
0
ファイル: MainPage.cs プロジェクト: Snsubuga/mine
 private IList<IssueInfo> OrderByDateIssued(IList<IssueInfo> issues)
 {
     LookupCollection ordered = new LookupCollection();
     foreach (IssueInfo issue in issues)
     {
         ordered.Add(issue.IssueId, Convert.ToDateTime(issue.IssueDate));
     }
     IList<IssueInfo> orderedList = new List<IssueInfo>();
     Object[] o = new Object[ordered.Count];
     ordered.Keys.CopyTo(o, 0);
     Array.Reverse(o);
     foreach (Object oo in o)
     {
         foreach (IssueInfo iss in issues)
         {
             if (iss.IssueId == (String)oo)
             {
                 orderedList.Add(iss);
             }
         }
     }
     return orderedList;
 }