///<summary>
        ///添加:项目评审记录
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddTzProjectReveiews(Epm_TzProjectReveiews model)
        {
            Result <int> result = new Result <int>();

            try
            {
                int  rows     = 0;
                bool isAdd    = false;
                var  reveiews = DataOperateBusiness <Epm_TzProjectReveiews> .Get().GetList(t => t.ProjectId == model.ProjectId && t.State != (int)PreProjectState.ApprovalFailure && t.State != (int)PreProjectState.Discarded).FirstOrDefault();

                if (reveiews == null)
                {
                    isAdd    = true;
                    reveiews = new Epm_TzProjectReveiews();
                    SetCreateUser(reveiews);
                }
                reveiews.ProjectId      = model.ProjectId;
                reveiews.ReveiewDate    = model.ReveiewDate;
                reveiews.HostUser       = model.HostUser;
                reveiews.Address        = model.Address;
                reveiews.ConclusionCode = model.ConclusionCode;
                reveiews.ConclusionName = model.ConclusionName;
                reveiews.OtherInfo      = model.OtherInfo;
                reveiews.InvitedExperts = model.InvitedExperts;
                reveiews.Attendees      = model.Attendees;
                reveiews.PerfectContent = model.PerfectContent;
                reveiews.State          = model.State;

                SetCurrentUser(reveiews);
                //上传附件
                AddFilesBytzTable(reveiews, model.TzAttachs);

                var projects = DataOperateBusiness <Epm_TzProjectProposal> .Get().GetModel(model.ProjectId);

                //特许经营项目性质的项目审批到项目批复完成就结束了,不生成工程模块的内容,不用写到机器人表里
                if (projects.Nature != "XMXZTXJY")
                {
                    #region  项目评审记录流程申请     暂时注释  勿删!!!
                    var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                    if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                    {
                        TzProjectReveiewsWorkFlowView view = new TzProjectReveiewsWorkFlowView();

                        var subjects = DataOperateBasic <Base_TypeDictionary> .Get().GetList(t => t.Type == DictionaryType.OtherInfo.ToString()).ToList();

                        string str = "";
                        foreach (var item in subjects)
                        {
                            if (subjects.Where(t => model.OtherInfo.Contains(t.No)).Any())
                            {
                                str = str + item.Name + ",";
                            }
                        }
                        str = str.Substring(0, str.Length - 1);
                        view.ProjectName    = projects.ProjectName;
                        view.StationName    = projects.StationName;
                        view.NatureName     = projects.NatureName;
                        view.Position       = projects.Position;
                        view.ApplyTime      = projects.ApplyTime.ToString();
                        view.CompanyName    = projects.CompanyName;
                        view.PredictMoney   = projects.PredictMoney.ToString();
                        view.ReveiewDate    = model.ReveiewDate.ToString();
                        view.HostUser       = model.HostUser;
                        view.Attendees      = model.Attendees;
                        view.ConclusionName = model.ConclusionName;
                        view.OtherInfo      = str;
                        view.Address        = model.Address;
                        view.PerfectContent = model.PerfectContent;
                        view.InvitedExperts = model.InvitedExperts;
                        var baseUser = DataOperateBasic <Base_User> .Get().GetModel(reveiews.CreateUserId);

                        if (baseUser == null)
                        {
                            throw new Exception("未找到申请人相关信息!");
                        }

                        view.hr_sqr = baseUser.ObjeId;

                        //上传附件
                        if (model.TzAttachs != null && model.TzAttachs.Any())
                        {
                            //string baseFaleUrl = System.Configuration.ConfigurationManager.AppSettings.Get("XtDownloadUrl");
                            //foreach (var item in model.TzAttachs)
                            //{
                            //    string fileUrl = string.Format("{0}?fileId={1}&type={2}", baseFaleUrl, item.Id, item.TypeNo);
                            //    view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs;
                            //}

                            //if (view.Temp_TzAttachs != null)
                            //{
                            //    view.Temp_TzAttachs = view.Temp_TzAttachs.Substring(0, view.Temp_TzAttachs.Length - 1);
                            //}
                            view.Temp_TzAttachs = XtWorkFlowSubmitService.CreateXtAttachPath(model.TzAttachs);
                        }

                        reveiews.WorkFlowId = XtWorkFlowService.CreateProjectReveiewsWorkFlow(view);
                    }
                    #endregion
                }

                if (isAdd)
                {
                    rows = DataOperateBusiness <Epm_TzProjectReveiews> .Get().Add(reveiews);
                }
                else
                {
                    rows = DataOperateBusiness <Epm_TzProjectReveiews> .Get().Update(reveiews);
                }


                result.Data = rows;
                result.Flag = EResultFlag.Success;
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddTzProjectReveiews");
            }
            return(result);
        }
        ///<summary>
        ///修改:项目评审记录
        ///</summary>
        /// <param name="model">要修改的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> UpdateTzProjectReveiews(Epm_TzProjectReveiews model)
        {
            Result <int> result = new Result <int>();

            try
            {
                #region  项目评审记录流程申请     暂时注释  勿删!!!
                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    TzProjectReveiewsWorkFlowView view = new TzProjectReveiewsWorkFlowView();

                    var project = DataOperateBusiness <Epm_TzProjectProposal> .Get().GetModel(model.ProjectId);

                    view.ProjectName    = project.ProjectName;
                    view.StationName    = project.StationName;
                    view.NatureName     = project.NatureName;
                    view.Position       = project.Position;
                    view.ApplyTime      = project.ApplyTime.ToString();
                    view.CompanyName    = project.CompanyName;
                    view.PredictMoney   = project.ProjectCode;
                    view.ReveiewDate    = DateTime.Now.ToString();
                    view.HostUser       = model.HostUser;
                    view.Attendees      = model.Attendees;
                    view.ConclusionName = model.ConclusionName;
                    view.OtherInfo      = model.InvitedExperts;
                    view.Address        = model.Address;
                    view.PerfectContent = model.PerfectContent;
                    view.InvitedExperts = model.InvitedExperts;
                    var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.CreateUserId);

                    if (baseUser == null)
                    {
                        throw new Exception("未找到申请人相关信息!");
                    }

                    view.hr_sqr = baseUser.ObjeId;

                    //上传附件
                    if (model.TzAttachs != null && model.TzAttachs.Any())
                    {
                        //string baseFaleUrl = System.Configuration.ConfigurationManager.AppSettings.Get("XtDownloadUrl");
                        //foreach (var item in model.TzAttachs)
                        //{
                        //    //string fileUrl = string.Format("{0}?fileId={1}&type={2}", baseFaleUrl, item.Id, item.TypeNo);
                        //    //view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs;
                        //    string fileUrl = XtWorkFlowService.GetXtAttachPaht(item.FilePath);
                        //    view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs;
                        //}

                        //if (view.Temp_TzAttachs != null)
                        //{
                        //    view.Temp_TzAttachs = view.Temp_TzAttachs.Substring(0, view.Temp_TzAttachs.Length - 1);
                        //}
                        view.Temp_TzAttachs = XtWorkFlowSubmitService.CreateXtAttachPath(model.TzAttachs);
                    }

                    model.WorkFlowId = XtWorkFlowService.CreateProjectReveiewsWorkFlow(view);
                }
                #endregion

                var rows = DataOperateBusiness <Epm_TzProjectReveiews> .Get().Update(model);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                //WriteLog(AdminModule.TzProjectReveiews.GetText(), SystemRight.Modify.GetText(), "修改项目评审记录: " + model.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateTzProjectReveiews");
            }
            return(result);
        }