コード例 #1
0
 public ImageRequest(params Stream[] images)
 {
     _modelSpec = new ModelSpec()
     {
     };
     _images = images;
 }
コード例 #2
0
 public CartController(IMessageSession _messageSession)
 {
     _domainInterface = new DomainInterface(_messageSession);
     _modelSpec       = new EnglishDictionary();
     _equipment       = EquipmentCollection.FromSampleFile(_modelSpec);
     _invoiceSpec     = new EnglishInvoice();
 }
コード例 #3
0
        public ModelSpec FindSpecViewModelByModel(int?id, ModelSpec model)
        {
            model.SpecViewModel.SpecCollection.RemoveAll(item => item.ModelID != id);


            return(model);
        }
コード例 #4
0
        public ModelSpec GetModelSpecViewModel()
        {
            ModelSpec model = new ModelSpec();

            model.EngineViewModel.ModelCollection = GetEngineModel().ModelCollection;
            model.SpecViewModel.SpecCollection    = GetSpecModel().SpecCollection;

            return(model);
        }
コード例 #5
0
 protected void btnAddModelSpec_Click(object sender, EventArgs e)
 {
     if (Session["CAR_SELECTED"] != null)
     {
         if (Request.Params["bid"] != null)
         {
             bid = Request.Params["bid"];
             ModelSpec ms = new ModelSpec();
             ms.Model = txtEditModel.Text;
             ms.Id = int.Parse(bid.Trim());
             ms.Doors = txtEditDoor.Text;
             ms.CarProductId = int.Parse(Session["CAR_SELECTED"].ToString());
             ms.BodyStyle = txtEditBodyStyle.Text;
             ms.Brakes = txtEditBrakesFR.Text;
             ms.Convenience = txtEditConvinence.Text;
             ms.CurbWeight = txtEditCubWeight.Text;
             ms.DriveLine = txtEditDriveLine.Text;
             ms.Engine = txtEditEngine.Text;
             ms.EngineCapacity = txtEditEngineCapacity.Text;
             ms.EngineSize = txtEditEngineSize.Text;
             ms.Transmission = txtEditTransmission.Text;
             ms.Year = txtEditYear.Text;
             ms.Entertainment = txtEditEntertainment.Text;
             ms.ExteriorColorOptions = txtEditExteriorColorOption.Text;
             ms.FrontSuspension = txtEditFrontSuspension.Text;
             ms.FuelEfficiencyRating = txtEditFuelEffiRating.Text;
             ms.FuelSystem = txtEditFuelSystem.Text;
            // ms.FueltankCapacity = txtEditFuelTank.Text;
             ms.GrossVehicleWeight = txtEditGrossVehicleWeigth.Text;
             ms.GroundClearance = txtEditGroundClearance.Text;
             ms.InteriorColorOption = txtEditInteriorColorOption.Text;
             ms.KeyFeatures = txtEditKeyFeatures.Text;
             ms.LengthWidthHeight = txtEditLenghtWidthHeight.Text; ;
             ms.LLI = txtEditLightingVI.Text;
             ms.MaxOutput = txtEditMaxOutput.Text;
             ms.MaxTorque = txtEditMaxTorque.Text;
             ms.MinimumTurningRadius = txtEditMinimumTRadius.Text;
             ms.Overview = txtEditOverview.Text;
             ms.PistonDisplacement = txtEditPiston.Text;
             ms.PowerTrain = txtEditPowerTrain.Text;
             ms.RearSuspension = txtEditRearSuspension.Text;
             ms.SafetySecurity = txtEditSafetySecurity.Text;
             ms.SuspensionHandling = txtEditSuspension.Text;
             ms.WeightDimensions = txtEditWeightDimension.Text;
             ms.Wheelbase = txtEditWheelbase.Text;
             ms.Wheels = txtEditWheels.Text;
             ms.Tyres = txtEditTyresFR.Text;
             ms.FueltankCapacityValue = txtEditFuelTankValue.Text;
             int result = DataService.Provider.SaveModelSpec(ms);
             if (result > 0)
             {
                 Response.Redirect(Util.AdminUrl + "maintain-car-product-models&cid=" + Session["CAR_SELECTED"].ToString());
             }
         }
     }
 }
