Example #1
0
 internal SubscriptionModule()
 {
     Log.Info("Creating");
     PrevSubValue  = null;
     this.SubTypes = new List <SubType>();
     SubTypes.Add(new SubType {
         Description = "$3.00 per month", Name = "silver"
     });
     SubTypes.Add(new SubType {
         Description = "$33.00 per year", Name = "gold"
     });
     CheckTimer          = new Timer(TimeSpan.FromMinutes(5).TotalMilliseconds);
     CheckTimer.Elapsed += CheckTimerOnElapsed;
     CheckTimer.Start();
     BroadcastTimer          = new Timer(TimeSpan.FromMinutes(3).TotalMilliseconds);
     BroadcastTimer.Elapsed += BroadcastTimerOnElapsed;
     BroadcastTimer.Start();
     Log.Info("Created");
     Task.Factory.StartNew(() => CheckTimerOnElapsed(null, null)).ContinueWith(
         x =>
         { if (x.Exception != null)
           {
               Log.Info("Get Is Subbed Failed", x.Exception);
           }
         });
 }
        public void GetSubTypes()
        {
            var subTypes = SubTypes.All();

            Assert.IsNotNull(subTypes);
            Assert.IsTrue(subTypes.Count > 1);
        }
Example #3
0
    private void sifrant_post(string anCountryID)
    {
        posta.Items.Clear();
        tip_zavezanca.Items.Clear();

        foreach (var c in Posts.Get(Convert.ToInt32(anCountryID), 0))
        {
            posta.Items.Add(new ListItem(c.acTitle + " (" + c.acISOCode + "-" + c.acCode + ")", Convert.ToString(c.anPostID)));
        }
        foreach (var t in SubTypes.Get(Convert.ToInt32(anCountryID), ""))
        {
            tip_zavezanca.Items.Add(new ListItem(t.acTitle + " (" + t.acTypeID + ")", Convert.ToString(t.acTypeID)));
        }

        sifrant_tip_zavezanca(tip_zavezanca.SelectedValue);

        if (Convert.ToInt32(anCountryID) == 206)
        {
            iskanje.ReadOnly = false;
        }
        else
        {
            iskanje.ReadOnly = true;
        }
    }
    protected void brisi_Click(object sender, EventArgs e)
    {
        var lData = SubTypes.Get(0, _id)[0];

        SubTypes.Delete(lData);
        Response.Redirect("SubTypes.aspx?msg=" + HttpUtility.UrlEncode("Izbrisano"));
    }
Example #5
0
        public async Task GetSubTypesAsync()
        {
            var subTypes = await SubTypes.AllAsync();

            Assert.IsNotNull(subTypes);
            Assert.IsTrue(subTypes.Count > 1);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Master.SelectedBox = "Ostalo";
         Master.Title       = "Ostalo";
         if (!Master.Uporabnik.Pravice.Contains("ostalo"))
         {
             throw new Exception("Nimate pravice!");
         }
         msg = Request.QueryString["msg"] ?? "";
         //_prihodkiodhodki_znesek = Convert.ToDouble(PrihodkiOdhodki.GetSkupaj(Master.Date).Rows[0]["znesek"]);
         //_osnovnasredstva_znesek = OsnovnaSredstva.GetSkupaj(Master.Date);
         _uporabniki_stetje = Uporabniki.Get().Rows.Count;
         _countrys_stetje   = Countrys.Get_d().Rows.Count;
         _posts_stetje      = Posts.Get_d().Rows.Count;
         _stranke_stetje    = Stranke.Get_d().Rows.Count;
         //_artikli_stetje = Artikli.Get("").Rows.Count;
         _subtypes_stetje = SubTypes.Get_d().Rows.Count;
         //_sporocila_stetje = Sporocila.Get().Rows.Count;
         //_posi_stetje = Posi.Get().Rows.Count;
         //poslovni_prostori_stetje = PoslovniProstori.Get().Rows.Count;
         if (!string.IsNullOrWhiteSpace(msg))
         {
             Master.SetMessage(msg);
         }
     }
     catch (Exception ee)
     {
         Master.SetMessage(ee);
     }
 }
Example #7
0
 public override string ToString()
 {
     if (SubTypes != null && SubTypes.Length > 0)
     {
         return(Identifier.ToString() + "<" + String.Join(",", SubTypes.Select(x => x.ToString())) + ">" + (Nullable ? "?" : ""));
     }
     return(Identifier.ToString() + (Nullable ? "?" : ""));
 }
