Exemple #1
0
        public AlterationForm(CustomerResource customer)
        {
            Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            ConfigurationRepository configRepo = new ConfigurationRepository();
            maxAlterations = Convert.ToDouble(configRepo.GetConfigrationSettings().Where(x => x.Setting == "maxAlterations").Select(x => x.Value).DefaultIfEmpty("").First());
            TicketRepository ticketRepo = new TicketRepository();
            alterationToatalForDays = ticketRepo.GetAlterationToatalForDays();
            SetupForm();
            this.customer = customer;
            customerId = customer.CustomerId;
            isNewAlteration = true;
            TicketNumberLabel.Hide();
            DateInPicker.Value = DateTime.Today;
            var readyDate = GetNextValidDateNotOverMaxAlterations(DateTime.Today.AddDays(7));
            DateReadyPicker.Value = readyDate;
            previousStatus = "a";
            NewTicketWithCustomerBttn.Enabled = false;

            TitleComboBox.Text = customer.Title;
            FirstNameTextBox.Text = customer.FirstName;
            MiddleNameTextBox.Text = customer.MiddleName;
            LastNameTextBox.Text = customer.LastName;
            AddressTextBox.Text = customer.Address;
            CityTextBox.Text = customer.City;
            StateTextBox.Text = customer.State;
            ZipTextBox.Text = customer.Zip;
            PhoneTextBox.Text = customer.Telephone;
            EmailTextBox.Text = customer.Email;
        }
Exemple #2
0
        public AlterationForm(TicketResource ticketResource)
        {
            SetupForm();
            ConfigurationRepository configRepo = new ConfigurationRepository();
            TicketRepository ticketRepo = new TicketRepository();
            maxAlterations = Convert.ToDouble(configRepo.GetConfigrationSettings().Where(x => x.Setting == "maxAlterations").Select(x => x.Value).DefaultIfEmpty("").First());
            alterationToatalForDays = ticketRepo.GetAlterationToatalForDays();

            if (ticketResource.TicketId == 0)
            {
                isNewAlteration = true;
                TicketNumberLabel.Hide();
                previousStatus = "a";
                NewTicketWithCustomerBttn.Enabled = false;
            }
            else
            {
                isNewAlteration = false;
                ticketID = ticketResource.TicketId;
                TicketNumberLabel.Text = ticketResource.TicketId.ToString();
                previousStatus = ticketResource.Status ?? "a";
            }

            customerId = ticketResource.CustomerID;

            TitleComboBox.Text = ticketResource.Title ?? "";
            FirstNameTextBox.Text = ticketResource.FirstName ?? "";
            MiddleNameTextBox.Text = ticketResource.MiddleName ?? "";
            LastNameTextBox.Text = ticketResource.LastName ?? "";
            AddressTextBox.Text = ticketResource.Address ?? "";
            CityTextBox.Text = ticketResource.City ?? "";
            StateTextBox.Text = ticketResource.State ?? "";
            ZipTextBox.Text = ticketResource.Zip ?? "";
            PhoneTextBox.Text = ticketResource.Telephone ?? "";
            EmailTextBox.Text = ticketResource.Email ?? "";
            CommentBox.Text = ticketResource.Comments ?? "";
            if (ticketResource.Status == "a")
            {
                StatusComboBox.Text = "Active";
            }
            else if (ticketResource.Status == "d")
            {
                StatusComboBox.Text = "Done";
            }
            else if (ticketResource.Status == "c")
            {
                StatusComboBox.Text = "Cancelled";
            }
            else if (ticketResource.Status == "i")
            {
                StatusComboBox.Text = "In Progress";
            }
            else
            {
                StatusComboBox.Text = "";
            }

            PickedUpComboBox.Text = ticketResource.PickedUp ?? "n/a";
            DateInPicker.Value = ticketResource.DateIn;
            DateReadyPicker.Value = ticketResource.DateReady;
            OrderIdTextBox.Text = ticketResource.OrderId ?? "";

            if (isNewAlteration)
            {
                //cant add this above because it will just get overwritten down here, and it looks messy it the if logic is added below
                DateReadyPicker.Value = DateTime.Today.AddDays(7);
            }
            DepositTextBox.Text = ticketResource.Deposit.ToString();
            TailorComboBox.Text = ticketResource.TailorName == "" ? "In House" : ticketResource.TailorName;
        }