Ejemplo n.º 1
0
 public VehicleTileControl(VehicleAdminObject vehicle)
 {
     InitializeComponent();
     _vehicle = vehicle;
     _defaultBrush = this.BorderBrush;
     Initialize();
     this.ToolTip = String.Format("{0} {1} {2} : {3}", _vehicle.GetValue(PropertyId.Year), _vehicle.GetValue(PropertyId.Make), _vehicle.GetValue(PropertyId.Model),
                                               _vehicle.GetValue(PropertyId.Trim));
 }
Ejemplo n.º 2
0
        public void LoadPanel(IAdminObject item)
        {
            _vehicle = item as VehicleAdminObject;

            ClearFormState();

            LoadAllChildren(PurchaseInfoGrid, item);
            addtionalContentControl.ListChanged += addtionalContentControl_ListChanged;

            string foundVendor = _vehicle.GetValue(PropertyId.Vendor);
            WellKnownVendors vehicleVendor = WellKnownVendors.Adesa;
            bool foundVehicleVendor = false;
            if (!string.IsNullOrEmpty(foundVendor))
            {
                foundVehicleVendor = true;
                vehicleVendor = (WellKnownVendors)Enum.Parse(typeof(WellKnownVendors), foundVendor, true);
            }

            int foundIndex = -1;

            cmbVendor.Items.Add("");
            foreach (WellKnownVendors vendor in (WellKnownVendors[])Enum.GetValues(typeof(WellKnownVendors)))
            {
                cmbVendor.Items.Add(vendor.ToString());
                if (foundVehicleVendor && vendor == vehicleVendor)
                {
                    foundIndex = cmbVendor.Items.Count - 1;
                }
            }

            if (foundIndex != -1)
            {
                cmbVendor.SelectedIndex = foundIndex;
            }

            CalculateTasksCost();
        }
Ejemplo n.º 3
0
 private bool isSold(VehicleAdminObject v)
 {
     string s = v.GetValue(PropertyId.SaleDate);
     return (s == null || s == string.Empty) ? false : true;
 }
Ejemplo n.º 4
0
 private bool isPurchased(VehicleAdminObject v)
 {
     string p = v.GetValue(PropertyId.PurchaseDate);
     return (p == null || p == string.Empty) ? false : true;
 }
Ejemplo n.º 5
0
 private string createDateKey(VehicleAdminObject currVehicle, PropertyId p)
 {
     string monthAndYearKey = string.Empty;
     string dateString = currVehicle.GetValue(p);
     DateTime d = DateTime.Parse(dateString);
     monthAndYearKey = d.Month + "-" + d.Year;
     return monthAndYearKey;
 }
Ejemplo n.º 6
0
        private void cache_ItemUpdate(object sender, AdminItemCache.UpdateEventArgs e)
        {
            if (e.Type == AdminItemCache.UpdateType.ModifyItem)
            {
                ListViewItem listViewItem = (from ListViewItem item in LstSearchResults.Items
                                             let listContent = item.Content as VehicleAdminObject
                                             where listContent.ObjectId == e.ItemId
                                             select item).FirstOrDefault();

                VehicleAdminObject cacheContent =
                    cache.FirstOrDefault(vehicleAdminObject => vehicleAdminObject.ObjectId == e.ItemId);

                if (cacheContent != null)
                {
                    VehicleCache tempCache = cacheContent.Cache as VehicleCache;
                    cacheContent = new VehicleAdminObject(cacheContent.ObjectId);
                    cacheContent.Cache = tempCache;

                    if (cacheContent.GetValue(PropertyId.IsDeleted) == true.ToString())
                    {
                        LstSearchResults.Items.Remove(listViewItem);
                        return;
                    }
                }

                if (listViewItem != null)
                {
                    listViewItem.Content = null;
                    listViewItem.Content = cacheContent;
                }
            }
        }