예제 #1
0
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {//save
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_offerList);
                }

                if (CallerName.Equals("IUList"))
                {
                    foreach (var x in selectedItemUnits)
                    {
                        x.id = 0;
                        ItemUnit iu = new ItemUnit();
                        iu = await itemUnitModel.GetById(x.itemUnitId.Value);

                        x.itemId = iu.itemId;
                        x.unitId = iu.unitId;
                    }
                    await itemUnitUserModel.UpdateList(selectedItemUnits, MainWindow.userID.Value);
                }
                else
                {
                    await package.UpdatePackByParentId(itemUnitId, allPackages, MainWindow.userID.Value);
                }

                isActive = true;
                this.Close();

                if (sender != null)
                {
                    SectionData.EndAwait(grid_offerList);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_offerList);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }