protected void HandleLoadedCommand(object parameter)
 {
     this.ClientsList   = new ObservableCollection <ContragentListDto>(this.ContragentService.GetContragentsForDropdown());
     this.InquiriesList = new ObservableCollection <InquiryListDto>(this.InquiryService.GetInquiriesList());
     this.OffersList    = new ObservableCollection <OfferListDto>(this.OfferService.GetOffersList());
     this.Creator       = Session.Instance.Username;
     this.creatorId     = this.UserService.GetUsernames().SingleOrDefault(x => x.Username == Creator).Id;
     if (this.SelectedProject != null)
     {
         this.Id   = (int)SelectedProject.Row.ItemArray[0];
         this.Name = (string)SelectedProject.Row.ItemArray[1];
         var offerDto = (OfferListDto)SelectedProject.Row.ItemArray[2];
         this.SelectedOffer = OffersList.SingleOrDefault(x => x.Id == offerDto.Id);
         var inquiryDto = (InquiryListDto)SelectedProject.Row.ItemArray[3];
         this.SelectedInquiry = InquiriesList.SingleOrDefault(x => x.Id == inquiryDto.Id);
         var clientDto = (ContragentListDto)SelectedProject.Row.ItemArray[5];
         this.SelectedClient = ClientsList.SingleOrDefault(x => x.Id == clientDto.Id);
         this.StartDate      = DateTime.ParseExact(SelectedProject.Row.ItemArray[6].ToString(), "dd.MM.yyyy", CultureInfo.InvariantCulture);
         this.EndDate        = (DateTime?)(SelectedProject.Row.ItemArray[7] == DBNull.Value ? null : SelectedProject.Row.ItemArray[7]);
         this.Deadline       = DateTime.ParseExact(SelectedProject.Row.ItemArray[8].ToString(), "dd.MM.yyyy", CultureInfo.InvariantCulture);
         this.ContactTo      = (string)(SelectedProject.Row.ItemArray[9] == DBNull.Value ? "" : SelectedProject.Row.ItemArray[9]);
         this.Telephone      = (string)(SelectedProject.Row.ItemArray[10] == DBNull.Value ? "" : SelectedProject.Row.ItemArray[10]);
         this.Incomes        = (decimal)SelectedProject.Row.ItemArray[11];
         this.Expenses       = (decimal)SelectedProject.Row.ItemArray[12];
         this.Profit         = (decimal)SelectedProject.Row.ItemArray[13];
         this.NotesAndEvents = NoteService.GetLast5NotesAsDataTable(this.Id);
     }
     else
     {
         this.EndDate = null;
     }
 }
Beispiel #2
0
        private void HandleLoadedCommand(object parameter)
        {
            this.ClientsList   = new ObservableCollection <ContragentListDto>(this.ContragentService.GetContragentsForDropdown());
            this.InquiriesList = new ObservableCollection <InquiryListDto>(this.InquiryService.GetInquiriesList());
            this.creatorId     = this.UserService.GetUsernames().SingleOrDefault(x => x.Username == offerCreator).Id;

            if (this.SelectedOffer != null)
            {
                this.Id = (int)SelectedOffer.Row.ItemArray[0];
                var clientDto = (ContragentListDto)SelectedOffer.Row.ItemArray[2];
                this.SelectedClient = ClientsList.SingleOrDefault(x => x.Id == clientDto.Id);
                var inquiryDto = (InquiryListDto)SelectedOffer.Row.ItemArray[3];
                this.SelectedInquiry = InquiriesList.SingleOrDefault(x => x.Id == inquiryDto.Id);
                this.Description     = (string)SelectedOffer.Row.ItemArray[4];
                this.Date            = DateTime.ParseExact(SelectedOffer.Row.ItemArray[5].ToString(), "dd.MM.yyyy", CultureInfo.InvariantCulture);
            }
        }
Beispiel #3
0
        private void HandleLoadedCommand(object parameter)
        {
            this.ClientsList = new ObservableCollection <ContragentListDto>(this.ContragentService.GetContragentsForDropdown());
            this.creatorId   = this.UserService.GetUsernames().SingleOrDefault(x => x.Username == inquiryCreator).Id;
            if (this.SelectedInquiry != null)
            {
                this.Id = (int)selectedInquiry.Row.ItemArray[0];
                var clientDto = (ContragentListDto)selectedInquiry.Row.ItemArray[2];
                this.SelectedClient = ClientsList.SingleOrDefault(x => x.NameAndIdentity == clientDto.NameAndIdentity);
                this.Description    = (string)selectedInquiry.Row.ItemArray[3];
                this.Date           = DateTime.ParseExact(selectedInquiry.Row.ItemArray[4].ToString(), "dd.MM.yyyy", CultureInfo.InvariantCulture);

                var clientId = clientDto.Id;

                var client = this.ContragentService.GetClientById(clientId);

                this.PersonOfContact = client.Contact;
                this.Email           = client.Email;
                this.PhoneNum        = client.PhoneNum;
            }
        }