示例#1
0
        public List <ContractViewModel> ListAll()
        {
            contract = db.GetTable <Contract>();
            employee = db.GetTable <Employee>();
            var query = from c in contract
                        join e in employee
                        on c.EmployeeID equals e.EmployeeID
                        join e2 in employee
                        on c.CreatedBy equals e2.EmployeeID
                        where c.Status == true
                        select new ContractViewModel
            {
                ContractID       = c.ContractID,
                ContractType     = c.ContractType,
                TimeType         = c.TimeType == 0 ? "Không thời hạn" : "Có thời hạn",
                EmployeeID       = e.EmployeeID,
                EmployeeFullName = e.FirstName + " " + e.LastName,
                PayRate          = c.PayRate,
                StartDate        = c.StartDate,
                EndDate          = c.EndDate,
                CreatedBy        = c.CreatedBy,
                CreatedByName    = e2.FirstName + " " + e2.LastName,
                CreatedDate      = c.CreatedDate,
                AttachedFile     = null,
                Note             = c.Note,
                Status           = c.Status
            };

            return(query.ToList());
        }
示例#2
0
        public List <HealthExaminationViewModel> ListHealthExamination()
        {
            HealthExamTable = db.GetTable <HealthExamination>();

            var query = from hex in HealthExamTable
                        select new HealthExaminationViewModel
            {
                HealthExaminationID = hex.HealthExaminationID,
                DateExamination     = hex.Date,
                NameExamination     = hex.Name,
                PlaceExamination    = hex.Place,
                Height           = hex.Height,
                Weight           = hex.Weight,
                Eyes             = hex.Eyes,
                ENT              = hex.ENT,
                Oral             = hex.Oral,
                InternalMedicine = hex.InternalMedicine,
                Surgery          = hex.Surgery,
                Dermatology      = hex.Dermatology,
                BoneMuscle       = hex.BoneMuscle,
                Nerve            = hex.Nerve,
                Endocrine        = hex.Endocrine,
                Status           = hex.Status
            };
            List <HealthExaminationViewModel> list = query.ToList();

            return(list);
        }
示例#3
0
        public List <FunctionGroup> ListAll()
        {
            functionGroup = db.GetTable <FunctionGroup>();
            var model = functionGroup.Where(x => x.Status.Equals(true));

            return(model.ToList());
        }
示例#4
0
        public List <StudentParent> ListParents(int StudentID)
        {
            Table <StudentParent> StudentParentsTable = db.GetTable <StudentParent>();
            var query = from p in StudentParentsTable
                        where p.StudentID.Equals(StudentID)
                        select p;

            return(query.ToList());
        }
示例#5
0
        public List <EthnicGroup> ListAll()
        {
            ethnicGroup = db.GetTable <EthnicGroup>();
            var query = from e in ethnicGroup
                        where e.Status.Equals(true)
                        select e;

            return(query.ToList());
        }
示例#6
0
        public List <Location> ListAllProvince()
        {
            Table <Location> provinceTable = db.GetTable <Location>();
            var province = from p in provinceTable
                           where (p.Status.Equals(true) && p.LocationParent.Equals(0))
                           orderby p.LocationName
                           select p;

            return(province.ToList());
        }
示例#7
0
 public DailyMenu GetDailyMenuDetail(int dailyMenuID)
 {
     try
     {
         dailyMenus = db.GetTable <DailyMenu>();
         return(dailyMenus.FirstOrDefault(x => x.DailyMenuID.Equals(dailyMenuID)));
     }
     catch
     {
         return(null);
     }
 }
示例#8
0
        public List <IngredientViewModel> ListAllActive(int ingredientTypeID)
        {
            ingredients = dt.GetTable <Ingredient>();
            var model = from i in ingredients
                        where i.IngredientTypeID == ingredientTypeID
                        select new IngredientViewModel
            {
                IngredientID       = i.IngredientID,
                Name               = i.Name,
                IngredientTypeID   = i.IngredientTypeID,
                IngredientTypeName = i.IngredientType.Name,
                Unit               = i.Unit,
                Kcal               = i.Kcal,
                Protein            = i.Protein,
                Fat          = i.Fat,
                Glucose      = i.Glucose,
                Fiber        = i.Fiber,
                Canxi        = i.Canxi,
                Iron         = i.Iron,
                Photpho      = i.Photpho,
                Kali         = i.Kali,
                Natri        = i.Natri,
                VitaminA     = i.VitaminA,
                VitaminB1    = i.VitaminB1,
                VitaminC     = i.VitaminC,
                AxitFolic    = i.AxitFolic,
                Cholesterol  = i.Cholesterol,
                Status       = i.Status,
                StringStatus = i.Status == true ? "Kích Hoạt" : "Khóa",
            };

            return(model.ToList());
        }
