コード例 #1
0
        internal static List <LichLamViecDTO> LoadLichLamViec()
        {
            DbCommand command = DataAccessCode.CreateCommand();

            command.CommandText = "dbo.LayDanhSachLichLamViec";

            DataTable             dt   = DataAccessCode.ExecuteSelectCommand(command);
            List <LichLamViecDTO> list = new List <LichLamViecDTO>();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    LichLamViecDTO lich = new LichLamViecDTO();
                    lich.MaNhanVien  = Int32.Parse(dt.Rows[i]["MaNhanVien"].ToString());
                    lich.HoNhanVien  = dt.Rows[i]["HoNhanVien"].ToString();
                    lich.TenNhanVien = dt.Rows[i]["TenNhanVien"].ToString();
                    lich.Thu         = Int32.Parse(dt.Rows[i]["Thu"].ToString());
                    lich.Ca          = Int32.Parse(dt.Rows[i]["Ca"].ToString());

                    list.Add(lich);
                }
            }
            return(list);
        }
コード例 #2
0
        public static List <ChuyenKhoaDTO> GetJoin()
        {
            var data = new SchedureEntities().SP_ChuyenKhoa_GetAll().ToList();
            List <ChuyenKhoaDTO> lst = new List <ChuyenKhoaDTO>();

            foreach (var gr in data.GroupBy(q => q.IDChuyenKhoa))
            {
                var           first      = gr.First();
                ChuyenKhoaDTO chuyenKhoa = new ChuyenKhoaDTO()
                {
                    IDChuyenKhoa = first.IDChuyenKhoa,
                    Avatar       = first.Avatar,
                    Name         = first.ChuyenKhoa_Name,
                    PhongBans    = new List <PhongBanDTO>(),
                    Status       = first.ChuyenKhoa_Status,
                    TimeUse      = first.TimeUse,
                };

                foreach (var pb in gr.GroupBy(q => q.PhongBan_Id))
                {
                    var pb_first = pb.First();
                    var phongban = new PhongBanDTO()
                    {
                        IDChuyenKhoa = pb_first.IDChuyenKhoa,
                        IDPhongBan   = pb_first.PhongBan_Id,
                        TenPhongBan  = pb_first.TenPhongBan,
                        PhongBan_Id  = pb_first.PhongBan_Id,
                        Doctors      = new List <DoctorDTO>(),
                        Status       = "ACTIVE",
                    };

                    foreach (var bs in pb.GroupBy(q => q.NhanVien_Id))
                    {
                        var bs_first = bs.First();

                        var bacsi = new DoctorDTO
                        {
                            IDDoctor     = bs_first.NhanVien_Id,
                            FullName     = bs_first.TenNhanVien,
                            LichLamViecs = new HashSet <LichLamViecDTO>(),
                        };

                        foreach (var lich in bs)
                        {
                            LichLamViecDTO lichLamViec = new LichLamViecDTO
                            {
                                IDLich   = lich.IDLich,
                                Status   = lich.LichLamViec_Status,
                                Date     = lich.Date,
                                TimeSlot = new TimeSlotDTO
                                {
                                    HourEnd   = lich.HourEnd,
                                    HourStart = lich.HourStart,
                                    Name      = lich.TimeSplot_Name,
                                    Status    = lich.TimeSlot_Status,
                                },
                                Doctor = new DoctorDTO
                                {
                                    IDDoctor     = bs_first.NhanVien_Id,
                                    FullName     = bs_first.TenNhanVien,
                                    LichLamViecs = new HashSet <LichLamViecDTO>(),
                                }
                            };
                            bacsi.LichLamViecs.Add(lichLamViec);
                        }

                        phongban.Doctors.Add(bacsi);
                    }

                    chuyenKhoa.PhongBans.Add(phongban);
                }

                lst.Add(chuyenKhoa);
            }
            return(lst.OrderBy(q => q.Name).ToList());
        }
コード例 #3
0
 public bool Create(IToken token, LichLamViecDTO obj)
 {
     return(new APIHelper(token.GetToken()).POST <object>($"api/{controlerAPI}", obj).Key);
 }