private void Fill()
        {
            switch (type)
            {
            case Enums.CommonOperationType.ODoctor:
                pnlNurse.Visible  = false;
                pnlDoctor.Visible = true;
                using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString))
                {
                    var docRepos = new DoctorRepository(uow);
                    cmbDoc.ValueMember   = "ID";
                    cmbDoc.DisplayMember = "FullName";
                    cmbDoc.DataSource    = docRepos.GetAllDoctorsL();
                    cmbDoc.Text          = "Choose A Doctor...";
                }
                break;

            case Enums.CommonOperationType.ONurse:
                pnlDoctor.Visible = false;
                pnlNurse.Visible  = true;
                using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString))
                {
                    var nurseRepos = new NurseRepository(uow);
                    cmbNurse.ValueMember   = "ID";
                    cmbNurse.DisplayMember = "FullName";
                    cmbNurse.DataSource    = nurseRepos.GetAllNursesL();
                    cmbNurse.Text          = "Choose A Nurse...";
                }
                break;
            }
        }
        private void btnNLeave_Click(object sender, EventArgs e)
        {
            int  data   = 0;
            bool _excep = false;

            using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString))
            {
                try
                {
                    Models.AnnualLeave annualLeave = new Models.AnnualLeave()
                    {
                        WorkerID   = (int)cmbNurse.SelectedValue,
                        WorkerType = (int)type,
                        Duration   = Convert.ToInt32(txtLeaveDurationN.Text),
                        LeaveType  = chkHasReport.Checked ? 2 : 1
                    };
                    var nRepos = new NurseRepository(uow);
                    data = nRepos.InsertAnnual(annualLeave);
                    uow.SaveChanges();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    _excep = true;
                }
                if (data == 2 && _excep == false)
                {
                    MessageBox.Show("The operation is successfull");
                }
            }
        }
예제 #3
0
        public FormAdminWindow(IMainController inController, DoctorRepository inDoctorRepository, NurseRepository inNurseRepository)
        {
            _controller       = inController;
            _doctorRepository = inDoctorRepository;
            _nurseRepository  = inNurseRepository;

            InitializeComponent();
        }
예제 #4
0
        public List <nurse> GetNurses()
        {
            INurseRepository repo = new NurseRepository();

            return(repo.GetNurses());
        }
예제 #5
0
        public nurse GetNurseByUserId(int userid)
        {
            INurseRepository repo = new NurseRepository();

            return(repo.GetNurseByUserId(userid));
        }
예제 #6
0
        public nurse GetNurseByPersonId(int personid)
        {
            INurseRepository repo = new NurseRepository();

            return(repo.GetNurseByPersonId(personid));
        }
예제 #7
0
        public void DeleteNurse(int id)
        {
            INurseRepository repo = new NurseRepository();

            repo.DeleteNurse(id);
        }
예제 #8
0
        public void CreateNurse(nurse objNurse)
        {
            INurseRepository repo = new NurseRepository();

            repo.CreateNurse(objNurse);
        }