Exemplo n.º 1
0
        private void Save()
        {
            GetContents();
            if (isNew)
            {
                contxt.CompanyMasters.Add(company);
                contxt.SaveChanges();
                isNew = false; isEdit = false;
                state = FORMSTATE.NOOP;

                SetButtons();
            }
            if (isEdit)
            {
                CompanyMaster com = contxt.CompanyMasters.Where(
                    o => o.id == company.id).FirstOrDefault();
                if (com != null)
                {
                    com.CompanyName = company.CompanyName;

                    contxt.SaveChanges();
                    isNew = false; isEdit = false;
                    state = FORMSTATE.NOOP;
                    SetButtons();
                }
            }
        }
Exemplo n.º 2
0
 private void dgvCo_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     company = (CompanyMaster)dgvCo.Rows[e.RowIndex].DataBoundItem;
     isEdit  = true; isNew = false;
     state   = FORMSTATE.EDIT;
     SetButtons();
     ShowContents();
     panelMid.Enabled = true;
 }
Exemplo n.º 3
0
 private void ShowContents()
 {
     tbFacName.Text = factory.FactoryName;
     company        = companies.Where(o => o.id == factory.CompanyId).FirstOrDefault();
     if (company != null)
     {
         cboCom.SelectedItem = company;
     }
     //throw new NotImplementedException();
 }
Exemplo n.º 4
0
 private void FormCompany_Load(object sender, EventArgs e)
 {
     contxt    = new PMModel();
     company   = new CompanyMaster();
     companies = new List <CompanyMaster>();
     GetCompanyList();
     state = FORMSTATE.NOOP;
     SetButtons();
     isEdit           = false; isNew = false;
     panelMid.Enabled = false;
     isFormLoading    = false;
 }
Exemplo n.º 5
0
 private void ShowRowContents()
 {
     tbABTypeName.Text = bookType.BookTypeName;
     tbCat01.Text      = bookType.Category01;
     tbCat02.Text      = bookType.Category02;
     tbCat03.Text      = bookType.Category03;
     if (bookType.CompanyId != null)
     {
         company             = companies.Where(o => o.id == bookType.CompanyId).FirstOrDefault();
         cboCom.SelectedItem = company;
     }
 }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
 private void cboCom_SelectedIndexChanged(object sender, EventArgs e)
 {
     company = (CompanyMaster)cboCom.SelectedItem;
 }