コード例 #1
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Returns the graphic parts (drawing and z-order) of the visual depiction of this representation, plus any others needed to make it comprehensive.
        /// For example, a Relationship only is meaningful if, appart of showing its main-symbol and connectors, it also includes the connected symbols.
        /// </summary>
        public override IDictionary <Drawing, int> CreateIntegralGraphic()
        {
            var Result = new Dictionary <Drawing, int>();

            // Generate the connected symbols
            var Connectors       = this.VisualParts.CastAs <VisualConnector, VisualElement>();
            var ConnectedSymbols = Connectors.Where(conn => conn.OriginSymbol != conn.TargetSymbol)
                                   .Select(conn => (conn.OriginSymbol == this.MainSymbol
                                                         ? conn.TargetSymbol : conn.OriginSymbol));

            foreach (var AssociatedSymbol in ConnectedSymbols)
            {
                Result.Add(AssociatedSymbol.CreateDraw(null, false), AssociatedSymbol.ZOrder);
            }

            // Generate the relationship parts
            foreach (var Part in this.VisualParts.OrderBy(part => !(part is VisualSymbol)))
            {
                Result.Add(Part.CreateDraw(null, false), Part.ZOrder);
            }

            // Generate complements
            foreach (var Complement in this.MainSymbol.AttachedComplements)
            {
                Result.Add(Complement.CreateDraw(false), Complement.ZOrder);
            }

            return(Result);
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,UploadedImage,ImageUrl")] Complement complement)
        {
            var webRoot = Directory.GetCurrentDirectory() + "\\wwwroot\\Images\\Uploads\\";

            if (complement.UploadedImage == null)
            {
                return(View(complement));
            }

            var filename = ContentDispositionHeaderValue
                           .Parse(complement.UploadedImage.ContentDisposition)
                           .FileName
                           .Trim('"');

            filename = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\Images\\Uploads\\" + filename);
            if (Directory.Exists(webRoot))
            {
                using (FileStream fs = System.IO.File.Create(filename))
                {
                    complement.UploadedImage.CopyTo(fs);
                    fs.Flush();
                }
            }
            complement.ImageUrl = "~/Images/Uploads/" + complement.UploadedImage.FileName;

            if (ModelState.IsValid)
            {
                _context.Add(complement);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(complement));
        }
コード例 #3
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Creates and returns a copy of the supplied original Relationship and its Visual Representation, for the specified target-view and position.
        /// </summary>
        public static OperationResult <RelationshipVisualRepresentation> CreateRelationshipAndRepresentationCopy(RelationshipVisualRepresentation OriginalRelationshipRep,
                                                                                                                 View TargetView, Point Position)
        {
            // PENDING: SHOW A LITTLE CIRCLE FOR SIMPLE MAIN-SYMBOL HIDING RELATIONSHIPS.

            var NewRelationship = OriginalRelationshipRep.RepresentedRelationship.GenerateIndependentRelationshipDuplicate();

            var NewRepresentator = CreateRelationshipVisualRepresentation(NewRelationship, TargetView, Position);

            NewRepresentator.MainSymbol.IsAutoPositionable = OriginalRelationshipRep.MainSymbol.IsAutoPositionable;
            NewRepresentator.MainSymbol.AreDetailsShown    = OriginalRelationshipRep.MainSymbol.AreDetailsShown;
            NewRepresentator.MainSymbol.ResizeTo(OriginalRelationshipRep.MainSymbol.BaseWidth,
                                                 OriginalRelationshipRep.MainSymbol.BaseHeight);
            NewRepresentator.MainSymbol.DetailsPosterHeight = OriginalRelationshipRep.MainSymbol.DetailsPosterHeight;

            foreach (var Complement in OriginalRelationshipRep.MainSymbol.AttachedComplements)
            {
                var NewComplementTarget = (Complement.Target.IsGlobal
                                           ? Ownership.Create <View, VisualSymbol>(TargetView)
                                           : Ownership.Create <View, VisualSymbol>(NewRepresentator.MainSymbol));
                var NewComplement = Complement.GenerateIndependentDuplicate(NewComplementTarget);
                if (!NewComplement.Target.IsGlobal)
                {
                    NewComplement.BaseCenter = new Point(NewComplement.BaseCenter.X + (NewComplementTarget.OwnerLocal.BaseCenter.X - OriginalRelationshipRep.MainSymbol.BaseCenter.X),
                                                         NewComplement.BaseCenter.Y + (NewComplementTarget.OwnerLocal.BaseCenter.Y - OriginalRelationshipRep.MainSymbol.BaseCenter.Y));
                }

                NewRepresentator.MainSymbol.AddComplement(NewComplement);
                TargetView.PutComplement(NewComplement);
            }

            return(OperationResult.Success(NewRepresentator));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Complement complement)
        {
            if (id != complement.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(complement);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComplementExists(complement.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(complement));
        }
コード例 #5
0
ファイル: AuxeUnity.cs プロジェクト: Albeleon/Unity-C-Assets
    public static List <T> GetRecursive <T>(this GameObject go, bool isIncluded = false, int depth = -1) where T : class
    {
        List <T>   list = new List <T>();
        Complement co   = go.GetComponent <Complement>();

        if (co == null || !isIncluded || co.included)
        {
            if (typeof(T).Equals(typeof(GameObject)))
            {
                list.Add(go as T);
            }
            else if (go.GetComponent <T>() != null)
            {
                list.Add(go.GetComponent <T>());
            }
        }

        if (depth != 0 && co != null)
        {
            foreach (GameObject c in co.complement)
            {
                list.AddRange(c.GetRecursive <T>(isIncluded, depth - 1));
            }
        }

        return(list);
    }
コード例 #6
0
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(dimnType.ToString());
            xmlDoc.AppendChild(rootNode);
            if (slaveType == SlaveTypes.IEC61850Server)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr2 = xmlDoc.CreateAttribute("ReportingIndex");
                attr2.Value = iec61850reportingindex.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attrDataType = xmlDoc.CreateAttribute("DataType");
                attrDataType.Value = DataType.ToString();
                rootNode.Attributes.Append(attrDataType);

                XmlAttribute attrCommandType = xmlDoc.CreateAttribute("CommandType");
                attrCommandType.Value = CommandType.ToString();
                rootNode.Attributes.Append(attrCommandType);

                XmlAttribute attrDeadband = xmlDoc.CreateAttribute("BitPos");
                attrDeadband.Value = BitPos.ToString();
                rootNode.Attributes.Append(attrDeadband);

                XmlAttribute attrMultiplier = xmlDoc.CreateAttribute("Complement");
                attrMultiplier.Value = Complement.ToString();
                rootNode.Attributes.Append(attrMultiplier);

                XmlAttribute attrConstant = xmlDoc.CreateAttribute("Description");
                attrConstant.Value = Description.ToString();
                rootNode.Attributes.Append(attrConstant);
            }
            if ((slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN))
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
            }
            return(rootNode);
        }