示例#9
0
        public List <FunctionViewModel> ListAll()
        {
            function = db.GetTable <Function>();
            var model = from f in function
                        where f.Status == true
                        select new FunctionViewModel
            {
                FunctionID        = f.FunctionID,
                FunctionGroupName = f.FunctionGroup.Name,
                FunctionName      = f.Name,
                Note   = f.Note,
                Status = f.Status
            };

            return(model.ToList());
        }
示例#10
0
        public List <PhysicalAssessmentViewModel> ListPhysicalAssessment()
        {
            PhysicalTable = db.GetTable <PhysicalAssessment>();

            var query = from ph in PhysicalTable
                        select new PhysicalAssessmentViewModel
            {
                PhysicalAssessmentID     = ph.PhysicalAssessmentID,
                DatePhysicalAssessment   = ph.Date,
                NamePhysicalAssessment   = ph.Name,
                NotePhysicalAssessment   = ph.Note,
                StatusPhysicalAssessment = ph.Status
            };
            List <PhysicalAssessmentViewModel> list = query.ToList();

            return(list);
        }
示例#11
0
        public List <Semester> ListSemester()
        {
            Table <Semester> tableSemester;

            tableSemester = dt.GetTable <Semester>();
            var c = (from a in tableSemester select a).OrderByDescending(t => t.SemesterID).Take(1);

            return(c.ToList());
        }
示例#12
0
        public List <PhysicalAssessmentViewModel> ListPhysicalAssessment()
        {
            PhysicalTable = db.GetTable <PhysicalAssessment>();

            var query = from ph in PhysicalTable
                        where ph.Status == true
                        select new PhysicalAssessmentViewModel
            {
                PhysicalAssessmentID     = ph.PhysicalAssessmentID,
                DatePhysicalAssessment   = ph.Date,
                NamePhysicalAssessment   = ph.Name,
                NotePhysicalAssessment   = ph.Note,
                StatusPhysicalAssessment = ph.Status,
                StringStatus             = ph.Status == true ? "Đang sử dụng" : "Không sử dụng"
            };
            List <PhysicalAssessmentViewModel> list = query.ToList();

            return(list);
        }
示例#13
0
        public List <Degree> ListAllDegree()
        {
            Table <Degree> degreeTable = db.GetTable <Degree>();
            var            degree      = from d in degreeTable
                                         where (d.Status.Equals(true))
                                         orderby d.Name
                                         select d;

            return(degree.ToList());
        }
示例#14
0
        public List <EthnicGroup> ListAllEthnicGroup()
        {
            Table <EthnicGroup> ethnicTable = db.GetTable <EthnicGroup>();
            var ethnicGroup = from d in ethnicTable
                              where (d.Status.Equals(true))
                              orderby d.Name
                              select d;

            return(ethnicGroup.ToList());
        }
示例#15
0
        public List <Religion> ListAllReligion()
        {
            Table <Religion> religionTable = db.GetTable <Religion>();
            var religion = from r in religionTable
                           where r.Status.Equals(true)
                           orderby r.Name
                           select r;

            return(religion.ToList());
        }
        public List <TCIngredientRequestDetaiViewModle> listInredientRequestDetail1(int ingredientRequest)
        {
            ingredient             = dt.GetTable <Ingredient>();
            ingredientRequesDetail = dt.GetTable <IngredientRequestDetail>();
            var a = from b in ingredient
                    join c in ingredientRequesDetail on b.IngredientID equals c.IngredientID
                    where (c.IngredientRequestID.Equals(ingredientRequest) && c.Status == false)
                    select new TCIngredientRequestDetaiViewModle
            {
                IngredientID        = c.IngredientID,
                IngredientRequestID = c.IngredientRequestID,
                Quantity            = c.Quantity,
                Unit   = b.Unit,
                Name   = b.Name,
                Status = c.Status
            };

            ListInredientReques = a.ToList();
            return(a.ToList());
        }
