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(); } }
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(); } }
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); }
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); }
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); } }
public static void updateEntertainment(EntertainmentBO objEntertainment) { EntertainmentDAL.updateEntertainment(objEntertainment); }
public static void insertEntertainment(EntertainmentBO objEntertainment) { EntertainmentDAL.insertEntertainment(objEntertainment); }