Exemple #1
0
 public Accouting()
 {
     consultation        = new Consultation();
     listOfConsultations = consultation.readAllConsultations();
     members             = Members.readMembers();
     providers           = Providers.readProvider();
     serviceDirectory    = ProviderServiceDirectory.readInServices();
 }
Exemple #2
0
        //=========================================================================
        //Function Name: writeConsultationToFile
        //Description: This function will take a newly saved consultation model.
        //It will write the data to a file.
        //The output directory will be: (application directory)/consultations/
        //Input: consultation (Consultation)
        //Output: none for now.
        //Last updated: 11.26.2016 16:09
        //=========================================================================
        public void writeConsultationToFile(Consultation consultation)
        {
            //create the file name for the consultation
            string fileName = "consultation." +
                              Regex.Replace(consultation.MemberRecord.Name, @"\s+", "") +
                              consultation.Date.ToString(DateFormat) +
                              ".txt";

            //Create unique file for a consultation in the designated
            //file directory
            Directory.CreateDirectory(ConsultationsDir);
            var path = $"{ConsultationsDir}\\{fileName}";

            File.WriteAllText(path, consultation.ToString());
            View.PrintSuccess($"Wrote consultation file to {path}.");
        }
Exemple #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string path = Directory.GetCurrentDirectory();

            if (!Directory.Exists(path + @"members"))
            {
                Directory.CreateDirectory(path + @"\members");
            }
            if (!Directory.Exists(path + @"provider"))
            {
                Directory.CreateDirectory(path + @"\provider");
            }
            if (!Directory.Exists(path + @"consultation"))
            {
                Directory.CreateDirectory(path + @"\consultation");
            }
            if (!Directory.Exists(path + @"providerServiceCodes"))
            {
                Directory.CreateDirectory(path + @"\providerServiceCodes");
            }
            if (!Directory.Exists(path + @"accounting"))
            {
                Directory.CreateDirectory(path + @"\accounting");
            }

            //Test

            /*
             * //member test.
             * Info temp = new Info();
             * temp.name = "David Cobbley";
             * temp.ID = 123456789;
             * temp.address = "4600 Nw 174th ave.";
             * temp.city = "portland";
             * temp.zip = 97229;
             * temp.valid = "valid";
             *
             * Members.addMembers(temp);
             */

            //consultation test
            Consultation consultationTest = new Consultation("11-30-12", "11:24:13", "11-30-12", "these are my comments", 123456789, 987654321, 135246);

            consultationTest.writeServiceToDisk();
        }
Exemple #4
0
        public void CreateConsultation()
        {
            var provider = View.ReadProviderById("Enter your provider ID number");

            if (provider == null)
            {
                return;
            }
            var member = View.ReadMemberById();

            if (member == null)
            {
                return;
            }
            var service = View.ReadServiceById();

            if (service == null)
            {
                return;
            }
            var date = View.ReadDateTime("Date of consultation");

            //Create a concultation object for the database collection and insert
            var consultation = new Consultation
            {
                ProviderRecord = provider,
                MemberRecord   = member,
                ServiceRecord  = service,
                Date           = date
            };

            Consultation.Collection.Insert(consultation);
            Console.WriteLine(member.ToString());
            Console.WriteLine(service.ToString());
            Console.WriteLine(date.ToString(DateFormat));
            Console.WriteLine("Press any key to contiue");
            Console.ReadKey();
            //Consultation was created, Write copy to file
            writeConsultationToFile(consultation);
        }
Exemple #5
0
        public List <Consultation> readAllConsultations()
        {
            List <Consultation> tempList = null;
            string        path           = Directory.GetCurrentDirectory();
            int           x     = 0;
            int           count = 0;
            DirectoryInfo dir   = new DirectoryInfo(path + @"\consultation");

            FileSystemInfo[] infos = dir.GetFileSystemInfos();
            foreach (FileSystemInfo fsi in infos)
            {
                ++count;
            }


            if (count == 0)
            {
                return(tempList);
            }
            else
            {
                tempList = new List <Consultation>();
                while (x < count)
                {
                    Consultation tempConsultation = null;

                    string   rawData;
                    string[] tempSplit;
                    System.IO.StreamReader file = new System.IO.StreamReader(path + @"\consultation\consultation" + x + @".txt");
                    while ((rawData = file.ReadLine()) != null)
                    {
                        tempSplit        = rawData.Split(',');
                        tempConsultation = new Consultation(tempSplit[0], tempSplit[1], tempSplit[2], tempSplit[3], Convert.ToInt32(tempSplit[4]), Convert.ToInt32(tempSplit[5]), Convert.ToInt32(tempSplit[6]));
                    }
                    tempList.Add(tempConsultation);
                    ++x;
                }
                return(tempList);
            }
        }
Exemple #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            Consultation cons = new Consultation(textBox18.ToString(), textBox17.ToString(), textBox16.ToString(), textBox15.ToString(), Convert.ToInt32(textBox14), Convert.ToInt32(textBox18), Convert.ToInt32(textBox18));

            cons.writeServiceToDisk();
        }