Exemplo n.º 1
0
        private void DeleteBtn_Click(object sender, RoutedEventArgs e)
        {
            var selectedCells = DateClinicMsgGrid.SelectedCells;

            if (selectedCells == null)
            {
                return;
            }

            foreach (var cellitem in selectedCells)
            {
                if (cellitem == null)
                {
                    continue;
                }

                PaiBan paiBan = cellitem.Item as PaiBan;

                string strColumn = cellitem.Column.Header.ToString();

                DateTime columnDate = DateTime.Parse(strColumn);

                int workPlanID = 0;

                workPlanID = paiBan.WorkPlanIDList[(int)columnDate.DayOfWeek];

                CommClient.WorkPlan workPlanClient = new CommClient.WorkPlan();
                workPlanClient.UpdateWorkPlanStatus(workPlanID, CommContracts.WorkPlanStatus.停诊);
            }

            updateDateClinicMsg();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 从界面中得到需要保存的排班记录列表
        /// 注意:界面上是从周一到周日分别对应的是0-6
        ///       然而,外国的一周是从周日开始的,所以枚举类型DayOfWeek是周日到周一对应0-6
        ///       会造成Bug
        /// </summary>
        /// <returns></returns>
        private List <CommContracts.WorkPlan> getSignalsFromView()
        {
            var vm = this.DataContext as HISGUIDoctorVM;

            CommClient.Employee employeeClient = new CommClient.Employee();

            var department = employeeClient.GetCurrentDepartment(vm.CurrentUser.ID);

            if (department == null)
            {
                return(null);
            }
            if (department.ID < 0)
            {
                return(null);
            }

            List <PaiBan> list = this.DateClinicMsgGrid.ItemsSource as List <PaiBan>;

            if (list == null)
            {
                return(null);
            }

            List <CommContracts.WorkPlan> sourceList = new List <CommContracts.WorkPlan>();

            for (int i = 0; i < list.Count; i++)
            {
                PaiBan paiBan = list.ElementAt(i);
                if (paiBan == null)
                {
                    continue;
                }

                if (paiBan.EmployeeID <= 0)
                {
                    continue;
                }

                for (int week = 0; week < 7; week++)
                {
                    if (paiBan.WorkPlanWorkTypeList[week] != null)
                    {
                        if (paiBan.WorkPlanWorkTypeList[week].ID == 0)
                        {
                            continue;
                        }

                        CommContracts.WorkPlan signalSource = new CommContracts.WorkPlan();
                        signalSource.ID           = paiBan.WorkPlanIDList[week];
                        signalSource.DepartmentID = department.ID;
                        signalSource.EmployeeID   = paiBan.EmployeeID;
                        signalSource.WorkTypeID   = paiBan.WorkPlanWorkTypeList[week].ID;
                        signalSource.ShiftID      = paiBan.ShiftID;
                        signalSource.MaxNum       = paiBan.MaxVistNum;


                        if (week == 0)
                        {
                            signalSource.WorkPlanDate = getMonday(currentManageDate).AddDays(6);
                        }
                        else
                        {
                            signalSource.WorkPlanDate = getMonday(currentManageDate).AddDays(week - 1);
                        }


                        if (signalSource.WorkPlanDate.Value.Date >= DateTime.Now.Date)
                        {
                            sourceList.Add(signalSource);
                        }
                    }
                }
            }
            return(sourceList);
        }
Exemplo n.º 3
0
        private List <PaiBan> updateDateClinicMsgGrid()
        {
            var vm = this.DataContext as HISGUIDoctorVM;

            CommClient.Employee employeeClient = new CommClient.Employee();

            var department = employeeClient.GetCurrentDepartment(vm.CurrentUser.ID);

            if (department == null)
            {
                return(null);
            }
            if (department.ID < 0)
            {
                return(null);
            }

            CommClient.EmployeeDepartmentHistory historyClient = new CommClient.EmployeeDepartmentHistory();
            List <CommContracts.Employee>        DoctorList    = historyClient.GetAllDepartmentDoctor(department.ID);

            if (DoctorList == null)
            {
                return(null);
            }

            CommClient.Shift           vistTimeClient = new CommClient.Shift();
            List <CommContracts.Shift> shiftList      = vistTimeClient.GetAllShift();

            if (shiftList == null)
            {
                return(null);
            }

            DateTime monday = getMonday(currentManageDate);

            List <PaiBan> data = new List <PaiBan>();

            for (int i = 0; i < DoctorList.Count(); i++)
            {
                CommContracts.Employee employee = DoctorList.ElementAt(i);
                if (employee == null)
                {
                    continue;
                }

                List <CommContracts.WorkPlan> sourceList = vm?.GetSignalSourceList(department.ID, employee.ID, monday, monday.AddDays(6), 0);
                if (sourceList == null || sourceList.Count <= 0)
                {
                    foreach (var shift in shiftList)
                    {
                        PaiBan paiBan = new PaiBan();
                        paiBan.EmployeeID = employee.ID;
                        paiBan.Name       = employee.Name;
                        paiBan.ShiftID    = shift.ID;
                        paiBan.ShiftName  = shift.Name;
                        paiBan.MaxVistNum = 0;
                        data.Add(paiBan);
                    }
                }
                else
                {
                    foreach (var vistTime in shiftList)
                    {
                        PaiBan paiBan = new PaiBan();
                        paiBan.EmployeeID = employee.ID;
                        paiBan.Name       = employee.Name;

                        paiBan.ShiftID   = vistTime.ID;
                        paiBan.ShiftName = vistTime.Name;

                        foreach (var tem in sourceList)
                        {
                            if (tem == null)
                            {
                                continue;
                            }
                            if (tem.ShiftID != vistTime.ID)
                            {
                                continue;
                            }

                            DayOfWeek dayOfWeek = tem.WorkPlanDate.Value.DayOfWeek;

                            paiBan.WorkPlanIDList[(int)dayOfWeek]       = tem.ID;
                            paiBan.WorkPlanWorkTypeList[(int)dayOfWeek] = tem.WorkType;

                            paiBan.MaxVistNum = tem.MaxNum;
                        }
                        data.Add(paiBan);
                    }
                }
            }
            return(data);
        }