示例#1
0
        private DevicesListViewModel NullAssingValuesToRequestSP(DevicesListViewModel obj)
        {
            if (obj.DeviceNameSearch == null)
            {
                obj.DeviceNameSearch = string.Empty;
            }
            if (obj.ModelNumberSearch == null)
            {
                obj.ModelNumberSearch = string.Empty;
            }
            if (obj.SerialNumberSearch == null)
            {
                obj.SerialNumberSearch = string.Empty;
            }
            if (obj.VendorNameSearch == null)
            {
                obj.VendorNameSearch = string.Empty;
            }
            if (obj.DeviceTypeIdSearch == null)
            {
                obj.DeviceTypeIdSearch = "0";
            }
            if (obj.DeviceStatusIdSearch == null)
            {
                obj.DeviceStatusIdSearch = "0";
            }
            if (obj.IsActiveSearch == null)
            {
                obj.IsActiveSearch = "0";
            }

            return(obj);
        }
        public MainContentControl()
        {
            InitializeComponent();

            var listViewModel = new DevicesListViewModel();

            NavigationManager.CreateNavigationManager(NavigationService);
            NavigationManager.Instanse.Navigate(listViewModel);
        }
        /// <summary>
        /// Gets a filtered and paginated list of LifeCycleManagers
        /// </summary>
        /// <param name="query">containing pagenumber, itemcount, name, project and status</param>
        /// <returns>DevicesListViewDataModel containing the devices, query and amount of pages</returns>
        private async Task <DevicesListViewModel> FilterDevices(DevicesFilter query)
        {
            if (query.Status.Equals("ALL"))
            {
                query.Status = "";
            }

            string httpResponse = await restService.PostRequest($"/api/devices", query);

            DevicesListViewModel response = ParseJSONResponse(httpResponse);

            response.Filter = query;
            return(response);
        }
示例#4
0
        public ActionResult _DeviceListView(DevicesListViewModel obj)
        {
            var DatepurchaseSearch = (obj.DatepurchaseSearch == null) ? (object)DBNull.Value : (object)Convert.ToDateTime(obj.DatepurchaseSearch);
            var StartDateSearch    = (obj.startDate == null) ? (object)DBNull.Value : (object)Convert.ToDateTime(obj.startDate);
            var EnddDteSearch      = (obj.enddate == null) ? (object)DBNull.Value : (object)Convert.ToDateTime(obj.enddate);

            obj = NullAssingValuesToRequestSP(obj);
            obj.devicelistFullBo = _db.Database.SqlQuery <DevicesListFullBo>("GetAllDevices @DeviceName,@ModelNumber,@SerialNumber,@VendorName,@RPMServiceId,@DeviceStatusId,@IsActive,@Datepurchase,@DateCreatedStart,@DateCreatedEnd",
                                                                             new SqlParameter("@DeviceName", obj.DeviceNameSearch), new SqlParameter("@ModelNumber", obj.ModelNumberSearch), new SqlParameter("@SerialNumber", obj.SerialNumberSearch)
                                                                             , new SqlParameter("@VendorName", obj.VendorNameSearch), new SqlParameter("@RPMServiceId", Convert.ToInt32(obj.DeviceTypeIdSearch))
                                                                             , new SqlParameter("@DeviceStatusId", Convert.ToInt32(obj.DeviceStatusIdSearch)), new SqlParameter("@IsActive", Convert.ToInt32(obj.IsActiveSearch)), new SqlParameter("@Datepurchase", DatepurchaseSearch)
                                                                             , new SqlParameter("@DateCreatedStart", StartDateSearch), new SqlParameter("@DateCreatedEnd", EnddDteSearch)).ToList();

            ViewBag.Devices = _db.Device.ToList();
            return(PartialView(obj.devicelistFullBo));
        }
示例#5
0
        public ActionResult DeviceIndex()
        {
            string currentuserId       = User.Identity.GetUserId();
            DevicesListViewModel model = new DevicesListViewModel();

            model.devicelistFullBo = new List <DevicesListFullBo>();

            //model.devicelistFullBo = db.Database.SqlQuery<DevicesListFullBo>("GetAllDevices @DeviceName,@ModelNumber,@SerialNumber,@VendorName,@RPMServiceId,@DeviceStatusId,@IsActive,@Datepurchase,@DateCreatedStart,@DateCreatedEnd",
            //                 new SqlParameter("@DeviceName", string.Empty), new SqlParameter("@ModelNumber", string.Empty), new SqlParameter("@SerialNumber", string.Empty)
            //                 , new SqlParameter("@VendorName", string.Empty), new SqlParameter("@RPMServiceId", Convert.ToInt32(0))
            //                 , new SqlParameter("@DeviceStatusId", Convert.ToInt32(0)), new SqlParameter("@IsActive", Convert.ToInt32(-1)), new SqlParameter("@Datepurchase", DBNull.Value)
            //                 , new SqlParameter("@DateCreatedStart", DBNull.Value), new SqlParameter("@DateCreatedEnd", DBNull.Value)).ToList();

            ViewBag.Devices = _db.Device.ToList();
            return(View(model));
        }
        public DevicesListView()
        {
            InitializeComponent();

            DataContext = new DevicesListViewModel();
        }