Example #1
0
 private void Fill()
 {
     ContractorTypesLogic types = new ContractorTypesLogic(manager);
     DataGV.AutoGenerateColumns = false;
     DataGV.DataSource = types.GetAll();
     DataGV.Update();
 }
Example #2
0
 private void DeleteSB_Click(object sender, EventArgs e)
 {
     ContractorTypesLogic types = new ContractorTypesLogic(manager);
     types.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value));
     manager.Save();
     Fill();
 }
Example #3
0
        private void Fill()
        {
            ContractorTypesLogic types = new ContractorTypesLogic(manager);

            if (mode == "edit")
            {
                ContractorType type = types.Get(Convert.ToInt32(id));
                if (type != null)
                {
                    NameTB.Text = type.Name;
                }
            }
        }
Example #4
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            ContractorTypesLogic types = new ContractorTypesLogic(manager);

            if (mode == "new")
            {
                types.Create(NameTB.Text);
            }
            if (mode == "edit")
            {
                types.Update(Convert.ToInt32(id), NameTB.Text);
            }
            manager.Save();

            this.Close();
        }
Example #5
0
        private void Fill()
        {
            ContractorsLogic contractors = new ContractorsLogic(manager);
            DataGV.AutoGenerateColumns = false;
            List<Contractor> resultA = contractors.GetAll();
            List<ContractorView> contractorsView = new List<ContractorView>();
            foreach (Contractor a in resultA)
            {
                ContractorView c = new ContractorView(a,manager);
                contractorsView.Add(c);
            }
            view = new SortableBindingList<ContractorView>(contractorsView);
            DataGV.DataSource = view;
            DataGV.AutoResizeRows();
            DataGV.Update();

            PersonCB.SelectedIndex = 0;
            ContractorTypesDDL.Items.Clear();
            ContractorTypesLogic types = new ContractorTypesLogic(manager);
            ContractorTypesDDL.DisplayMember = "Name";
            ContractorTypesDDL.ValueMember = "ID";
            ContractorType all = new ContractorType();
            all.ID = -1;
            all.Name = " - всі - ";
            ContractorTypesDDL.Items.Add(all);
            foreach (var a in types.GetAll())
            {
                ContractorTypesDDL.Items.Add(a);
            }
            ContractorTypesDDL.SelectedIndex = 0;
        }