コード例 #6
0
        private static Cart ReadCart(
            HttpRequest request, EquipmentCollection equipment, ModelSpec spec)
        {
            List <CartCompactItem> items = new List <CartCompactItem>();
            var cartCookie = request.Cookies["cart"];

            if (!string.IsNullOrWhiteSpace(cartCookie))
            {
                items = System.Text.Json.JsonSerializer.Deserialize <List <CartCompactItem> >(cartCookie);
            }
            return(Cart.Validate(items, equipment, spec));
        }
コード例 #7
0
        public static EquipmentCollection FromSampleFile(ModelSpec spec)
        {
            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                    "Models", "SampleEquipmentCollection.csv");
            var lines      = File.ReadAllLines(path);
            var collection = lines
                             .Select(l => l.Split(','))
                             .Select(strs => new Equipment(strs[0], strs[1]))
                             .ToList();

            return(new EquipmentCollection(collection, spec));
        }
コード例 #8
0
        public ModelSpec FindEngineViewModel(int?id, ModelSpec model)
        {
            model.EngineViewModel.ModelCollection.RemoveAll(item => item.ModelID != id);

            foreach (EngineModelModel.tblEngineModel item in model.EngineViewModel.ModelCollection)
            {
                if (item.ModelID != id)
                {
                    model.EngineViewModel.ModelCollection.Remove(item);
                }
            }
            return(model);
        }
コード例 #9
0
        public ImageRequest(params Stream[] images)
        {
            _modelSpec = new ModelSpec();
            _proto     = new TensorProto {
                Dtype = DataType.DtString
            };

            var bytes = images.Select(ByteString.FromStream);

            _proto.StringVal.AddRange(bytes);
            _proto.TensorShape = new TensorShapeProto();
            _proto.TensorShape.Dim.Add(new TensorShapeProto.Types.Dim());
            _proto.TensorShape.Dim[0].Size = images.Length;
        }
コード例 #10
0
ファイル: Cart.cs プロジェクト: curr3nt/Bondora.Rental
        public static Cart Validate(IEnumerable <CartCompactItem> compactItems,
                                    EquipmentCollection equipment,
                                    ModelSpec spec)
        {
            var equipmentTypeIndex = equipment.ToDictionary(e => e.Name, e => e.Type);

            return(new Cart(
                       compactItems
                       .Select(i => CartFullItem.Restore(i, equipmentTypeIndex))
                       // this filters out only properly restored items
                       // please check comment above
                       .Where(item => item != null)
                       .ToList(), spec));
        }
コード例 #11
0
ファイル: MujocoConverter.cs プロジェクト: sts-sadr/furniture
    /*
     * Quaternion q = new Quaternion(0, 0, 0, 1);
     *  q.SetLookRotation(
     *      new Vector3(transform.yaxis[0], -transform.yaxis[2], transform.yaxis[1]),
     *      new Vector3(-transform.zaxis[0], transform.zaxis[2], -transform.zaxis[1])
     *  );
     *
     *  obj.transform.localPosition = new Vector3(-transform.position[0], transform.position[2], -transform.position[1]);
     *  obj.transform.localRotation = q;
     *  obj.transform.localScale = new Vector3(transform.scale[0], transform.scale[2], transform.scale[1]);
     */
    private void LoadEnvironmentModels()
    {
        environmentInfo = EnvironmentInfo.Read();
        furnitureList   = new Dictionary <string, FurnitureInfo>();
        HashSet <string> shapeSet = new HashSet <string>();
        int idx = 0;

        foreach (string furniture in environmentInfo.furnitureNameList)
        {
            furnitureList[furniture]        = ModelSpec.Read(furniture);
            furnitureList[furniture].taskID = idx;
            foreach (var part in furnitureList[furniture].partList)
            {
                shapeSet.Add(part.shapeDesc);
            }
            idx++;
        }
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ModelSpec modelSpec = new ModelSpec();

        modelSpec.Class    = "A";
        modelSpec.Color    = "Black";
        modelSpec.exterior = "exterior";
        modelSpec.Size     = "Size";
        modelSpec.OrderNo  = "OrderNo";
        modelSpec.Remark   = "Remark";
        servComm.Add(modelSpec);

        #region  页面加载
        if (!IsPostBack)
        {
            DataSet ds = dal.SelectAll();
            this.UserSelectGridView.DataSource = ds;
            UserSelectGridView.DataBind();
        }
    }
