Beispiel #1
0
 private void AddCompanyClick(object sender, RoutedEventArgs e)
 {
     var newCompany = new Company();
     Companies.Add(newCompany);
     DatabaseAccess.SaveOrUpdate(newCompany.SaveChildren());
     RebindCompanies();
     companiesGrid.SelectedValue = newCompany;
 }
Beispiel #2
0
 public ProjectsStatistics(Company sourceCompany)
 {
     if(sourceCompany.IsNull())
     {
         throw new ArgumentNullException();
     }
     List<Project> companyProjects = Database.DatabaseAccess.GetEntitiesOfType<Project>()
         .Where(x => x.InvolvedCompanies.Contains(sourceCompany) || (!x.TargetCompany.IsNull() && x.TargetCompany.ID == sourceCompany.ID)).ToList();
     
     OpenedProjects = companyProjects.Where(x => x.State.ID == ProjectState.OpenedId).Count();
     InProgressProjects = companyProjects.Where(x => x.State.ID == ProjectState.InProgressId).Count();
     ClosedProjects = companyProjects.Where(x => x.State.ID == ProjectState.ClosedId).Count();
     CanceledProjects = companyProjects.Where(x => x.State.ID == ProjectState.CanceledId).Count();
 }
Beispiel #3
0
        /// <summary>
        /// Does not clone containers items, due to further problems how to resolve them (to clone every one of them or just to reassigns the container content)
        /// </summary>
        /// <returns></returns>
        public virtual object Clone()
        {
            var clonedCompany = new Company();
            clonedCompany.Name = this.Name;
            clonedCompany.TaxNumber = this.TaxNumber;
            clonedCompany.RepresentedBy = this.RepresentedBy;
            clonedCompany.ServedBy = this.ServedBy;
            clonedCompany.WebAddress = this.WebAddress;
            clonedCompany.EmailAddress = this.EmailAddress;
            clonedCompany.Addresses = new List<Address>();
            clonedCompany.Employees = new List<Person>();
            clonedCompany.Phones = new List<PhoneNumber>();

            return clonedCompany;
        }
 public ShowCompanyDetailsView(Company source) : this()
 {
     SelectedCompany = source;
     this.ShowDialog();
 }
Beispiel #5
0
 private void SaveButtonClick(object sender, RoutedEventArgs e)
 {
     EditMode = false;
     DatabaseAccess.SaveOrUpdate(SourceCompany);
     preEditData = null;
 }
Beispiel #6
0
 private void EditButtonClick(object sender, RoutedEventArgs e)
 {
     if (SourceCompany == null)
     {
         return;
     }
     EditMode = true;
     preEditData = SourceCompany.Clone() as Company;
 }
Beispiel #7
0
 public virtual void SetValues(Company sourceCompany)
 {
     this.ID = sourceCompany.ID;
     this.Name = sourceCompany.Name;
     this.TaxNumber = sourceCompany.TaxNumber;
     this.RepresentedBy = sourceCompany.RepresentedBy;
     this.ServedBy = sourceCompany.ServedBy;
     this.WebAddress = sourceCompany.WebAddress;
     this.EmailAddress = sourceCompany.EmailAddress;
 }