Esempio n. 1
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();
 }
Esempio n. 2
0
 private void Fill()
 {
     ContractorTypesLogic types = new ContractorTypesLogic(manager);
     DataGV.AutoGenerateColumns = false;
     DataGV.DataSource = types.GetAll();
     DataGV.Update();
 }
Esempio n. 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;
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
        private void Fill()
        {
            ContractorTypesLogic types = new ContractorTypesLogic(manager);

            DataGV.AutoGenerateColumns = false;
            DataGV.DataSource          = types.GetAll();
            DataGV.Update();
        }
Esempio n. 6
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;
                }
            }
        }
Esempio n. 7
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;
                }
            }
        }
Esempio n. 8
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();
        }
Esempio n. 9
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();
        }
Esempio n. 10
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;
        }
Esempio n. 11
0
        private void Fill()
        {
            ContractorsLogic     cl    = new ContractorsLogic(manager);
            ContractorTypesLogic types = new ContractorTypesLogic(manager);

            ContractorTypesCBE.Properties.ValueMember   = "ID";
            ContractorTypesCBE.Properties.DisplayMember = "Name";

            foreach (var a in types.GetAll())
            {
                ContractorTypesCBE.Properties.Items.Add(a.ID, a.Name, CheckState.Unchecked, true);
            }

            if (mode == "edit")
            {
                Contractor contractor = cl.Get(Convert.ToInt32(id));
                if (contractor != null)
                {
                    PrefixNameTE.Text = contractor.PrefixName;
                    LastNameTE.Text   = contractor.LastName;
                    FirstNameTE.Text  = contractor.FirstName;
                    MiddleNameE.Text  = contractor.MiddleName;

                    CountryTE.Text  = contractor.Country;
                    RegionTE.Text   = contractor.Region;
                    DistrictTE.Text = contractor.District;
                    CityTE.Text     = contractor.City;
                    StreetTE.Text   = contractor.Street;
                    BuildingTE.Text = contractor.Building;
                    FlatTE.Text     = contractor.Flat;
                    PhoneTE.Text    = contractor.Phone;
                    MobPhoneTE.Text = contractor.MobilePhone;
                    EmailTE.Text    = contractor.EMail;
                    SiteTE.Text     = contractor.Site;

                    if (contractor.Birthdate != null)
                    {
                        BirthDateTE.DateTime = Convert.ToDateTime(contractor.Birthdate);
                    }

                    if (contractor.Sex != null)
                    {
                        if (contractor.Sex == true)
                        {
                            SexRG.SelectedIndex = 0;
                        }
                        if (contractor.Sex == false)
                        {
                            SexRG.SelectedIndex = 1;
                        }
                    }

                    if (contractor.Person != null)
                    {
                        if (contractor.Person == true)
                        {
                            PersonRG.SelectedIndex = 1;
                        }
                        if (contractor.Person == false)
                        {
                            PersonRG.SelectedIndex = 0;
                        }
                    }

                    List <ContractorContractorType> checkedTypes = cl.GetContractorTypesForContractor(contractor.ID);

                    foreach (DevExpress.XtraEditors.Controls.CheckedListBoxItem i in ContractorTypesCBE.Properties.Items)
                    {
                        foreach (var a in checkedTypes)
                        {
                            if (a.ContractorTypeID == Convert.ToInt32(i.Value))
                            {
                                i.CheckState = CheckState.Checked;
                            }
                        }
                    }

                    //вибираємо картки по клієнту
                    DataGV.AutoGenerateColumns = false;
                    DataGV.DataSource          = cl.GetCards(contractor.ID);
                    DataGV.Update();
                }
            }
        }