private void EditProjectHours_Click(object sender, RoutedEventArgs e)
        {

            projectmasterDataSetTableAdapters.project_hoursTableAdapter pha = new projectmasterDataSetTableAdapters.project_hoursTableAdapter();
            string description = txtphdescription.Text;
            DateTime date = (DateTime)dpHoursDate.SelectedDate;
            decimal hours = Convert.ToDecimal(txthours.Text);
            int phid = (int)txtPhid.Content;

            pha.UpdateProjectHours(pid, eid, description, date, DateTime.Now, hours, phid);
            this.Close();
            MessageBox.Show("Færslu hefur verið breytt");
        }
Beispiel #2
0
        private void menu_RemoveProjectHours_Click(object sender, RoutedEventArgs e)
        {
            //
            //Remove hoursentry.  Userrights -> project owner/creator and admin
            //
            DataRowView drv = (DataRowView)project_hoursDataGrid.SelectedItem;
            string description = (string)drv["hourdescription"];
            int phid = (int)project_hoursDataGrid.SelectedValue;
            MessageBoxResult dlg = MessageBox.Show("Ertu viss um að þú viljir eyða færslu nr. "+ phid  + "?" , "Eyða færslu?", MessageBoxButton.YesNo);
            

            if (dlg == MessageBoxResult.Yes)
            {
                try
                {
                    projectmasterDataSetTableAdapters.project_hoursTableAdapter phta = new projectmasterDataSetTableAdapters.project_hoursTableAdapter();
                    phta.DeleteProjectHours(phid);
                    MessageBox.Show("Færslu nr. " + phid + " hefur verið eytt.");
                    UpdateWindow();

                }
                catch (Exception)
                {
                    //MessageBox.Show(exc.ToString());
                    MessageBox.Show("Ekki hægt að eyða færslu nr." + phid , "Framkvæmd mistókst");
                }
            }
        }
        private void AddProjectHours_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                
                string description = (string)txtphdescription.Text;
                DateTime hoursdate = (DateTime)dpHoursDate.SelectedDate;
                int hours = Convert.ToInt32(txthours.Text);
                projectmasterDataSetTableAdapters.project_hoursTableAdapter pha = new projectmasterDataSetTableAdapters.project_hoursTableAdapter();
                pha.Insert(pid, eid, description, hoursdate, DateTime.Now, hours);
                this.Close();
            }
            catch (Exception)
            {

                MessageBox.Show("Verður að fylla rétt í viðeigandi reiti");
            }
        }