コード例 #13
0
ファイル: Cart.cs プロジェクト: curr3nt/Bondora.Rental
 public Cart(IEnumerable <CartFullItem> items, ModelSpec spec)
 {
     _items = items;
     Spec   = spec;
 }
コード例 #14
0
 public EquipmentCollection(IEnumerable <Equipment> collection, ModelSpec spec)
 {
     _collection = collection;
     Spec        = spec;
 }
コード例 #15
0
 public void UpdateEngineSpecModel(ModelSpec model)
 {
     //INvoke DAL to update tblEngineModel
 }
コード例 #16
0
        public PropertyType Register(Type returnType, int depth = 0)
        {
            returnType = Nullable.GetUnderlyingType(returnType) ?? returnType;

            if (_models.ContainsKey(returnType))
            {
                return(new PropertyType
                {
                    Type = _models[returnType].id,
                    Description = returnType.FriendlyName(),
                    Items = new Items
                    {
                        Ref = _models[returnType].id
                    }
                });
            }

            if (PrimitiveMappings.ContainsKey(returnType))
            {
                var mapping = PrimitiveMappings[returnType];
                return(new PropertyType
                {
                    Description = returnType.FriendlyName(),
                    Type = mapping.Type,
                    Format = mapping.Format
                });
            }

            if (returnType.IsEnum)
            {
                return(new PropertyType
                {
                    Description = returnType.FriendlyName(),
                    Type = "string",
                    Enum = Enum.GetNames(returnType)
                });
            }

            if (returnType.Implements <IEnumerable>())
            {
                var collectionType = returnType.GetElementType();
                if (returnType.IsGenericType)
                {
                    collectionType = returnType.GetGenericArguments()[0];
                }

                var colMapping = Register(collectionType, depth++);
                var isComplex  = _models.ContainsKey(collectionType);

                return(new PropertyType
                {
                    Description = returnType.FriendlyName(),
                    Type = "array",
                    Items = new Items
                    {
                        Ref = (isComplex)? colMapping.Type : "",
                        Type = (!isComplex)? colMapping.Type : ""
                    }
                });
            }

            if (returnType.IsPrimitive)
            {
                return(new PropertyType
                {
                    Description = returnType.FriendlyName(),
                    Type = returnType.Name
                });
            }

            var modelSpec = new ModelSpec {
                id = ModelIdFromType(returnType)
            };

            _models.Add(returnType, modelSpec);

            foreach (var prop in returnType.GetProperties())
            {
                var mapping = Register(prop.PropertyType, depth++);
                modelSpec.properties.Add(prop.Name, mapping);
            }

            return(new PropertyType
            {
                Description = returnType.FriendlyName(),
                Type = modelSpec.id,
            });
        }
コード例 #17
0
ファイル: Home.cs プロジェクト: curr3nt/Bondora.Rental
 public Home(ModelSpec spec)
 {
     Spec = spec;
 }
