예제 #1
0
        public bool SubmitHolidayReq(DateTime startH, DateTime endH, long StaffID)
        {
            var ID = (from a in db.employees
                      where a.StaffID == StaffID
                      select a.EmployeeID).SingleOrDefault();

            try
            {
                holidaysrequested newHlday = new holidaysrequested
                {
                    EmployeeID = (long)ID,
                    StartDate  = Convert.ToDateTime(startH.ToShortDateString()),
                    EndDate    = Convert.ToDateTime(endH.ToShortDateString()),
                    Status     = "Pending"
                };
                db.holidaysrequesteds.InsertOnSubmit(newHlday);
                db.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);

                throw;
            }
        }
        public bool SubmitHolidayReq(DateTime startH, DateTime endH, long ID)
        {
            try
            {
                holidaysrequested newHlday = new holidaysrequested
                {
                    EmployeeID = ID,
                    StartDate  = Convert.ToDateTime(startH.ToShortDateString()),
                    EndDate    = Convert.ToDateTime(endH.ToShortDateString()),
                    Status     = "Pending"
                };

                db.holidaysrequesteds.InsertOnSubmit(newHlday);
                db.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }