Example #1
0
        public void update(TemplateBO objClass)
        {
            MongoCollection<Language> objCollection = db.GetCollection<Language>("c_Language");

            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)

                                ;
            var result = objCollection.FindAndModify(query, sortBy, update, true);
        }
Example #2
0
        public void insert(TemplateBO objClass)
        {
            MongoCollection<BsonDocument> objCollection = db.GetCollection<BsonDocument>("c_Language");

            var query = Query.And(
                    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 },

                        };

                var rt = objCollection.Insert(doc);

            }
        }
Example #3
0
        public void update(TemplateBO objClass)
        {
            MongoCollection<Employer> objCollection = db.GetCollection<Employer>("c_Employer");

            var query = Query.EQ("_id", ObjectId.Parse(objClass.Id));
            var sortBy = SortBy.Descending("_id");
            var update = Update.Set("UserId", ObjectId.Parse(objClass.UserId))
                                  .Set("Organization", objClass.Organization)
                        .Set("Position", objClass.Position)
                        .Set("Town", objClass.Town)
                       .Set("Description", objClass.Description)
                        .Set("IsCurrentlyWork", objClass.IsCurrentlyWork)
                       .Set("StartDay", objClass.StartDay)
                       .Set("StartMonth", objClass.StartMonth)
                       .Set("StartYear", objClass.StartYear)
                       .Set("EndDay", objClass.EndDay)
                        .Set("EndMonth", objClass.EndMonth)
                       .Set("EndYear", objClass.EndYear)
                       .Set("Image", objClass.Image)

                                ;
            var result = objCollection.FindAndModify(query, sortBy, update, true);
        }
Example #4
0
 public static void update(TemplateBO obj,TemplateInfoDAL baseobj)
 {
     baseobj.insert(obj);
 }
Example #5
0
        public void insert(TemplateBO objClass)
        {
            MongoCollection<BsonDocument> objCollection = db.GetCollection<BsonDocument>("c_Employer");

            BsonDocument doc = new BsonDocument {
                      { "UserId" , ObjectId.Parse(objClass.UserId) },
                        { "Organization" , objClass.Organization },
                        { "Position", objClass.Position },
                        { "Town" , objClass.Town  },
                        { "Description", objClass.Description },
                        { "IsCurrentlyWork" , objClass.IsCurrentlyWork },
                        { "StartDay", objClass.StartDay },
                        { "StartMonth" , objClass.StartMonth },
                        { "StartYear", objClass.StartYear },
                        { "EndDay", objClass.EndDay },
                        { "EndMonth" , objClass.EndMonth },
                        { "EndYear", objClass.EndYear },
                        { "Image",objClass.Image }

                        };

            objCollection.Insert(doc);
        }