Exemple #1
0
        public ActionResult Edit()
        {
            var id = Convert.ToInt32(Request.QueryString["id"]);

            #region  拉框绑定
            var belongDeptList = CodeBLL.GetCodeListByParentCode("PCS");
            var listItems      = new List <ListItem>();
            foreach (var d in belongDeptList)
            {
                listItems.Add(new ListItem
                {
                    Text  = d.BMVALUE,
                    Value = d.BMKEY.ToString()
                });
            }

            var belongDept = new DropDownListModel();
            belongDept.DropDownList     = "VALUE";
            belongDept.DropDownListItem = listItems;

            var vehicleTypeList = CodeBLL.GetCodeListByParentCode("CLLX");
            listItems = new List <ListItem>();
            foreach (var d in vehicleTypeList)
            {
                listItems.Add(new ListItem
                {
                    Text  = d.BMVALUE,
                    Value = d.BMKEY.ToString()
                });
            }

            var vehicleType = new DropDownListModel();
            vehicleType.DropDownList     = "VALUE1";
            vehicleType.DropDownListItem = listItems;

            var belongNetList = NetManageBLL.GetAll();
            listItems = new List <ListItem>();
            foreach (var d in belongNetList)
            {
                listItems.Add(new ListItem
                {
                    Text  = d.Name,
                    Value = d.Id.ToString()
                });
            }

            var belongNet = new DropDownListModel();
            belongNet.DropDownList     = "VALUE2";
            belongNet.DropDownListItem = listItems;

            var ownerTypeList = CodeBLL.GetCodeListByParentCode("YCBM");
            listItems = new List <ListItem>();
            foreach (var d in ownerTypeList)
            {
                listItems.Add(new ListItem
                {
                    Text  = d.BMVALUE,
                    Value = d.BMKEY.ToString()
                });
            }

            var ownerType = new DropDownListModel();
            ownerType.DropDownList     = "VALUE3";
            ownerType.DropDownListItem = listItems;
            #endregion
            CarInfoModel model = new CarInfoModel();
            model.belongDept  = belongDept;
            model.vehicleType = vehicleType;
            model.belongNet   = belongNet;
            model.ownerType   = ownerType;
            var data = CarBLL.Get(id);
            model.carInfo.Id           = data.ID;
            model.carInfo.VehicleNo    = data.VEHICLENO;
            model.carInfo.VehicleType  = data.VEHICLETYPE;
            model.carInfo.VehicleBrand = data.VEHICLEBRAND;
            model.carInfo.BelongDeptId = data.BELONGDEPTID;
            model.carInfo.BelongNetId  = data.BELONGNETID;
            model.carInfo.Owner        = data.OWNER;
            model.carInfo.OwnerType    = data.OWNERTYPE;
            model.carInfo.Remark       = data.REMARK;
            model.carInfo.Cldwzdsbh    = data.CLDWZDSBH;
            model.carInfo.Wlwkhm       = data.WLWKHM;
            return(View(model));
        }