Example #1
0
 public CategoryController(ILogger <CategoryController> logger, ICategories categories, ITypes types)
 {
     //_db = db;
     _type   = types;
     _logger = logger;
     _repo   = categories;
 }
Example #2
0
        public bool AddType(ITypes type)
        {
            bool success = false;

            try
            {
                Database  db        = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand dbCommand = db.GetStoredProcCommand(Constant.SP_Type_Insert);

                db.AddInParameter(dbCommand, "@sTypeName", DbType.String, type.TypeName);
                db.AddOutParameter(dbCommand, "@iTypeId", DbType.Int32, 4);

                if (db.ExecuteNonQuery(dbCommand) > 0)
                {
                    int newItemID = (int)db.GetParameterValue(dbCommand, "@iTypeId");

                    if (newItemID > 0)
                    {
                        success     = true;
                        type.TypeId = newItemID;
                    }
                }
            }
            catch (System.Exception ex)
            {
                ex.Data.Add("BusinessLayerException", GetType().ToString() + Constant.Error_Seperator + "public bool AddType(Type type)");
                throw ex;
            }
            return(success);
        }
Example #3
0
 public Writer(IPrefixRegistry registry, ITypes types, IFormatWriter writer, System.Xml.XmlWriter native)
 {
     _registry = registry;
     _types    = types;
     _writer   = writer;
     _native   = native;
 }
 public Classification(IFormattedContentSpecification specification, IIdentityStore identities, IGenericTypes generic,
                       ITypes types)
 {
     _specification = specification;
     _identities    = identities;
     _generic       = generic;
     _types         = types;
 }
Example #5
0
 public Ingredient(bool random)
 {
     if (random)
     {
         System.Random ran = new System.Random();
         int           d   = ran.Next(0, 7);
         itype = (ITypes)d;
     }
 }
Example #6
0
        /// <summary>
        /// настройка параметров контекста
        /// </summary>
        private void Initialize(ITypes types)
        {
            this.types = types;
            Database.SetInitializer <Context>(null);
            this.Configuration.ProxyCreationEnabled = false;

            //отключаем ленивую загрузку, для принудительной загрузки тегов
            this.Configuration.LazyLoadingEnabled = false;
            //this.Configuration.AutoDetectChangesEnabled = false;
        }
Example #7
0
 // ReSharper disable once TooManyDependencies
 public MemberSerializers(IAttributeSpecifications runtime, IMemberAccessors accessors,
                          IMemberConverters converters, IMemberContents content, IIdentityStore identities,
                          ITypes types, IIdentifiers identifiers)
 {
     _runtime     = runtime;
     _accessors   = accessors;
     _converters  = converters;
     _content     = content;
     _identities  = identities;
     _types       = types;
     _identifiers = identifiers;
 }
