public static void Serializuj(Ukaz item, string strSoubor)
        {
            Encoding encKodovani = Encoding.UTF8;
            bool     blnOdsazeni = false;
            XmlSerializerNamespaces xsnJmenneProstory = new XmlSerializerNamespaces();

            XmlWriterSettings xws = new XmlWriterSettings();

            xws.CloseOutput = true;
            xws.Encoding    = encKodovani;
            xws.Indent      = blnOdsazeni;
            XmlSerializer xs = null;
            XmlWriter     xw = XmlTextWriter.Create(strSoubor, xws);

            if (xsnJmenneProstory == null)
            {
                xsnJmenneProstory = new XmlSerializerNamespaces();
            }

            xs = new XmlSerializer(item.GetType());
            xs.Serialize(xw, item, xsnJmenneProstory);
            xw.Close();
            xw = null;
            xs = null;
        }
示例#2
0
 public static bool NezacinaPismenem(Ukaz uk)
 {
     if (String.IsNullOrEmpty(uk.Nazev))
     {
         return(false);
     }
     return(!Char.IsLetter(uk.Nazev, 0));
 }
示例#3
0
 public static bool ZacinaMalymPismenem(Ukaz uk)
 {
     if (String.IsNullOrEmpty(uk.Nazev))
     {
         return(false);
     }
     return(Char.IsLetter(uk.Nazev, 0) && Char.IsLower(uk.Nazev, 0));
 }
示例#4
0
 //TODO: co když budu chtít porovnávat podle počtu, nikoli podle názvu?
 public int CompareTo(object obj)
 {
     if (obj is Ukaz)
     {
         Ukaz uk = (Ukaz)obj;
         return(this.Identifikator.CompareTo(uk.Identifikator));
     }
     else
     {
         throw new ArgumentException("Porovnávaný objekt není typu Ukaz");
     }
 }
示例#5
0
        public bool OdpovidaPocet(Ukaz uk)
        {
            bool bOdpovidaPodmince = false;

            if (uk == null)
            {
                return(bOdpovidaPodmince);
            }

            switch (this.Porovnani)
            {
            case Operator.JeRovno:
                bOdpovidaPodmince = (uk.Pocet == this.Pocet);
                break;

            case Operator.JeVetsi:
                bOdpovidaPodmince = (uk.Pocet > this.Pocet);
                break;

            case Operator.JeVetsiRovno:
                bOdpovidaPodmince = (uk.Pocet >= this.Pocet);
                break;

            case Operator.JeMensi:
                bOdpovidaPodmince = (uk.Pocet < this.Pocet);
                break;

            case Operator.JeMensiRovno:
                bOdpovidaPodmince = (uk.Pocet <= this.Pocet);
                break;

            case Operator.NeniRovno:
                bOdpovidaPodmince = (uk.Pocet != this.Pocet);
                break;

            default:
                break;
            }

            return(bOdpovidaPodmince);
        }
示例#6
0
        public bool ObsahujeText(Ukaz uk)
        {
            const char mcchHraniceSlova = '\u2038';
            bool       bObsahuje        = false;

            if (uk.Nazev == null)
            {
                return(bObsahuje);
            }


            string sText = this.NerozlisovatVelikostPismen ? Text.ToLower() : Text;

            if (sText == null)
            {
                return(bObsahuje);
            }

            if (Text.Length == 0)
            {
                return(true);
            }
            string sSrovnani = this.NerozlisovatVelikostPismen ? uk.Nazev.ToLower() : uk.Nazev;

            if (sText[0] == mcchHraniceSlova)
            {
                sText = sText.Substring(1);
                return(sSrovnani.StartsWith(sText));
            }

            if (sText[sText.Length - 1] == mcchHraniceSlova)
            {
                sText = sText.Substring(0, sText.Length - 1);
                return(sSrovnani.EndsWith(sText));
            }

            return(sSrovnani.Contains(sText));
        }