Ejemplo n.º 1
0
    protected void SaveBooks()
    {
        if (!txtBooks.Text.Equals(""))
        {
            EntertainmentBO objEntertainment = new EntertainmentBO();

            objEntertainment.Name   = txtBooks.Text;
            objEntertainment.UserId = Userid;
            if (System.IO.File.Exists(Server.MapPath("../../Resources/images/ProfileIcons/" + txtBooks.Text + Global.PICTURE_EXTENSION_JPG)))
            {
                objEntertainment.Image = txtBooks.Text + ".jpg";
            }
            else if (System.IO.File.Exists(Server.MapPath("../../Resources/images/ProfileIcons/" + txtBooks.Text + ".png")))
            {
                objEntertainment.Image = txtBooks.Text + ".png";
            }
            else
            {
                objEntertainment.Image = "DefaultBooks.png";
            }
            objEntertainment.Type = Global.BOOKS;
            EntertainmentBLL.insertEntertainment(objEntertainment);
            txtBooks.Text = "";
            LoadDataListBooks();
        }
    }
Ejemplo n.º 2
0
    protected void SaveGame()
    {
        if (!txtGame.Text.Equals(""))
        {
            EntertainmentBO objEntertainment = new EntertainmentBO();

            objEntertainment.Name   = txtGame.Text;
            objEntertainment.UserId = Userid;
            if (System.IO.File.Exists(Server.MapPath("../../Resources/images/ProfileIcons/" + txtGame.Text + ".jpg")))
            {
                objEntertainment.Image = txtGame.Text + ".jpg";
            }
            else if (System.IO.File.Exists(Server.MapPath("../../Resources/images/ProfileIcons/" + txtGame.Text + ".png")))
            {
                objEntertainment.Image = txtGame.Text + ".png";
            }
            else
            {
                objEntertainment.Image = "DefaultGame.png";
            }
            objEntertainment.Type = Global.GAME;
            EntertainmentBLL.insertEntertainment(objEntertainment);
            txtGame.Text = "";
            LoadDataListGame();
        }
    }
Ejemplo n.º 3
0
        public static void updateEntertainment(EntertainmentBO objClass)
        {
            MongoCollection <Entertainment> objCollection = db.GetCollection <Entertainment>("c_Entertainment");

            var query  = Query.EQ("_id", ObjectId.Parse(objClass.Id));
            var sortBy = SortBy.Descending("_id");
            var update = Update.Set("UserId", ObjectId.Parse(objClass.UserId))
                         .Set("Name", objClass.Name)
                         .Set("Type", objClass.Type)
                         .Set("Image", objClass.Image)

            ;
            var result = objCollection.FindAndModify(query, sortBy, update, true);
        }
Ejemplo n.º 4
0
        public static EntertainmentBO getEntertainmentByEntertainmentId(string Id)
        {
            MongoCollection <Entertainment> objCollection = db.GetCollection <Entertainment>("c_Entertainment");

            EntertainmentBO objClass = new EntertainmentBO();

            foreach (Entertainment item in objCollection.Find(Query.EQ("_id", ObjectId.Parse(Id))))
            {
                objClass.Id     = item._id.ToString();
                objClass.UserId = item.UserId.ToString();
                objClass.Name   = item.Name;
                objClass.Type   = item.Type;
                objClass.Image  = item.Image;
                break;
            }
            return(objClass);
        }
Ejemplo n.º 5
0
        public static void insertEntertainment(EntertainmentBO objClass)
        {
            MongoCollection <BsonDocument> objCollection = db.GetCollection <BsonDocument>("c_Entertainment");

            var query = Query.And(
                Query.EQ("Type", objClass.Type),
                Query.EQ("Name", objClass.Name),
                Query.EQ("UserId", ObjectId.Parse(objClass.UserId)));
            var result = objCollection.Find(query);

            if (!result.Any())
            {
                BsonDocument doc = new BsonDocument {
                    { "UserId", ObjectId.Parse(objClass.UserId) },
                    { "Name", objClass.Name },
                    { "Type", objClass.Type },
                    { "Image", objClass.Image }
                };

                objCollection.Insert(doc);
            }
        }
Ejemplo n.º 6
0
 public static void updateEntertainment(EntertainmentBO objEntertainment)
 {
     EntertainmentDAL.updateEntertainment(objEntertainment);
 }
Ejemplo n.º 7
0
 public static void insertEntertainment(EntertainmentBO objEntertainment)
 {
     EntertainmentDAL.insertEntertainment(objEntertainment);
 }