public int updateDeliveryAddr(DeliveryAddr addr, DataActionMode mode) { try { switch (mode) { case DataActionMode.Add: _context.DeliveryAddrs.Add(addr); break; case DataActionMode.Edit: var _addr = getAddrById(addr.id); _addr.Address = addr.Address; _addr.City = addr.City; _addr.ContactName = addr.ContactName; _addr.Country = addr.Country; _addr.email = addr.email; _addr.fax = addr.fax; _addr.mobile = addr.mobile; _addr.phone = addr.phone; _addr.Province = addr.Province; _addr.Zipcode = addr.Zipcode; break; } return(_context.SaveChanges()); } catch { return(0); } }
public AddrInfo(DeliveryAddr addr, DataActionMode custMode, DataActionMode addrMode) { InitializeComponent(); Address = addr; _custMode = custMode; _addrMode = addrMode; lbMode.Text = _addrMode.ToString(); lbCustomerCode.Text = Address.CustCode; }
private void addressInfo(DeliveryAddr addr) { txtAddress.Text = addr.Address; txtCity.Text = addr.City; txtContactName.Text = addr.ContactName; txtCountry.Text = addr.Country; txtFax.Text = addr.fax; txtEmail.Text = addr.email; txtMobile.Text = addr.mobile; txtPhone.Text = addr.phone; txtProvince.Text = addr.Province; txtZipCode.Text = addr.Zipcode; updateUI(); }
private void deliveryAddrInfo(DeliveryAddr addr, DataActionMode custMode, DataActionMode addrMode) { using (var _da = new views.Master.Customer.AddrInfo(addr, custMode, addrMode)) { _da.StartPosition = FormStartPosition.CenterScreen; if (_da.ShowDialog(this) == DialogResult.OK) { // add to delivery address collection if (_custMode == DataActionMode.Add) { _addrs.Add(_da.Address); dgvAddr.DataSource = _addrs.ToDataTable(); } } } if (_custMode != DataActionMode.Add) { tsbtnRefresh.PerformClick(); } }