Exemple #1
0
        private void OnSaveCommand()
        {
            IsBusy = true;
            if (productPartTimeWindowState == ProductPartTimeWindowState.Add)
            {
                SelectProductPartTimeEntity.DUpdate();

                if (SelectProductTypeEntity != null)
                {
                    SelectProductPartTimeEntity.ProductPartName = SelectProductTypeEntity.ProductPartTypeName;
                }
                else
                {
                    ProductPartTypeEntity productPartTypeEntity;
                    if (ProductPartTypeDictionary.TryGetValue(SelectProductPartTimeEntity.ProductPartID, out productPartTypeEntity))
                    {
                        SelectProductPartTimeEntity.ProductPartName = productPartTypeEntity.ProductPartTypeName;
                    }
                }

                SelectProductPartTimeEntity.RaisALL();
                ProductPartTimeEntityList.Add(SelectProductPartTimeEntity);
                ProductDomainContext.product_part_times.Add(SelectProductPartTimeEntity.ProductPartTime);
                productPartTimeWindowState = ProductPartTimeWindowState.NO;
            }
            if (productPartTimeWindowState == ProductPartTimeWindowState.Modify)
            {
                SelectProductPartTimeEntity.DUpdate();
                if (SelectProductTypeEntity != null)
                {
                    SelectProductPartTimeEntity.ProductPartName = SelectProductTypeEntity.ProductPartTypeName;
                }
                else
                {
                    ProductPartTypeEntity productPartTypeEntity;
                    if (ProductPartTypeDictionary.TryGetValue(SelectProductPartTimeEntity.ProductPartID, out productPartTypeEntity))
                    {
                        SelectProductPartTimeEntity.ProductPartName = productPartTypeEntity.ProductPartTypeName;
                    }
                }
                SelectProductPartTimeEntity.RaisALL();
                productPartTimeWindowState = ProductPartTimeWindowState.NO;
            }
            SubmitOperation submitOperation = ProductDomainContext.SubmitChanges();

            submitOperation.Completed += SubOperationCommpleted;
            IsNotAddorModify           = true;
        }
Exemple #2
0
 private void LoadOperationProductPartTimeCompleted(LoadOperation <ProductManager.Web.Model.product_part_time> aLoadOperation)
 {
     ProductPartTimeEntityList.Clear();
     foreach (ProductManager.Web.Model.product_part_time product_part_time in aLoadOperation.Entities)
     {
         ProductPartTimeEntity productPartTimeEntity = new ProductPartTimeEntity();
         productPartTimeEntity.ProductPartTime = product_part_time;
         productPartTimeEntity.Update();
         ProductPartTypeEntity productPartTypeEntity;
         if (ProductPartTypeDictionary.TryGetValue(productPartTimeEntity.ProductPartID, out productPartTypeEntity))
         {
             productPartTimeEntity.ProductPartName = productPartTypeEntity.ProductPartTypeName;
         }
         ProductPartTimeEntityList.Add(productPartTimeEntity);
     }
     if (aLoadOperation.TotalEntityCount != -1)
     {
         this.productPartTimeView.SetTotalItemCount(aLoadOperation.TotalEntityCount);
     }
     UpdateChanged("ProductPartTimeEntityList");
     this.IsBusy = false;
 }