Beispiel #1
0
 public SearchCommand(ConsultationViewModel ConsultationViewModel)
 {
     this.ConsultationViewModel = ConsultationViewModel;
 }
Beispiel #2
0
 public AddCommand(ConsultationViewModel ConsultationViewModel)
 {
     this.ConsultationViewModel = ConsultationViewModel;
 }
Beispiel #3
0
 public ReplyCommand(ConsultationViewModel ConsultationViewModel)
 {
     this.ConsultationViewModel = ConsultationViewModel;
 }
Beispiel #4
0
        private void LoadConsultation(List<FLOW_FLOWRECORDDETAIL_T> listDetail)
        {


            SubmitData submmitData = new SubmitData();
            submmitData.FormID = AuditEntity.FormID;
            submmitData.ModelCode = AuditEntity.ModelCode;
            submmitData.ApprovalUser = new UserInfo();
            submmitData.ApprovalUser.CompanyID = AuditEntity.CreateCompanyID;

            submmitData.ApprovalUser.DepartmentID = AuditEntity.CreateDepartmentID;
            submmitData.ApprovalUser.PostID = AuditEntity.CreatePostID;
            submmitData.ApprovalUser.UserID = AuditEntity.CreateUserID;
            submmitData.ApprovalUser.UserName = AuditEntity.CreateUserName;
            submmitData.ApprovalContent = AuditRemark;
            submmitData.NextStateCode = "";
            submmitData.NextApprovalUser = new UserInfo();
            submmitData.NextApprovalUser.CompanyID = NextCompanyID;
            submmitData.NextApprovalUser.DepartmentID = NextDepartmentID;
            submmitData.NextApprovalUser.PostID = NextPostID;
            submmitData.NextApprovalUser.UserID = NextUserID;
            submmitData.NextApprovalUser.UserName = NextUserName;
            submmitData.XML = this.XmlObject;
            //submmitData.SubmitFlag =SubmitFlag.Approval;
            string loginUserID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            string loginUserName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;

            #region 发送的咨询
            List<ConsultationViewModel> listSend = new List<ConsultationViewModel>();
            //登录人已发送的咨询
            listDetail.Where(detail => (detail.EDITUSERID == loginUserID || detail.AGENTUSERID == loginUserID) && detail.FLOW_CONSULTATION_T != null).ForEach(item =>
            {
                item.FLOW_CONSULTATION_T.ForEach(consultation =>
                {
                    ConsultationViewModel viewModel = new ConsultationViewModel(consultation, loginUserID, submmitData);
                    viewModel.WaitingHandler += new EventHandler(viewModel_WaitingHandler);
                    viewModel.CompletedHandler += new EventHandler(viewModel_CompletedHandler);
                    listSend.Add(viewModel);
                });
            });
            //登录人发起新咨询
            if (this.currentFLOWRECORDDETAIL != null)
            {
                if (listSend.FirstOrDefault(v => v.FlowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID == this.currentFLOWRECORDDETAIL.FLOWRECORDDETAILID) == null)
                {
                    FLOW_CONSULTATION_T consultation = new FLOW_CONSULTATION_T();
                    consultation.CONSULTATIONID = Guid.NewGuid().ToString();
                    consultation.CONSULTATIONUSERID = loginUserID;
                    consultation.CONSULTATIONUSERNAME = loginUserName;
                    consultation.FLAG = "0";
                    consultation.FLOW_FLOWRECORDDETAIL_T = this.currentFLOWRECORDDETAIL;
                    if (this.currentFLOWRECORDDETAIL.FLOW_CONSULTATION_T == null)
                    {
                        this.currentFLOWRECORDDETAIL.FLOW_CONSULTATION_T = new ObservableCollection<FLOW_CONSULTATION_T>();
                    }
                    this.currentFLOWRECORDDETAIL.FLOW_CONSULTATION_T.Add(consultation);
                    ConsultationViewModel viewModel = new ConsultationViewModel(consultation, loginUserID, submmitData);
                    viewModel.WaitingHandler += new EventHandler(viewModel_WaitingHandler);
                    viewModel.CompletedHandler += new EventHandler(viewModel_CompletedHandler);
                    listSend.Add(viewModel);
                }


            }

            if (listSend.Count > 0)
            {
                // this.expanderConsultationSend.IsExpanded = true;//龙康才:有咨询信息时默认展开
                this.expanderConsultationSend.Visibility = System.Windows.Visibility.Visible;
                this.ConsultationListSend.ItemsSource = listSend;
            }
            else
            {
                this.expanderConsultationSend.Visibility = System.Windows.Visibility.Collapsed;
            }
            #endregion

            #region 回复咨询
            List<ConsultationViewModel> listReply = new List<ConsultationViewModel>();
            listDetail.Where(detail => detail.FLOW_CONSULTATION_T != null).ForEach(item =>
            {
                item.FLOW_CONSULTATION_T.ForEach(consultation =>
                {
                    if (consultation.REPLYUSERID == loginUserID)
                    {
                        ConsultationViewModel viewModel = new ConsultationViewModel(consultation, loginUserID, submmitData);
                        viewModel.WaitingHandler += new EventHandler(viewModel_WaitingHandler);
                        viewModel.CompletedHandler += new EventHandler(viewModel_CompletedHandler);
                        listReply.Add(viewModel);
                    }
                });
            });
            if (listReply.Count > 0)
            {
                this.expanderConsultationSend.IsExpanded = true;//龙康才:有回复内容,咨询人的咨询信息时默认展开
                this.expanderConsultationReply.IsExpanded = true;//龙康才:有回复内容信息时默认展开
                this.expanderConsultationReply.Visibility = System.Windows.Visibility.Visible;
                this.ConsultationListReply.ItemsSource = listReply;
            }
            else
            {
                this.expanderConsultationReply.Visibility = System.Windows.Visibility.Collapsed;
            }
            #endregion

            #region old

            //List<ConsultationViewModel> listViewModel = new List<ConsultationViewModel>();
            //#region 找出所有登录人的咨询


            //listDetail.Where(detail => (detail.EDITUSERID == loginUserID || detail.AGENTUSERID == loginUserID) && detail.FLOW_CONSULTATION_T != null).ForEach(item =>
            //{
            //    item.FLOW_CONSULTATION_T.ForEach(consultation =>
            //    {
            //        ConsultationViewModel viewModel = new ConsultationViewModel(consultation, loginUserID, submmitData);
            //        viewModel.WaitingHandler += new EventHandler(viewModel_WaitingHandler);
            //        viewModel.CompletedHandler += new EventHandler(viewModel_CompletedHandler);
            //        listViewModel.Add(viewModel);
            //    });
            //});


            //#endregion

            //#region 登录人发起咨询
            //if (this.currentFLOWRECORDDETAIL != null)
            //{
            //    if (listViewModel.FirstOrDefault(v => v.FlowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID == this.currentFLOWRECORDDETAIL.FLOWRECORDDETAILID) == null)
            //    {
            //        FLOW_CONSULTATION_T consultation = new FLOW_CONSULTATION_T();
            //        consultation.CONSULTATIONID = Guid.NewGuid().ToString();
            //        consultation.CONSULTATIONUSERID = loginUserID;
            //        consultation.CONSULTATIONUSERNAME = loginUserName;
            //        consultation.FLAG = "0";
            //        consultation.FLOW_FLOWRECORDDETAIL_T = this.currentFLOWRECORDDETAIL;
            //        if (this.currentFLOWRECORDDETAIL.FLOW_CONSULTATION_T == null)
            //        {
            //            this.currentFLOWRECORDDETAIL.FLOW_CONSULTATION_T = new ObservableCollection<FLOW_CONSULTATION_T>();
            //        }
            //        this.currentFLOWRECORDDETAIL.FLOW_CONSULTATION_T.Add(consultation);
            //        ConsultationViewModel viewModel = new ConsultationViewModel(consultation, loginUserID, submmitData);
            //        viewModel.WaitingHandler += new EventHandler(viewModel_WaitingHandler);
            //        viewModel.CompletedHandler += new EventHandler(viewModel_CompletedHandler);
            //        listViewModel.Add(viewModel);
            //    }


            //}
            //#endregion

            //if (listViewModel.Count == 0)
            //{

            //    #region 登录人为被咨询人
            //    listDetail.Where(detail => detail.FLOW_CONSULTATION_T != null).ForEach(item =>
            //    {
            //        item.FLOW_CONSULTATION_T.ForEach(consultation =>
            //        {
            //            if (consultation.REPLYUSERID == loginUserID)
            //            {
            //                ConsultationViewModel viewModel = new ConsultationViewModel(consultation, loginUserID, submmitData);
            //                viewModel.WaitingHandler += new EventHandler(viewModel_WaitingHandler);
            //                viewModel.CompletedHandler += new EventHandler(viewModel_CompletedHandler);
            //                listViewModel.Add(viewModel);
            //            }
            //        });
            //    });
            //    #endregion
            //}

            //if (listViewModel.Count > 0)
            //{
            //    this.expanderConsultation.Visibility = System.Windows.Visibility.Visible;
            //    this.ConsultationList.ItemsSource = listViewModel;
            //}
            //else
            //{
            //    this.expanderConsultation.Visibility = System.Windows.Visibility.Collapsed;
            //}
            #endregion

            if (listDetail.FirstOrDefault(detail => detail.EDITUSERID == loginUserID || detail.AGENTUSERID == loginUserID) != null)
            {
                this.gridAudit.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                //this.gridAudit.Visibility = System.Windows.Visibility.Collapsed;
            }

            if (listDetail != null && listDetail.Count > 0 &&
                (listDetail[0].FLOW_FLOWRECORDMASTER_T.CHECKSTATE == "2" || listDetail[0].FLOW_FLOWRECORDMASTER_T.CHECKSTATE == "3"))
            {
                this.expanderConsultationSend.Visibility = System.Windows.Visibility.Collapsed;
            }

        }