コード例 #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            listClassType = DataCache.findAllDict().Where(model => model.ClassID == "MaterialType").ToList();
            listClassType.Insert(0, new ModelDictDetail()
            {
            });
        }
        string actiontype = Request["actiontype"];

        if (actiontype == "GetSpecManageList")
        {
            string Bh = Request["Bh"];
            if (!String.IsNullOrEmpty(Bh))
            {
                ccwhere.AddComponent("Bh", "%" + Bh + "%", SearchComponent.Like, SearchPad.And);
            }
            string Class = Request["Class"];
            if (!String.IsNullOrEmpty(Class))
            {
                ccwhere.AddComponent("Class", Class, SearchComponent.Equals, SearchPad.And);
            }
            string OrderNo = Request["OrderNo"];
            if (!String.IsNullOrEmpty(OrderNo))
            {
                ccwhere.AddComponent("OrderNo", "%" + OrderNo + "%", SearchComponent.Like, SearchPad.And);
            }



            int iPageCount = 0;
            int iPageIndex = int.Parse(Request["PageIndex"]) + 1;
            servComm.strOrderString = "Id desc ";
            listObj = servComm.GetList <ModelSpec>("Spec", "*", "Id", 10, iPageIndex, iPageCount, ccwhere);
            listObj.ToList().ForEach(eo => eo.Class = (listClassType.Where(le => le.Code == eo.Class).Count() > 0 ? listClassType.Where(le => le.Code == eo.Class).FirstOrDefault().DictName : ""));


            var timeConvert = new IsoDateTimeConverter();
            //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConvert.DateTimeFormat = "yyyy-MM-dd";


            string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert);
            responseJson = responseJson.Replace(": null", ": \"\"");
            Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]");
            Response.End();
        }
        else if (actiontype == "ExportExcel")
        {
            string BillNo = Request["BillNo"];
            if (!String.IsNullOrEmpty(BillNo))
            {
                ccwhere.AddComponent("BillNo", "%" + BillNo + "%", SearchComponent.Like, SearchPad.And);
            }
            string Salesperson = Request["Salesperson"];
            if (!String.IsNullOrEmpty(Salesperson))
            {
                ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And);
            }
            string IsDel = Request["IsDel"];
            if (!String.IsNullOrEmpty(IsDel))
            {
                ccwhere.AddComponent("IsDel", "1", SearchComponent.Equals, SearchPad.And);
            }
            else
            {
                ccwhere.AddComponent("Isnull(IsDel,0)", "1", SearchComponent.UnEquals, SearchPad.And);
            }

            servComm.strOrderString = "Id";
            listObj = servComm.GetListTop <ModelSpec>(0, "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Reg],[RegTime]", "Sale", ccwhere);
            string shortName = DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx";
            string fileName  = Request.PhysicalApplicationPath + "UploadFile\\" + shortName;
            using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\"))
            {
                DataTable dtTable = listObj.ToDataTable();
                dtTable.Columns.Remove("IsDel");
                int count = excelHelper.DataTableToExcel(dtTable, "订单信息", true);
            }
            Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName);
            Response.End();
        }
        else if (Request["actiontype"] == "SaveSpec")
        {
            int identityID = 0;
            try
            {
                ModelSpec ModelSpec = new ModelSpec();
                if (String.IsNullOrEmpty(Request["Id"]))
                {
                    ModelSpec.Class       = Request["Class"];
                    ModelSpec.Bh          = Request["Bh"];
                    ModelSpec.ProductName = Request["ProductName"];
                    ModelSpec.Spec        = Request["Spec"];
                    ModelSpec.OrderNo     = Request["OrderNo"];
                    ModelSpec.Size        = Request["Size"];
                    ModelSpec.exterior    = Request["exterior"];
                    ModelSpec.Color       = Request["Color"];
                    ModelSpec.Remark      = Request["Remark"];
                    identityID            = servComm.Add(ModelSpec);
                }
                else
                {
                    if (String.IsNullOrEmpty(Request["Bh"]))
                    {
                        identityID = servComm.ExecuteSql(" delete from Spec where ID in (" + Request["Id"] + ");");
                    }
                    else
                    {
                        identityID            = int.Parse(Request["Id"]);
                        ModelSpec.Class       = Request["Class"];
                        ModelSpec.Bh          = Request["Bh"];
                        ModelSpec.ProductName = Request["ProductName"];
                        ModelSpec.Spec        = Request["Spec"];
                        ModelSpec.OrderNo     = Request["OrderNo"];
                        ModelSpec.Size        = Request["Size"];
                        ModelSpec.exterior    = Request["exterior"];
                        ModelSpec.Color       = Request["Color"];
                        ModelSpec.Remark      = Request["Remark"];
                        ModelSpec.ID          = identityID;
                        int result = servComm.Update(ModelSpec);
                    }
                }
                DataCache.dict = servComm.GetListTop <ModelDictDetail>(0, null).ToList();
            }
            catch (Exception ex)
            {
                Response.Write(0);
                Response.End();
            }

            Response.Write(identityID);
            Response.End();
        }
    }
コード例 #19
0
        private void AssertModelProperty(ModelSpec modelSpec, string propertyName, Action <ModelPropertySpec> applyAssertions)
        {
            var propertySpec = modelSpec.properties[propertyName];

            applyAssertions(propertySpec);
        }
コード例 #20
0
        private static void ModelProperty(ModelSpec model, string name, Action <ModelSpec> applyAssertions)
        {
            var modelPropertySpec = model.Properties[name];

            applyAssertions(modelPropertySpec);
        }
コード例 #21
0
ファイル: VehicleItem.ascx.cs プロジェクト: haslam/ELIZADE
 private Hashtable GetHashtableFromModelSpec(ModelSpec item)
 {
     if (item != null)
     {
         Hashtable ht = new Hashtable();
         // use reflection to set the properties for this class
         ht["Overview"] = (item.Overview == null) ? "" : item.Overview;
         ht["Year"] = (item.Year == null) ? "" : item.Year;
         ht["Transmission"] = (item.Transmission == null) ? "" : item.Transmission;
         ht["EngineCapacity"] = (item.EngineCapacity == null) ? "" : item.EngineCapacity;
         ht["DriveLine"] = (item.DriveLine == null) ? "" : item.DriveLine;
         ht["Doors"] = (item.Doors == null) ? "" : item.Doors;
         ht["ExteriorColorOptions"] = (item.ExteriorColorOptions == null) ? "" : item.ExteriorColorOptions;
         ht["InteriorColorOption"] = (item.InteriorColorOption == null) ? "" : item.InteriorColorOption;
         ht["BodyStyle"] = (item.BodyStyle == null) ? "" : item.BodyStyle;
         ht["FuelEfficiencyRating"] = (item.FuelEfficiencyRating == null) ? "" : item.FuelEfficiencyRating; 
         ht["KeyFeatures"]  = (item.KeyFeatures == null) ? "" : item.KeyFeatures; 
         ht["Convenience"] = (item.Convenience == null) ? "" : item.Convenience;
         ht["Entertainment"] = (item.Entertainment == null) ? "" : item.Entertainment;
         ht["SafetySecurity"] = (item.SafetySecurity == null) ? "" : item.SafetySecurity;
         ht["LLI"] = (item.LLI == null) ? "" : item.LLI;
         ht["WeightDimensions"] = (item.WeightDimensions == null) ? "" : item.WeightDimensions;
         ht["LengthWidthHeight"] = (item.LengthWidthHeight == null) ? "" : item.LengthWidthHeight;
         ht["Wheelbase"] = (item.Wheelbase == null) ? "" : item.Wheelbase;
         ht["GroundClearance"] = (item.GroundClearance == null) ? "" : item.GroundClearance;
         ht["CurbWeight"] = (item.CurbWeight == null) ? "" : item.CurbWeight;
         ht["GrossVehicleWeight"] = (item.GrossVehicleWeight == null) ? "" : item.GrossVehicleWeight;
         ht["MinimumTurningRadius"] = (item.MinimumTurningRadius == null) ? "" : item.MinimumTurningRadius;
         ht["SuspensionHandling"] = (item.SuspensionHandling == null) ? "" : item.SuspensionHandling;
         ht["FrontSuspension"] = (item.FrontSuspension == null) ? "" : item.FrontSuspension;
         ht["RearSuspension"] = (item.RearSuspension == null) ? "" : item.RearSuspension;
         ht["Brakes"] = (item.Brakes == null) ? "" : item.Brakes;
         ht["Tyres"] = (item.Tyres == null) ? "" : item.Tyres;
         ht["Wheels"] = (item.Wheels == null) ? "" : item.Wheels;
         ht["PowerTrain"] = (item.PowerTrain == null) ? "" : item.PowerTrain;
         ht["Engine"] = (item.Engine == null) ? "" : item.Engine;
         ht["EngineSize"] = (item.EngineSize == null) ? "" : item.EngineSize;
         ht["PistonDisplacement"] = (item.PistonDisplacement == null) ? "" : item.PistonDisplacement; 
         ht["MaxOutput"]  = (item.MaxOutput == null) ? "" : item.MaxOutput;
         ht["MaxTorque"] = (item.MaxTorque == null) ? "" : item.MaxTorque;
         ht["FuelSystem"] = (item.FuelSystem == null) ? "" : item.FuelSystem;
         //ht["FueltankCapacity"] = (item.FueltankCapacity == null) ? "" : item.FueltankCapacity;
         ht["FueltankCapacityValue"] = (item.FueltankCapacityValue == null) ? "" : item.FueltankCapacityValue;
         ht["Model"] = (item.Model == null) ? "" : item.Model;
         return ht;
     }
     return null;
 }