private void CopyColorLink(TblColorLink newRow, string brand, int brandsection, int season) { using (var context = new WorkFlowManagerDBEntities()) { var colorList = (from e in context.TblColorLinks where e.TblLkpSeason == newRow.TblLkpSeason && e.TblLkpBrandSection == newRow.TblLkpBrandSection && e.TblBrand == newRow.TblBrand select e ).ToList(); foreach (var tblColorLink in colorList) { var oldRow = (from e in context.TblColorLinks where e.TblLkpSeason == season && e.TblBrand == brand && e.TblLkpBrandSection == brandsection && e.TblColor == tblColorLink.TblColor select e).SingleOrDefault(); if (oldRow == null) { var row = new TblColorLink { TblBrand = brand, TblLkpBrandSection = brandsection, TblLkpSeason = season, TblColor = tblColorLink.TblColor }; context.TblColorLinks.AddObject(row); } } context.SaveChanges(); } }
internal void DeleteColorLink() { if (SelectedMainRows != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { foreach (var row in SelectedMainRows) { Loading = true; var newrow = new TblColorLink { TblBrand = BrandCode, TblColor = row.Iserial, TblLkpSeason = Season, TblLkpBrandSection = BrandSection }; Client.UpdateOrDeleteTblColorLinkAsync( newrow, false, MainRowList.IndexOf(row)); } } } }
public void CopyColorLink() { var newrow = new TblColorLink { TblBrand = BrandCode, //TblColor = MainRowList.FirstOrDefault().Iserial, TblLkpSeason = Season, TblLkpBrandSection = BrandSection }; Loading = true; Client.CopyColorLinkAsync(newrow, BrandCodeCopy, BrandSectionCopy, SeasonCopy); }
public void AddToColorLink() { foreach (var row in MainSelectedRows) { Loading = true; var newrow = new TblColorLink { TblBrand = BrandCode, TblColor = row.Iserial, TblLkpSeason = Season, TblLkpBrandSection = BrandSection }; Client.UpdateOrDeleteTblColorLinkAsync( newrow, true, 0); } }
public void UpdateColorLinkPanton() { foreach (var row in UpdatedPantonRows) { Loading = true; var newrow = new TblColorLink { TblBrand = BrandCode, TblColor = row.Iserial, TblLkpSeason = Season, TblLkpBrandSection = BrandSection, PantonCode = row.PantonCode }; Client.UpdateColorLinkPantonAsync( newrow, true, 0); } }
private TblColorLink UpdateColorLinkPanton(TblColorLink newRow, bool save, int index, out int outindex) { outindex = index; using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblColorLinks where e.TblLkpSeason == newRow.TblLkpSeason && e.TblBrand == newRow.TblBrand && e.TblLkpBrandSection == newRow.TblLkpBrandSection && e.TblColor == newRow.TblColor select e).SingleOrDefault(); if (oldRow != null) { oldRow.PantonCode = newRow.PantonCode; } context.SaveChanges(); return(newRow); } }