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()); }
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); }
public List <FunctionGroup> ListAll() { functionGroup = db.GetTable <FunctionGroup>(); var model = functionGroup.Where(x => x.Status.Equals(true)); return(model.ToList()); }
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()); }
public List <EthnicGroup> ListAll() { ethnicGroup = db.GetTable <EthnicGroup>(); var query = from e in ethnicGroup where e.Status.Equals(true) select e; return(query.ToList()); }
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()); }
public DailyMenu GetDailyMenuDetail(int dailyMenuID) { try { dailyMenus = db.GetTable <DailyMenu>(); return(dailyMenus.FirstOrDefault(x => x.DailyMenuID.Equals(dailyMenuID))); } catch { return(null); } }
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()); }
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()); }
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); }
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()); }
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); }
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()); }
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()); }
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()); }
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 } }
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); }
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); }
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); }
public GradeDAO() { db = new QLHSSmartKidsDataContext(); grade = db.GetTable <Grade>(); }
public ContractDAO() { db = new QLHSSmartKidsDataContext(); contract = db.GetTable <Contract>(); employee = db.GetTable <Employee>(); }
public List <Employee> ListAll() { employee = db.GetTable <Employee>(); var query = from e in employee select e; return(query.ToList()); }
public IngredientDAO() { db = new QLHSSmartKidsDataContext(); ingredients = db.GetTable <Ingredient>(); }
public StudentParentsDAO() { db = new QLHSSmartKidsDataContext(); StudentParentsTable = db.GetTable <StudentParent>(); }
public MealDAO() { db = new QLHSSmartKidsDataContext(); meals = db.GetTable <Meal>(); }
public PositionDAO() { db = new QLHSSmartKidsDataContext(); position = db.GetTable <Position>(); }
public DepartmentDAO() { db = new QLHSSmartKidsDataContext(); department = db.GetTable <Department>(); }