Ejemplo n.º 1
0
        public void GetBalance()
        {
            try
            {
                //    db = new LetranIntegratedSystemEntities();
                BList = new List <BalanceList>();

                var x = db.GetHRiSLeaveBalances().OrderBy(m => m.EmployeeName).ToList();

                foreach (var i in x)
                {
                    BalanceList bl = new BalanceList();
                    bl.Department            = i.Department;
                    bl.Designation           = i.Designation;
                    bl.EmployeeID            = i.EmployeeID;
                    bl.EmployeeName          = i.EmployeeName.ToUpper();
                    bl.EmployeeNumber        = i.EmployeeNo;
                    bl.LeaveBalanceID        = i.LeaveBalanceID;
                    bl.SickLeaveBalance      = i.SickLeaveBalance.Value;
                    bl.VacationLeaveBalance  = i.VacationLeaveBalance.Value;
                    bl.ServiceIncentiveLeave = i.ServiceIncentiveLeave.Value;
                    //el.NickName = x.Nickname == null ? " " : x.Nickname;
                    BList.Add(bl);
                }
                dgBalances.ItemsSource = BList.OrderBy(m => m.EmployeeName);
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong!", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 2
0
        private void cbEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                using (var db = new LetranIntegratedSystemEntities())
                {
                    BList = new List <BalanceList>();
                    var         empid = Convert.ToInt32(cbEmployee.SelectedValue);
                    var         x     = db.GetHRiSLeaveBalances().Where(m => m.EmployeeID == empid).OrderBy(m => m.EmployeeName).FirstOrDefault();
                    BalanceList bl    = new BalanceList();

                    if (x != null)
                    {
                        bl.Department            = x.Department;
                        bl.Designation           = x.Designation;
                        bl.EmployeeID            = x.EmployeeID;
                        bl.EmployeeName          = x.EmployeeName.ToUpper();
                        bl.EmployeeNumber        = x.EmployeeNo;
                        bl.LeaveBalanceID        = x.LeaveBalanceID;
                        bl.SickLeaveBalance      = x.SickLeaveBalance.Value;
                        bl.VacationLeaveBalance  = x.VacationLeaveBalance.Value;
                        bl.ServiceIncentiveLeave = x.ServiceIncentiveLeave.Value;
                        //el.NickName = x.Nickname == null ? " " : x.Nickname;
                        BList.Add(bl);

                        dgBalances.ItemsSource = BList.OrderBy(m => m.EmployeeName);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }