コード例 #1
0
        //Refresh itemlist
        private void RefreshContractItems()
        {
            DataAccessContracts dataAccessContracts = new DataAccessContracts();

            Items = dataAccessContracts.GetContracts();

            //empty last item with default values
            ContractItem itemLast = new ContractItem();

            itemLast.ContractItemSet("", "Priceing", LoginWindow.LoggedIn.UserNameDB
                                     , DateTime.Today.ToString("yyyy-MM-dd"),
                                     "", "", "", DateTime.Today.AddMonths(1).ToString("yyyy-MM-dd"), "");

            Items.Add(itemLast);

            ContractsDataGrind.ItemsSource = Items;

            CheckSelection();
        }
コード例 #2
0
        //save or update record
        private void SaveUpdate()
        {
            DataAccessContracts dataAccessContracts = new DataAccessContracts();

            try
            {
                dataAccessContracts.AddNewContract(
                    idOfSelectedRow,
                    Items[numberOfSelectedRow].Status,
                    Items[numberOfSelectedRow].Worker,
                    Convert.ToDateTime(Items[numberOfSelectedRow].Date).ToString("yyyy-MM-dd"),
                    Items[numberOfSelectedRow].Client,
                    Items[numberOfSelectedRow].Contact,
                    Items[numberOfSelectedRow].InvoiceStatus,
                    Convert.ToDateTime(Items[numberOfSelectedRow].ExpiryDate).ToString("yyyy-MM-dd"),
                    Items[numberOfSelectedRow].Other);
            }
            catch
            {
                MessageBox.Show("Update Error");
            }
            RefreshContractItems();
        }