public ViewModelBase( INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) { if (navigationService != null) { NavigationService = navigationService; } if (dialogService != null) { Dialog = dialogService; } if (sqLiteHelper != null) { Database = sqLiteHelper; } BackCommand = new DelegateCommand(BackCommandExecute); BCommand = new DelegateCommand(BExecute); ACommand = new DelegateCommand(AExecute); CCommand = new DelegateCommand(CExecute); }
public DataRepository(ISQLiteHelper sqlConnection) { SQLite.Net.IBlobSerializer serializer = new SQLite.Net.BlobSerializerDelegate(SerializeObject, DeSerializeObject, CanSerialize); helper = sqlConnection; _db = new SQLiteConnection(sqlConnection.GetPlatform(), sqlConnection.GetDBPath(), false, serializer); }
private void DocumentOpenedAction(object sender, DocumentOpenedEventArgs even) { settings = ExtensibleStorage.GetTooltipInfo(even.Document.ProjectInformation); this.mysql = new MysqlUtil(settings); this.sqlite = new SQLiteHelper(settings); m_previousDocPathName = even.Document.PathName; current_doc = even.Document; //过滤测点待使用 //打开文档就过滤一次 keyNameToElementMap = new Dictionary <string, Element>(); BuiltInParameter testParam = BuiltInParameter.ALL_MODEL_TYPE_NAME; ParameterValueProvider pvp = new ParameterValueProvider(new ElementId(testParam)); FilterStringEquals eq = new FilterStringEquals(); FilterRule rule = new FilterStringRule(pvp, eq, Res.String_ParameterSurveyType, false); ElementParameterFilter paramFilter = new ElementParameterFilter(rule); Document document = current_doc; FilteredElementCollector elementCollector = new FilteredElementCollector(document).OfClass(typeof(FamilyInstance)); IList <Element> elems = elementCollector.WherePasses(paramFilter).ToElements(); foreach (var elem in elems) { string param_value = string.Empty; Parameter param = elem.get_Parameter(Res.String_ParameterName); if (null != param && param.StorageType == StorageType.String) { param_value = param.AsString(); if (!string.IsNullOrWhiteSpace(param_value)) { keyNameToElementMap.Add(param_value, elem); } } } //准备Material IEnumerable <Material> allMaterial = new FilteredElementCollector(even.Document).OfClass(typeof(Material)).Cast <Material>(); foreach (Material elem in allMaterial) { if (elem.Name.Equals(Res.String_Color_Redline)) { color_red = elem; } if (elem.Name.Equals(Res.String_Color_Gray)) { color_gray = elem; } if (elem.Name.Equals(Res.String_Color_Blue)) { color_blue = elem; } if (color_gray != null && color_red != null && color_blue != null) { this.ColorMaterialIsReady = true; break; } } }
public void Show(ISQLiteHelper database, Class cls) { _db = database; _class = cls; EntrySubjectName.Text = cls.Name; LabelWrong.IsVisible = false; App.Current.MainPage.Navigation.PushPopupAsync(this); }
public void Show(ISQLiteHelper database, Subject subject) { _db = database; _subject = subject; EntrySubjectName.Text = subject.Name; LabelWrong.IsVisible = false; App.Current.MainPage.Navigation.PushPopupAsync(this); }
public StudentScoreTabViewModel(INavigationService navigationService, IPageDialogService dialogService, ISQLiteHelper sqLiteHelper) : base(navigationService, dialogService, sqLiteHelper) { var user = Database.GetUser(); _student = Database.Get <Student>(s => s.Id == user.Id); LoadPersonalScore(); }
public void GetScore(ISQLiteHelper db, int subjectId, int semester) { var score = db.Get <Score>(s => s.StudentId == this.Id && s.SubjectId == subjectId && s.Semester == semester); if (score != null) { this.Score = score; } }
public void CountStudent(ISQLiteHelper db) { var students = db.GetList <Student>(s => s.ClassId == Id); Students = students?.Count() ?? 0; Boys = students?.Count(s => s.Gender == 1) ?? 0; Girls = Students - Boys; MaxStudents = db.GetSetting().MaxStudentPerClass; IsFull = Students >= MaxStudents; }
public SettingsPageViewModel(INavigationService navigationService, ISQLiteHelper sqLiteHelper) : base(navigationService, sqLiteHelper: sqLiteHelper) { // Set values PageTitle = "Cài đặt"; // Commands SettingCommand = new DelegateCommand(SettingExecute); LogOutCommand = new DelegateCommand(LogOutExecute); InitUser(); }
public bool Login(ISQLiteHelper db, string username, string password) { var user = _users.FirstOrDefault(u => u.UserName.ToLower().Equals(username.Trim().ToLower()) && u.Password.Equals(password)); if (user == null) { return(false); } db.DeleteAll <User>(); db.Insert(user); return(true); }
public void GetReportBySubject(ISQLiteHelper db, int subjectId, int semester) { var students = db.GetList <Student>(s => s.ClassId == Id); var settings = db.GetSetting(); Passes = 0; foreach (var student in students) { student.GetScore(db, subjectId, semester); if (student.Score.ScoreAverage >= settings.SubjectPassScore) { this.Passes++; } } PassesPercents = (float)Passes / Students * 100; }
public void GetReportBySemester(ISQLiteHelper db, int semester) { var students = db.GetList <Student>(s => s.ClassId == Id); var settings = db.GetSetting(); Passes = 0; foreach (var student in students) { student.GetAvgScore(db); if (settings.SubjectPassScore <= (semester == 1 ? student.ScoreAvg1 : student.ScoreAvg2)) { this.Passes++; } } PassesPercents = (float)Passes / Students * 100; }
public ViewModelBase( INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) { if (navigationService != null) { NavigationService = navigationService; } if (dialogService != null) { Dialog = dialogService; } if (sqLiteHelper != null) { Database = sqLiteHelper; } }
public void GetAvgScore(ISQLiteHelper db) { var scores = db.GetList <Score>(score => score.StudentId == this.Id).ToList(); float totalScore1 = 0; float totalScore2 = 0; foreach (var score in scores) { if (score.Semester == 1) { totalScore1 += score.ScoreAverage; } else { totalScore2 += score.ScoreAverage; } } ScoreAvg1 = (float)Math.Round(totalScore1 / (scores.Count / 2), 1); ScoreAvg2 = (float)Math.Round(totalScore2 / (scores.Count / 2), 1); }
public SearchPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { PageTitle = "Tra cứu"; }
public StudentDetailPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { //ViewScoreBoardCommand = new DelegateCommand(ViewScoreBoardExecute); user = Database.GetUser(); if (user.Role.Equals(RoleManager.StudentRole)) { GetStudentDetail(); } PageTitle = "Thông tin"; Instance = this; // Commands ViewClassInfoCommand = new DelegateCommand(ViewClassInfoExecute); ViewScoreBoardCommand = new DelegateCommand(ViewScoreBoardExecute); RemoveStudentCommand = new DelegateCommand(RemoveStudentExecute); EditStudentCommand = new DelegateCommand(EditStudentExecute); }
public ClassDetailPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { // Commands ViewListStudentCommand = new DelegateCommand(ViewListStudentExecute); ViewScoreBoardCommand = new DelegateCommand(ViewScoreBoardExecute); AcceptCommand = new DelegateCommand(AcceptExecute); user = Database.GetUser(); if (user.Role.Equals(RoleManager.TeacherRole)) { GetClassInfo(); } }
public HomePageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { }
public ScoreBoardPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { PageTitle = "Bảng điểm"; SemesterName = "Học kỳ 1"; user = Database.GetUser(); if (user.Role.Equals(RoleManager.TeacherRole)) { GetScoreClassBoard(); } }
public AddNewStudentPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { // Set values PageTitle = "Tiếp nhận học sinh"; DoB = new DateTime(2001, 1, 1); ButtonName = "Tiếp theo"; // Commands ContinueCommand = new DelegateCommand(ContinueExecute); }
public InputScorePageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { PageTitle = "Nhập bảng điểm môn"; //Get list class name ClassNames = new ObservableCollection <string>(); StudentNames = new ObservableCollection <string>(); Students = new ObservableCollection <Student>(); GetListPicker(); SaveCommand = new DelegateCommand(SaveExecute); }
public MockData(ISQLiteHelper sqLite) { _db = sqLite; }
public ReportHomePageViewModel(INavigationService navigationService, IPageDialogService dialogService, ISQLiteHelper sqLiteHelper) : base(navigationService, dialogService, sqLiteHelper) { PageTitle = "Báo cáo tổng kết"; }
public ChooseClassPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { // Set values PageTitle = "Chọn lớp"; LoadClass(); }
public ClassesPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { SearchToolbarItemsCommand = new DelegateCommand(SearchToolbarItemsExecute); SearchIconCommand = new DelegateCommand(SearchIconExecute); FilterIconCommand = new DelegateCommand(FilterIconExecute); var classes = sqLiteHelper.GetList <Class>(c => c.Id > 0); foreach (var c in classes) { c.CountStudent(sqLiteHelper); } ListClass = Classes = new ObservableCollection <Class>(classes); ShowSearchBox = false; }
/// <summary> /// Initializes a new instance of the <see cref="DivingLogSQLiteRepositroy"/> class. /// </summary> /// <param name="sQLiteHelper">The s q lite helper.</param> public DivingLogSQLiteRepositroy(ISQLiteHelper sQLiteHelper) { _sQLiteHelper = sQLiteHelper; }
public void Logout(ISQLiteHelper db) { db.DeleteAll <User>(); }
private void InitDatabase() { var connectionService = DependencyService.Get <IDatabaseConnection>(); _sqLiteHelper = new SQLiteHelper(connectionService); }
public void Show(ISQLiteHelper database) { _db = database; LabelWrong.IsVisible = false; App.Current.MainPage.Navigation.PushPopupAsync(this); }
public StudentsPageViewModel(INavigationService navigationService = null, IPageDialogService dialogService = null, ISQLiteHelper sqLiteHelper = null) : base(navigationService, dialogService, sqLiteHelper) { Title = "Danh sách"; user = Database.GetUser(); if (user.Role.Equals(RoleManager.StudentRole)) { GetStudentsInClass(); } else if (!user.Role.Equals(RoleManager.TeacherRole)) { SetListStudentData(); } // Commands SearchToolbarItemsCommand = new DelegateCommand(SearchToolbarItemsExecute); SearchIconCommand = new DelegateCommand(SearchIconExecute); FilterIconCommand = new DelegateCommand(FilterIconExecute); }