Example #8
0
    protected void btnTypeSave_Click(object sender, EventArgs e)
    {
        try
        {
            Boolean save = true;
            ITypes  type = new ITypes();
            type.TypeName = txtType.Text.Trim();
            if (type.Save())
            {
                //
                // Types
                //
                DataSet dsTypes = (new TypesDAO()).GetAllTypes();
                if (dsTypes == null || dsTypes.Tables.Count == 0)
                {
                    ddlType.Items.Add(new ListItem("--No Data Found--", "-1"));
                }
                else
                {
                    Master.BindDropdown("TypeName", "TypeId", dsTypes, ddlType);
                    ddlType.Items.Add(new ListItem("--Please Select--", "-1"));
                    ddlType.SelectedValue = type.TypeId.ToString();
                }

                ddlType.Visible = true;
                RequiredFieldValidator10.Enabled = false;
                txtType.Visible     = false;
                btnTypeSave.Visible = false;
                btnAddType.Visible  = true;
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnTypeSave_Click(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }
Example #9
0
    public static bool convertToIngredient(string ingredient, out Ingredient ingr)
    {
        ITypes tempType   = Ingredient.ITypes.CHEESE;
        string normString = ingredient.ToLower();
        bool   found      = false;

        //TODO change to switch statement
        if (normString == "lettuce")
        {
            tempType = ITypes.LETTUCE;
            found    = true;
        }
        else if (normString == "cheese")
        {
            tempType = ITypes.CHEESE;
            found    = true;
        }
        else if (normString.Contains("tomato"))
        {
            tempType = ITypes.TOMATO;
            found    = true;
        }
        else if (normString == "ham")
        {
            tempType = ITypes.HAM;
            found    = true;
        }
        else if (new Regex(".*white.*").IsMatch(normString))
        {
            tempType = ITypes.WHITEBREAD;
            found    = true;
        }
        else if (new Regex(".*wheat.*").IsMatch(normString))
        {
            tempType = ITypes.WHEATBREAD;
            found    = true;
        }
        ingr = new Ingredient(tempType);
        return(found);
    }
Example #10
0
        public static void Seed(ApplicationDbContext context)
        {
            Console.WriteLine("In DB");
            if (!context.Categories.Any())
            {
                context.Categories.AddRange(Categories.Select(c => c.Value));
            }
            if (!context.ITypes.Any())
            {
                context.ITypes.AddRange(ITypes.Select(c => c.Value));
            }

            if (!context.Items.Any())
            {
                context.AddRange
                (
                    new Item
                {
                    ItemName          = "Mango",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "The most widely favorite fruit of summer",
                    LongDescription   = "Mango is the king of fruit and most eatable fruit of summer.",
                    Category          = Categories["Organic"],
                    ImageUrl          = "mango.png",
                    InStock           = true,
                    ImageThumbnailUrl = "http://imgh.us/beerS_1.jpeg",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Apple",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Apple is very useful for health reasons",
                    LongDescription   = "Apple, Once a day keep Doctors away.",
                    Category          = Categories["Organic"],
                    ImageUrl          = "apple.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/apple.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Guvava",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Guvava",
                    LongDescription   = "Guvava",
                    Category          = Categories["Organic"],
                    ImageUrl          = "guvava.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/guvava.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Strawberry",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Strawberry",
                    LongDescription   = "Strawberry",
                    Category          = Categories["Organic"],
                    ImageUrl          = "strawberry.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/strawberry.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Blackberry",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Blackberry",
                    LongDescription   = "Blackberry",
                    Category          = Categories["Organic"],
                    ImageUrl          = "blackberry.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/blackberry.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Blueberry",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Blueberry",
                    LongDescription   = "Blueberry",
                    Category          = Categories["Organic"],
                    ImageUrl          = "blueberry.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/Fruits/blueberry.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Kiwi",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Kiwi",
                    LongDescription   = "Kiwi",
                    Category          = Categories["Organic"],
                    ImageUrl          = "kiwi.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/Fruits/kisi.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Plum",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Plum",
                    LongDescription   = "Plum",
                    Category          = Categories["Organic"],
                    ImageUrl          = "plum.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/Fruits/plum.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Pineapple",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Pineapple",
                    LongDescription   = "Pineapple",
                    Category          = Categories["Organic"],
                    ImageUrl          = "pineapple.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/Fruits/pineapple.png",
                    IType             = ITypes["Fruits"]
                },
                    new Item
                {
                    ItemName          = "Pomegranate",
                    ItemPrice         = 7.95F,
                    ShortDescription  = "Pomegranate",
                    LongDescription   = "Pomegranate",
                    Category          = Categories["Organic"],
                    ImageUrl          = "pomegranate.png",
                    InStock           = true,
                    ImageThumbnailUrl = "~/images/Fruits/pomegranate.png",
                    IType             = ITypes["Fruits"]
                }
                );
            }
            context.SaveChanges();
        }
Example #11
0
 public TypeController(ILogger <CategoryController> logger, ITypes types)
 {
     _repo   = types;
     _logger = logger;
 }
			public Types(ITypes types, IIdentityStore store)
			{
				_types = types;
				_store = store;
			}
 public TypePartReflector(IIdentityStore identities, ITypes types) : base(TypePartsEqualityComparer.Default)
 {
     _identities = identities;
     _types      = types;
 }
Example #14
0
 public FormatReaderContexts(IIdentityStore store, ITypes types, IXmlParserContexts contexts)
 {
     _store    = store;
     _contexts = contexts;
     _types    = types;
 }
Example #15
0
 public FormatReaderContexts(IIdentityStore store, ITypes types) :
     this(store, types, XmlParserContexts.Default)
 {
 }
Example #16
0
 public Ingredient(ITypes itype)
 {
     this.itype = itype;
 }
Example #17
0
 public Ingredient()
 {
     this.itype = ITypes.LETTUCE;
 }
Example #18
0
 public FormatWriters(IPrefixRegistry registry, ITypes types, IFormatWriters <System.Xml.XmlWriter> writers)
 {
     _registry = registry;
     _types    = types;
     _writers  = writers;
 }