public QuestionTraceWindowViewModel(ChildWindow aChildWindow,  QuestionTraceOperation aQuestionTraceOperation, ObservableCollection<UserEntity> aUserEntityList, ObservableCollection<DepartmentEntity> aDepartmentEntityList, QuestionTraceEntity aQuestionTraceEntity )
        {
            childWindow = aChildWindow;
            QuestionTraceOperation = aQuestionTraceOperation;
            DepartmentEntityList = aDepartmentEntityList;
            UserEntityList = aUserEntityList;
            QuestionTraceEntity = aQuestionTraceEntity;
            OnOK = new DelegateCommand(OnOKCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);

            if (aQuestionTraceOperation == QuestionTraceOperation.ADD)
            {
                IsAdd = true;
                IsAnswer = false;
                Title = "添加问题 " + QuestionTraceEntity.ManufactureNumber;
            }
            else if (aQuestionTraceOperation == QuestionTraceOperation.ANSWER)
            {
                IsAdd = false;
                IsAnswer = true;
                Title = "回答问题 " + QuestionTraceEntity.ManufactureNumber;
            }
            else if (aQuestionTraceOperation == QuestionTraceOperation.VIEW)
            {
                IsAdd = false;
                IsAnswer = false;
                Title = "查看问题 " + QuestionTraceEntity.ManufactureNumber;
            }
            else if (aQuestionTraceOperation == QuestionTraceOperation.CLOSE)
            {
                IsAdd = false;
                IsAnswer = false;
                Title = "关闭问题 " + QuestionTraceEntity.ManufactureNumber;
            }
        }
 private void LoadOperationQuestionTraceCompleted(LoadOperation<ProductManager.Web.Model.questiontrace> aLoadOperation)
 {
     QuestionTraceEntityList.Clear();
     foreach (ProductManager.Web.Model.questiontrace questiontrace in aLoadOperation.Entities)
     {
         QuestionTraceEntity questionTraceEntity = new QuestionTraceEntity();
         questionTraceEntity.QuestionTrace = questiontrace;
         questionTraceEntity.Update();
         DepartmentEntity lDepartmentTemp;
         if (DepartmentEntityDictionary.TryGetValue(questionTraceEntity.QuestionResDepartmentID, out lDepartmentTemp))
         {
             questionTraceEntity.QuestionResDepartmentName = lDepartmentTemp.DepartmentName;
         }
         if (DepartmentEntityDictionary.TryGetValue(questionTraceEntity.QuestionHandDepartmentID, out lDepartmentTemp))
         {
             questionTraceEntity.QuestionHandDepartmentName = lDepartmentTemp.DepartmentName;
         }
         if (DepartmentEntityDictionary.TryGetValue(questionTraceEntity.QuestionTraceDepartmentID, out lDepartmentTemp))
         {
             questionTraceEntity.QuestionTraceDepartmentName = lDepartmentTemp.DepartmentName;
         }
         UserEntity lUserEntityTemp;
         if (UserEntityDictionary.TryGetValue(questionTraceEntity.UserIDMain, out lUserEntityTemp))
         {
             questionTraceEntity.UserIDMainString = lUserEntityTemp.CUserName;
         }
         if (UserEntityDictionary.TryGetValue(questionTraceEntity.UserIDCP1, out lUserEntityTemp))
         {
             questionTraceEntity.UserIDCP1String = lUserEntityTemp.CUserName;
         }
         if (UserEntityDictionary.TryGetValue(questionTraceEntity.UserIDCP2, out lUserEntityTemp))
         {
             questionTraceEntity.UserIDCP2String = lUserEntityTemp.CUserName;
         }
         if (UserEntityDictionary.TryGetValue(questionTraceEntity.OwnerUserID, out lUserEntityTemp))
         {
             questionTraceEntity.OwnerUserString = lUserEntityTemp.CUserName;
         }
         if (UserEntityDictionary.TryGetValue(questionTraceEntity.LastAnswerUserID, out lUserEntityTemp))
         {
             questionTraceEntity.LastAnswerUserString = lUserEntityTemp.CUserName;
         }
         QuestionTraceEntityList.Add(questionTraceEntity);
     }
     if (aLoadOperation.TotalEntityCount != -1)
     {
         this.questionTraceView.SetTotalItemCount(aLoadOperation.TotalEntityCount);
     }
     UpdateChanged("QuestionTraceEntityList");
     UpdateChanged("CollectionQuestionTraceView");
     this.IsBusy = false;
 }
 public QuestionTraceWindow(QuestionTraceOperation aQuestionTraceOperation, ObservableCollection<UserEntity> aUserEntityList, ObservableCollection<DepartmentEntity> aDepartmentEntityList, QuestionTraceEntity aQuestionTraceEntity)
 {
     InitializeComponent();
     this.DataContext = new QuestionTraceWindowViewModel(this, aQuestionTraceOperation, aUserEntityList, aDepartmentEntityList, aQuestionTraceEntity);
 }
 private void OnAddQuestionCommand()
 {
     AddQuestionTraceEntity = new QuestionTraceEntity();
     AddQuestionTraceEntity.ManufactureNumber = ManufactureNumber;
     AddQuestionTraceEntity.UserIDMain = -2;
     AddQuestionTraceEntity.UserIDCP1 = -2;
     AddQuestionTraceEntity.UserIDCP2 = -2;
     AddQuestionTraceEntity.QuestionTrace = new questiontrace();
     QuestionTraceWindow questionTraceWindow = new QuestionTraceWindow(QuestionTraceOperation.ADD, UserEntityList, DepartmentEntityList, AddQuestionTraceEntity);
     questionTraceWindow.Closed += AddQuestionClosed;
     questionTraceWindow.Show();
 }