/// <summary>
        /// Returns firm data object with updated values.
        /// </summary>
        /// <returns>the updated firm data object</returns>
        private tFirmy GetNewFirmData()
        {
            var f = GetFirmData();

            FirmData.UpdateFirm(f, service);
            return(f);
        }
 protected void CreateUser_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         try
         {
             TravelAgencyService service = new TravelAgencyService();
             try
             {
                 if (FirmPanel.Visible)
                 {
                     CreateUser(FirmData.EmailString, FirmData.PasswordString, service, () =>
                     {
                         service.CreateFirm(FirmData.Firm, FirmData.GetAddressEntity(service), FirmData.EmailString);
                     });
                 }
                 else if (PersonPanel.Visible)
                 {
                     CreateUser(PersonData.EmailString, PersonData.PasswordString, service, () =>
                     {
                         service.CreatePerson(PersonData.Person, PersonData.GetAddressEntity(service), PersonData.EmailString);
                     });
                 }
             }
             finally
             {
                 service.Dispose();
             }
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", ex.Message);
         }
     }
 }
 private ChangePasswordData GetPasswordData()
 {
     if (IsPerson)
     {
         return(PersonData.GetPasswordData());
     }
     else
     {
         return(FirmData.GetPasswordData());
     }
 }
        private void AssignData()
        {
            tOsoby person = GetPersonData();

            if (person != null)
            {
                IsPerson = true;
                PersonData.AssignData(person);
            }
            else
            {
                tFirmy firm = GetFirmData();
                if (firm != null)
                {
                    IsFirm = true;
                    FirmData.AssignData(firm);
                }
            }
        }
Exemple #5
0
        public static DocumentBuilder Run()
        {
            string   firmJsonFile    = CheckFile(Path.Combine("Content", "firm-data.json"));
            string   firmJsonContent = File.ReadAllText(firmJsonFile);
            FirmData firmData        =
                JsonConvert.DeserializeObject <FirmData>(firmJsonContent);

            string tradeJsonFile    = CheckFile(Path.Combine("Content", "trade-data.json"));
            string tradeJsonContent = File.ReadAllText(tradeJsonFile);

            TradeData tradeData =
                JsonConvert.DeserializeObject <TradeData>(tradeJsonContent);

            TradeConfirmationBuilder TradeConfirmationBuilder =
                new TradeConfirmationBuilder();

            TradeConfirmationBuilder.FirmData  = firmData;
            TradeConfirmationBuilder.TradeData = tradeData;

            return(TradeConfirmationBuilder.Build());
        }