Beispiel #1
0
        private async void btnAddService_Click(object sender, RoutedEventArgs e)
        {
            if (!int.TryParse(inServiceCode.Text, out int _))
            {
                lblServiceAdded.Content = "Service code is not valid";
                return;
            }

            Service service   = DataCenter.RequestServiceInfoByNumber(inServiceCode.Text);
            Record  newRecord = new Record(inCurrentDateTime.Text, inDateServiceProvided.Text, inProviderID.Text, inMemberID.Text, inServiceCode.Text, inComments.Text, service.Fee);

            DataCenter.WriteRecordInfo(newRecord);
            lblServiceAdded.Content = "Service added successfully";

            await Task.Delay(2000);

            btnCancel_Click(sender, e);
        }
        private async void btnMemberDelete_Click(object sender, RoutedEventArgs e)
        {
            var memberID   = inMemberID.Password;
            var isMemberID = !numOnlyRegex.IsMatch(memberID);

            if (!isMemberID)
            {
                lblMemberIDInputError.Content = "Member ID must be numerical!";
                return;
            }

            DataCenter.DeleteMemberAccount(memberID);
            lblMemberIDInputError.Content = "Member successfully deleted";

            await Task.Delay(2000);

            btnBackToMain_Click(sender, e);
        }
Beispiel #3
0
        /// <summary>
        /// Print member report
        /// </summary>
        /// <param name="member">Member object</param>
        /// <param name="name">Name of the report to generate</param>
        public static void PrintMemberReport(Member member, string name)
        {
            name = name.Replace("\\s+", "");
            var fileName = name + ".txt";

            using (StreamWriter input = new StreamWriter(new FileStream(fileName, FileMode.CreateNew)))
            {
                input.Write("Member Name: " + member.Name + "\n" + "Member Number: " + member.Number + "\n" +
                            "Member Address: " + member.Address + "\n" + "Member City: " + member.City +
                            "\n" + "Member State: " + member.State + "\n" + "Member Zip Code: " + member.Zip + "\n");

                var allRecords = DataCenter.RequestAllRecordsFromMember(member.Number);
                if (allRecords != null)
                {
                    foreach (Record iRecord in allRecords)
                    {
                        input.Write("\n");
                        input.Write("Service Date: " + iRecord.ServiceDate + "\n" + "Service Provider: " + iRecord.ProviderNumber + "\n" + "Service Name: " + iRecord.Service.Name + "\n");
                    }
                }
            }

            OpenFile(fileName);
        }
        private void btnMemberReportGenerate_Click(object sender, RoutedEventArgs e)
        {
            var memberID   = inMemberID.Password;
            var isMemberID = !numOnlyRegex.IsMatch(memberID);

            if (!isMemberID)
            {
                lblMemberIDInputError.Content = "Member ID must be numerical!";
                return;
            }

            var member = DataCenter.RequestMemberInfo(memberID);

            if (member != null)
            {
                GenerateReport.GenerateMemberReport(member);
                btnBackToMain_Click(sender, e);
            }
            else
            {
                lblMemberIDInputError.Content = "Member ID does not match our records!";
                return;
            }
        }
Beispiel #5
0
        private void btnProviderLogin_Click(object sender, RoutedEventArgs e)
        {
            var providerNumber = inProviderID.Password;
            var isProviderID   = !numOnlyRegex.IsMatch(providerNumber);

            if (!isProviderID)
            {
                lblProviderIDInputError.Content = "Provider ID must be numerical!";
                return;
            }

            var provider = DataCenter.RequestProviderInfo(providerNumber);

            if (provider != null)
            {
                ProviderPanel providerPanelWindow = new ProviderPanel();
                providerPanelWindow.Show();
                this.Close();
            }
            else
            {
                lblProviderIDInputError.Content = "Provider ID does not exist in the database!";
            }
        }
Beispiel #6
0
        private void btnMemberLogin_Click(object sender, RoutedEventArgs e)
        {
            var memberID   = inMemberID.Password;
            var isMemberID = !numOnlyRegex.IsMatch(memberID);

            if (!isMemberID)
            {
                lblMemberIDInputError.Content = "Member ID must be numerical!";
                return;
            }

            var member = DataCenter.RequestMemberInfo(memberID);

            if (member != null)
            {
                MemberPanel memberPanelWindow = new MemberPanel();
                memberPanelWindow.Show();
                this.Close();
            }
            else
            {
                lblMemberIDInputError.Content = "Member ID does not exist in the database!";
            }
        }
 public MemberPanel(string memberNumber)
 {
     InitializeComponent();
     lblMemberPanel.Content = "Welcome, " + DataCenter.RequestMemberInfo(memberNumber).Name + "!";
 }
 public MainWindow()
 {
     InitializeComponent();
     DataCenter.Open("ChocAnDB.xml");
 }
 public ProviderPanel(string providerNumber)
 {
     InitializeComponent();
     lblProviderPanel.Content = "Welcome, " + DataCenter.RequestProviderInfo(providerNumber).Name + "!";
 }