private void SetDataToFieldsFromRow(DataGridViewCustomRow row) { // Заполняем поля слева значениями из строки txtName.Text = row?.Name; dtCreatedOn.Value = (DateTime)row?.CreatedOn; dtModifiedOn.Value = (DateTime)row?.ModifiedOn; rtxtDescription.Text = row?.Description; }
DataGridViewCustomRow IDataGridViewReflection.GetCustomData() { var item = new DataGridViewCustomRow() { Id = Id, CreatedOn = CreatedOn, ModifiedOn = ModifiedOn, Name = Name, Contact = Contact?.Name }; return(item); }
DataGridViewCustomRow IDataGridViewReflection.GetCustomData() { var item = new DataGridViewCustomRow() { Id = Id, CreatedOn = CreatedOn, ModifiedOn = ModifiedOn, Name = Name, Description = Description }; return(item); }
private void btnAddRecord_Click(object sender, EventArgs e) { var o = new DataGridViewCustomRow(); o.Id = Guid.NewGuid(); o.Name = txtName.Text; o.CreatedOn = dtCreatedOn.Value; o.ModifiedOn = dtModifiedOn.Value; o.Description = rtxtDescription.Text; Mapping[Table + "Add"]?.Invoke(o); SysLookupForm_Load(null, null); }
DataGridViewCustomRow IDataGridViewReflection.GetCustomData() { var item = new DataGridViewCustomRow() { Id = Id, CreatedOn = CreatedOn, ModifiedOn = ModifiedOn, Name = Login, Password = Password, Contact = Contact?.Name, Type = UserType?.Name }; return(item); }
public void Add(DataGridViewCustomRow o) { using (DBEntities db = new DBEntities()) { var record = new InvoiceStatus() { CreatedOn = o.CreatedOn, ModifiedOn = o.ModifiedOn, Name = o.Name, Description = o.Description }; db.InvoiceStatus.Add(record); db.SaveChanges(); } }
public void Update(DataGridViewCustomRow o) { using (DBEntities db = new DBEntities()) { var entity = db.InvoiceStatus.Where(x => x.Id == o.Id).FirstOrDefault(); if (entity != null) { entity.Name = o.Name; entity.Description = o.Description; entity.CreatedOn = o.CreatedOn; entity.ModifiedOn = o.ModifiedOn; db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); } } }
DataGridViewCustomRow IDataGridViewReflection.GetCustomData() { var item = new DataGridViewCustomRow() { Id = Id, CreatedOn = CreatedOn, ModifiedOn = ModifiedOn, Name = Name, Account = Account?.Name, Contact = Contact?.Name, Amount = Amount, Status = InvoiceStatus?.Name, Owner = ContactOwner?.Name }; return(item); }
DataGridViewCustomRow IDataGridViewReflection.GetCustomData() { var item = new DataGridViewCustomRow() { Id = Id, CreatedOn = CreatedOn, ModifiedOn = ModifiedOn, Name = Name, Job = Job?.Name, City = City?.Name, Phone = Phone, Email = Email, Account = Account.Where(x => x.Contact.Id == Id).FirstOrDefault()?.Name }; return(item); }
private void btnUpdate_Click(object sender, EventArgs e) { if (MessageBox.Show("Вы уверенны, что хотите обновить запись?", "Обновление", MessageBoxButtons.YesNo) == DialogResult.Yes) { var id = dgvLookup.Rows[(int)CurrentRowIndex].Cells[0].Value.ToString(); var o = new DataGridViewCustomRow(); o.Id = new Guid(id); o.CreatedOn = dtCreatedOn.Value; o.ModifiedOn = dtModifiedOn.Value; o.Name = txtName.Text; o.Description = rtxtDescription.Text; Mapping[Table + "Update"]?.Invoke(o); SysLookupForm_Load(null, null); } }