Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        private void btnShowTrainee_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            frmShowTrainee frm = new frmShowTrainee();

            try
            {
                sp1.Dispose();
                sp1.Close();
                addForm(frm);
            }
            catch
            {
                addForm(frm);
            }
        }