Example #1
0
        public static int SaveDemonstration(Demonstration item)
        {
            Demonstration demo = null;

            for (int d = 0; d < demonstrations.Count; d++)
            {
                if ((demonstrations [d].doctorID == item.doctorID) && (demonstrations [d].visitDate == item.visitDate))
                {
                    demo = demonstrations[d];
                }
            }
            if (demo == null)
            {
                demo = GetLastDemonstration(item.doctorID);
                if (demo == null)
                {
                    demonstrations.Add(item);
                }
                else
                {
                    item.analyze            = demo.analyze;
                    item.commentForPharmacy = demo.commentForPharmacy;
                    item.POSmaterials       = demo.POSmaterials;
                    demonstrations.Add(item);
                }
            }
            else
            {
                demo = item;                 // replaces item in collection with updated value
            }

            WriteXml();
            return(item.doctorID);
        }
Example #2
0
        public static bool SplitFile(string filePath)
        {
            FileInfo             fi     = new FileInfo(filePath);
            List <Demonstration> demons = ReadFromFile(filePath);

            if (fi.Length <= 600 * 1024)
            {
                if (filePath != DatabaseFilePath)
                {
                    File.Delete(filePath);
                }
                tempFiles.Add(WriteToFile(demons.ToArray()));
                return(true);
            }
            else
            {
                if (filePath != DatabaseFilePath)
                {
                    File.Delete(filePath);
                }
                int mediumCnt = demons.Count / 2;

                Demonstration[] d1 = new Demonstration[mediumCnt];
                demons.CopyTo(0, d1, 0, mediumCnt);

                Demonstration[] d2 = new Demonstration[demons.Count - mediumCnt];
                demons.CopyTo(mediumCnt, d2, 0, demons.Count - mediumCnt);

                return(SplitFile(WriteToFile(d1)) && SplitFile(WriteToFile(d2)));
            }
        }
 public static int SaveDemonstration(Demonstration item)
 {
     return DemonstrationRepository.SaveDemonstration(item);
 }
 public static int SaveDemonstration(Demonstration item)
 {
     return(DemonstrationRepository.SaveDemonstration(item));
 }
        public static int SaveDemonstration(Demonstration item)
        {
            Demonstration demo = null;
            for (int d = 0; d < demonstrations.Count; d++) {
                if ((demonstrations [d].doctorID == item.doctorID) && (demonstrations [d].visitDate == item.visitDate)){
                    demo = demonstrations[d];
                }
            }
            if ( demo == null ) {
                demo = GetLastDemonstration (item.doctorID);
                if (demo == null) {
                    demonstrations.Add (item);
                } else {
                    item.analyze = demo.analyze;
                    item.commentForPharmacy = demo.commentForPharmacy;
                    item.POSmaterials = demo.POSmaterials;
                    demonstrations.Add (item);
                }
            } else {
                demo = item; // replaces item in collection with updated value
            }

            WriteXml ();
            return item.doctorID;
        }
 static string WriteToFile(Demonstration[] demons)
 {
     string filePath =  Path.Combine(Common.DatabaseFileDir(), Path.GetRandomFileName() + ".xml");
     var serializer = new XmlSerializer (typeof(Demonstration[]));
     using (var writer = new StreamWriter (filePath)) {
         serializer.Serialize (writer, demons);
     }
     return filePath;
 }
        public static bool SplitFile(string filePath)
        {
            FileInfo fi = new FileInfo (filePath);
            List <Demonstration> demons = ReadFromFile (filePath);
            if (fi.Length <= 600 * 1024) {
                if (filePath != DatabaseFilePath) { File.Delete (filePath); }
                tempFiles.Add (WriteToFile (demons.ToArray ()));
                return true;
            } else {
                if (filePath != DatabaseFilePath) { File.Delete (filePath); }
                int mediumCnt = demons.Count / 2;

                Demonstration[] d1 = new Demonstration[mediumCnt];
                demons.CopyTo (0, d1, 0, mediumCnt);

                Demonstration[] d2 = new Demonstration[demons.Count - mediumCnt];
                demons.CopyTo (mediumCnt, d2, 0, demons.Count - mediumCnt );

                return SplitFile(WriteToFile (d1)) && SplitFile(WriteToFile (d2));
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);

            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.PresentationView);

            Window.AddFlags (WindowManagerFlags.KeepScreenOn);

            (FindViewById<TextView> (Resource.Id.txtView)).Visibility = ViewStates.Gone;

            gestureDetector = new GestureDetector (this);
            _locMgr = GetSystemService (Context.LocationService) as LocationManager;

            preses = Presentations.GetPresentations ();
            ivSlide = FindViewById<ImageView> (Resource.Id.ivSlide);
            doctorID = Intent.GetIntExtra ("doctorID", 0);
            if (doctorID == 0) {
                Finish ();
            }

            doctor = DoctorManager.GetDoctor (doctorID, false);
            if (doctor == null) {
                Finish ();
            }

            lastSlideTime = DateTime.Now;
            demonstration = DemonstrationManager.GetDemonstration (doctorID, DateTime.Today);
            demonstration.analyze = doctor.LastVisitAnalyze;

            if (demonstration.visitTime.Date != DateTime.Today) {
                demonstration.visitTime = DateTime.Now;
            }

            selectedPresent = Intent.GetIntExtra ("presentationID", 0);

            CreateTopLayout ();
            RefreshParts ();

            OnButtonTopClick (preses [selectedPresent].btn, null);

            OnButtonBottomClick(preses[selectedPresent].parts [Intent.GetIntExtra ("partID", 0)].btn, null);
        }