Ejemplo n.º 1
0
        public IHttpActionResult Get(int id)
        {
            var policy = policyManager.GetPolicy(id);

            if (policy != null)
            {
                return(Ok(policy));
            }

            return(NotFound());
        }
        public EditWindow(string type, object context)
        {
            InitializeComponent();
            policyManager          = new PolicyManager();
            quoteManager           = new QuoteManager();
            countryManager         = new CountryManager();
            countriesList          = countryManager.GetCountries();
            cb_Country.ItemsSource = countriesList;

            _viewType = type;
            try
            {
                if (_viewType == ConfigurationManager.AppSettings["VIEW_TYPE_POLICY"])
                {
                    int _policyId = (int)context;
                    _policy            = policyManager.GetPolicy(_policyId);
                    txtb_header.Text   = "Editing Policy : " + _policy.Id.ToString();
                    txt_Firstname.Text = _policy.InsurerFirstName;
                    txt_Lastname.Text  = _policy.InsurerLastName;
                    //txt_Middlename.Text = _policy.InsurerMiddleName;
                    txt_Email.Text       = _policy.Email;
                    txt_PhoneNumber.Text = _policy.Phone;
                    txt_TotalAmount.Text = _policy.Amount.ToString();
                    txt_Address.Text     = _policy.Address;
                    txt_State.Text       = _policy.State;

                    txt_Pincode.Text = _policy.Pin.ToString();
                    //txt_AccountNumber.Text = _policy.BankAccountNumber;
                    txt_AgentName.Text          = _policy.AgentName;
                    txt_Nominee.Text            = _policy.Nominee;
                    txt_Relation.Text           = _policy.Relation;
                    date_StartDate.SelectedDate = _policy.StartDate;
                    date_EndDate.SelectedDate   = _policy.EndDate;

                    if (_policy.Gender == "MALE")
                    {
                        rbm.IsChecked = true;
                    }
                    else if (_policy.Gender == "FEMALE")
                    {
                        rbf.IsChecked = true;
                    }
                    else
                    {
                        rbo.IsChecked = true;
                    }
                }
                else if (_viewType == ConfigurationManager.AppSettings["VIEW_TYPE_QUOTE"])
                {
                    int _quoteId = (int)context;
                    _quote = quoteManager.GetQuote(_quoteId);
                    btn_UploadFile.Visibility = Visibility.Hidden;
                    txtb_header.Text          = "Editing Quote : " + _quote.Id.ToString();
                    txt_Firstname.Text        = _quote.InsurerFirstName;
                    txt_Lastname.Text         = _quote.InsurerLastName;
                    //txt_Middlename.Text = _quote.InsurerMiddleName;
                    txt_Email.Text       = _quote.Email;
                    txt_PhoneNumber.Text = _quote.Phone;
                    txt_TotalAmount.Text = _quote.Amount.ToString();
                    txt_Address.Text     = _quote.Address;
                    txt_State.Text       = _quote.State;

                    txt_Pincode.Text = _quote.Pin.ToString();
                    //txt_AccountNumber.Text = _quote.BankAccountNumber;
                    txt_AgentName.Text = _quote.AgentName;
                    txt_Nominee.Text   = _quote.Nominee;
                    txt_Relation.Text  = _quote.Relation;

                    date_StartDate.SelectedDate = _quote.StartDate;
                    date_EndDate.SelectedDate   = _quote.EndDate;

                    if (_quote.Gender == "MALE")
                    {
                        rbm.IsChecked = true;
                    }
                    else if (_quote.Gender == "FEMALE")
                    {
                        rbf.IsChecked = true;
                    }
                    else
                    {
                        rbo.IsChecked = true;
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
        public ViewWindow(string type, object context)
        {
            InitializeComponent();
            countryManager = new CountryManager();
            policyManager  = new PolicyManager();
            quoteManager   = new QuoteManager();
            _viewType      = type;

            try
            {
                if (_viewType == ConfigurationManager.AppSettings["VIEW_TYPE_POLICY"])
                {
                    int policyId = (int)context;
                    _policy                  = policyManager.GetPolicy(policyId);
                    _policy.Country          = countryManager.GetCountries().Find(x => x.Code == _policy.Country).Description;
                    _policy.Type             = GetPolicyOrQuoteTypes(_policy.Type);
                    _policy.AddressProofType = _policy.AddressProofType == "PASS" ? "Passport" : "Voter id";
                    this.txtb_header.Text    = "Policy ID :" + _policy.Id.ToString();

                    if (_policy.Gender == "MALE")
                    {
                        txt_Gender.Text = "MALE";
                    }
                    else if (_policy.Gender == "FEMALE")
                    {
                        txt_Gender.Text = "FEMALE";
                    }
                    else
                    {
                        txt_Gender.Text = "OTHERS";
                    }

                    this.DataContext = _policy;
                }
                else if (_viewType == ConfigurationManager.AppSettings["VIEW_TYPE_QUOTE"])
                {
                    int quoteId = (int)context;
                    _quote                  = quoteManager.GetQuote(quoteId);
                    _quote.Country          = countryManager.GetCountries().Find(x => x.Code == _quote.Country).Description;
                    _quote.Type             = GetPolicyOrQuoteTypes(_quote.Type);
                    _quote.AddressProofType = _quote.AddressProofType == "PASS" ? "Passport" : "Voter id";
                    this.txtb_header.Text   = "Quote ID :" + _quote.Id.ToString();
                    this.btn_DownloadDocument.Visibility = Visibility.Collapsed;

                    if (_quote.Gender == "MALE")
                    {
                        txt_Gender.Text = "MALE";
                    }
                    else if (_quote.Gender == "FEMALE")
                    {
                        txt_Gender.Text = "FEMALE";
                    }
                    else
                    {
                        txt_Gender.Text = "OTHERS";
                    }

                    this.DataContext = _quote;
                }
                else
                {
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }