コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var auto = _autoManager.GetById(int.Parse(Request.QueryString["id"]));
         lblYearMakeModel.Text      = auto.Year + " " + auto.Make + " " + auto.Model + " ";
         lblPhone.Text              = auto.PhoneNumber ?? auto.Seller.PhoneNumber;
         lblEmail.Text              = auto.Seller.Email;
         lblContactName.Text        = auto.ContactName ?? auto.Seller.LastName + ", " + auto.Seller.FirstName;
         litFinancing.Text          = auto.HasFinancing == 1 ? "Yes" : "No";
         lblMinimumDownPayment.Text = auto.MinimumDownPayment.HasValue ? StringHelper.FormatCurrency(auto.MinimumDownPayment.Value) : "N/A";
         lblPrice.Text              = StringHelper.FormatCurrency(auto.Price);
         lblColor.Text              = auto.Color;
         ViewState["auto"]          = auto;
         hfId.Value = auto.Id.ToString();
         if (string.IsNullOrEmpty(auto.CarfaxReportPath))
         {
             btnDownloadCarfax.Visible = false;
         }
         if (!string.IsNullOrEmpty(auto.CarfaxReportPath))
         {
             litCarFax.Text = "<a href='" + auto.CarfaxReportPath + "'>View Carfax</a>";
         }
     }
     BindRepeater();
 }
コード例 #2
0
        private void Update(Button btn, int value)
        {
            var id   = int.Parse(btn.CommandArgument);
            var auto = _autoManager.GetById(id);

            auto.IsApproved = value;
            var user = Session["User"] as RollingRides.WebApp.Components.Datalayer.Models.User;

            _autoManager.AddUpdate(auto, user.UserType);
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                for (var i = DateTime.Now.Year + 1; i > 1919; i--)
                {
                    ddlYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    var auto = _autoManager.GetById(int.Parse(Request.QueryString["id"]));
                    //BindOldImages(auto.Images);
                    txtZipCode.Text = auto.ZipCode;
                    txtTitle.Text   = auto.Title;
                    txtStreet1.Text = auto.Street1;
                    txtStreet2.Text = auto.Street2;
                    txtMake.Text    = auto.Make;
                    txtModel.Text   = auto.Model;

                    ddlYear.SelectedValue  = auto.Year.ToString();
                    txtPhoneNumber.Text    = auto.PhoneNumber ?? auto.Seller.PhoneNumber;
                    txtDescription.Text    = auto.Description;
                    txtContactName.Text    = auto.ContactName ?? auto.Seller.FirstName + " " + auto.Seller.LastName;
                    lblId.Text             = auto.Id.ToString();
                    txtCity.Text           = auto.City;
                    txtMinDownPayment.Text = auto.MinimumDownPayment.HasValue
                                                 ? StringHelper.FormatCurrency(auto.MinimumDownPayment.Value)
                                                 : "N/A";
                    ddlState.SelectedValue = auto.State;
                    txtPrice.Text          = auto.Price.ToString();
                    txtColor.Text          = auto.Color;
                    txtMinDownPayment.Text = auto.MinimumDownPayment.ToString();
                    cbxFianacing.Checked   = auto.HasFinancing == 1;
                    cbxUsed.Checked        = auto.IsUsed == 1;
                    //cbxUserMyInfo.Visible = false;
                }
            }
            int id;

            if (!string.IsNullOrEmpty(lblId.Text) && int.TryParse(lblId.Text, out id))
            {
                var auto = _autoManager.GetById(id);
                BindOldImages(auto.Images);

                if (!IsPostBack)
                {
                    var youtubeVid = auto.Images.FirstOrDefault(x => x.MediaType == MediaType.Youtube);
                    txtYoutube.Text = youtubeVid == null ? "" : youtubeVid.Url;
                }
            }
            else
            {
                lblId.Text = "N/A";
            }
        }