Example #8
0
        public static oCMsgMovement Create(SubTypes type, zCVob vob)
        {
            int address = Process.CDECLCALL <IntArg>(0x764680, null); //_CreateInstance()

            //Konstruktor...
            Process.THISCALL <NullReturnCall>(address, 0x765930, (IntArg)(int)type, vob);
            return(new oCMsgMovement(address));
        }
Example #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Master.SelectedBox = "Ostalo";
         Master.Title       = "Tipi zavezancev";
         if (!Master.Uporabnik.Pravice.Contains("tipi_zavezancev"))
         {
             throw new Exception("Nimate pravice!");
         }
         msg   = Request.QueryString["msg"] ?? "";
         _sort = Request.QueryString["sort"] ?? "";
         if (string.IsNullOrWhiteSpace(_sort))
         {
             _sort = Convert.ToString(Session["sort_subtypes"]);
             if (string.IsNullOrWhiteSpace(_sort))
             {
                 _sort = "acTitle asc";
             }
         }
         else
         {
             Session["sort_subtypes"] = _sort;
         }
         _persistence = Convert.ToString(Session["persistence_subtypes"]) ?? "";
         DataTable dt = SubTypes.Get_w();
         if (dt.Rows.Count > 0)
         {
             if (Request.QueryString["a"] == "csv")
             {
                 Response.Clear();
                 byte[] csv = Encoding.Default.GetBytes(Splosno.Csv(dt, "tipi_zavezancev"));
                 Response.ContentType = "application/csv; name=tipi_zavezancev.csv";
                 Response.AddHeader("content-transfer-encoding", "binary");
                 Response.AddHeader("Content-Disposition", "attachment; filename=tipi_zavezancev.csv");
                 Response.OutputStream.Write(csv, 0, csv.Length);
                 Response.Flush();
                 Response.End();
             }
             else
             {
                 r_subtypes.DataSource = dt.Select("", _sort).CopyToDataTable();
                 r_subtypes.DataBind();
             }
         }
         if (!string.IsNullOrWhiteSpace(msg))
         {
             Master.SetMessage(msg);
         }
     }
     catch (Exception ee)
     {
         Master.SetMessage(ee);
     }
 }
Example #10
0
        public bool IsSubType(SubTypes subType)
        {
            foreach (SubTypes cardSubType in SubTypes)
            {
                if (subType == cardSubType)
                {
                    return(true);
                }
            }

            return(false);
        }
    protected void shrani_Click(object sender, EventArgs e)
    {
        try
        {
            naziv.Text  = naziv.Text.Trim();
            TypeID.Text = TypeID.Text.Trim();

            if (string.IsNullOrWhiteSpace(naziv.Text))
            {
                throw new Exception("Polje Naziv ne sme biti prazno!");
            }
            if (string.IsNullOrWhiteSpace(TypeID.Text))
            {
                throw new Exception("Polje ID ne sme biti prazno!");
            }
            if (string.IsNullOrWhiteSpace(drzava.Text))
            {
                throw new Exception("Polje Država ne sme biti prazno!");
            }

            if (String.IsNullOrEmpty(_id))
            {
                var lData = new SubTypes.SubType(0,
                                                 TypeID.Text,
                                                 Convert.ToInt32(drzava.SelectedValue),
                                                 naziv.Text,
                                                 DateTime.Now,
                                                 Master.Uporabnik.Id,
                                                 0);

                SubTypes.Insert(lData);
                _id = lData.acTypeID;
            }
            else
            {
                var lData = SubTypes.Get(0, _id)[0];
                lData.acTitle            = naziv.Text;
                lData.anCountryID        = Convert.ToInt32(drzava.SelectedValue);
                lData.adModificationDate = DateTime.Now;
                lData.anUserMod          = Master.Uporabnik.Id;

                SubTypes.Update(lData);
            }

            Response.Redirect("SubType.aspx?id=" + _id + "&msg=" + HttpUtility.UrlEncode("Podatki shranjeni"));
        }
        catch (Exception er)
        {
            Master.SetMessage(er.Message);
        }
    }
Example #12
0
        private Func <string, int, List <int>, SubTypes> GetEncodingMethod(SubTypes currentSubType)
        {
            switch (currentSubType)
            {
            case SubTypes.CodeA: return(DoTextEncodingForCodeA);

            case SubTypes.CodeB: return(DoTextEncodingForCodeB);

            case SubTypes.CodeC: return(DoTextEncodingForCodeC);

            default:
                throw new BarcodeException("Invalid SubType");
            }
        }