コード例 #7
0
        public void Visit(Complement node)
        {
            Visit(node.Expr);
            var @int = Context.GetType("Int");

            if (node.Expr.computedType != @int)
            {
                errorLog.LogError(string.Format(ExprIsNotInt, node.Expr.Line));
            }
            node.computedType = @int;
        }
コード例 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (ZipCode != null ? ZipCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StreetName != null ? StreetName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BuildNumber != null ? BuildNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (District != null ? District.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Complement != null ? Complement.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #9
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Returns the graphic parts (drawing and z-order) of the visual depiction of this representation, plus any others needed to make it comprehensive.
        /// For example, a Relationship only is meaningful if, appart of showing its main-symbol and connectors, it also includes the connected symbols.
        /// </summary>
        public override IDictionary <Drawing, int> CreateIntegralGraphic()
        {
            var Result     = new Dictionary <Drawing, int>();
            var SourceView = this.MainSymbol.GetDisplayingView();

            // Generate the symbol
            Result.Add(this.MainSymbol.CreateDraw(null, false), this.MainSymbol.ZOrder);

            // Generate complements
            foreach (var Complement in this.MainSymbol.AttachedComplements)
            {
                Result.Add(Complement.CreateDraw(false), Complement.ZOrder);
            }

            return(Result);
        }
コード例 #10
0
        private void MapAndCreateConsultation(Patient patient, ConsultationModel model)
        {
            if (model == null)
            {
                return;
            }

            var consultation = new Consultation(patient, DateTime.Now, model.ComplementaryMethodRequested,
                                                model.Length, model.Weight, model.Alimentation, model.Comments, model.DefecatoryHabit,
                                                model.Evolution, model.SchoolPerformance, model.PhysicalExam, model.PhysicalActivity);

            var consultationId = _genericService.Create(consultation).Result;

            if (model.ComplementaryMethodRequested)
            {
                var complement = new Complement(consultationId, DateTime.Now);
                _genericService.Create(complement);
            }
        }
コード例 #11
0
ファイル: QuoteService.cs プロジェクト: mirror222/ZeroSystem
		/// <summary>
		///   回補即時報價今天的所有歷史Tick
		/// </summary>
		/// <param name="symbolId">商品代號</param>
		public override void Complement(string symbolId) {
			int iSerial = MitakeSymbolManager.ConvertToSerial(symbolId);
			if (iSerial > 0) {
				switch (iSerial) {
					case 9998:  //OTC上櫃指數
					case 9999:  //TWI加權指數
						MitakeIndex cIndex = MitakeStorage.Storage.GetIndex(iSerial);
						cIndex.ComplementStatus = ComplementStatus.Complementing;
						break;
					default:
						MitakeQuote cQuote = MitakeStorage.Storage.GetQuote(iSerial);
						cQuote.ComplementStatus = ComplementStatus.Complementing;
						break;
				}

				Complement cComplement = new Complement();
				cComplement.Serial = iSerial;
				this.Send(cComplement);
			}
		}
コード例 #12
0
        public bool Contains(S2Cell cell)
        {
            // If the cap does not contain all cell vertices, return false.
            // We check the vertices before taking the Complement() because we can't
            // accurately represent the complement of a very small cap (a height
            // of 2-epsilon is rounded off to 2).
            var vertices = new S2Point[4];

            for (var k = 0; k < 4; ++k)
            {
                vertices[k] = cell.GetVertex(k);
                if (!Contains(vertices[k]))
                {
                    return(false);
                }
            }
            // Otherwise, return true if the complement of the cap does not intersect
            // the cell. (This test is slightly conservative, because technically we
            // want Complement().InteriorIntersects() here.)
            return(!Complement.Intersects(cell, vertices));
        }
コード例 #13
0
        public Dictionary <DictionaryKey, List <BaseEntity> > SeedData()
        {
            var dictionary = new Dictionary <DictionaryKey, List <BaseEntity> >();

            var lstUserProfile = new List <BaseEntity>();
            var lstUserType    = new List <BaseEntity>();
            var lstCompany     = new List <BaseEntity>();

            lstCompany.Add(new Company()
            {
                Name = "Service Company SAC", CompanyId = 1
            });
            lstUserProfile.Add(new UserProfile()
            {
                Description = Complement.GetEnumDescription(UserProfiles.Administrador), UserProfileId = (int)UserProfiles.Administrador
            });
            lstUserProfile.Add(new UserProfile()
            {
                Description = Complement.GetEnumDescription(UserProfiles.Votante), UserProfileId = (int)UserProfiles.Votante
            });
            lstUserType.Add(new UserType()
            {
                Description = Complement.GetEnumDescription(UserTypes.Detractor), UserTypeId = (int)UserTypes.Detractor
            });
            lstUserType.Add(new UserType()
            {
                Description = Complement.GetEnumDescription(UserTypes.Neutro), UserTypeId = (int)UserTypes.Neutro
            });
            lstUserType.Add(new UserType()
            {
                Description = Complement.GetEnumDescription(UserTypes.Promotor), UserTypeId = (int)UserTypes.Promotor
            });

            dictionary.Add(DictionaryKey.Company, lstCompany);
            dictionary.Add(DictionaryKey.UserProfile, lstUserProfile);
            dictionary.Add(DictionaryKey.UserType, lstUserType);

            return(dictionary);
        }
コード例 #14
0
ファイル: CEP.cs プロジェクト: Carzuilha/CS-UsefulSources
        /// <summary>
        /// Returns the hash code of the CEP object.
        /// </summary>
        /// <returns>The CEP's hash code.</returns>
        public override int GetHashCode()
        {
            unchecked
            {
                int hashcode;

                const int baseHash       = 63689;
                const int baseMultiplier = 378551;

                hashcode = (baseHash * baseMultiplier) ^ ZipCode.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Address.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Complement.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Neighborhood.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ City.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ State.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ Unity.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ IBGE.GetHashCode();
                hashcode = (hashcode * baseMultiplier) ^ GIA.GetHashCode();

                return(hashcode);
            }
        }
コード例 #15
0
 public void Rna_complement()
 {
     Assert.Equal("UGCACCAGAAUU", Complement.OfDna("ACGTGGTCTTAA"));
 }
コード例 #16
0
 public void Rna_complement_of_cytosine_is_guanine()
 {
     Assert.That(Complement.OfDna("C"), Is.EqualTo("G"));
 }
コード例 #17
0
 public void Rna_complement()
 {
     Assert.That(Complement.OfDna("ACGTGGTCTTAA"), Is.EqualTo("UGCACCAGAAUU"));
 }
コード例 #18
0
 public void Rna_complement_of_adenine_is_uracil()
 {
     Assert.That(Complement.OfDna("A"), Is.EqualTo("U"));
 }
コード例 #19
0
 public void Rna_complement_of_thymine_is_adenine()
 {
     Assert.That(Complement.OfDna("T"), Is.EqualTo("A"));
 }
コード例 #20
0
 public void Dna_complement()
 {
     Assert.That(Complement.OfRna("UGAACCCGACAUG"), Is.EqualTo("ACTTGGGCTGTAC"));
 }
コード例 #21
0
 public void Rna_complement_of_cytosine_is_guanine()
 {
     Assert.Equal("G", Complement.OfDna("C"));
 }
コード例 #22
0
 public void Rna_complement_loweCase()
 {
     Assert.That(Complement.OfDna("acgtggtcttaa"), Is.EqualTo("UGCACCAGAAUU"));
 }
コード例 #23
0
        public ClientesAdd(Tables.Client client = null)
        {
            InitializeComponent();

            sqlClient = new Sql.Client();

            if (client != null)
            {
                idClient        = client.Id;
                clientName.Text = client.Name;
                Adress.Text     = client.Street;
                District.Text   = client.District;
                Number.Text     = client.Number.ToString();
                Complement.Text = client.Complement;
                Telephone.Text  = client.Telephone;
                Reference.Text  = client.Reference;
            }

            Loaded += ClientesAdd_Loaded;

            Number.PreviewTextInput += (sender, e) => e.Handled = new Regex("[^0-9]").IsMatch(e.Text);

            clientName.GotFocus += delegate { clientName.SelectAll(); };
            Adress.GotFocus     += delegate { Adress.SelectAll(); };
            District.GotFocus   += delegate { District.SelectAll(); };
            Number.GotFocus     += delegate { Number.SelectAll(); };
            Complement.GotFocus += delegate { Complement.SelectAll(); };
            Telephone.GotFocus  += delegate { Complement.SelectAll(); };
            Reference.GotFocus  += delegate { Reference.SelectAll(); };

            clientName.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                          {
                                                              Adress.Focus();
                                                          }
            };
            Adress.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                      {
                                                          Number.Focus();
                                                      }
            };
            Number.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                      {
                                                          District.Focus();
                                                      }
            };
            District.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                        {
                                                            Complement.Focus();
                                                        }
            };
            Complement.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                          {
                                                              Telephone.Focus();
                                                          }
            };
            Telephone.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                         {
                                                             Reference.Focus();
                                                         }
            };
            Reference.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                         {
                                                             SaveBtn_Click(null, null);
                                                         }
            };

            SaveBtn.Click  += SaveBtn_Click;
            ClearBtn.Click += ClearBtn_Click;
        }
