public PipeCategoryViewModel()
        {
            mPipeCategory = new PipeCategory();

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler);
        }
        public PipeCategoryViewModel(int pipeCategoryId)
        {
            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler);

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            cmsWebServiceClient.GetPipeCategoriesCompleted +=
                (s, e) =>
                    {
                        mPipeCategory = (from x in e.Result where x.Id == pipeCategoryId select x).FirstOrDefault();
                        View.PipeCategory = mPipeCategory;
                        if (DataLoaded != null)
                        {
                            DataLoaded();
                        }
                    };
            cmsWebServiceClient.GetPipeCategoriesAsync();
        }
Beispiel #3
0
        public PipeCategory SavePipeCategory(PipeCategory pipeCategory)
        {
            using (CmsEntities cee = new CmsEntities())
            {
                //Check if the pipe area exist
                var originalPipeIssueCategory = (from x in cee.PipeCategories where x.Id == pipeCategory.Id select x).FirstOrDefault();

                if (originalPipeIssueCategory == null)
                {
                    //Add new Pipe Class
                    pipeCategory.Pipes = null;
                    cee.PipeCategories.Add(pipeCategory);
                }
                else
                {
                    //Update existing Area
                    originalPipeIssueCategory.Name = pipeCategory.Name;
                    originalPipeIssueCategory.Description = pipeCategory.Description;
                }

                cee.SaveChanges();
            }
            return pipeCategory;
        }
Beispiel #4
0
 public Pipe(long key, PipeType type, PipeCategory category, DetectionCompany company, PipeOwner owner, Producer producer,
     Supplier supplier, DeliverNotice notice, DeliverWaggon waggon)
     : base(key)
 {
     this.PipeType = type;
     this.Category = category;
     this.DetectionCompany = company;
     this.Owner = owner;
     this.Producer = producer;
     this.Supplier = supplier;
     this.DeliverNotice = notice;
     this.DeliverWaggon = waggon;
 }