Example #1
0
        void chkCardNumber1()
        {
            int empID = 0, traineeID = 0, UserID = 0;

            var em = (from y in db.Employees
                      where y.CardNumber == cardNumber1
                      select y).ToList();

            var tr = (from yy in db.Trainees
                      where yy.CardNumber == cardNumber1
                      select yy).ToList();

            var us = (from yy in db.Users
                      where yy.CardNumber == cardNumber1
                      select yy).ToList();

            if (em.Count > 0)
            {
                foreach (var item in em)
                {
                    empID = item.EmployeeID;
                    break;
                }
                frmShowEmpolyee frm = new frmShowEmpolyee();
                frm.EmployeeID = empID;
                frm.getEmployee();
                addForm(frm);
            }
            else if (tr.Count > 0)
            {
                foreach (var item in tr)
                {
                    traineeID = item.TraineeID;
                    break;
                }
                frmShowTrainee frm = new frmShowTrainee();
                frm.TraineeID = traineeID;
                frm.getTrainee();
                addForm(frm);
            }
            else if (us.Count > 0)
            {
                foreach (var item in us)
                {
                    UserID = item.EmployeeID;
                    break;
                }
                frmShowUser frm = new frmShowUser();
                frm.UserID = UserID;
                frm.getUser();
                addForm(frm);
            }
            else
            {
                frmAddTrainee frm = new frmAddTrainee();
                frm.txtCardNumber.Text = cardNumber1;
                addForm(frm);
            }
        }
Example #2
0
        private void btnShowUser_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            frmShowUser frm = new frmShowUser();

            addForm(frm);
        }