Example #13
0
        public int CountTypes(SubTypes cardSubType)
        {
            int num = 0;

            foreach (Card instance in this)
            {
                CardInfo card = instance.MetaInfo;
                foreach (SubTypes type in card.SubTypes)
                {
                    num++;
                }
            }

            return(num);
        }
Example #14
0
        public Type?GetRuntimeType()
        {
            if (Identifier == RepresentationTypeIdentifier.TypedList)
            {
                var sub = SubTypes[0].GetRuntimeType();
                if (sub == null)
                {
                    return(null);
                }

                var rt = sub.MakeArrayType();

                return(rt);
            }
            else if (Identifier == RepresentationTypeIdentifier.TypedMap)
            {
                var subs = SubTypes.Select(x => x.GetRuntimeType()).ToArray();
                var rt   = typeof(Map <,>).MakeGenericType(subs);
                return(rt);
            }

            return(Identifier switch
            {
                (RepresentationTypeIdentifier.Void) => typeof(void),
                (RepresentationTypeIdentifier.Dynamic) => typeof(object),
                (RepresentationTypeIdentifier.Bool) => Nullable ? typeof(bool?) : typeof(bool),
                (RepresentationTypeIdentifier.Char) => Nullable ? typeof(char?) : typeof(char),
                (RepresentationTypeIdentifier.UInt8) => Nullable ? typeof(byte?) : typeof(byte),
                (RepresentationTypeIdentifier.Int8) => Nullable ? typeof(sbyte?) : typeof(sbyte),
                (RepresentationTypeIdentifier.Int16) => Nullable ? typeof(short?) : typeof(short),
                (RepresentationTypeIdentifier.UInt16) => Nullable ? typeof(ushort?) : typeof(ushort),
                (RepresentationTypeIdentifier.Int32) => Nullable ? typeof(int?) : typeof(int),
                (RepresentationTypeIdentifier.UInt32) => Nullable ? typeof(uint?) : typeof(uint),
                (RepresentationTypeIdentifier.Int64) => Nullable ? typeof(ulong?) : typeof(long),
                (RepresentationTypeIdentifier.UInt64) => Nullable ? typeof(ulong?) : typeof(ulong),
                (RepresentationTypeIdentifier.Float32) => Nullable ? typeof(float?) : typeof(float),
                (RepresentationTypeIdentifier.Float64) => Nullable ? typeof(double?) : typeof(double),
                (RepresentationTypeIdentifier.Decimal) => Nullable ? typeof(decimal?) : typeof(decimal),
                (RepresentationTypeIdentifier.String) => typeof(string), //Nullable ? typeof(Nullable<string>) : typeof(string),
                (RepresentationTypeIdentifier.DateTime) => Nullable ? typeof(DateTime?) : typeof(DateTime),
                (RepresentationTypeIdentifier.Resource) => typeof(IResource),
                (RepresentationTypeIdentifier.Record) => typeof(IRecord),
                (RepresentationTypeIdentifier.TypedRecord) => Warehouse.GetTemplateByClassId((Guid)GUID, TemplateType.Record).DefinedType,
                (RepresentationTypeIdentifier.TypedResource) => Warehouse.GetTemplateByClassId((Guid)GUID, TemplateType.Unspecified).DefinedType,
                (RepresentationTypeIdentifier.Enum) => Warehouse.GetTemplateByClassId((Guid)GUID, TemplateType.Enum).DefinedType,

                _ => null
            });
Example #15
0
 /// <summary>
 /// True if the specified entity type inherits from this entity type.
 /// </summary>
 /// <param name="entityType">Entity type to look for in the subtypes of this entity.</param>
 /// <returns>True if found, false if not.</returns>
 public bool InheritsFrom(ModelEntityType entityType)
 {
     try
     {
         return(SubTypes.Any(t => t == entityType));
     }
     catch (Exception ex)
     {
         try
         {
             ExceptionTools.AddExceptionData(ex, this);
         }
         catch { }
         throw;
     }
 }
Example #16
0
    TypeContainer GetContainer(TypeMask typeMask)
    {
        TypeContainer value;

        if (dict == null)
        {
            dict = new Dictionary <TypeMask, TypeContainer>();
        }
        if (!dict.TryGetValue(typeMask, out value))
        {
            var types = SubTypes.GetSubTypes(typeMask.baseType);
            value = new TypeContainer(types);
            dict.Add(typeMask, value);
        }
        return(value);
    }
        public NormalizationApiModel(NormalizationApiModel copyFrom) : base(copyFrom)
        {
            if (copyFrom == null)
            {
                return;
            }

            Description   = copyFrom.Description;
            Discriminator = copyFrom.Discriminator;
            Name          = copyFrom.Name;
            ResourceName  = copyFrom.ResourceName;
            ResourcePath  = copyFrom.ResourcePath;

            Properties.AddRange(copyFrom.Properties);

            SubTypes.AddRange(copyFrom.SubTypes);
        }
Example #18
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ NullableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ Bool.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ (ByteArray != null ? ByteArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CharArray != null ? CharArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringArray != null ? StringArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntArray != null ? IntArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LongArray != null ? LongArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringList != null ? StringList.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringMap != null ? StringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntStringMap != null ? IntStringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubType != null ? SubType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubTypes != null ? SubTypes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CustomText != null ? CustomText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MaxText != null ? MaxText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomDecimal.GetHashCode();
         return(hashCode);
     }
 }
Example #19
0
        internal SubscriptionModule()
        {
            Log.Info("Creating");
            PrevSubValue  = null;
            this.SubTypes = new List <SubType>();
            SubTypes.Add(new SubType {
                Description = "$3.00 per month", Name = "silver"
            });
            SubTypes.Add(new SubType {
                Description = "$33.00 per year", Name = "gold"
            });
            CheckTimer          = new Timer(TimeSpan.FromMinutes(5).TotalMilliseconds);
            CheckTimer.Elapsed += CheckTimerOnElapsed;
            CheckTimer.Start();
            BroadcastTimer          = new Timer(TimeSpan.FromMinutes(3).TotalMilliseconds);
            BroadcastTimer.Elapsed += BroadcastTimerOnElapsed;
            BroadcastTimer.Start();
            Log.Info("Created");
            Task.Factory.StartNew(() => CheckTimerOnElapsed(null, null)).ContinueWith(
                x =>
                { if (x.Exception != null)
                  {
                      Log.Info("Get Is Subbed Failed", x.Exception);
                  }
                });
            Program.LobbyClient.OnLoginComplete += LobbyClientOnOnLoginComplete;
            var sti      = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/subscriberbenefits.txt"));
            var benifits = new List <string>();

            using (var sr = new StreamReader(sti.Stream))
            {
                var l = sr.ReadLine();
                while (l != null)
                {
                    benifits.Add(l);
                    l = sr.ReadLine();
                }
            }
            Benefits = benifits;
        }
Example #20
0
 protected bool Equals(AllTypes other)
 {
     return(Id == other.Id &&
            NullableId == other.NullableId &&
            Byte == other.Byte &&
            Short == other.Short &&
            Int == other.Int &&
            Long == other.Long &&
            UShort == other.UShort &&
            UInt == other.UInt &&
            ULong == other.ULong &&
            Float.Equals(other.Float) &&
            Double.Equals(other.Double) &&
            Decimal == other.Decimal &&
            string.Equals(String, other.String) &&
            DateTime.Equals(other.DateTime) &&
            TimeSpan.Equals(other.TimeSpan) &&
            DateTimeOffset.Equals(other.DateTimeOffset) &&
            Guid.Equals(other.Guid) &&
            Bool == other.Bool &&
            Char == other.Char &&
            NullableDateTime.Equals(other.NullableDateTime) &&
            NullableTimeSpan.Equals(other.NullableTimeSpan) &&
            ByteArray.SequenceEqual(other.ByteArray) &&
            CharArray.SequenceEqual(other.CharArray) &&
            IntArray.SequenceEqual(other.IntArray) &&
            LongArray.SequenceEqual(other.LongArray) &&
            StringArray.SequenceEqual(other.StringArray) &&
            StringList.SequenceEqual(other.StringList) &&
            StringMap.SequenceEqual(other.StringMap) &&
            IntStringMap.SequenceEqual(other.IntStringMap) &&
            SubType.Equals(other.SubType) &&
            SubTypes.SequenceEqual(other.SubTypes) &&
            CustomText == other.CustomText &&
            MaxText == other.MaxText &&
            CustomDecimal.Equals(other.CustomDecimal));
 }
        protected void BuildTypesCollections()
        {
            var textInfo = CultureInfo.CurrentCulture.TextInfo;

            Types.Clear();
            Types.Add(Strings.GetMoreModsViewModel_AllTypes);
            foreach (var type in from m in TrovesaurusMods
                     group m by m.DataObject.Type into g
                     orderby g.First().DataObject.Type
                     select textInfo.ToTitleCase(g.First().DataObject.Type.ToLower()))
            {
                Types.Add(type);
            }

            SubTypes.Clear();
            SubTypes.Add(Strings.GetMoreModsViewModel_AllSubTypes);
            foreach (var subtype in from m in TrovesaurusMods
                     where !string.IsNullOrEmpty(m.DataObject.SubType)
                     group m by m.DataObject.SubType into g
                     orderby g.First().DataObject.SubType
                     select textInfo.ToTitleCase(g.First().DataObject.SubType.ToLower()))
            {
                SubTypes.Add(subtype);
            }

            Formats.Clear();
            Formats.Add(Strings.GetMoreModsViewModel_AllFormats);
            //var formats = TrovesaurusMods.SelectMany(m => m.DataObject.Downloads).GroupBy(d => d.Format);
            foreach (var format in from d in TrovesaurusMods.SelectMany(m => m.DataObject.Downloads)
                     group d by d.Format into g
                     orderby g.First().Format
                     select g.First().Format)
            {
                Formats.Add(format);
            }
        }
Example #22
0
 public bool IsSubType(SubTypes subType)
 {
     return(MetaInfo.IsSubType(subType));
 }
Example #23
0
        private void PopulateEventList()
        {
            lock (Lock)
            {
                if (EventList.Count > 0)
                {
                    return;
                }

                //var curDir = System.Web.HttpRuntime.AppDomainAppPath;
                //var dlls = Directory.GetFiles(curDir, "*.dll", SearchOption.AllDirectories);
                var types = new List <Type>();

                var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                foreach (var assembly in allAssemblies)
                {
                    var tmpBaseTypes = assembly.GetTypes()
                                       .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Event)))
                                       .ToList();
                    types.AddRange(tmpBaseTypes);
                }
                // This seems to work better than loading all dlls in current domain path.

                //var appDomain = AppDomain.CreateDomain("tmpDomainForWebTemplate");
                //foreach (var dll in dlls)
                //{
                //    if (dll.Contains("\\roslyn\\"))
                //    {
                //        continue;
                //    }
                //    try
                //    {
                //        var assembly = appDomain.Load(File.ReadAllBytes(dll));


                //        var eventTypes = assembly.GetTypes()
                //                                .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Event)))
                //                                .ToList();
                //        if (eventTypes.Count > 0)
                //        {
                //            types.AddRange(eventTypes);
                //        }

                //    }
                //    catch (BadImageFormatException ex)
                //    {
                //        Console.WriteLine(ex.Message);
                //    }
                //    catch (ReflectionTypeLoadException ex)
                //    {
                //        Console.WriteLine(ex.Message);
                //    }
                //    catch (FileNotFoundException ex)
                //    {
                //        Console.WriteLine(ex.Message);
                //    }
                //}

                //AppDomain.Unload(appDomain);

                foreach (var type in types)
                {
                    //if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(Event)))
                    //{
                    if (type == typeof(BasicCrudModify <>))
                    {
                        continue;
                    }
                    if (type == typeof(BasicCrudView <>))
                    {
                        continue;
                    }
                    if (type == typeof(BasicCrudDelete <>))
                    {
                        continue;
                    }


                    if (type.GetInterface("IBasicCrudMenuItem") != null)
                    {
                        var subType = (IBasicCrudMenuItem)Container.Resolve(type);

                        var    d1        = typeof(BasicCrudView <>);
                        Type[] typeArgs1 = { subType.InnerType };
                        var    viewType  = d1.MakeGenericType(typeArgs1);

                        var viewInstance = (IBasicCrudView)Container.Resolve(viewType);
                        viewInstance.Id                  = subType.GetBaseMenuId();
                        viewInstance.ItemName            = subType.GetBaseItemName();
                        viewInstance.ColumnsToShowInView = subType.GetColumnsToShowInView();
                        viewInstance.OrderQuery          = subType.OrderQueryInternal;
                        var columnConfig = new ColumnConfiguration();
                        subType.ConfigureAdditionalColumns(columnConfig);
                        viewInstance.AdditionalColumns = columnConfig.GetColumns();

                        if (!EventList.ContainsKey(viewInstance.GetId()))
                        {
                            EventList.Add(viewInstance.GetId(), viewInstance.GetType());
                            EventDescriptions.Add(viewInstance.GetId(), viewInstance.Description);
                            EventMenuList.Add(viewInstance.GetId(), viewInstance);
                            SubTypes.Add(viewInstance.GetId(), type);
                        }

                        var    d2             = typeof(BasicCrudModify <>);
                        Type[] typeArgs2      = { subType.InnerType };
                        var    modifyType     = d2.MakeGenericType(typeArgs2);
                        var    modifyInstance = (IBasicCrudModify)Container.Resolve(modifyType);
                        modifyInstance.Id                 = subType.GetBaseMenuId() + 1;
                        modifyInstance.ItemName           = subType.GetBaseItemName();
                        modifyInstance.InputProperties    = subType.GetInputProperties();
                        modifyInstance.UniquePropertyName = subType.UniquePropertyName;
                        modifyInstance.OnModifyInternal   = subType.OnModifyInternal;

                        if (!EventList.ContainsKey(modifyInstance.GetId()))
                        {
                            EventList.Add(modifyInstance.GetId(), modifyInstance.GetType());
                            EventDescriptions.Add(modifyInstance.GetId(), modifyInstance.Description);
                            EventMenuList.Add(modifyInstance.GetId(), modifyInstance);
                            SubTypes.Add(modifyInstance.GetId(), type);
                        }

                        var    d3             = typeof(BasicCrudDelete <>);
                        Type[] typeArgs3      = { subType.InnerType };
                        var    deleteType     = d3.MakeGenericType(typeArgs2);
                        var    deleteInstance = (IBasicCrudDelete)Container.Resolve(deleteType);
                        deleteInstance.Id               = subType.GetBaseMenuId() + 2;
                        deleteInstance.ItemName         = subType.GetBaseItemName();
                        deleteInstance.OnDeleteInternal = subType.OnDeleteInternal;
                        if (!EventList.ContainsKey(deleteInstance.GetId()))
                        {
                            EventList.Add(deleteInstance.GetId(), deleteInstance.GetType());
                            EventDescriptions.Add(deleteInstance.GetId(), deleteInstance.Description);
                            EventMenuList.Add(deleteInstance.GetId(), deleteInstance);
                            SubTypes.Add(deleteInstance.GetId(), type);
                        }
                    }
                    else if (type != typeof(BasicCrudMenuItem <>))
                    {
                        //if (System.Diagnostics.Debugger.IsAttached == false) System.Diagnostics.Debugger.Launch();
                        var instance = (IEvent)Container.Resolve(type);

                        if (!(instance is BackgroundEvent) && !EventList.ContainsKey(instance.GetId()))
                        {
                            EventList.Add(instance.GetId(), instance.GetType());
                            EventDescriptions.Add(instance.GetId(), instance.Description);
                            EventMenuList.Add(instance.GetId(), instance);
                        }
                        else if (instance is BackgroundEvent && !BackgroundEventList.ContainsKey(instance.GetId()))
                        {
                            BackgroundEventList.Add(instance.GetId(), instance as BackgroundEvent);
                        }
                    }
                    //}
                    //else
                    //{
                    //    Console.WriteLine("X");
                    //}
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Master.SelectedBox = "Ostalo";
            Master.Title       = "Tip Zavezanca";
            if (!Master.Uporabnik.Pravice.Contains("tipi_zavezancev"))
            {
                throw new Exception("Nimate pravice!");
            }
            msg   = Request.QueryString["msg"] ?? "";
            _sort = Request.QueryString["sort"] ?? "";
            if (string.IsNullOrWhiteSpace(_sort))
            {
                _sort = Convert.ToString(Session["sort_subtype"]);
                if (string.IsNullOrWhiteSpace(_sort))
                {
                    _sort = "datum desc";
                }
            }
            else
            {
                Session["sort_subtype"] = _sort;
            }
            _persistence = Convert.ToString(Session["persistence_subtype"]) ?? "";
            //int.TryParse(Request.QueryString["id"], out _id);
            _id = Request.QueryString["id"];

            if (IsPostBack)
            {
                #region
                msg = "";
                Master.SetMessage(msg);
                #endregion
            }
            else
            {
                #region
                foreach (var c in Countrys.Get(0))
                {
                    drzava.Items.Add(new ListItem(c.acTitle, Convert.ToString(c.anCountryID)));
                }

                var lc = new List <SubTypes.SubType>();
                if (!String.IsNullOrEmpty(_id))
                {
                    lc = SubTypes.Get(0, _id);
                }

                if (lc.Count > 0)
                {
                    var lData = lc[0];
                    naziv.Text           = lData.acTitle;
                    TypeID.Text          = (lData.acTypeID);
                    drzava.SelectedValue = Convert.ToString(lData.anCountryID);

                    brisi.Visible   = true;
                    TypeID.ReadOnly = true;
                }
                else
                {
                    TypeID.ReadOnly = false;
                }
                #endregion
            }
            if (!string.IsNullOrWhiteSpace(msg))
            {
                Master.SetMessage(msg);
            }
        }
        catch (Exception ee)
        {
            Master.SetMessage(ee);
        }
    }
Example #25
0
        private bool IsOfSubType(string chr, SubTypes subtype)
        {
            var idx = (int)subtype;

            return(TextMatrices[idx].Any(enc => !enc.IsSwitch && enc.TextValue == chr));
        }
Example #26
0
        public string DisplayString()
        {
            var sb     = new StringBuilder();
            var widthA = Formatting.MaxLineLength / 2;
            var widthB = Formatting.MaxLineLength - widthA;

            // First Line
            sb.AppendLine(new string('=', Formatting.MaxLineLength));
            sb.AppendLine(string.Format("{0,-" + widthA + "}{1," + widthB + "}", Name, ManaCost));

            // Second Line
            sb.AppendLine(new string('-', Formatting.MaxLineLength));
            if (SuperType != SuperType.None)
            {
                sb.Append(SuperType + " ");
            }
            sb.Append(string.Join(" ", Types.Select(t => t.ToString())));
            if (SubTypes.Count != 0)
            {
                sb.Append(" - " + string.Join(" ", SubTypes.Select(t => t.ToString())));
            }
            sb.AppendLine();

            // Rules
            if (Text != string.Empty)
            {
                sb.AppendLine(new string('-', Formatting.MaxLineLength));
                foreach (var line in Text.Split(new char[] { '|' }))
                {
                    var words = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    sb.Append(words[0]);
                    var charCount = words[0].Length;
                    foreach (var word in words.Skip(1))
                    {
                        if (charCount + word.Length >= Formatting.MaxLineLength)
                        {
                            sb.AppendLine();
                            sb.Append(word);
                            charCount = word.Length;
                        }
                        else
                        {
                            sb.Append(' ');
                            sb.Append(word);
                            charCount += word.Length + 1;
                        }
                    }
                    sb.AppendLine();
                }
            }

            // Power / Toughness
            if (Power != string.Empty || Toughness != string.Empty)
            {
                sb.AppendLine(new string('-', Formatting.MaxLineLength));
                sb.AppendLine(string.Format("{0}/{1}", Power, Toughness));
            }

            // End
            sb.AppendLine(new string('=', Formatting.MaxLineLength));

            return(sb.ToString());
        }
