public FabricBomViewModel(FabricSetupsWFViewModel viewModel) { if (!DesignerProperties.IsInDesignTool) { _fabricViewModel.InjectFrom(viewModel); MainRowList = new SortableCollectionView <TblFabricBomViewModel>(); SelectedMainRow = new TblFabricBomViewModel(); Client.GetTblFabricBomCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblFabricBomViewModel { ItemPerRow = new ItemsDto() }; var ItemRow = sv.FabricServiceList.FirstOrDefault( x => x.Iserial == row.Item && x.ItemGroup == row.ItemType); newrow.ItemPerRow.Code = ItemRow.Code; newrow.ItemPerRow.Name = ItemRow.Name; newrow.ItemPerRow.Unit = ItemRow.Unit; newrow.ItemPerRow.ItemGroup = ItemRow.ItemGroup; newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Client.UpdateOrInsertTblFabricBomCompleted += (s, x) => { var savedRow = (TblFabricBomViewModel)MainRowList.GetItemAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; Client.DeleteTblFabricBomCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; } }
public FabricBom(FabricSetupsWFViewModel fabricViewModel) { InitializeComponent(); ViewModel = new FabricBomViewModel(fabricViewModel); DataContext = ViewModel; ViewModel.GetMaindata(); }
public FabricSetupsWF() { InitializeComponent(); FabAttrsViewModelObj = new FabricSetupsWFViewModel(); LayoutRoot.DataContext = FabAttrsViewModelObj; SearchResultChild = new FabTool_SearchResultChild(); SearchResultChild.SubmitAction += SearchResultChild_SubmitAction; }
private void btnAddNewCard_Checked(object sender, RoutedEventArgs e) { FabAttrsViewModelObj = new FabricSetupsWFViewModel(); LayoutRoot.DataContext = FabAttrsViewModelObj; BtnCancel.IsEnabled = true; BtnCancel.Visibility = Visibility.Visible; BtnSave.Visibility = Visibility.Visible; FabCategoryCombo.IsEnabled = true; }
public static _Proxy.tbl_FabricAttriputes MapToModelObject(FabricSetupsWFViewModel objectToBeMapped) { var temp = new _Proxy.tbl_FabricAttriputes { Iserial = objectToBeMapped.Iserial, FabricDesignsID = objectToBeMapped.FabricDesignsID, FabricFinishesID = objectToBeMapped.FabricFinishesID, FabricID = objectToBeMapped.FabricID, FabricMaterialsID = objectToBeMapped.FabricMaterialsID, FabricStructuresID = objectToBeMapped.FabricStructuresID, FabricTypesID = objectToBeMapped.FabricTypesID, DyingClassificationID = objectToBeMapped.DyingClassificationID, ExpectedDyingLossMargin = objectToBeMapped.ExpectedDyingLossMargin, FabricCategoryID = objectToBeMapped.FabricCategoryID, FabricDescription = objectToBeMapped.FabricDescription, FabricDescriptionAR = objectToBeMapped.FabricDescriptionAR, HorizontalShrinkage = objectToBeMapped.HorizontalShrinkage, Notes = objectToBeMapped.Notes, Twist = objectToBeMapped.Twist, VerticalShrinkage = objectToBeMapped.VerticalShrinkage, HorizontalShrinkageMax = objectToBeMapped.HorizontalShrinkageMax, VerticalShrinkageMax = objectToBeMapped.VerticalShrinkageMax, WeightPerSquarMeterAfterWashMin = objectToBeMapped.WeightPerSquarMeterAfterWash, WeightPerSquarMeterAsRawMin = objectToBeMapped.WeightPerSquarMeterAsRaw, WeightPerSquarMeterBeforWashMin = objectToBeMapped.WeightPerSquarMeterBeforWash, DyedFabricWidthMin = objectToBeMapped.DyedFabricWidth, WidthAsRawMin = objectToBeMapped.WidthAsRaw, WeightPerSquarMeterAfterWashMax = objectToBeMapped.WeightPerSquarMeterAfterWashMax, WeightPerSquarMeterAsRawMax = objectToBeMapped.WeightPerSquarMeterAsRawMax, WeightPerSquarMeterBeforWashMax = objectToBeMapped.WeightPerSquarMeterBeforWashMax, DyedFabricWidthMax = objectToBeMapped.DyedFabricWidthMax, WidthAsRawMax = objectToBeMapped.WidthAsRawMax, UoMID = objectToBeMapped.UoMID, YarnCountID = objectToBeMapped.YarnCountID, YarnFinishesID = objectToBeMapped.YarnFinishesID, YarnSource = objectToBeMapped.YarnSourceID, GaugesID = objectToBeMapped.GaugesID, ThreadNumbersID = objectToBeMapped.ThreadNumbersID, SupplierRef = objectToBeMapped.SupplierRef, InchesID = objectToBeMapped.InshesProperty != null ? (int?)objectToBeMapped.InshesProperty.Iserial : null, TubularWidth = objectToBeMapped.TubularWidth, NoteUpdatedDate = objectToBeMapped.NoteUpdatedDate, IsPartialDetails = objectToBeMapped.IsPartialDetails, Colored = objectToBeMapped.Colored, YarnStatusID = objectToBeMapped.YarnStatusID }; return(temp); }
public static void MapToViewModelObject(FabricSetupsWFViewModel temp, _Proxy.tbl_FabricAttriputes objectToBeMapped) { temp.Iserial = objectToBeMapped.Iserial; temp.FabricCategoryID = objectToBeMapped.FabricCategoryID; temp.FabricDesignsID = objectToBeMapped.FabricDesignsID; temp.FabricFinishesID = objectToBeMapped.FabricFinishesID; temp.FabricID = objectToBeMapped.FabricID; temp.FabricMaterialsID = objectToBeMapped.FabricMaterialsID; temp.FabricStructuresID = objectToBeMapped.FabricStructuresID; temp.FabricTypesID = objectToBeMapped.FabricTypesID; temp.DyingClassificationID = objectToBeMapped.DyingClassificationID; temp.ExpectedDyingLossMargin = objectToBeMapped.ExpectedDyingLossMargin; temp.FabricDescription = objectToBeMapped.FabricDescription; temp.FabricDescriptionAR = objectToBeMapped.FabricDescriptionAR; temp.Notes = objectToBeMapped.Notes; temp.Twist = objectToBeMapped.Twist; temp.VerticalShrinkage = objectToBeMapped.VerticalShrinkage; temp.HorizontalShrinkage = objectToBeMapped.HorizontalShrinkage; temp.HorizontalShrinkageMax = objectToBeMapped.HorizontalShrinkageMax; temp.VerticalShrinkageMax = objectToBeMapped.VerticalShrinkageMax; temp.WeightPerSquarMeterAfterWash = objectToBeMapped.WeightPerSquarMeterAfterWashMin; temp.WeightPerSquarMeterAsRaw = objectToBeMapped.WeightPerSquarMeterAsRawMin; temp.WeightPerSquarMeterBeforWash = objectToBeMapped.WeightPerSquarMeterBeforWashMin; temp.WidthAsRaw = objectToBeMapped.WidthAsRawMin; temp.DyedFabricWidth = objectToBeMapped.DyedFabricWidthMin; temp.WeightPerSquarMeterAfterWashMax = objectToBeMapped.WeightPerSquarMeterAfterWashMax; temp.WeightPerSquarMeterAsRawMax = objectToBeMapped.WeightPerSquarMeterAsRawMax; temp.WeightPerSquarMeterBeforWashMax = objectToBeMapped.WeightPerSquarMeterBeforWashMax; temp.WidthAsRawMax = objectToBeMapped.WidthAsRawMax; temp.DyedFabricWidthMax = objectToBeMapped.DyedFabricWidthMax; temp.UoMID = objectToBeMapped.UoMID; temp.UoMProperty = temp.UoMList.FirstOrDefault(x => x.Iserial == objectToBeMapped.UoMID); temp.YarnCountID = objectToBeMapped.YarnCountID; temp.YarnFinishesID = objectToBeMapped.YarnFinishesID; temp.GaugesID = objectToBeMapped.GaugesID; temp.ThreadNumbersID = objectToBeMapped.ThreadNumbersID; temp.StatusID = objectToBeMapped.Status; temp.SupplierRef = objectToBeMapped.SupplierRef; temp.YarnSourceID = objectToBeMapped.YarnSource; temp.InshesProperty = temp.InshesList.FirstOrDefault(x => x.Iserial == objectToBeMapped.InchesID); temp.TubularWidth = objectToBeMapped.TubularWidth; temp.NoteUpdatedDate = objectToBeMapped.NoteUpdatedDate; temp.IsPartialDetails = objectToBeMapped.IsPartialDetails; temp.Colored = objectToBeMapped.Colored; temp.YarnStatusID = objectToBeMapped.YarnStatusID; }
private void btnLoadFabricForDying_Click(object sender, RoutedEventArgs e) { FabAttrsViewModelObj = new FabricSetupsWFViewModel { FabricCategoryID = (int)FabCategoryCombo.SelectedValue == 4 ? 2 : (int)FabCategoryCombo.SelectedValue == 5 ? 3 : 0 }; SearchResultChild.Show(); SearchResultChild.IsSearchingToDye = true; SearchResultChild.SearchFabricAttrs(FabAttrsViewModelObj); }
private void btnCancel_Click(object sender, RoutedEventArgs e) { FabAttrsViewModelObj = new FabricSetupsWFViewModel(); LayoutRoot.DataContext = FabAttrsViewModelObj; BtnCancel.IsEnabled = false; BtnCancel.Visibility = Visibility.Collapsed; BtnAddNewCard.IsChecked = false; BtnAddNewCard.Visibility = Visibility.Visible; BtnShowSearch.Visibility = Visibility.Visible; FabCategoryCombo.IsEnabled = false; BtnShowSearch.IsChecked = false; BtnSave.Visibility = Visibility.Collapsed; BtnPostToAx.Visibility = Visibility.Collapsed; }
private void SearchResultChild_SubmitAction(object sender, EventArgs e) { if (SearchResultChild.DialogResult == true) { if (SearchResultChild.FabricCode != null) { FabAttrsViewModelObj = new FabricSetupsWFViewModel ( SearchResultChild.FabricCode , SearchResultChild.IsSearchingToDye ? (int)FabCategoryCombo.SelectedValue == 4 ? 2 : 3 : int.Parse(FabCategoryCombo.SelectedValue.ToString()) , SearchResultChild.IsSearchingToDye ); LayoutRoot.DataContext = FabAttrsViewModelObj; if (SearchResultChild.IsSearchingToDye) { BtnCancel.Visibility = Visibility.Visible; BtnCancel.IsEnabled = true; BtnAddNewCard.Visibility = Visibility.Collapsed; BtnSearch.Visibility = Visibility.Collapsed; BtnSave.Visibility = Visibility.Visible; BtnSave.IsEnabled = true; BtnShowSearch.Visibility = Visibility.Collapsed; FabAttrsViewModelObj.CanPostToAX = false; FabAttrsViewModelObj.IsLoadingForDyedFlag = true; } BtnSave.Visibility = Visibility.Visible; BtnSave.IsEnabled = true; } } }
public void SearchFabricAttrs(FabricSetupsWFViewModel _SearchCriteria) { var client = new _Proxy.CRUD_ManagerServiceClient(); client.GetFabAttributesByCategoryCompleted += (s, e) => { switch (_SearchCriteria.FabricCategoryID) { case 2: case 3: FabAttrResultDataGrid.ItemsSource = (from x in e.Result.ToList() select new { x.FabricID , x.FabricDescription , x.FabricCategoryName , x.UoM , x.WidthAsRaw , x.WeightPerSquarMeterAsRaw , x.ExpectedDyingLossMargin , x.Notes }); break; case 4: case 5: FabAttrResultDataGrid.ItemsSource = (from x in e.Result.ToList() select new { x.FabricID , x.FabricDescription , x.FabricCategoryName , x.UoM , x.HorizontalShrinkage , x.VerticalShrinkage , x.WeightPerSquarMeterAfterWash , x.WeightPerSquarMeterBeforWash , x.Twist , x.Notes }).ToList(); break; case 1: FabAttrResultDataGrid.ItemsSource = (from x in e.Result.ToList() select new { x.FabricID , x.FabricDescription , x.FabricCategoryName , x.UoM , x.Notes }).ToList(); break; } }; client.GetFabAttributesByCategoryAsync(_SearchCriteria.FabricCategoryID); }