Esempio n. 1
0
        private void ChangeContractButton_Click(object sender, RoutedEventArgs e)
        {
            if (contractListView.SelectedItem == null)
            {
                MessageBox.Show("errror");
                return;
            }
            Items             item         = (Items)contractListView.SelectedItem;
            AddContractWindow contractWind = new AddContractWindow(item.typeName, item.artistCategory, item.beginDate, item.endDate,
                                                                   item.OrderNum, item.Position);

            if (contractWind.ShowDialog() == false)
            {
                this.Visibility = Visibility.Visible;
                return;
            }
            contractListView.Items.Remove(contractListView.SelectedItem);
            contractListView.Items.Add(new Items
            {
                typeName       = contractWind.typeOfCon,
                beginDate      = (DateTime)contractWind.beginningDt,
                endDate        = (DateTime)contractWind.endDt,
                OrderNum       = contractWind.orderN,
                artistCategory = contractWind.artistCat,
                Position       = contractWind.posit
            });
            contractListView.Items.Refresh();
        }
Esempio n. 2
0
        private void AddContractButton_Click(object sender, RoutedEventArgs e)
        {
            TimeSpan days = TimeSpan.Zero;

            if (contractListView.Items != null)
            {
                for (int i = contractListView.Items.Count - 1; i >= 0; i--)
                {
                    Items Value = (Items)contractListView.Items[i];
                    if (Value.contr.ContractTypeId == 2)
                    {
                        days += Value.contr.EndDate - Value.contr.BeginningDate;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            AddContractWindow contractWind = null;

            if (days.Days > 1826)
            {
                contractWind = new AddContractWindow(false);
            }
            else
            {
                contractWind = new AddContractWindow(true);
            }
            //1826
            //var it = ;

            this.Visibility = Visibility.Collapsed;
            if (contractWind.ShowDialog() == false)
            {
                this.Visibility = Visibility.Visible;
                return;
            }
            if (contractWind.DialogResult.HasValue && contractWind.DialogResult.Value)
            {
                Contract contract = new Contract();
                contract.ContractTypeId   = contractTypeRepositoty.Get(p => p.Name == contractWind.typeOfCon).First().ID;
                contract.BeginningDate    = (DateTime)contractWind.beginningDt;
                contract.EndDate          = (DateTime)contractWind.endDt;
                contract.WorkerId         = worker.ID;
                contract.OrderNum         = contractWind.orderN;
                contract.ArtistCategoryId = artistCategoryRepositoty.Get(p => p.Name == contractWind.artistCat).First().ID;
                contract.Position         = contractWind.posit;

                contractRepositoty.Insert(contract);

                contractListView.Items.Add(new Items
                {
                    contr = contract
                });
            }
            this.Visibility = Visibility.Visible;
            contractListView.Items.Refresh();
        }
Esempio n. 3
0
        private void ChangeContractButton_Click(object sender, RoutedEventArgs e)
        {
            if (contractListView.SelectedItem == null)
            {
                MessageBox.Show("errror");
                return;
            }
            Items item = (Items)contractListView.SelectedItem;

            AddContractWindow contractWind = new AddContractWindow(contractTypeRepositoty.FindByID(item.contr.ContractTypeId).Name,
                                                                   artistCategoryRepositoty.FindByID(item.contr.ArtistCategoryId).Name,
                                                                   item.contr.BeginningDate, item.contr.EndDate,
                                                                   item.contr.OrderNum, item.contr.Position);

            this.Visibility = Visibility.Collapsed;
            if (contractWind.ShowDialog() == false)
            {
                this.Visibility = Visibility.Visible;
                return;
            }

            contractListView.Items.Remove(contractListView.SelectedItem);
            if (contractWind.DialogResult.HasValue && contractWind.DialogResult.Value)
            {
                Contract contract = item.contr;
                contract.ContractTypeId   = contractTypeRepositoty.Get(p => p.Name == contractWind.typeOfCon).First().ID;
                contract.BeginningDate    = (DateTime)contractWind.beginningDt;
                contract.EndDate          = (DateTime)contractWind.endDt;
                contract.WorkerId         = worker.ID;
                contract.OrderNum         = contractWind.orderN;
                contract.ArtistCategoryId = artistCategoryRepositoty.Get(p => p.Name == contractWind.artistCat).First().ID;
                contract.Position         = contractWind.posit;

                contractListView.Items.Add(new Items
                {
                    contr = contract
                });
            }

            this.Visibility = Visibility.Visible;

            contractListView.Items.Refresh();
        }
Esempio n. 4
0
        private void AddContractButton_Click(object sender, RoutedEventArgs e)
        {
            AddContractWindow contractWind = new AddContractWindow(false);

            if (contractWind.ShowDialog() == false)
            {
                this.Visibility = Visibility.Visible;
                return;
            }

            contractListView.Items.Add(new Items
            {
                typeName       = contractWind.typeOfCon,
                beginDate      = (DateTime)contractWind.beginningDt,
                endDate        = (DateTime)contractWind.endDt,
                OrderNum       = contractWind.orderN,
                artistCategory = contractWind.artistCat,
                Position       = contractWind.posit
            });
            contractListView.Items.Refresh();
        }