Esempio n. 1
0
        private void btnLeaveStatTruncate_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities context = new MEAPSDbEntities();

            context.Database.ExecuteSqlCommand("TRUNCATE TABLE[LeaveStatuses]");
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 2
0
        private void btnLEDel_Click(object sender, RoutedEventArgs e)
        {
            LeaveApplication la        = (LeaveApplication)dataGridLeaveApp.SelectedItem;
            MEAPSDbEntities  context   = new MEAPSDbEntities();
            LeaveApplication deletable = context.LeaveApplications.SingleOrDefault(x => x.Date == la.Date);

            context.LeaveApplications.Remove(deletable);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 3
0
        private void btnTEDel_Click(object sender, RoutedEventArgs e)
        {
            TimeException   te        = (TimeException)dataGridExcepTime.SelectedItem;
            MEAPSDbEntities context   = new MEAPSDbEntities();
            TimeException   deletable = context.TimeExceptions.SingleOrDefault(x => x.Date == te.Date);

            context.TimeExceptions.Remove(deletable);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 4
0
        private void btnAEDel_Click(object sender, RoutedEventArgs e)
        {
            ExceptionAttendance ae        = (ExceptionAttendance)dataGridExcepHolidays.SelectedItem;
            MEAPSDbEntities     context   = new MEAPSDbEntities();
            ExceptionAttendance deletable = context.ExceptionAttendances.SingleOrDefault(x => ((x.EmpId == ae.EmpId) && (x.Date == ae.Date)));

            context.ExceptionAttendances.Remove(deletable);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 5
0
        private void btnHolidaysDel_Click(object sender, RoutedEventArgs e)
        {
            Holiday         h         = (Holiday)dataGridHolidays.SelectedItem;
            MEAPSDbEntities context   = new MEAPSDbEntities();
            Holiday         deletable = context.Holidays.SingleOrDefault(x => x.Date == h.Date);

            context.Holidays.Remove(deletable);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 6
0
        private void btnEmpDelSelected_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities context   = new MEAPSDbEntities();
            Employee        em        = (Employee)dataGridEmployees.SelectedItem;
            Employee        deletable = context.Employees.SingleOrDefault(x => x.EmpId == em.EmpId);

            context.Employees.Remove(deletable);
            context.SaveChanges();
            RefreshDataGrids();
        }
        private void btnDel_Click(object sender, RoutedEventArgs e)
        {
            Attendance      at        = (Attendance)dataGrid.SelectedItem;
            MEAPSDbEntities context   = new MEAPSDbEntities();
            Attendance      deletable = context.Attendances.SingleOrDefault(x => x.SISOId == at.SISOId);

            context.Attendances.Remove(deletable);
            context.SaveChanges();
            dataGrid.ItemsSource = context.Attendances.ToList();
            dataGrid.Items.Refresh();
        }
Esempio n. 8
0
        private void btnHolidaysAdd_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities context = new MEAPSDbEntities();
            Holiday         h       = new Holiday();

            h.Date    = (DateTime)calHolidays.SelectedDate;
            h.Comment = txtHolidayComment.Text;
            context.Holidays.Add(h);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 9
0
        private void btnAEAdd_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities     context = new MEAPSDbEntities();
            ExceptionAttendance ae      = new ExceptionAttendance();
            ComboBoxItem        EmpId   = (ComboBoxItem)cbAEEmp.SelectedItem;

            ae.EmpId   = Convert.ToInt32(EmpId.Content);
            ae.Date    = Convert.ToDateTime(dtAEDate.Text);
            ae.Remarks = txtAERemarks.Text;
            context.ExceptionAttendances.Add(ae);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 10
0
        private void btnLEAdd_Click(object sender, RoutedEventArgs e)
        {
            LeaveApplication la = new LeaveApplication();

            la.Date          = Convert.ToDateTime(dtLEDate.Text);
            la.EmployeeEmpId = Int32.Parse(cbLEEmp.Text);
            la.Type          = cbLeaveType.Text;
            la.Remarks       = txtLERemarks.Text;
            MEAPSDbEntities context = new MEAPSDbEntities();

            context.LeaveApplications.Add(la);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 11
0
        private void btnTEAdd_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities context = new MEAPSDbEntities();
            TimeException   te      = new TimeException();

            te.Date = Convert.ToDateTime(dtTEDate.Text);
            string entryTime = cbInHrs.Text + ":" + cbInMins.Text;
            string exitTime  = cbOutHrs.Text + ":" + cbOutMins.Text;

            te.InTime  = TimeSpan.Parse(entryTime);
            te.OutTime = TimeSpan.Parse(exitTime);
            context.TimeExceptions.Add(te);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 12
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            MEAPSDbEntities  context = new MEAPSDbEntities();
            TabCtrl          t       = context.TabCtrls.First();
            MessageBoxResult result  = MessageBox.Show("Save position?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                t.selectedIndex = tabCtrlMain.SelectedIndex.ToString();
            }
            else
            {
                t.selectedIndex = "0";
            }
            context.SaveChanges();
            Application.Current.Shutdown();
        }
Esempio n. 13
0
        private void btnEmpUpdate_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities context   = new MEAPSDbEntities();
            Employee        em        = (Employee)dataGridEmployees.SelectedItem;
            Employee        updatable = context.Employees.SingleOrDefault(x => x.EmpId == em.EmpId);

            updatable.EmpId       = int.Parse(txtEmpId.Text);
            updatable.Name        = txtEmpName.Text;
            updatable.Dept        = txtDept.Text;
            updatable.CL          = Double.Parse(txtCL.Text);
            updatable.ML          = Double.Parse(txtML.Text);
            updatable.EL          = Double.Parse(txtEL.Text);
            updatable.JoiningDate = Convert.ToDateTime(dtJoiningDate.Text);
            updatable.LWP         = Double.Parse(txtLWP.Text);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 14
0
        private void btnEmpAdd_Click(object sender, RoutedEventArgs e)
        {
            MEAPSDbEntities context = new MEAPSDbEntities();
            Employee        em      = new Employee();

            em.EmpId       = Int32.Parse(txtEmpId.Text);
            em.Name        = txtEmpName.Text;
            em.Dept        = txtDept.Text;
            em.CL          = Double.Parse(txtCL.Text);
            em.ML          = Double.Parse(txtML.Text);
            em.EL          = Double.Parse(txtEL.Text);
            em.LWP         = Double.Parse(txtLWP.Text);
            em.JoiningDate = Convert.ToDateTime(dtJoiningDate.Text);
            context.Employees.Add(em);
            context.SaveChanges();
            RefreshDataGrids();
        }
Esempio n. 15
0
        public MainWindow()
        {
            InitializeComponent();
            RefreshDataGrids();
            MEAPSDbEntities context = new MEAPSDbEntities();
            TabCtrl         t       = context.TabCtrls.FirstOrDefault();

            if (t == null)
            {
                t = new TabCtrl();
                t.selectedIndex = "0";
                context.TabCtrls.Add(t);
                context.SaveChanges();
            }
            btnLaunchViewer.Visibility = Visibility.Hidden;
            tabCtrlMain.SelectedIndex  = Int32.Parse(t.selectedIndex);
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            Attendance   at        = new Attendance();
            string       entryTime = cbInHrs.Text + ":" + cbInMins.Text;
            string       exitTime  = cbOutHrs.Text + ":" + cbOutMins.Text;
            ComboBoxItem EmpId     = (ComboBoxItem)cbEmp.SelectedItem;

            at.Employee_EmpId = Convert.ToInt32(EmpId.Content);
            at.InTime         = TimeSpan.Parse(entryTime);
            at.OutTime        = TimeSpan.Parse(exitTime);
            at.Date           = Convert.ToDateTime(dtDate.Text);
            MEAPSDbEntities context = new MEAPSDbEntities();

            context.Attendances.Add(at);
            context.SaveChanges();
            dataGrid.ItemsSource = context.Attendances.ToList();
            dataGrid.Items.Refresh();
        }