예제 #1
0
        public void GetLeave()
        {
            try
            {
                db = new LetranIntegratedSystemEntities();
                al = new List <ApprovedList>();

                var x = db.GetHRiSLeaveApproved().ToList();

                foreach (var i in x)
                {
                    ApprovedList Alist = new ApprovedList();

                    Alist.LeaveID       = i.LeaveID;
                    Alist.EmployeeNo    = i.EmployeeNo;
                    Alist.EmployeeName  = i.EmployeeName.ToUpper();
                    Alist.DateFiled     = i.FiledDate.Value;
                    Alist.StartDate     = i.StartDate.Value;
                    Alist.EndDate       = i.EndDate.Value;
                    Alist.Type          = i.LeaveCode;
                    Alist.Days          = i.Days.Value;
                    Alist.Status        = i.Status;
                    Alist.Reason        = i.Reason;
                    Alist.ApprovedDate  = i.ApprovedDate.Value;
                    Alist.ApprovedBy    = i.Approved;
                    Alist.LeaveStatusID = i.LeaveApprovedStatusID.Value;

                    al.Add(Alist);
                }
                dgApproved.ItemsSource = al.OrderByDescending(m => m.DateFiled);
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong!", "System Warning.", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }