public void Insert_Abonent_Information(Class_Abonent _Obj) { MongoCollection<Class_Abonent> Collection_ = Database_.GetCollection<Class_Abonent>("Abonent"); BsonDocument Stu_Doc = new BsonDocument { { "Id", _Obj.Id }, { "StreetCD", _Obj.StreetCD }, { "HouseNo", _Obj.HouseNo }, { "FlatNo", _Obj.FlatNo }, { "Fio", _Obj.Fio }, { "Phone", _Obj.Phone } }; Collection_.Insert(Stu_Doc); }
private void toolStripButtonAdd_Click(object sender, EventArgs e) { Class_Abonent A = new Class_Abonent(); Form_EditAbonent _f = new Form_EditAbonent(A); _f.ShowDialog(); Load_Data(); }
public void Save_Abonent_Information(Class_Abonent _Obj) { MongoCollection<Class_Abonent> Collection_ = Database_.GetCollection<Class_Abonent>("Abonent"); BsonDocument Stu_Doc = new BsonDocument() .Add("_id", _Obj._id) .Add("StreetCD", _Obj.StreetCD) .Add("HouseNo", _Obj.HouseNo) .Add("FlatNo", _Obj.FlatNo) .Add("Fio", _Obj.Fio) .Add("Phone", _Obj.Phone); ; Collection_.Save(Stu_Doc); }
public void Update_Abonent_Information(Class_Abonent _Obj) { MongoCollection<Class_Abonent> Collection_ = Database_.GetCollection<Class_Abonent>("Abonent"); IMongoQuery Marker = Query.EQ("Id", _Obj.Id); IMongoUpdate Update_ = MongoDB.Driver.Builders.Update .Set("StreetCD", _Obj.StreetCD) .Set("HouseNo", _Obj.HouseNo) .Set("FlatNo", _Obj.FlatNo) .Set("Fio", _Obj.Fio) .Set("Phone", _Obj.Phone); Collection_.Update(Marker, Update_); }
private void toolStripBupdate_Click(object sender, EventArgs e) { Class_Abonent A = (Class_Abonent)BSAbonent.Current; Form_EditAbonent _f = new Form_EditAbonent(A); if (A != null) { _f.ShowDialog(); Load_Data(); } else { MessageBox.Show("Выберите абонента"); } }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { Class_Abonent A = (Class_Abonent)BSAbonent.Current; if (A != null) { DialogResult dr = MessageBox.Show("Удалить абонента " + A.Fio + "?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.Yes) { _Obj.Delete_Abonent_Infromation(A); } Load_Data(); } else { MessageBox.Show("Выберите абонента"); } }
public Form_EditAbonent(Class_Abonent StuObj) { InitializeComponent(); StuObj_ = StuObj; }
public void Delete_Abonent_Infromation(Class_Abonent _Obj) { MongoCollection<Class_Abonent> Collection_ = Database_.GetCollection<Class_Abonent>("Abonent"); IMongoQuery Marker = Query.EQ("Id", _Obj.Id); Collection_.Remove(Marker); }