コード例 #1
0
ファイル: HardwareController.cs プロジェクト: nimafantasy/CRM
        public ActionResult GetDeviceInfo3(DataSourceRequest command, ReturnRepairedDeviceListModel model)
        {
            var HardwareItems = _hardwareService.GetAllHardware();
            var HardwareTypeItems = _hardwareService.GetAllHardwareTypes();

            var query1 = from hi in HardwareItems
                         join hti in HardwareTypeItems
                              on hi.Hardware_ID equals hti.Hardware_ID
                         where hi.Request_ID == model.DeviceSerialNumber_ID && hi.DeliveryDate != null
                         select new
                         {
                             hi.DeliveryDate,
                             hti.WarrantyPeriod
                         };

            var gridModel = new DataSourceResult
            {

                ExtraData = new ReturnRepairedDeviceModel
                {
                    DeliveryDate = query1.FirstOrDefault().DeliveryDate,
                    WarrantyPeriod = query1.FirstOrDefault().WarrantyPeriod
                },
                Total = query1.Count()
            };

            return Json(gridModel);
        }
コード例 #2
0
ファイル: HardwareController.cs プロジェクト: nimafantasy/CRM
 public ActionResult ReturnRepairedDevice()
 {
     HttpSessionStateBase session = HttpContext.Session;
     ReturnRepairedDeviceListModel model = new ReturnRepairedDeviceListModel();
     //model.Product = GetProductDropDown();
     //model.TroubleShooting = _tsh.GetTroubleShootingList();
     //if (session["Customer_ID"] != null)
     //{
     //    model.CustomerName = _customerService.GetCustomerById(Convert.ToInt32(session["Customer_ID"])).CustomerName;
     //    session.Remove("Customer_ID");
     //}
     model.DeviceSerialNumber = new List<SelectListItem>();
     return View(model);
 }
コード例 #3
0
ファイル: HardwareController.cs プロジェクト: nimafantasy/CRM
        public virtual ActionResult ReturnRepairedDeviceList(DataSourceRequest command, ReturnRepairedDeviceListModel model)
        {
            if (model.Customer_ID == 0 && string.IsNullOrEmpty(model.CustomerConnector) && string.IsNullOrEmpty(model.ReturnDate) && string.IsNullOrEmpty(model.Repairs) && string.IsNullOrEmpty(model.Reserve) && string.IsNullOrEmpty(model.Description))
            {
                var hardwareItems = _hardwareService.GetAllReturnRepairedDevice();
                var gridModel = new DataSourceResult
                {

                    Data = hardwareItems.Select(x => new ReturnRepairedDeviceModel
                    {

                        CustomerName = _customerService.GetCustomerById(x.Customer_ID).CustomerName,
                        CustomerConnector = x.CustomerConnector,
                        DeviceSerialNumber = x.DeviceSerialNumber,
                        DeliveryDate = x.DeliveryDate,
                        WarrantyPeriod = x.WarrantyPeriod,
                        Description = x.Description,
                        Customer_ID = x.Customer_ID,
                        Request_ID = x.Request_ID,
                        Repairs = x.Repairs,
                        ReturnDate = x.ReturnDate



                    }),
                    Total = hardwareItems.Count()
                };

                return Json(gridModel);
            }
            else
            {
                var hardwareItems = _hardwareService.SearchReturnRepairedDevice(model.CustomerConnector, model.Repairs, model.ReturnDate, model.Reserve, model.Description);
                var gridModel = new DataSourceResult
                {

                    Data = hardwareItems.Select(x => new ReturnRepairedDeviceModel
                    {
                        CustomerName = _customerService.GetCustomerById(x.Customer_ID).CustomerName,
                        CustomerConnector = x.CustomerConnector,
                        DeviceSerialNumber = x.DeviceSerialNumber,
                        DeliveryDate = x.DeliveryDate,
                        WarrantyPeriod = x.WarrantyPeriod,
                        Description = x.Description,
                        Customer_ID = x.Customer_ID,
                        Request_ID = x.Request_ID,
                        Repairs = x.Repairs,
                        ReturnDate = x.ReturnDate


                    }),
                    Total = hardwareItems.Count()
                };

                return Json(gridModel);
            }
        }