public void GetMarkUpdata(bool header)
        {
            var client =
                new ProductionService.ProductionServiceClient();

            TransactionHeader.MarkUpTransList.Clear();
            client.GetTblProductionOrderInvoiceMarkupTransProdAsync(0, TransactionHeader.Iserial, LoggedUserInfo.DatabasEname);
            client.GetTblProductionOrderInvoiceMarkupTransProdCompleted += (s, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    var newrow = new TblMarkupTranProdViewModel();
                    newrow.InjectFrom(row);
                    newrow.CurrencyPerRow = new CRUDManagerService.GenericTable();
                    newrow.CurrencyPerRow.InjectFrom(CurrencyList.FirstOrDefault(w => w.Iserial == newrow.TblCurrency));
                    newrow.TblMarkupProd1 = new CRUDManagerService.TblMarkupProd();
                    newrow.TblMarkupProd1.InjectFrom(MarkupList.FirstOrDefault(w => w.Iserial == row.TblMarkupProd));
                    newrow.JournalAccountTypePerRow = JournalAccountTypeList.FirstOrDefault(w => w.Iserial == newrow.TblJournalAccountType);
                    newrow.EntityPerRow             = new GlService.Entity().InjectFrom(sv.entityList.FirstOrDefault(w => w.Iserial == row.EntityAccount && w.TblJournalAccountType == row.TblJournalAccountType)) as GlService.Entity;
                    newrow.TblJournalAccountType    = row.TblJournalAccountType;
                    newrow.EntityAccount            = row.EntityAccount;

                    TransactionHeader.MarkUpTransList.Add(newrow);
                }

                Loading = false;

                if (TransactionHeader.MarkUpTransList.Count == 0)
                {
                    AddNewMarkUpRow(false, true);
                }
            };

            Loading = true;
        }
示例#2
0
        public void SaveFromStyleHeader()
        {
            ViewModel.AddNewMainRow();
            ProductionService.ProductionServiceClient _client = new ProductionService.ProductionServiceClient();
            foreach (var row in ViewModel.MainRowList.Where(x => x.Iserial == 0))
            {
                var isvalid = Validator.TryValidateObject(row,
                                                          new ValidationContext(row, null, null), null, true);

                if (isvalid)
                {
                    var saveRow = new ProductionService.TblStyleTNAStatusDetail();

                    saveRow.InjectFrom(row);
                    int x = ViewModel.MainRowList.IndexOf(row); //Retail Approved
                    saveRow.TblStyleTnaStatus = 1;
                    _client.UpdateOrInsertTblStyleTNAStatusDetailAsync(saveRow, ViewModel.MainRowList.IndexOf(row));
                }


                //_client.GetTblStyleTNAStatusDetailAsync(ViewModel.TempStyleViewModel.SelectedTnaRow.Iserial);
                //_client.GetTblStyleTNAStatusDetailCompleted += (s, sv) =>
                //{
                //    //if (sv.Error != null)
                //    //{
                //    //    MessageBox.Show(sv.Error.Message);
                //    //}

                //    //foreach (var row in sv.Result)
                //    //{
                //    //    var newrow = new TblStyleTNAStatusDetailModel();
                //    //    newrow.InjectFrom(row);
                //    //    newrow.UserPerRow = row.TblAuthUser1;
                //    //    newrow.StyleTNAStatusPerRow = new GenericTable();
                //    //    if (row.TblStyleTNAStatu != null)
                //    //    {
                //    //        GenericTable newTempRow = new GenericTable().InjectFrom(row.TblStyleTNAStatu) as GenericTable;
                //    //        newrow.StyleTNAStatusPerRow = newTempRow;
                //    //    }
                //    //    ViewModel.MainRowList.Add(newrow);
                //    //}

                //    }
                //   // ViewModel.SaveMainRow();
                //};
            }
        }