예제 #1
0
		void LongPress(UILongPressGestureRecognizer gesture)
		{
			LichThiCell cell = (LichThiCell )gesture.View;

			VCHomeReminder remid = new VCHomeReminder (controller);
			remid.lt = tableItems [cell.num];
			LTRemindItem rmItem = BRemind.GetLTRemind (SQLite_iOS.GetConnection (), remid.lt.MaMH, 
				remid.lt.NamHoc,
				remid.lt.HocKy);

			if (rmItem != null) {
				remid.LoadEvent (rmItem.EventID,null);
			}
				else
				{
			remid.RemindLT ();
				}
		}
예제 #2
0
		async void SwtNLich_ValueChanged (object sender, EventArgs e)
		{
			SettingsHelper.SaveSetting ("Remind", swtNLich.On);
			progress1.Hidden = false;
			progress1.StartAnimating ();
			if (swtNLich.On) {
				try {
					List<LichThi> listlt = BLichThi.GetNewestLT (SQLite_iOS.GetConnection ());

					List<LichHoc> listlh = BLichHoc.GetNewestLH (SQLite_iOS.GetConnection ());
				
					VCHomeReminder reminder = new VCHomeReminder (this);
					await reminder.RemindALLLH (listlh, "");
					await reminder.RemindAllLT (listlt);
					progress1.StopAnimating ();
				} catch {

				}
			} else {
				bool accepted = await ShowAlert("Xoá Nhắc Lịch", "Bạn muốn xoá hết các nhắc lịch đã tạo");
				if (accepted) {
					
					VCHomeReminder reminder = new VCHomeReminder (this);
					await reminder.RemoveAllEvent ();
					BRemind.RemoveAllRM (SQLite_iOS.GetConnection ());
				}
				progress1.StopAnimating ();

			}
			try
			{
				VCLichHoc.Instance.LoadData();
				if (VCADiemThi.instance!=null) VCADiemThi.Instance.LoadData();
				if (VCLichHocTuan.instance!=null) VCLichHocTuan.Instance.LoadData_Tuan(DateTime.Today);
				if (VCLichThi.instance!=null) VCLichThi.Instance.LoadData();
				if (VCDiemThi.instance!=null) VCDiemThi.Instance.LoadData("0","0");
				if (VCHocPhi.instance!=null) VCHocPhi.Instance.LoadData();
			}
			catch{
			}
		}
예제 #3
0
		async void LongPress(UILongPressGestureRecognizer gesture)
		{
			if (gesture.State == UIGestureRecognizerState.Ended) {
				LichHocHKCell cell = (LichHocHKCell)gesture.View;
				string monhoc = BMonHoc.GetMH (SQLite_iOS.GetConnection (), BLichHoc.GetLH (SQLite_iOS.GetConnection (), tableItems [cell.num].Id).MaMH).TenMH;
				VCHomeReminder remid = new VCHomeReminder (controller);
				List<LHRemindItem> rmItem=BRemind.GetLHRemind(SQLite_iOS.GetConnection (),tableItems [cell.num].Id);
				bool hasRM=false;
				if (rmItem.Count>0)
				{
					hasRM=true;
				}
				if (!hasRM) {

					remid.lh = BLichHoc.GetLH (SQLite_iOS.GetConnection (), tableItems [cell.num].Id);
					List<LichHoc> list = new List<LichHoc> ();
					list.Add (remid.lh);
					var mycontent = ShowAlert (monhoc);
					string content = await mycontent;
					await remid.RemindALLLH (list, content);
					if (VCLichHoc.instance != null)
						VCLichHoc.Instance.LoadData ();
					if (VCLichHocTuan.instance != null)
						VCLichHocTuan.Instance.LoadData_Tuan (VCLichHocTuan.LoadedDate);
				}
				else
				{


					bool accepted = await ShowAlert("Xoá Nhắc Lịch", "Bạn muốn xoá hết các nhắc lịch cho môn "+monhoc);
					if (accepted) {
						remid.RemoveEvents (rmItem);
						UIAlertView _error = new UIAlertView ("Xoá Nhắc Lịch", "Xoá Nhắc Lịch Thành Công", null, "Ok", null);
						_error.Show ();
					}

				}
			}
		}
예제 #4
0
		public async void LoadData()
		{
			try
			{
				progress.Hidden = false;
				progress.StartAnimating ();

				listLH.Hidden= false;
				errorLB.Hidden=true;
				headers.Hidden=false;
				bool sync = SettingsHelper.LoadSetting ("AutoUpdate"); 
				if (sync&&isfirst)
				{
					bool accepted =false;
					while (Reachability.InternetConnectionStatus ()==NetworkStatus.NotReachable&&!accepted)
					{
						accepted = await LayoutHelper.ShowAlert("Lỗi", "Bạn cần mở kết nối để cập nhật dữ liệu mới nhất");


					}
					if (Reachability.InternetConnectionStatus ()!=NetworkStatus.NotReachable)
					{
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
					var newlistlh= BLichHoc.MakeDataFromXml (SQLite_iOS.GetConnection ());
					List<LichHoc> newListLH= await newlistlh;var checkRemind=SettingsHelper.LoadSetting("Remind");
						if (newListLH==null)
						{
							UIAlertView _error = new UIAlertView ("Lỗi", "Xảy ra lỗi trong quá trình cập nhật dữ liệu từ server", null, "Ok", null);

							_error.Show ();
						}
						else
						{
					if (checkRemind){
						VCHomeReminder remind= new VCHomeReminder(this);
						await remind.RemindALLLH(newListLH,"");
					}
						UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
					}
					}

				}
				progress.StopAnimating ();
				List<LichHoc> newlistLH= BLichHoc.GetNewestLH(SQLite_iOS.GetConnection());
				if (newlistLH.Count>0)
				{
					var listCT = new List<chiTietLH> ();
					foreach (LichHoc item in newlistLH) {
						listCT.AddRange (BLichHoc.GetCTLH (SQLite_iOS.GetConnection (),item.Id ));
					}
					timeLH.TextAlignment= UITextAlignment.Center;
					timeLH.Text="Học Kỳ " + newlistLH[0].HocKy+ " Năm "+ newlistLH[0].NamHoc;
					listLH.Source=new LichHocHKSource(listCT,this);
					listLH.ReloadData();
					isfirst = false;
				}
				else
				{
					headers.Hidden=true;
					listLH.Hidden= true;
					errorLB.Hidden=false;
				}
			}
			catch {
			}
		}
예제 #5
0
		public async void LoadData()
		{
			try
			{
				progress.Hidden = false;
				progress.StartAnimating ();
				List<LichThi> list= new List<LichThi>();
				bool sync = SettingsHelper.LoadSetting ("AutoUpdate"); 
				if (sync&&isfirst)
				{
					bool accepted =false;
					while (Reachability.InternetConnectionStatus ()==NetworkStatus.NotReachable&&!accepted)
					{
						accepted = await LayoutHelper.ShowAlert("Lỗi", "Bạn cần mở kết nối để cập nhật dữ liệu mới nhất");


					}
					if (Reachability.InternetConnectionStatus ()!=NetworkStatus.NotReachable)
					{
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
					var newlistlt= BLichThi.MakeDataFromXml (SQLite_iOS.GetConnection ());
					List<LichThi> newListLT= await newlistlt;
					var checkRemind=SettingsHelper.LoadSetting("Remind");
					if (newListLT==null)
					{
						UIAlertView _error = new UIAlertView ("Lỗi", "Xảy ra lỗi trong quá trình cập nhật dữ liệu từ server", null, "Ok", null);
						_error.Show ();
					}
						else
						{
					if (checkRemind){
						VCHomeReminder remind= new VCHomeReminder(this);
						await remind.RemindAllLT(newListLT);
					}
						}
					UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
					}
				}
				progress.StopAnimating ();
				list= BLichThi.GetNewestLT(SQLite_iOS.GetConnection());
				if (list.Count>0)
				{
					listLT.Hidden= false;
					errorLB.Hidden=true;
					headers.Hidden=false;
					timeLT.Text="Học Kỳ "+list[0].HocKy+" Năm "+ list[0].NamHoc;
					listLT.Source=new LichThiSource(list,this);
					listLT.ReloadData();
					isfirst = false;
				}
				else
				{
					timeLT.Text="";
					listLT.Hidden= true;
					errorLB.Hidden=false;
					headers.Hidden=true;
				}
			}
			catch {
			}
		}
예제 #6
0
		public static async Task<string> LoadDataFromSV(UIViewController controller)
		{
			try
			{
				var newlistlh= BLichHoc.MakeDataFromXml (SQLite_iOS.GetConnection ());
				List<LichHoc> newListLH= await newlistlh;
				var newlistlt= BLichThi.MakeDataFromXml (SQLite_iOS.GetConnection ());
				List<LichThi> newListLT= await newlistlt;
				var dtRS=await BDiemThi.MakeDataFromXml (SQLite_iOS.GetConnection ());
				var hpRS=await BHocPhi.MakeDataFromXml (SQLite_iOS.GetConnection ());
//				var prefs = Application.Context.GetSharedPreferences("SGU APP", FileCreationMode.Private);              
//				var checkRemind = prefs.GetBoolean ("Remind",false);
				var checkRemind=SettingsHelper.LoadSetting("Remind");
				if (checkRemind)
				{
					VCHomeReminder remind= new VCHomeReminder(controller);
					if (newListLH!=null) await remind.RemindALLLH(newListLH,"");
					if (newListLT!=null) await remind.RemindAllLT(newListLT);
				}


				if (dtRS!=null&&hpRS!=null&&newListLH!=null&&newListLT!=null)
				{
					
					return "Cập nhật dữ liệu thành công";
				}	
				else
				{
					
					return "Xảy ra lỗi trong quá trình cập nhật dữ liệu";
				}
			}
			catch {
				return "Xảy ra lỗi trong quá trình cập nhật dữ liệu";
			}



		}
예제 #7
0
		public async void LoadData_Tuan (DateTime dateOfWeek)
		{
			try
			{
				listContent.Hidden= false;
				errorLB.Hidden=true;
				btTuanKe.Hidden=true;
				btTuanTrc.Hidden=true;
				progress.Hidden = false;
				timeLHTuan.Hidden=true;
				txtngayLHTuan.Hidden=true;
				progress.StartAnimating ();
				bool sync = SettingsHelper.LoadSetting ("AutoUpdate"); 
				List<LichHoc> listLH = new List<LichHoc> ();
				if (sync&&isfirst)
				{
					bool accepted =false;
					while (Reachability.InternetConnectionStatus ()==NetworkStatus.NotReachable&&!accepted)
					{
						accepted = await LayoutHelper.ShowAlert("Lỗi", "Bạn cần mở kết nối để cập nhật dữ liệu mới nhất");


					}
					if (Reachability.InternetConnectionStatus ()!=NetworkStatus.NotReachable)
					{
						UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
						var newlistlh= BLichHoc.MakeDataFromXml (SQLite_iOS.GetConnection ());
						List<LichHoc> newListLH= await newlistlh;var checkRemind=SettingsHelper.LoadSetting("Remind");
						if (newListLH==null)
						{
							UIAlertView _error = new UIAlertView ("Lỗi", "Xảy ra lỗi trong quá trình cập nhật dữ liệu từ server", null, "Ok", null);

							_error.Show ();
						}
						else {
							if (checkRemind){
								VCHomeReminder remind= new VCHomeReminder(this);
								await remind.RemindALLLH(newListLH,"");
							}
						}
						UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
					}

				}
				progress.StopAnimating ();
				listLH = BLichHoc.GetNewestLH (SQLite_iOS.GetConnection ());


				listCT = new List<chiTietLH> ();
				foreach (var item in listLH) {
					List<chiTietLH> list = BLichHoc.GetCTLH (SQLite_iOS.GetConnection (), item.Id);
					foreach (var ct in list) {
						String result = checkTuan (ct.Tuan, dateOfWeek);
						if (result != "") {
							ct.Tuan = result;
							listCT.Add (ct);
							break;
						}

					}

				}
				if (listLH.Count>0) 
				{
				btTuanKe.Hidden=false;
				btTuanTrc.Hidden=false;
				timeLHTuan.Hidden=false;
				txtngayLHTuan.Hidden=false;
				isfirst = false;
				LoadedDate=dateOfWeek;
				}
				if (listCT.Count==0) 
				{
					listContent.Hidden= true;
					errorLB.Hidden=false;
				}

				GetWeek (dateOfWeek, out begining, out end);
				txtngayLHTuan.Text = "Từ " + begining + " Đến " + end;
				timeLHTuan.Text = "Học Kỳ " + listLH [0].HocKy + " Năm học " + listLH [0].NamHoc;
				if (listCT.Count > 0) {
					


					listContent.Source = new LichHocTSource (listCT, this);
					listContent.ReloadData ();
					btTuanKe.Hidden=false;
					btTuanTrc.Hidden=false;
				}
			}
			catch {
			}
		}
예제 #8
0
		void LongPress(UILongPressGestureRecognizer gesture)
		{
			LichHocTCell cell = (LichHocTCell )gesture.View;

			VCHomeReminder remid = new VCHomeReminder (controller);
			remid.ct = Items [cell.num];
			LHRemindItem rmItem = BRemind.GetLHRemind (SQLite_iOS.GetConnection (), remid.ct.Id, remid.ct.Tuan);

			if (rmItem != null) {
				remid.LoadEvent (rmItem.EventID,rmItem);
			} else {
				remid.lh = BLichHoc.GetLH (SQLite_iOS.GetConnection (), Items [cell.num].Id);
				remid.RemindLH ();
			}
		}