Example #1
0
 void UpRightB_Click(object sender, EventArgs e)
 {
     FragmentManager.BeginTransaction().Remove(fragment).Commit();
     AttendanceManager.SetCurrentAttendance(null);
     AttendanceResultManager.SetCurrentAttendanceResults(null);
     AttendancePhotoManager.SetCurrentAttendancePhotos(null);
     RefreshMainView();
 }
Example #2
0
        void RefreshMainView()
        {
            user = Common.GetCurrentUser();

            if (user == null)
            {
                content.Visibility       = ViewStates.Gone;
                upPanel.Visibility       = ViewStates.Gone;
                botPanel.Visibility      = ViewStates.Gone;
                pharamcyTable.Visibility = ViewStates.Gone;
                beforeSignIn.Visibility  = ViewStates.Visible;
            }
            else
            {
                // Testing
//				List<Promo> promos = new List<Promo> ();
//
//				promos.Add (new Promo { id = 1, name = @"Промо1", key = @"П1" });
//				promos.Add (new Promo { id = 2, name = @"Промо2", key = @"П2" });
//				promos.Add (new Promo { id = 4, name = @"Промо3", key = @"п3" });
//
//				Common.SetPromos (user.username, promos);
//
//				List<NetCategory> netCategories = new List<NetCategory> ();
//
//				netCategories.Add (new NetCategory { id = 1, name = @"КатСети1", key = @"Кат1" });
//				netCategories.Add (new NetCategory { id = 2, name = @"КатСети2", key = @"Кат2" });
//				netCategories.Add (new NetCategory { id = 3, name = @"КатСети3", key = @"Кат3" });
//				netCategories.Add (new NetCategory { id = 4, name = @"КатСети4", key = @"Кат4" });
//
//				Common.SetNetCategories (user.username, netCategories);

                AttendanceManager.SetCurrentAttendance(null);
                // Testing

                Common.SetIsAttendanceRun(user.username, isVisitStart);
                content.Visibility      = ViewStates.Gone;
                beforeSignIn.Visibility = ViewStates.Gone;

                // Set Up Panel
                upPanel.Visibility           = ViewStates.Visible;
                botPanel.Visibility          = ViewStates.Visible;
                upStartAttendance.Visibility = ViewStates.Gone;
                upEndAttendance.Visibility   = ViewStates.Gone;
                upClose.Visibility           = ViewStates.Gone;
                upNextBlock.Visibility       = ViewStates.Gone;
                upPrevBlock.Visibility       = ViewStates.Gone;
                Project   project   = Common.GetProject(user.username);
                Territory territory = Common.GetTerritory(user.username);
                upInfo.Visibility   = ViewStates.Visible;
                upLogout.Visibility = ViewStates.Visible;
                upSync.Visibility   = ViewStates.Visible;
                upInfo.Text         = string.Format(@"ПРОЕКТ : {0}; ГОРОД : {1}", project.fullName, territory.baseCity);

                RefreshPharmacyTable();
            }
        }
Example #3
0
        void UpEndAttendance_Click(object sender, EventArgs e)
        {
            isVisitStart = false;
            Common.SetIsAttendanceRun(user.username, isVisitStart);
            locMgr.RemoveUpdates(this);

            // SAVE
            upPrevBlock.Visibility = ViewStates.Gone;
            upNextBlock.Visibility = ViewStates.Gone;
            FragmentManager.BeginTransaction().Remove(fragment).Commit();
            fragmentNum = 1;

            Attendance newAttendance = AttendanceManager.GetCurrentAttendance();
            List <AttendanceResult> newAttendanceResults = AttendanceResultManager.GetCurrentAttendanceResults();
            List <AttendancePhoto>  newAttendancePhotos  = AttendancePhotoManager.GetCurrentAttendancePhotos();
//			List<AttendanceGPSPoint> newAttendanceGPSPoints = AttendanceGPSPointManager.GetCurrentAttendanceGPSPoints ();
            int attID = AttendanceManager.SaveAttendance(newAttendance);

            if (newAttendanceResults != null)
            {
                AttendanceResultManager.SaveNewAttendanceResults(attID, newAttendanceResults);
            }
            if (newAttendancePhotos != null)
            {
                AttendancePhotoManager.SaveNewAttendancePhotos(attID, newAttendancePhotos);
            }
            if (attendanceGPSPoints != null)
            {
                AttendanceGPSPointManager.SaveNewAttendanceGPSPoints(attID, attendanceGPSPoints);
            }
            //Correct Pharmacy
            Pharmacy pharmacy = PharmacyManager.GetPharmacy(selectedPharmacyID);

            pharmacy.prev = DateTime.Now;
            pharmacy.next = DateTimeFormatInfo.CurrentInfo.Calendar.AddWeeks(pharmacy.prev, 2);
            PharmacyManager.SavePharmacy(pharmacy);

            //Clear
            AttendanceManager.SetCurrentAttendance(null);
            AttendanceResultManager.SetCurrentAttendanceResults(null);
            AttendancePhotoManager.SetCurrentAttendancePhotos(null);

            RefreshMainView();
        }
Example #4
0
        public override void OnPause()
        {
            base.OnPause();
            if (Common.GetIsAttendanceRun(user.username))
            {
                attendance.purchaserFIO    = purchaserFIOEdit.Text;
                attendance.pharmacistCount = int.Parse(pharmacistCountEdit.Text);
                attendance.telephone       = telephoneEdit.Text;
                attendance.comment         = commentEdit.Text;
                AttendanceManager.SetCurrentAttendance(attendance);
            }
            else
            {
                AttendanceManager.SetCurrentAttendance(null);
            }
//			Activity.Window.SetSoftInputMode (SoftInput.StateAlwaysHidden);
//			if (Activity.CurrentFocus != null) {
//				InputMethodManager imm = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);
//				imm.HideSoftInputFromWindow(Activity.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
//			}
        }