public void マテリアルリスト_シナリオ() { var materialMock = new Mock <IMaterialReceiptRepository>(); var entities = new List <MaterialReceiptEntity>(); entities.Add(new MaterialReceiptEntity( new MaterialManagementCode("AAAA"), Convert.ToDateTime("2012/12/12 12:34:56"), "BOX-1234" )); entities.Add(new MaterialReceiptEntity( new MaterialManagementCode("BBBB"), Convert.ToDateTime("2012/12/13 12:34:56"), "BOX-4567" )); entities.Add(new MaterialReceiptEntity( new MaterialManagementCode("CCCC"), Convert.ToDateTime("2012/12/14 12:34:56"), "BOX-5689" )); materialMock.Setup(x => x.GetData()).Returns(entities); var viewModel = new MaterialListViewModel(materialMock.Object); viewModel.MaterialReceipts.Count.Is(3); }
public PartialViewResult FilterMaterialIndex(MaterialListViewModel model) { var data = _materialBll.getAllMaterial(model.SearchView.GoodTypeSource); model.Details = AutoMapper.Mapper.Map <List <MaterialDetails> >(data); model.IsNotViewer = (CurrentUser.UserRole != Enums.UserRole.Viewer && CurrentUser.UserRole != Enums.UserRole.Controller ? true : false); return(PartialView("_MaterialList", model)); }
public void Reload() { MaterialListNotificator.Clear(); _materialsData = null; NotifyPropertyChanged("MaterialsData"); _materialOrdersData = null; NotifyPropertyChanged("MaterialOrdersData"); _productOrdersData = null; NotifyPropertyChanged("ProductOrdersData"); _externStorageMaterialsData = null; NotifyPropertyChanged("ExternStorageMaterialsData"); }
/// <summary> /// Initializes a new instance of the <see cref="ProducersAndMaterialsTabItemViewModel"/> class. /// </summary> /// <param name="modalDialogProvider">The modal dialog service.</param> /// <param name="serviceFactory">The service factory.</param> public MaterialsAndContractorsTabItemViewModel(IMainViewModel mainViewModel, IModalDialogProvider modalDialogProvider, IServiceFactory serviceFactory) : base(mainViewModel, modalDialogProvider, serviceFactory) { MaterialDetailsViewModel = new MaterialDetailsViewModel(MainViewModel, ModalDialogProvider, ServiceFactory); MaterialListViewModel = new MaterialListViewModel(MainViewModel, MaterialDetailsViewModel, ModalDialogProvider, ServiceFactory); ContractorDetailsViewModel = new ContractorDetailsViewModel(MainViewModel, ModalDialogProvider, ServiceFactory); ContractorListViewModel = new ContractorListViewModel(MainViewModel, ContractorDetailsViewModel, ModalDialogProvider, ServiceFactory); ViewModelProvider.RegisterChildViewModel(MaterialDetailsViewModel, ViewModelProviderAction.IsReadOnlyChanged); ViewModelProvider.RegisterChildViewModel(ContractorDetailsViewModel, ViewModelProviderAction.IsReadOnlyChanged | ViewModelProviderAction.SaveInvoked); ViewModelProvider.RegisterChildViewModel(ContractorListViewModel, ViewModelProviderAction.DeleteInvoked); ViewModelProvider.ChildrenViewModelDeleteInvoked += new System.EventHandler<ViewModelProviderActionEventArgs>(ViewModelProvider_ChildrenViewModelDeleteInvoked); ViewModelProvider.ChildrenViewModelSaveInvoked += new System.EventHandler<ViewModelProviderActionEventArgs>(ViewModelProvider_ChildrenViewModelSaveInvoked); }
private string CreateXlsFile(MaterialListViewModel model) { //var data = _materialBll.getByID(mn, p); ////Mapper.Map(data,model); var input = Mapper.Map <MaterialInput>(model.SearchView); var tempData = _materialBll.GetMaterialByParam(input); var data = Mapper.Map <List <MaterialDto> >(tempData); //if(model.SearchView.GoodTypeSource != null) data = data.Where(c=>c.EXC_GOOD_TYP == model.SearchView.GoodTypeSource).ToList(); //get data var listData = Mapper.Map <List <MaterialDetailViewModel> >(data); var slDocument = new SLDocument(); //string goodTypeName = ""; //if (listData.Count > 0) // goodTypeName = "-" + listData[0].GoodTypeName; //create filter //slDocument.SetCellValue(1, 1, "Excisable Goods Type"); //slDocument.SetCellValue(1, 2, ": " + model.SearchView.GoodTypeSource + goodTypeName); //title slDocument.SetCellValue(2, 1, "Material Master"); slDocument.MergeWorksheetCells(2, 1, 2, 15); //create style SLStyle valueStyle = slDocument.CreateStyle(); valueStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Center); valueStyle.Font.Bold = true; valueStyle.Font.FontSize = 18; slDocument.SetCellStyle(2, 1, valueStyle); //create header slDocument = CreateHeaderExcel(slDocument); //create data slDocument = CreateDataExcel(slDocument, listData); var fileName = "MasterData_MaterialMaster" + DateTime.Now.ToString("_yyyyMMddHHmmss") + ".xlsx"; var path = Path.Combine(Server.MapPath(Constans.UploadPath), fileName); slDocument.SaveAs(path); return(path); }
// // GET: /Material/ public ActionResult Index() { var model = new MaterialListViewModel(); model.MainMenu = _mainMenu; model.CurrentMenu = PageInfo; model.SearchView.GoodTypeList = GlobalFunctions.GetGoodTypeList(_goodTypeBll); model.SearchView.PlantList = GlobalFunctions.GetPlantAll(); model.SearchView.UomList = GlobalFunctions.GetUomList(_unitOfMeasurementBll); //model.SearchView.GoodType = EnumHelper.GetDescription(Enums.GoodsType.HasilTembakau); //var data = _materialBll.getAllMaterial(model.GoodType); //model.Details = AutoMapper.Mapper.Map<List<MaterialDetails>>(data); model.IsNotViewer = (CurrentUser.UserRole != Enums.UserRole.Viewer && CurrentUser.UserRole != Enums.UserRole.Controller ? true : false); ViewBag.Message = TempData["message"]; return(View("Index", model)); }
public void ExportXlsFile(MaterialListViewModel model) { string pathFile = ""; pathFile = CreateXlsFile(model); var newFile = new FileInfo(pathFile); var fileName = Path.GetFileName(pathFile); string attachment = string.Format("attachment; filename={0}", fileName); Response.Clear(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.WriteFile(newFile.FullName); Response.Flush(); newFile.Delete(); Response.End(); }
public void Reload(ILongOperationResult result) { try { if (result == null) { return; } if (result.CustomAction != null) { result.CustomAction(); } if (result.RefreshAll) { Reload(); return; } if (result.DataPublished) { UIApplication.MessageDialogs.Info("DataSaved".Localize()); Reload(); return; } if (result.RefreshProductOrders) { _productOrdersData = null; NotifyPropertyChanged("ProductOrdersData"); } if (result.RefreshMaterialOrders) { _materialOrdersData = null; NotifyPropertyChanged("MaterialOrdersData"); } if (result.RefreshExternStorageStats) { _externStorageMaterialsData = null; NotifyPropertyChanged("ExternStorageMaterialsData"); } if (result.RefreshAllMaterial) { _materialsData = null; NotifyPropertyChanged("MaterialsData"); } if (result.MaterialRefreshList != null) { foreach (ObjectId materialId in result.MaterialRefreshList) { MaterialListNotificator.Notify(materialId); } } } catch (Exception ex) { ApplicationContext.Log.Error(GetType(), ex); } }