/// <summary> /// Saving/updating form data to the database /// </summary> private void Save() { if (isNew) { bookType.CreatedBy = 1; bookType.CreatedDate = DateTime.Now; contxt.AddressBookTypes.Add(bookType); contxt.SaveChanges(); } if (isEdit) { AddressBookType type = contxt.AddressBookTypes.Where (o => o.id == bookType.id).FirstOrDefault(); if (type != null) { type.BookTypeName = bookType.BookTypeName; type.Category01 = bookType.Category01; type.Category02 = bookType.Category02; type.Category03 = bookType.Category03; type.Category04 = bookType.Category04; type.Category05 = bookType.Category05; type.ModifiedBy = 1; type.ModifiedDate = DateTime.Now; contxt.SaveChanges(); } } }
private void cboType_SelectedIndexChanged(object sender, EventArgs e) { bookType = (AddressBookType)cboType.SelectedItem; if (bookType != null) { cboFactory.Focus(); } }
private void formAddressBookType_Load(object sender, EventArgs e) { contxt = new PMModel(); bookType = new AddressBookType(); bookTypes = new List <AddressBookType>(); company = new CompanyMaster(); companies = new List <CompanyMaster>(); state = FORMSTATE.NOOP; SetButtons(); panelMid.Enabled = false; GetAddressBookTypeList(); GetCompanyList(); }
private void cboType_SelectedIndexChanged(object sender, EventArgs e) { if (cboType.SelectedItem != null && !isFormLoading) { bookType = (AddressBookType)cboType.SelectedItem; GetAddressList(); if (bookType.BookTypeName.Trim().ToLower() == "route") { panelMBot.Visible = true; } else { panelMBot.Visible = false; } } }
private void FormAddressBook_Load(object sender, EventArgs e) { contxt = new PMModel(); bookType = new AddressBookType(); bookTypes = new List <AddressBookType>(); addresses = new List <AddressBook>(); factories = new List <FactoryMaster>(); address = new AddressBook(); factory = new FactoryMaster(); GetAddressBookTypeList(); GetFactories(); state = FORMSTATE.NOOP; SetButtons(); panelMid.Enabled = false; isFormLoading = false; panelMBot.Visible = false; }
private void ShowContents() { tbName.Text = address.AddressName; tbAL01.Text = address.AddressLine01; tbAL02.Text = address.AddressLine02; tbCity.Text = address.City; bookType = bookTypes.FirstOrDefault(o => o.id == address.AddressType); cboType.SelectedItem = bookType; factory = factories.FirstOrDefault(o => o.id == address.FactoryId); nRegNo.Value = supplier.RegNo; chkbSaving.Checked = supplier.SavingRegistered == 1 ? true : false; chkbWF.Checked = supplier.WelfareRegistered == 1 ? true : false; chkbStatus.Checked = supplier.Status == 1 ? true : false; chkbDel.Checked = supplier.Deleted == 1 ? true : false; route = routes.FirstOrDefault(o => o.id == supplier.RouteId); dtRegDate.Value = supplier.RegDate.Value; tbWelfareId.Text = supplier.WelfareId; //throw new NotImplementedException(); }
private void FormSupplierMaster_Load(object sender, EventArgs e) { contxt = new PMModel(); bookType = new AddressBookType(); bookTypes = new List <AddressBookType>(); addresses = new List <AddressBook>(); routes = new List <AddressBook>(); factories = new List <FactoryMaster>(); address = new AddressBook(); route = new AddressBook(); factory = new FactoryMaster(); supplier = new SupplierMaster(); //TypeName = "Suppliers"; GetAddressBookTypeList(); GetRoutes(); GetFactories(); state = FORMSTATE.NOOP; SetButtons(); panelMid.Enabled = false; AdjustFields(); LoadPartners(); isFormLoading = false; }
private void dgvType_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { bookType = (AddressBookType)dgvType.Rows[e.RowIndex].DataBoundItem; ShowRowContents(); btnEdit_Click(sender, new EventArgs()); }