private void Save() { GetContents(); if (isNew) { contxt.FactoryMasters.Add(factory); contxt.SaveChanges(); isNew = false; isEdit = false; state = FORMSTATE.NOOP; SetButtons(); } if (isEdit) { FactoryMaster fac = contxt.FactoryMasters.Where( o => o.id == factory.id).FirstOrDefault(); if (fac != null) { fac.FactoryName = factory.FactoryName; fac.CompanyId = factory.CompanyId; contxt.SaveChanges(); isNew = false; isEdit = false; state = FORMSTATE.NOOP; SetButtons(); } } GetFactoryList(); }
private void cboFactory_SelectedIndexChanged(object sender, EventArgs e) { if (cboFactory.SelectedItem != null && !isFormLoading) { factory = (FactoryMaster)cboFactory.SelectedItem; if (factory.id == 0) { MessageBox.Show("Call add factory Form Here"); } } }
private void FormProducts_Load(object sender, EventArgs e) { contxt = new PMModel(); factories = new List <FactoryMaster>(); factory = new FactoryMaster(); products = new List <Product>(); product = new Product(); GetFactories(); GetProducts(); isNew = false; isEdit = false; state = FORMSTATE.NOOP; SetButtons(); panelMid.Enabled = false; isFormLoading = 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 FormFactory_Load(object sender, EventArgs e) { contxt = new PMModel(); company = new CompanyMaster(); companies = new List <CompanyMaster>(); factory = new FactoryMaster(); factories = new List <FactoryMaster>(); GetCompanyList(); GetFactoryList(); ///tbFacName.MaxLength = from meta in contxt.FactoryMasters.Me state = FORMSTATE.NOOP; SetButtons(); isEdit = false; isNew = false; panelMid.Enabled = false; isFormLoading = false; }
private void GetFactories() { if (contxt.FactoryMasters.ToList().Count > 0) { factories = contxt.FactoryMasters.ToList(); } else { FactoryMaster newFac = new FactoryMaster(); newFac.FactoryName = "New"; newFac.id = 0; factories.Add(newFac); } cboFactory.DataSource = factories; cboFactory.DisplayMember = "FactoryName"; cboFactory.ValueMember = "id"; //throw new NotImplementedException(); }
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 dgvFac_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { factory = (FactoryMaster)dgvFac.Rows[e.RowIndex].DataBoundItem; btnEdit_Click(sender, new EventArgs()); }
private void cboFactory_SelectedIndexChanged(object sender, EventArgs e) { factory = (FactoryMaster)cboFactory.SelectedItem; }