コード例 #24
0
        /**
         * Modelo "Complemento de pago"
         * - Se especifica: la moneda, método de pago, forma de pago, cliente, y lugar de expedición
         */
        private static Facturama.Models.Request.Cfdi CreateModelCfdiPaymentComplement(FacturamaApi facturama, Facturama.Models.Response.Cfdi cfdiInicial)
        {
            Cfdi cfdi = new Cfdi();

            // Lista del catálogo de nombres en el PDF
            var nameForPdf = facturama.Catalogs.NameIds.First(m => m.Value == "14"); // Nombre en el pdf: "Complemento de pago"

            cfdi.NameId = nameForPdf.Value;

            // Receptor de comprobante (se toma como cliente el mismo a quien se emitió el CFDI Inicial),
            String clientRfc = cfdiInicial.Receiver.Rfc;
            Client client    = facturama.Clients.List().Where(p => p.Rfc.Equals(clientRfc)).First();

            Receiver receiver = new Receiver
            {
                CfdiUse = "P01",
                Name    = client.Name,
                Rfc     = client.Rfc
            };

            cfdi.Receiver = receiver;

            // Lugar de expedición (es necesario por lo menos tener una sucursal)
            BranchOffice branchOffice = facturama.BranchOffices.List().First();

            cfdi.ExpeditionPlace = "78240";

            // Fecha y hora de expecidión del comprobante
            //DateTime bindingDate;
            //DateTime.TryParse(cfdiBinding.Date, null, DateTimeStyles.RoundtripKind, out bindingDate);

            cfdi.Date     = null; // Puedes especificar una fecha por ejemplo:  DateTime.Now
            cfdi.CfdiType = CfdiType.Pago;
            // Complemento de pago ---
            Complement complement = new Complement();

            // Pueden representarse más de un pago en un solo CFDI
            List <Facturama.Models.Complements.Payment> lstPagos = new List <Facturama.Models.Complements.Payment>();

            Facturama.Models.Complements.Payment pago = new Facturama.Models.Complements.Payment();

            // Fecha y hora en que se registró el pago en el formato: "yyyy-MM-ddTHH:mm:ss"
            // (la fecha del pago debe ser menor que la fecha en que se emite el CFDI)
            // Para este ejemplo, se considera que  el pago se realizó hace una hora
            pago.Date = DateTime.Now.AddHours(-6).ToString("yyyy-MM-dd HH:mm:ss");


            // Forma de pago (Efectivo, Tarjeta, etc)
            Facturama.Models.Response.Catalogs.CatalogViewModel paymentForm = facturama.Catalogs.PaymentForms.Where(p => p.Name.Equals("Efectivo")).First();
            pago.PaymentForm = paymentForm.Value;

            // Selección de la moneda del catálogo
            // La Moneda, puede ser diferente a la del documento inicial
            // (En el caso de que sea diferente, se debe colocar el tipo de cambio)
            List <CurrencyCatalog> lstCurrencies = facturama.Catalogs.Currencies.ToList();
            CurrencyCatalog        currency      = lstCurrencies.Where(p => p.Value.Equals("MXN")).First();

            pago.Currency = currency.Value;

            // Monto del pago
            // Este monto se puede distribuir entre los documentos relacionados al pago
            pago.Amount = 100.00m;

            // Documentos relacionados con el pago
            // En este ejemplo, los datos se obtiene el cfdiInicial, pero puedes colocar solo los datos
            // aun sin tener el "Objeto" del cfdi Inicial, ya que los valores son del tipo "String"
            List <Facturama.Models.Complements.RelatedDocument> lstRelatedDocuments = new List <Facturama.Models.Complements.RelatedDocument>();

            Facturama.Models.Complements.RelatedDocument relatedDocument = new Facturama.Models.Complements.RelatedDocument
            {
                Uuid                  = cfdiInicial.Complement.TaxStamp.Uuid, // "27568D31-E579-442F-BA77-798CBF30BD7D"
                Serie                 = "A",                                  //cfdiInicial.Serie, // "EA"
                Folio                 = cfdiInicial.Folio,                    // 34853
                Currency              = currency.Value,
                PaymentMethod         = "PUE",                                // En el complemento de pago tiene que ser PUE
                PartialityNumber      = 1,
                PreviousBalanceAmount = 100.00m,
                AmountPaid            = 100.00m
            };
            lstRelatedDocuments.Add(relatedDocument);

            pago.RelatedDocuments = lstRelatedDocuments;

            lstPagos.Add(pago);

            complement.Payments = lstPagos;

            cfdi.Complement = complement;


            return(cfdi);
        }