Example #27
0
 public Valve(SubTypes Subtype)
 {
     _Subtype = Subtype;
 }
Example #28
0
        /// <summary>
        /// Gets a fields value as a string suitable for things like, oh, a velocity template
        /// </summary>
        /// <param name="field">A FormFields enum value</param>
        /// <returns>The value of the field, OR, and error message</returns>
        public string GetFieldAsString(FormFields field)
        {
            try
            {
                switch (field)
                {
                case FormFields.MainType:
                {
                    return(MainType.Label);
                }

                case FormFields.SubTypes:
                {
                    return(String.Join(", ", SubTypes.Select(st => st.Label)));
                }

                case FormFields.Stages:
                {
                    return(String.Join(", ", Stages.Select(stg => stg.Label)));;
                }

                case FormFields.Findings:
                {
                    return(String.Join(", ", Findings.Select(fin => fin.Label)));
                }

                case FormFields.Age:
                {
                    return(Age.ToString());
                }

                case FormFields.Phrase:
                {
                    return(Phrase);
                }

                case FormFields.HealthyVolunteers:
                {
                    switch (_healthyVols)
                    {
                    case HealthyVolunteerType.Healthy: { return("Only Accepting Healthy Volunteers"); }

                    case HealthyVolunteerType.Infirmed: { return("Not Accepting Healthy Volunteers"); }

                    default: { return("Accepting All Volunteers"); }
                    }
                }

                case FormFields.Gender:
                {
                    return(Gender);
                }

                case FormFields.TrialTypes:
                {
                    return(String.Join(", ", TrialTypes.Select(tt => tt.Label)));
                }

                case FormFields.Drugs:
                {
                    return(String.Join(", ", Drugs.Select(d => d.Label)));
                }

                case FormFields.OtherTreatments:
                {
                    return(String.Join(", ", OtherTreatments.Select(ot => ot.Label)));;
                }

                case FormFields.TrialPhases:
                {
                    return(String.Join(", ", TrialPhases.Select(tp => tp.Label)));
                }

                case FormFields.TrialIDs:
                {
                    return(String.Join(", ", TrialIDs));
                }

                case FormFields.Investigator:
                {
                    return(Investigator);
                }

                case FormFields.LeadOrg:
                {
                    return(LeadOrg);
                }

                case FormFields.IsVAOnly:
                {
                    if (IsVAOnly)
                    {
                        return("True");
                    }
                    else
                    {
                        return("False");
                    }
                }

                case FormFields.AtNIH:
                case FormFields.City:
                case FormFields.State:
                case FormFields.Country:
                case FormFields.Hospital:
                case FormFields.ZipCode:
                case FormFields.ZipRadius:
                {
                    return(GetLocFieldAsString(field));
                }

                default:
                {
                    return("Error Retrieving Field");
                }
                }
            }
            catch (Exception)
            {
                return("Error Retrieving Field");
            }
        }