示例#17
0
 public int Login(string username, string password)
 {
     try
     {
         employee = db.GetTable <Employee>();
         HistoryDAO historyDAO = new HistoryDAO();
         var        user       = (from emp in employee
                                  where emp.Username.Equals(username)
                                  select new
         {
             emp.EmployeeID,
             emp.Username,
             emp.Password,
             emp.FirstName,
             emp.LastName,
             emp.Status
         });
         if (user.Count() > 0)
         {
             if (user.FirstOrDefault().Password.Equals(password))
             {
                 if (user.FirstOrDefault().Status.Equals(true))
                 {
                     historyDAO.Insert(user.FirstOrDefault().EmployeeID, 1, "Thành công");
                     LoginDetail.LoginID   = user.FirstOrDefault().EmployeeID;
                     LoginDetail.LoginName = user.FirstOrDefault().FirstName + " " + user.FirstOrDefault().LastName;
                     //Thêm mới lịch sử hoạt động
                     return(1); //Đăng nhập thành công
                 }
                 else
                 {
                     historyDAO.Insert(user.FirstOrDefault().EmployeeID, 1, "Thất bại");
                     //Thêm mới lịch sử hoạt động
                     return(-1); //Tài khoản đã bị khóa
                 }
             }
             else
             {
                 historyDAO.Insert(user.FirstOrDefault().EmployeeID, 1, "Thất bại");
                 //Thêm mới lịch sử hoạt động
                 return(2); //Mật khẩu không chính xác
             }
         }
         else
         {
             return(-2); //Tài khoản không tồn tại
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(0); //Đã xảy ra lỗi trong quá trình đăng nhập
     }
 }
示例#18
0
        public List <IngredientTypeViewModel> ListAll()
        {
            ingredients = db.GetTable <Ingredient>();
            var model = from it in ingredientTypes
                        select new IngredientTypeViewModel
            {
                IngredientTypeID = it.IngredientTypeID,
                Name             = it.Name,
                Status           = it.Status,
                StatusString     = it.Status == true ? "Kích Hoạt" : "Khóa",
                CountChild       = 0
            };
            List <IngredientTypeViewModel> listModel = model.ToList();

            for (int i = 0; i < listModel.Count(); i++)
            {
                listModel[i].CountChild = ingredients.Where(x => x.IngredientTypeID.Equals(listModel[i].IngredientTypeID)).Count();
            }
            return(listModel);
        }
示例#19
0
 public List <DishDetailViewModel> GetDishDetailViewModels(int dishID)
 {
     try
     {
         Table <Ingredient> ingredients = db.GetTable <Ingredient>();
         var model = from d in dishDetails
                     join i in ingredients
                     on d.IngredientID equals i.IngredientID
                     where d.DishID == dishID
                     select new DishDetailViewModel
         {
             DishID         = d.DishID,
             IngredientID   = d.IngredientID,
             IngredientName = i.Name,
             QuantityOfUnit = d.QuantiyOfUnit,
             Status         = d.Status
         };
         return(model.ToList());
     }
     catch
     {
         return(null);
     }
 }
        public List <HealthExaminationDetailViewModel> ListHealthDetail(int ClassID, int HealthExaminationID)
        {
            StudentTable                 = db.GetTable <Student>();
            StudentClassTable            = db.GetTable <Student_Class>();
            ClassTable                   = db.GetTable <Class>();
            HealthExaminationTable       = db.GetTable <HealthExamination>();
            HealthExaminationDetailTable = db.GetTable <HealthExaminationDetail>();
            var query = from hd in HealthExaminationDetailTable
                        join s in StudentTable
                        on hd.StudentID equals s.StudentID
                        join sc in StudentClassTable
                        on s.StudentID equals sc.StudentID
                        join c in ClassTable
                        on sc.ClassID equals c.ClassID
                        join he in HealthExaminationTable
                        on hd.HealthExaminationID equals he.HealthExaminationID
                        where sc.ClassID == ClassID && hd.HealthExaminationID == HealthExaminationID
                        select new HealthExaminationDetailViewModel
            {
                HealthExaminationDetailID = hd.HealthExaminationDetailID,
                HealthExaminationID       = hd.HealthExaminationID,
                StudentID   = hd.StudentID,
                StudentCode = s.StudentCode,
                FullName    = s.FirstName + " " + s.LastName,
                //HealthInsurance = hd.HealthInsurance,
                Height           = hd.Height,
                Weight           = hd.Weight,
                Eyes             = hd.Eyes,
                ENT              = hd.ENT,
                Oral             = hd.Oral,
                InternalMedicine = hd.InternalMedicine,
                Surgery          = hd.Surgery,
                Dermatology      = hd.Dermatology,
                BoneMuscle       = hd.BoneMuscle,
                Nerve            = hd.Nerve,
                Endocrine        = hd.Endocrine,
                Other            = hd.Other,
                Note             = hd.Note,
                Rating           = hd.Rating,
                ClassID          = sc.ClassID,
                ClassName        = c.Name,
                Status           = hd.Status
            };
            List <HealthExaminationDetailViewModel> list = query.ToList();

            return(list);
        }
示例#21
0
 public AgeGroupDAO()
 {
     db        = new QLHSSmartKidsDataContext();
     AgeGroups = db.GetTable <AgeGroup>();
 }
        public List <PhysicalAssessmentViewModel> ListPhysicalDetail(int ClassID, int PhysicalAssessmentID)
        {
            StudentTable        = db.GetTable <Student>();
            StudentClassTable   = db.GetTable <Student_Class>();
            ClassTable          = db.GetTable <Class>();
            PhysicalTable       = db.GetTable <PhysicalAssessment>();
            PhysicalDetailTable = db.GetTable <PhysicalAssessmentDetail>();
            var query = from phd in PhysicalDetailTable
                        join s in StudentTable
                        on phd.StudentID equals s.StudentID
                        join sc in StudentClassTable
                        on s.StudentID equals sc.StudentID
                        join c in ClassTable
                        on sc.ClassID equals c.ClassID
                        join ph in PhysicalTable
                        on phd.PhysicalAssessmentID equals ph.PhysicalAssessmentID
                        where sc.ClassID == ClassID && phd.PhysicalAssessmentID == PhysicalAssessmentID
                        select new PhysicalAssessmentViewModel
            {
                PhysicalAssessmentDetailID = phd.PhysicalAssessmentDeailID,
                PhysicalAssessmentID       = phd.PhysicalAssessmentID,

                StudentID    = phd.StudentID,
                StudentCode  = s.StudentCode,
                FullName     = s.FirstName + " " + s.LastName,
                Birthday     = s.Birthday,
                Gender       = s.Gender,
                StringGender = s.Gender == true ? "Nam" : "Nữ",
                ClassID      = sc.ClassID,
                ClassName    = c.Name,

                Height       = phd.Height,
                Weight       = phd.Weight,
                HeightRating = phd.HeightRating,
                WeightRating = phd.WeightRating,

                NoteDetail = phd.Note,
                StatusPhysicalAssessmentDetail = phd.Status
            };
            List <PhysicalAssessmentViewModel> list = query.ToList();

            return(list);
        }
示例#23
0
 public GradeDAO()
 {
     db    = new QLHSSmartKidsDataContext();
     grade = db.GetTable <Grade>();
 }
示例#24
0
 public ContractDAO()
 {
     db       = new QLHSSmartKidsDataContext();
     contract = db.GetTable <Contract>();
     employee = db.GetTable <Employee>();
 }
示例#25
0
        public List <Employee> ListAll()
        {
            employee = db.GetTable <Employee>();
            var query = from e in employee
                        select e;

            return(query.ToList());
        }
示例#26
0
 public IngredientDAO()
 {
     db          = new QLHSSmartKidsDataContext();
     ingredients = db.GetTable <Ingredient>();
 }
示例#27
0
 public StudentParentsDAO()
 {
     db = new QLHSSmartKidsDataContext();
     StudentParentsTable = db.GetTable <StudentParent>();
 }
示例#28
0
 public MealDAO()
 {
     db    = new QLHSSmartKidsDataContext();
     meals = db.GetTable <Meal>();
 }
示例#29
0
 public PositionDAO()
 {
     db       = new QLHSSmartKidsDataContext();
     position = db.GetTable <Position>();
 }
示例#30
0
 public DepartmentDAO()
 {
     db         = new QLHSSmartKidsDataContext();
     department = db.GetTable <Department>();
 }