示例#1
0
 private void DeleteSB_Click(object sender, EventArgs e)
 {
     ContractorsLogic wares = new ContractorsLogic(manager);
     wares.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value));
     manager.Save();
     Fill();
 }
示例#2
0
 /// <summary>
 /// Заповнення переліку контрагентів
 /// </summary>
 private void InitContractorsLookUp()
 {
     ContractorsLogic contractors = new ContractorsLogic(manager);
     BindingSource bs = new BindingSource();
     bs.DataSource = contractors.GetAll();
     // Bind the edit value to the ProductID field of the "Order Details" table.
     // The edit value matches the value of the ValueMember field
     //ContractorLUE.DataBindings.Add("EditValue", bs, "ID");
     // Specify the data source to display in the dropdown.
     ContractorLUE.Properties.DataSource = bs;
     // The field providing the editor's display text.
     ContractorLUE.Properties.DisplayMember = "LastName";
     // The field matching the edit value.
     ContractorLUE.Properties.ValueMember = "ID";
     // Add two columns to the dropdown.
     LookUpColumnInfoCollection coll = ContractorLUE.Properties.Columns;
     // A column to display the ProductID field's values.
     coll.Add(new LookUpColumnInfo("ID", 0));
     // A column to display the ProductName field's values.
     coll.Add(new LookUpColumnInfo("LastName", 0, "Прізвище"));
     // A column to display the QuantityPerUnit field's values.
     coll.Add(new LookUpColumnInfo("FirstName", 0, "Ім'я"));
     coll.Add(new LookUpColumnInfo("MiddleName", 0, "По-батькові"));
     coll.Add(new LookUpColumnInfo("City", 0, "Місто"));
     // Set column widths according to their contents and resize the popup, if required.
     ContractorLUE.Properties.BestFitMode = BestFitMode.BestFitResizePopup;
     // Enable auto completion search mode.
     ContractorLUE.Properties.SearchMode = SearchMode.AutoFilter;
     // Specify the column against which to perform the search.
     ContractorLUE.Properties.AutoSearchColumnIndex = 1;
     //ContractorCB.DataSource = contractors.GetAll();
     //ContractorCB.DisplayMember = "LastName";
     //ContractorCB.ValueMember = "ID";
     //ContractorCB.Update();
 }
示例#3
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;
        }