예제 #1
0
        public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer)
        {
            string link;
            if (type.Equals("quickgroup"))
            {
                link = String.Format("QuickGroups.aspx?c={0}&vid={1}&ssd={2}", catalog.Code, catalog.VehicleId, catalog.Ssd);
            }
            else
            {
                ListCategoriesRow category = dataItem as ListCategoriesRow;
                if (category == null)
                {
                    throw new ArgumentException(String.Format("Expected type 'ListCategoriesRow'. Actual type is '{0}'.", renderer.GetType()));
                }
                link = String.Format("Vehicle.aspx?c={0}&vid={1}&cid={2}&ssd={3}", catalog.Code, catalog.VehicleId,
                                     category.categoryid,
                                     catalog.Ssd);
            }

            if (ItemId > 0)
            {
                link += string.Format("&ItemId={0}", ItemId);
            }

            return link;
        }
예제 #2
0
        public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer)
        {
            ListUnitsRow unit = dataItem as ListUnitsRow;
            if (unit == null)
            {
                throw new ArgumentException(String.Format("Expected type 'ListUnitsRow'. Actual type is '{0}'.", renderer.GetType()));
            }

            string link;

            if (type.Equals("filter"))
            {
                link = String.Format("UnitFilter.aspx?c={0}&vid={1}&uid={2}&cid={3}&ssd={4}&path_id={5}&f={6}",
                                     catalog.Code, catalog.VehicleId, unit.unitid, catalog.CategoryId, unit.ssd,
                                     catalog.PathId, HttpUtility.UrlEncode(unit.filter));
            }
            else
            {
                link = String.Format("Unit.aspx?c={0}&vid={1}&uid={2}&cid={3}&ssd={4}&path_id={5}",
                                     catalog.Code, catalog.VehicleId, unit.unitid, catalog.CategoryId, unit.ssd,
                                     catalog.PathId);
            }

            if (ItemId > 0)
            {
                link += string.Format("&ItemId={0}", ItemId);
            }

            return link;
        }
예제 #3
0
        public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer)
        {
            VehicleInfo vehicleInfo = dataItem as VehicleInfo;
            if (vehicleInfo == null)
            {
                throw new ArgumentException(String.Format("Expected type 'VehicleInfo'. Actual type is '{0}'.", dataItem.GetType()));
            }

            VehiclesList vehiclesList = renderer as VehiclesList;
            if (vehiclesList == null)
            {
                throw new ArgumentException(String.Format("Expected type 'VehiclesList'. Actual type is '{0}'.", renderer.GetType()));
            }

            if (string.IsNullOrEmpty(vehicleInfo.PathData))
            {
                throw new ArgumentNullException("VehicleInfo.PathData");
            }

            string catalogCode = string.IsNullOrEmpty(catalog.Code) ? vehicleInfo.catalog : catalog.Code;

            string pathData = (vehicleInfo.PathData.Length > 300)
                                  ? vehicleInfo.PathData.Substring(0, 300)
                                  : vehicleInfo.PathData;

            string link = String.Format("{0}.aspx?c={1}&vid={2}&ssd={3}&path_data={4}",
                                        vehiclesList.QuickGroupsEnable ? "QuickGroups" : "Vehicle",
                                        catalogCode,
                                        vehicleInfo.vehicleid,
                                        vehicleInfo.ssd,
                                        HttpUtility.UrlEncode(Convert.ToBase64String(Encoding.Default.GetBytes(pathData))));

            if (ItemId > 0)
            {
                link += string.Format("&ItemId={0}", ItemId);
            }

            return link;
        }