Exemplo n.º 1
0
        public static void AddTeamMember(TeamMember AddMe)
        {
            TMTempDB.Add(AddMe);

            string TM_Path = System.IO.Path.Combine(Base_Path, "TMData.xml");
            System.Xml.Serialization.XmlSerializer Saver = new System.Xml.Serialization.XmlSerializer(typeof(List<TeamMember>));
            System.IO.FileStream file = System.IO.File.Create(TM_Path);
            Saver.Serialize(file, TMTempDB);
            file.Close();
            Load_TMs(TM_Path);
        }
Exemplo n.º 2
0
        public static void MakeNewWO(string Fault, string Action, TeamMember Discoverer, DateTime DateFound, DateTime DateToComplete)
        {
            WO NewWO = new WO();
            //NewWO.Equipment = equipment
            NewWO.DateEntered = DateFound;
            NewWO.DateToComplete = DateToComplete;
            NewWO.FoundBy = Discoverer;
            NewWO.Fault = Fault;
            NewWO.Action = Action;

            TempDB.Add(NewWO);

            System.Xml.Serialization.XmlSerializer Saver = new System.Xml.Serialization.XmlSerializer(typeof(List<WO>));
            System.IO.FileStream file = System.IO.File.Create(WODatabase_Path);
            Saver.Serialize(file, TempDB);
            file.Close();

            Load_WOs(WODatabase_Path);
        }
Exemplo n.º 3
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            string FName = FirstName.Text;
            string LName = Surname.Text;
            string JobTitle = Title.Text;
            DateTime JoinedOn = DateJoined.SelectedDate.Value;
            

            if(FName != FNameDefault && string.IsNullOrWhiteSpace(FName) != true)
            {
                if(LName != LNameDefault && string.IsNullOrWhiteSpace(LName) != true)
                {
                    if (JobTitle != JobTitleDefault && string.IsNullOrWhiteSpace(JobTitle) != true)
                    {
                        if (System.Windows.MessageBox.Show("The team member will now join your team.", "Team Member Creation", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            TeamMember temp = new TeamMember();
                            List<TeamMember> checkTMDB = new List<TeamMember>();

                            FName.Replace(" ", "");
                            LName.Replace(" ", "");

                            string Name = FName + " " + LName;

                            temp.FullName = Name;
                            temp.Title = JobTitle;
                            temp.JoinedTeam = JoinedOn;
                            temp.DateCreated = DateTime.Now;

                            checkTMDB = TMDatabaseHelpers.TMDB_State(checkTMDB);

                            Surname.Text = LNameDefault;
                            FirstName.Text = FNameDefault;
                            Title.Text = JobTitleDefault;

                            for(int i = 0; i < checkTMDB.Count ; i++)
                            {
                                if(checkTMDB[i].FullName == temp.FullName)
                                {
                                    if(System.Windows.MessageBox.Show("A team member with that name already exists, you can edit existing team members through screen x. Do you want to create this team member anyway?","Team Member Exists!", MessageBoxButton.YesNo,MessageBoxImage.Warning) == MessageBoxResult.No)
                                    {
                                        return;
                                    }
                                }
                            }

                            TMDatabaseHelpers.AddTeamMember(temp);
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Please enter a job title");
                        return;
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("Please enter a surname");
                    return;
                }
            }
            else
            {
                System.Windows.MessageBox.Show("Please enter a first name");
                return;
            }
        }