Example #29
0
        internal static Headers ConvertToHeader(this DataRow dr, List <Headers> H)
        {
            Headers headers = new Headers();
            byte    productGroup;
            byte    productType;
            byte    productSubType;

            if (dr["product_group"] != DBNull.Value)
            {
                productGroup = Convert.ToByte(dr["product_group"]);

                if (!H.Exists(x => x.Id == productGroup))
                //if (H.ElementAtOrDefault(productGroup - 1) == null)//(!H.ContainsKey(productGroup))
                {
                    H.Add(new Headers()
                    {
                        Id = productGroup
                    });
                }

                Headers headers1 = H.Find(x => x.Id == productGroup);

                if (dr["group_name"] != DBNull.Value)
                {
                    //H.Find(x => x.Id == productGroup).Name = dr["group_name"].ToString();
                    headers1.Name = dr["group_name"].ToString();
                }
                if (dr["group_eng_name"] != DBNull.Value)
                {
                    //H[productGroup - 1].EngName = dr["group_eng_name"].ToString();
                    headers1.EngName = dr["group_eng_name"].ToString();
                }

                //H[productGroup - 1].Id = productGroup;

                if (dr["product_type"] != DBNull.Value)
                {
                    productType = Convert.ToByte(dr["product_type"]);


                    // if (H[productGroup - 1].Values.ElementAtOrDefault(productType - 1) == null)
                    if (!headers1.Values.Exists(x => x.Id == productType))
                    {
                        //H[productGroup - 1].Values.Add(new Types());
                        headers1.Values.Add(new Types()
                        {
                            Id = productType
                        });
                    }

                    Types types1 = headers1.Values.Find(x => x.Id == productType);

                    if (dr["product_subtype"] != DBNull.Value)
                    {
                        productSubType = Convert.ToByte(dr["product_subtype"]);

                        if (!types1.Values.Exists(x => x.Id == productSubType))
                        {
                            types1.Values.Add(new SubTypes()
                            {
                                Id = productSubType
                            });
                        }

                        SubTypes subTypes1 = types1.Values.Find(x => x.Id == productSubType);

                        if (dr["subtype_name"] != DBNull.Value)
                        {
                            subTypes1.Name = dr["subtype_name"].ToString();
                        }

                        if (dr["subtype_eng_name"] != DBNull.Value)
                        {
                            subTypes1.EngName = dr["subtype_eng_name"].ToString();
                        }

                        //H[productGroup - 1].Values[productType - 1].Values[productSubType - 1].Id = productSubType;
                    }

                    if (dr["type_name"] != DBNull.Value)
                    {
                        types1.Name = dr["type_name"].ToString();
                    }

                    if (dr["type_eng_name"] != DBNull.Value)
                    {
                        types1.EngName = dr["type_eng_name"].ToString();
                    }

                    //H[productGroup - 1].Values[productType - 1].Id = productType;
                }
            }

            return(headers);
        }