コード例 #25
0
        /**
         * Return true if and only if the interior of this cap intersects the given
         * other cap. (This relationship is not symmetric, since only the interior of
         * this cap is used.)
         */

        public bool InteriorIntersects(S2Cap other)
        {
            // Interior(X) intersects Y if and only if Complement(Interior(X))
            // does not contain Y.
            return(!Complement.Contains(other));
        }
コード例 #26
0
 public void Rna_complement_of_thymine_is_adenine()
 {
     Assert.Equal("A", Complement.OfDna("T"));
 }
コード例 #27
0
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(dimnType.ToString());
            xmlDoc.AppendChild(rootNode);

            #region IEC61850Server
            if (slaveType == SlaveTypes.IEC61850Server)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr2 = xmlDoc.CreateAttribute("ReportingIndex");
                attr2.Value = iec61850reportingindex.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attrDataType = xmlDoc.CreateAttribute("DataType");
                attrDataType.Value = DataType.ToString();
                rootNode.Attributes.Append(attrDataType);

                XmlAttribute attrCommandType = xmlDoc.CreateAttribute("CommandType");
                attrCommandType.Value = CommandType.ToString();
                rootNode.Attributes.Append(attrCommandType);

                XmlAttribute attrDeadband = xmlDoc.CreateAttribute("BitPos");
                attrDeadband.Value = BitPos.ToString();
                rootNode.Attributes.Append(attrDeadband);

                XmlAttribute attrMultiplier = xmlDoc.CreateAttribute("Complement");
                attrMultiplier.Value = Complement.ToString();
                rootNode.Attributes.Append(attrMultiplier);

                XmlAttribute attrConstant = xmlDoc.CreateAttribute("Description");
                attrConstant.Value = Description.ToString();
                rootNode.Attributes.Append(attrConstant);
            }
            #endregion IEC61850Server

            #region SPORTSLAVE,IEC101SLAVE,IEC104,MODBUSSLAVE,UNKNOWN
            if ((slaveType == SlaveTypes.DNP3SLAVE) || (slaveType == SlaveTypes.SPORTSLAVE) || (slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN) || (slaveType == SlaveTypes.MQTTSLAVE) || (slaveType == SlaveTypes.SMSSLAVE))
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
            }
            #endregion SPORTSLAVE,IEC101SLAVE,IEC104,MODBUSSLAVE,UNKNOWN

            #region GDisplaySlave
            if (slaveType == SlaveTypes.GRAPHICALDISPLAYSLAVE)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attrCellNo = xmlDoc.CreateAttribute("CellNo");
                attrCellNo.Value = CellNo.ToString();
                rootNode.Attributes.Append(attrCellNo);

                XmlAttribute attrWidget = xmlDoc.CreateAttribute("Widget");
                attrWidget.Value = Widget.ToString();
                rootNode.Attributes.Append(attrWidget);

                //XmlAttribute attrUnit = xmlDoc.CreateAttribute("Unit");
                //attrUnit.Value = UnitID.ToString();
                //rootNode.Attributes.Append(attrUnit);

                XmlAttribute attrComplement = xmlDoc.CreateAttribute("Complement");
                attrComplement.Value = Complement.ToString();
                rootNode.Attributes.Append(attrComplement);

                XmlAttribute attrDescription = xmlDoc.CreateAttribute("Description");
                attrDescription.Value = Description.ToString();
                rootNode.Attributes.Append(attrDescription);
            }
            #endregion GDisplaySlave
            return(rootNode);
        }
コード例 #28
0
 public void Rna_complement_of_adenine_is_uracil()
 {
     Assert.Equal("U", Complement.OfDna("A"));
 }