/// <summary>
        /// 绑定数据
        /// </summary>
        private void BindData()
        {
            if (UCHQList.Count > 0)
            {
                M_ProgramFile.DeptSign info = new M_ProgramFile.DeptSign();
                for (int i = 0; i < UCHQList.Count; i++)
                {
                    info = (M_ProgramFile.DeptSign)UCHQList[i];
                    Count++;
                    LoadUserControl(Count, false);

                    //TBID
                    Label lblTBID = this.PlaceHolder1.Controls[i].FindControl("lblTBID") as Label;
                    lblTBID.Text = info.TBID;

                    //部门ID
                    DropDownList drpDept = PlaceHolder1.Controls[i].FindControl("drpDept") as DropDownList;

                    Label lbDept = PlaceHolder1.Controls[i].FindControl("lbDept") as Label;
                    lbDept.Text = info.DeptName;

                    FormsMethod.SelectedDropDownList(drpDept, info.DeptID, info.DeptName);

                    //会签人ID
                    Label lblUserID = this.PlaceHolder1.Controls[i].FindControl("lblUserID") as Label;
                    lblUserID.Text = info.ID;
                    //会签人
                    Label lblUserName = this.PlaceHolder1.Controls[i].FindControl("lblUserName") as Label;
                    lblUserName.Text = info.Name;

                    if (!string.IsNullOrEmpty(info.IsAgree))
                    {
                        drpDept.Enabled = false;
                        drpDept.CssClass = "dropdownlist_blue";
                        CheckBox cb = this.PlaceHolder1.Controls[i].FindControl("cb") as CheckBox;
                        if (UCIsAllowDel && UCIsDisEnable == false)
                        {
                            cb.Enabled = true;//显示是否参加会签的checkbox
                            cb.Checked = info.IsExclude;//设置checkbox的状态
                            //cb.Enabled = !UCIsDisEnable;
                        }//部门会签控件允许删除并且可用
                        else
                        {
                            cb.Enabled = false;//隐藏是否参加会签的checkbox
                            cb.Checked = info.IsExclude;//设置checkbox的状态
                        }//不可用
                    }//已通过会签则不可重新选择

                    Label lblDate1 = this.PlaceHolder1.Controls[i].FindControl("lblDate1") as Label;
                    if (info.SubmitDate != DateTime.MinValue)
                    {
                        //会签日期
                        lblDate1.Text = info.SubmitDate.ToString(DateFormat);
                        lblDate1.ToolTip = info.SubmitDate.ToString();

                        lbDept.Text = info.DeptName;
                        lbDept.Visible = true;
                        drpDept.Visible = false;

                    }
                    else
                    {
                        lblDate1.Text = "";
                        lbDept.Visible = false;
                        drpDept.Visible = true;
                    }

                    //意见
                    Label lblYiJian = this.PlaceHolder1.Controls[i].FindControl("lblYiJian") as Label;
                    lblYiJian.ToolTip = info.Comment;
                    lblYiJian.Text = SysString.TruncationString(info.Comment, 20);

                    //是否同意
                    Label lblTongYi = this.PlaceHolder1.Controls[i].FindControl("lblTongYi") as Label;
                    lblTongYi.Text = info.IsAgree;

                    ////落实情况
                    //TextBox txtDealCondition = this.PlaceHolder1.Controls[i].FindControl("txtDealCondition2") as TextBox;
                    //txtDealCondition.Text = info.DealCondition;

                    HiddenField hfLuoShi = this.PlaceHolder1.Controls[i].FindControl("hfLuoShi") as HiddenField;
                    hfLuoShi.Value = info.DealCondition;

                    //处理落实日期
                    Label lblDate2 = this.PlaceHolder1.Controls[i].FindControl("lblDate2") as Label;
                    if (info.DealDate != DateTime.MinValue)
                    {
                        lblDate2.Text = info.DealDate.ToShortDateString();
                    }
                    else
                    {
                        lblDate2.Text = "";
                    }
                    //绑定会签意见、落实情况///////////
                    Repeater rptCurrentList = this.PlaceHolder1.Controls[i].FindControl("rptCurrentList") as Repeater;//主键ID
                    Label lblComment = this.PlaceHolder1.Controls[i].FindControl("lblComment") as Label;
                    lblComment.Text = SysString.TruncationString(info.Comment, 20);

                    List<CYiJian> yiJianList = new List<CYiJian>();
                    foreach (B_PF.DetailInfo detailInfo in info.DetailInfoList)
                    {
                        CYiJian yiJian = new CYiJian();

                        yiJian.Content = detailInfo.Comment;
                        yiJian.DealCondition = detailInfo.DealCondition;
                        yiJian.FinishTime = info.SubmitDate.ToString();
                        yiJian.ID = info.TBID;
                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN;
                        yiJian.UserName = info.Name;
                        yiJian.UserID = info.ID;
                        yiJianList.Add(yiJian);
                    }
                    rptCurrentList.DataSource = yiJianList;
                    rptCurrentList.DataBind();

                    if (!this.IsHistory && this.UCReceiveUserID == info.ID)
                    {
                        lblDate1.Visible = false;
                        lblYiJian.Visible = false;
                        lblTongYi.Visible = false;
                        lblComment.Visible = false;
                    }
                }
            }
            HiddenField hfDeptSignCount = this.Parent.Parent.FindControl("hfDeptSignCount") as HiddenField;
            if (hfDeptSignCount != null)
            { hfDeptSignCount.Value = UCHQList.Count.ToString(); }
        }
        private void BindData()
        {
            if (UCHQList.Count > 0)
            {
                M_ProgramFile.LeaderSign info = new M_ProgramFile.LeaderSign();
                for (int i = 0; i < UCHQList.Count; i++)
                {
                    info = (M_ProgramFile.LeaderSign)UCHQList[i];
                    Count++;
                    LoadUserControl(false, Count);

                    //TBID
                    Label lblTBID = this.PlaceHolder1.Controls[i].FindControl("lblTBID") as Label;
                    lblTBID.Text = info.TBID;

                    //会签人ID
                    DropDownList drpUser = PlaceHolder1.Controls[i].FindControl("drpUser") as DropDownList;
                    Label lbUser = PlaceHolder1.Controls[i].FindControl("lbUser") as Label;

                    lbUser.Text = info.Name;

                    FormsMethod.SelectedDropDownList(drpUser, info.ID, info.Name);

                    //是否同意
                    Label lblTongYi = this.PlaceHolder1.Controls[i].FindControl("lblTongYi") as Label;
                    lblTongYi.Text = info.IsAgree;

                    if (!string.IsNullOrEmpty(info.IsAgree))
                    {
                        drpUser.Enabled = false;
                        drpUser.CssClass = "dropdownlist_blue";
                    }//已通过会签则不可重新选择

                    //会签日期
                    Label lblDate1 = this.PlaceHolder1.Controls[i].FindControl("lblDate1") as Label;
                    if (info.Date != DateTime.MinValue)
                    {
                        lblDate1.Text = info.Date.ToString(DateFormat);
                        lblDate1.ToolTip = info.Date.ToString();

                        lbUser.Text = info.Name;
                        lbUser.Visible = true;
                        drpUser.Visible = false;
                    }
                    else
                    {
                        lblDate1.Text = "";
                        lbUser.Visible = false;
                        drpUser.Visible = true;

                    }

                    //意见
                    Label lblYiJian = this.PlaceHolder1.Controls[i].FindControl("lblYiJian") as Label;
                    lblYiJian.ToolTip = info.Comment;
                    lblYiJian.Text = SysString.TruncationString(info.Comment, 20);

                    ////落实情况
                    //TextBox txtDealCondition = this.PlaceHolder1.Controls[i].FindControl("txtDealCondition") as TextBox;
                    //txtDealCondition.Text = info.DealCondition;

                    HiddenField hfLuoShi = this.PlaceHolder1.Controls[i].FindControl("hfLuoShi") as HiddenField;
                    hfLuoShi.Value = info.DealCondition;

                    //处理落实日期
                    Label lblDate2 = this.PlaceHolder1.Controls[i].FindControl("lblDate2") as Label;
                    if (info.DealDate != DateTime.MinValue)
                    {
                        lblDate2.Text = info.DealDate.ToShortDateString();
                    }
                    else
                    {
                        lblDate2.Text = "";
                    }

                    //绑定会签意见、落实情况//
                    Repeater rptCurrentList = this.PlaceHolder1.Controls[i].FindControl("rptCurrentList") as Repeater;//主键ID
                    Label lblComment = this.PlaceHolder1.Controls[i].FindControl("lblComment") as Label;
                    lblComment.Text = SysString.TruncationString(info.Comment, 20);
                    List<CYiJian> yiJianList = new List<CYiJian>();
                    foreach (B_PF.DetailInfo detailInfo in info.DetailInfoList)
                    {
                        CYiJian yiJian = new CYiJian();

                        yiJian.Content = detailInfo.Comment;
                        yiJian.DealCondition = detailInfo.DealCondition;
                        yiJian.FinishTime = info.Date.ToString();
                        yiJian.ID = info.TBID;
                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN;
                        yiJian.UserName = info.Name;
                        yiJian.UserID = info.ID;
                        yiJianList.Add(yiJian);
                    }
                    rptCurrentList.DataSource = yiJianList;
                    rptCurrentList.DataBind();
                    if (!this.IsHistory && this.UCReceiveUserID == info.ID)
                    {
                        lblDate1.Visible = false;
                        lblYiJian.Visible = false;
                        lblTongYi.Visible = false;
                        lblComment.Visible = false;
                    }
                }
            }
            HiddenField hfLeaderSignCount = this.Parent.Parent.FindControl("hfLeaderSignCount") as HiddenField;
            if (hfLeaderSignCount != null)
            { hfLeaderSignCount.Value = UCHQList.Count.ToString(); }
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            EntityLetterSend entity = null;

            entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();


            entity.DocumentTitle = txtSubject.Text;
            entity.ccCompany     = txtccCompany.Text;
            entity.company       = txtCompany.Text;
            entity.company1      = txtCompany.Text;
            //entity.content = SysString.TextToHtmlCode(txtContent.Text);
            entity.content = txtContent.Text;

            entity.pages = txtPages.Text;

            entity.subject      = txtSubject.Text;
            entity.title        = txtTitle.Text;
            entity.to           = txtTo.Text;
            entity.yourRef      = txtYourRef.Text;
            entity.jinJi        = chkJinJi.Checked;
            entity.UrgentDegree = chkJinJi.Checked ? ConstString.CommonStr.Urgent : ConstString.CommonStr.Normal;
            entity.huiZhi       = chkHuiZhi.Checked;
            entity.ccDept       = txtccDept.Text;
            entity.ccDeptIDs    = this.txtccDeptIDs.Text;
            entity.ccLeader     = txtccLeader.Text;
            entity.companyID    = txtCompanyID.Text;

            //流程数据和隐藏数据
            entity.deptLeaderIDs = txtDeptLeaderIDs.Text;

            entity.ccLeaderIDs      = txtccLeaderIDs.Text;
            entity.wfChuanYueRenIDs = wfChuanYueRenIDs.Text;

            if (wfChuanYueRenIDs.Text != "")
            {
                string[] strCYarr = wfChuanYueRenIDs.Text.Split(';');

                for (int i = 0; i < strCYarr.Length; i++)
                {
                    ChuanYues cy    = new ChuanYues();
                    bool      isHas = false;
                    for (int j = 0; j < entity.chuanyues.Count; j++)
                    {
                        if (entity.chuanyues[j].UserID.ToLower() == strCYarr[i].ToLower())
                        {
                            isHas = true;
                        }
                    }
                    if (!isHas)
                    {
                        cy.UserID   = strCYarr[i];
                        cy.UserName = OAUser.GetUserName(strCYarr[i]);
                        cy.Date     = DateTime.Now.ToShortDateString();
                        entity.chuanyues.Add(cy);
                    }
                }
            }
            //附件数据绑定
            entity.FileList = this.ucAttachment.UCDataList;

            //函件类型
            entity.hanJian1   = drpHanJian.SelectedItem == null ? "" : drpHanJian.SelectedItem.Text;
            entity.hanJianID1 = drpHanJian.SelectedValue == null ? "" : drpHanJian.SelectedValue;

            //add
            entity.equipmentCode1 = this.txtEquipmentCode.Text;
            entity.contractNo1    = this.txtContractNo.Text;

            //意见
            if (IsSave == false)
            {
                entity.isSave = false;
                CYiJian so = new CYiJian();
                so.UserID     = entity.ReceiveUserID == string.Empty ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                so.UserName   = entity.ReceiveUserName == string.Empty ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                so.ViewName   = base.StepName;
                so.FinishTime = DateTime.Now.ToString();
                so.Content    = "(" + base.SubAction + ")" + txtComment.Text;
                entity.yiJian.Add(so);
            }
            else
            {
                entity.isSave  = true;
                entity.syiJian = txtComment.Text;
            }

            switch (base.StepName)
            {
            case ProcessConstString.StepName.LetterSend.发起函件:

                //核稿
                entity.heGaoRen     = txtHeGaoRen.Text;
                entity.wfHeGaoRenID = wfHeGaoRenID.Text;
                //会签
                entity.huiQianRen      = txtHuiQianRen.Text;
                entity.wfHuiQianRenIDs = wfHuiQianRenIDs.Text;
                //签发
                entity.qianFaRen     = txtQianFaRen.Text;
                entity.wfQianFaRenID = wfQianFaRenID.Text;

                if (txtNiGaoRenDate.Text.Trim() == "")     //不是第一次
                {
                    //发起人
                    if (IsSave == false)
                    {
                        entity.UserDate     = DateTime.Now.ToString();
                        entity.niGaoRenDate = (entity.niGaoRenDate == string.Empty ? CurrentUserInfo.DisplayName : entity.ReceiveUserName) + " " + entity.UserDate;
                        entity.DraftDate    = SysConvert.ToDateTime(entity.UserDate);
                    }
                    if (entity.Drafter == string.Empty)
                    {
                        entity.Drafter     = CurrentUserInfo.DisplayName;
                        entity.DrafterID   = CurrentUserInfo.UserName;
                        entity.wfFaQiRenID = CurrentUserInfo.UserName;
                    }
                }
                if (base.SubAction == "提交会签" || base.SubAction == "提交签发")     //如果是被退回的 再次提交会签 不经过核稿 则清空核稿人和核稿日期
                {
                    if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                    {
                        entity.heGaoRen     = "";
                        entity.heGaoRenDate = "";
                        entity.wfHeGaoRenID = "";
                        entity.heGaoYiJian  = "";
                    }
                    else
                    {
                        entity.heGaoRen     = txtHeGaoRen.Text;
                        entity.wfHeGaoRenID = wfHeGaoRenID.Text;
                    }
                }
                if (base.SubAction == "提交签发")     //如果是被退回的 再次提交签发 不经过会签 则清空会签人和会签日期
                {
                    if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                    {
                        entity.huiqianDates = "";
                        entity.huiQianRen   = "";
                        entity.huiQian.Clear();
                    }
                }

                //发文部门
                entity.sendDept1   = drpSendDept.SelectedItem == null ? "" : drpSendDept.SelectedItem.Text;
                entity.sendDeptID1 = drpSendDept.SelectedValue;

                //是否会签驳回
                entity.isHuiQianBoHui = false;
                if (base.SubAction == "提交会签")
                {
                    entity.iHuiQianCount = entity.iHuiQianCount + 1;
                }
                break;

            case ProcessConstString.StepName.LetterSend.核稿:
                //核稿
                entity.heGaoRen = entity.ReceiveUserName;
                if (IsSave == false)
                {
                    entity.heGaoRenDate = DateTime.Now.ToString();
                }
                entity.heGaoYiJian = txtComment.Text;

                //会签
                entity.huiQianRen      = txtHuiQianRen.Text;
                entity.wfHuiQianRenIDs = wfHuiQianRenIDs.Text;

                //签发
                entity.qianFaRen     = txtQianFaRen.Text;
                entity.wfQianFaRenID = wfQianFaRenID.Text;
                if (base.SubAction == "提交会签")
                {
                    entity.iHuiQianCount = entity.iHuiQianCount + 1;
                }
                if (base.SubAction == "提交签发")     //如果是被核稿退回的 再次提交签发 不经过会签 则清空会签人和会签日期
                {
                    if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                    {
                        entity.huiqianDates = "";
                        entity.huiQianRen   = "";
                        entity.huiQian.Clear();
                    }
                }
                break;

            case ProcessConstString.StepName.LetterSend.会签:
                if (IsSave == false)
                {
                    if (entity.huiqianDates == "")
                    {
                        entity.huiqianDates = entity.ReceiveUserName + " " + DateTime.Now.ToString(DateFormat);
                    }
                    else
                    {
                        entity.huiqianDates = entity.huiqianDates + ";" + entity.ReceiveUserName + " " + DateTime.Now.ToString(DateFormat);
                    }

                    HanJianHuiQian hjhq = new HanJianHuiQian();
                    hjhq.UserID   = entity.ReceiveUserID;
                    hjhq.UserName = entity.ReceiveUserName;
                    hjhq.Date     = DateTime.Now;
                    hjhq.YiJian   = txtComment.Text;
                    hjhq.ICount   = entity.iHuiQianCount;
                    entity.huiQian.Add(hjhq);
                }
                //签发
                entity.qianFaRen     = txtQianFaRen.Text;
                entity.wfQianFaRenID = wfQianFaRenID.Text;

                if (base.SubAction == "退回")
                {
                    entity.isHuiQianBoHui = true;
                }
                break;

            case ProcessConstString.StepName.LetterSend.签发:
                if (IsSave == false)
                {
                    if (base.SubAction != "退回")
                    {
                        entity.signDate = DateTime.Now.ToString(DateFormat);
                    }
                }
                entity.HanJianAdminID = OAUser.GetUserByRoleName("函件管理员")[0];
                entity.HanJianAdmin   = OAUser.GetUserByRoleName("函件管理员")[1];
                break;

            case ProcessConstString.StepName.LetterSend.函件分发:
                entity.ourRef     = txtOurRef.Text;
                entity.DocumentNo = txtOurRef.Text;
                break;

            case ProcessConstString.StepName.LetterSend.二次分发:
                break;

            default: break;
            }

            return(entity);
        }
        /// <summary>
        /// 实体赋值
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns></returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            B_DJGTSend entity = base.EntityData != null ? base.EntityData as B_DJGTSend : new B_DJGTSend();

            entity.SendDate = this.txtSendDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(this.txtSendDate.Text);

            //附件
            entity.FileList = ucAttachment.UCDataList;

            CYiJian YJ = new CYiJian();

            //提示信息
            if (!IsSave)
            {
                if (!string.IsNullOrEmpty(this.txtMyPrompt.Text))
                {
                    entity.MyPrompt = string.Empty;
                    entity.Prompt   = this.txtAllPrompt.Text + (string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName) + "[" +
                                      System.DateTime.Now.ToString(ConstString.DateFormat.Long) + "]:(" + base.StepName + ")" + this.txtMyPrompt.Text + "\n";
                }
            }
            else
            {
                entity.Prompt   = this.txtAllPrompt.Text;
                entity.MyPrompt = this.txtMyPrompt.Text;
            }

            switch (base.StepName)
            {
                #region 拟稿
            case ProcessConstString.StepName.STEP_DRAFT:
                entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;

                if (this.ddlHostDept.Items.Count > 0)
                {
                    entity.HostDeptID = this.ddlHostDept.SelectedValue;
                    entity.HostDept   = this.ddlHostDept.SelectedItem.Text;
                }

                if (this.ddlCheckDrafter.Items.Count > 0)
                {
                    entity.CheckDrafterID = this.ddlCheckDrafter.SelectedValue;
                    entity.CheckDrafter   = this.ddlCheckDrafter.SelectedItem.Text;
                }

                entity.PhoneNum      = this.txtPhoneNum.Text;
                entity.DocumentTitle = this.txtDocumentTitle.Text;
                entity.SubjectWord   = this.txtSubjectWord.Text;
                entity.MainSenders   = this.txtMainSender.Text;
                entity.CopySenders   = this.txtCopySender.Text;

                //拟稿人、拟稿日期
                entity.Drafter   = this.txtDrafter.Text;
                entity.DrafterID = this.wfDrafterID.Text;
                entity.DraftDate = DateTime.Now;
                if (entity.FirstDraftDate == DateTime.MinValue)    //第一次的拟稿日期,以前的实体FirstDraftDate没值,取DraftDate。renjinquan+
                {
                    entity.FirstDraftDate = DateTime.Now;
                }
                entity.IsCheckDraftBack = Convert.ToBoolean(this.wfIsDeny.Text);

                //发文类型
                entity.SendType = this.ddlType.SelectedValue;
                break;
                #endregion

                #region 审稿
            case ProcessConstString.StepName.SendStepName.STEP_CHECK:
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                {
                    entity.UrgentDegree  = this.ddlUrgentDegree.SelectedValue;
                    entity.PhoneNum      = this.txtPhoneNum.Text;
                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord   = this.txtSubjectWord.Text;
                    entity.MainSenders   = this.txtMainSender.Text;
                    entity.CopySenders   = this.txtCopySender.Text;

                    //if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_BMHQ)//renjinquan改。防止覆盖掉前面的会签人
                    //{
                    //部门会签
                    entity.NewDeptSignerIDs = this.wfDeptSignIDs.Text;
                    entity.NewDeptSigners   = this.txtDeptSigners.Text;
                    if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_BMHQ)    //renjinquan改。防止覆盖掉前面的会签人
                    {
                        entity.DeptSignerIDs    = SysString.FilterRepeat(entity.DeptSignerIDs + (entity.DeptSignerIDs != string.Empty ? ";" : "") + this.wfDeptSignIDs.Text);
                        entity.DeptSigners      = SysString.FilterRepeat(entity.DeptSigners + (entity.DeptSigners != string.Empty ? ";" : "") + this.txtDeptSigners.Text);
                        entity.NewDeptSignerIDs = "";
                        entity.NewDeptSigners   = "";
                    }
                    //entity.DeptSignerIDs = this.wfDeptSignIDs.Text;
                    //entity.DeptSigners = this.txtDeptSigners.Text;
                    //}

                    if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_TJHG)
                    {
                        //党群秘书组
                        string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.PartysSecretary);
                        entity.VerifierIDs = array[0].ToString();
                        entity.Verifiers   = array[1].ToString();
                    }
                    entity.CheckDraftDate = DateTime.Now;

                    //清除CommonList值
                    entity.CommentList.Clear();
                }
                else
                {
                    entity.IsCheckDraftBack = true;
                }
                break;
                #endregion

                #region 部门会签
            case ProcessConstString.StepName.SendStepName.STEP_DEPT:
                if (IsSave)
                {
                    entity.DeptSignComment = this.txtComment.Text;
                }
                else
                {
                    entity.DeptSignComment = string.Empty;

                    if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                    {
                        //意见列表
                        YJ.UserID     = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                        YJ.UserName   = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                        YJ.ViewName   = ProcessConstString.StepName.SendStepName.STEP_DEPT;
                        YJ.FinishTime = DateTime.Now.ToString();
                        YJ.Content    = this.txtComment.Text;
                        entity.CommentList.Add(YJ);
                    }
                }
                break;

                #endregion

                #region 核稿
            //秘书核稿
            case ProcessConstString.StepName.SendStepName.STEP_VERIFY:
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                {
                    entity.UrgentDegree  = this.ddlUrgentDegree.SelectedValue;
                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord   = this.txtSubjectWord.Text;

                    if (this.ddlSigner.Items.Count > 0)
                    {
                        //签发人
                        entity.SignerID = this.ddlSigner.SelectedValue;
                        entity.Signer   = this.ddlSigner.SelectedItem.Text;
                    }

                    //领导会签
                    entity.NewLeadSignerIDs = this.wfLeaderSignIDs.Text;
                    entity.NewLeadSigners   = this.txtLeadSigners.Text;
                    if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_LDHQ)    //renjinquan改。防止覆盖掉前面的会签人
                    {
                        entity.LeadSignerIDs    = SysString.FilterRepeat(entity.LeadSignerIDs + (entity.LeadSignerIDs != string.Empty ? ";" : "") + this.wfLeaderSignIDs.Text);
                        entity.LeadSigners      = SysString.FilterRepeat(entity.LeadSigners + (entity.LeadSigners != string.Empty ? ";" : "") + this.txtLeadSigners.Text);
                        entity.NewLeadSignerIDs = "";
                        entity.NewLeadSigners   = "";
                        //entity.LeadSignerIDs = this.wfLeaderSignIDs.Text;
                        //entity.LeadSigners = this.txtLeadSigners.Text;
                    }

                    //秘书核稿
                    entity.Verifier   = this.txtSecretaryChecker.Text;
                    entity.VerifierID = this.wfVerifierID.Text;
                    entity.VerifyDate = DateTime.Now;

                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;

                    //清除CommonList值
                    entity.CommentList.Clear();
                }
                break;
                #endregion

                #region 领导会签
            case ProcessConstString.StepName.SendStepName.STEP_LEADER:
                if (IsSave)
                {
                    entity.LeadSignComment = this.txtComment.Text;
                }
                else
                {
                    entity.LeadSignComment = string.Empty;
                    entity.CommentList.Clear();
                    if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                    {
                        YJ.UserID     = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                        YJ.UserName   = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                        YJ.ViewName   = ProcessConstString.StepName.SendStepName.STEP_LEADER;
                        YJ.FinishTime = DateTime.Now.ToString();
                        YJ.Content    = this.txtComment.Text;
                        entity.CommentList.Add(YJ);
                    }
                }
                break;
                #endregion

                #region 签发
            case ProcessConstString.StepName.SendStepName.STEP_SIGN:
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                {
                    //党群文书组
                    string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.PartysDocument);
                    entity.AssignerIDs = array[0].ToString();
                    entity.Assigners   = array[1].ToString();
                    entity.SignDate    = DateTime.Now;
                    entity.SendDate    = DateTime.Now;

                    entity.SubjectWord = this.txtSubjectWord.Text;

                    if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_QF)
                    {
                        entity.DeptHaveSigners = this.txtDeptSigners.Text;
                        entity.LeadHaveSigners = this.txtLeadSigners.Text;
                    }
                }

                if (IsSave)
                {
                    entity.SignComment = this.txtComment.Text;
                }
                else
                {
                    entity.SignComment = this.txtComment.Text;
                    if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                    {
                        YJ.UserID     = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                        YJ.UserName   = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                        YJ.ViewName   = ProcessConstString.StepName.SendStepName.STEP_SIGN;
                        YJ.FinishTime = DateTime.Now.ToString();
                        YJ.Content    = this.txtComment.Text;
                        entity.CommentList.Add(YJ);
                    }
                }
                break;

                #endregion

                #region 分发
            case ProcessConstString.StepName.SendStepName.STEP_DISTRIBUTE:
                entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                entity.DocumentYear = this.txtDocumentYear.Text;
                entity.DocumentNum  = this.txtDocumentNum.Text;
                entity.DocumentNo   = this.txtDocumentNo.Text;

                entity.DocumentTitle = this.txtDocumentTitle.Text;
                entity.SubjectWord   = this.txtSubjectWord.Text;
                entity.MainSenders   = this.txtMainSender.Text;
                entity.CopySenders   = this.txtCopySender.Text;

                entity.ShareCount = this.txtShareCount.Text;
                entity.SheetCount = this.txtSheetCount.Text;

                entity.Typist    = this.txtTypist.Text;
                entity.ReChecker = this.txtReChecker.Text;

                entity.AssignerID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                entity.Assigner   = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;

                //传阅
                entity.CirculateDeptIDs   = this.hDeptID.Value;
                entity.CirculateDepts     = this.txtDeptName.Text;
                entity.CirculateLeaderIDs = this.hUserID.Value;
                entity.CirculateLeaders   = this.txtUserName.Text;
                break;
                #endregion

                #region 校对
            case ProcessConstString.StepName.SendStepName.STEP_PROOF:
                entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                entity.PhoneNum     = this.txtPhoneNum.Text;

                entity.DocumentTitle = this.txtDocumentTitle.Text;
                entity.SubjectWord   = this.txtSubjectWord.Text;
                entity.MainSenders   = this.txtMainSender.Text;
                entity.CopySenders   = this.txtCopySender.Text;
                entity.Checker       = this.txtChecker.Text;

                entity.IsHaveChecked = true;
                break;
                #endregion
            }
            return(entity);
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void LoadBindData()
        {
            if (UCHQList.Count > 0)
            {
                M_WorkRelation.DeptSign info = new M_WorkRelation.DeptSign();
                for (int i = 0; i < UCHQList.Count; i++)
                {
                    info = (M_WorkRelation.DeptSign)UCHQList[i];
                    Count++;
                    LoadUserControl(Count, false);

                    //TBID
                    Label lblTBID = this.pnlCountSignList.Controls[i].FindControl("lblTBID") as Label;
                    lblTBID.Text = info.TBID;

                    //部门ID
                    DropDownList ddlSignDept = pnlCountSignList.Controls[i].FindControl("ddlSignDept") as DropDownList;

                    FormsMethod.SelectedDropDownList(ddlSignDept, info.DeptID, info.DeptName);

                    //会签人ID
                    Label lblUserID = this.pnlCountSignList.Controls[i].FindControl("lblUserID") as Label;
                    lblUserID.Text = info.ID;

                    //会签人
                    Label lblUserName = this.pnlCountSignList.Controls[i].FindControl("lblUserName") as Label;
                    lblUserName.Text = info.Name;

                    //是否同意
                    Label lblTongYi = this.pnlCountSignList.Controls[i].FindControl("lblTongYi") as Label;
                    lblTongYi.Text = info.IsAgree;

                    if (!String.IsNullOrEmpty(info.IsAgree))
                    {
                        ddlSignDept.Enabled  = false;
                        ddlSignDept.CssClass = "dropdownlist_blue";
                        CheckBox cb = this.pnlCountSignList.Controls[i].FindControl("cb") as CheckBox;
                        if (UCIsAllowDel && UCIsDisEnable == false)
                        {
                            cb.Enabled = true;
                            cb.Checked = info.IsExclude;
                        }
                        else
                        {
                            cb.Enabled = false;
                            cb.Checked = info.IsExclude;
                        }
                    }

                    //会签日期
                    Label lblDate = this.pnlCountSignList.Controls[i].FindControl("lblDate") as Label;
                    if (info.SubmitDate != DateTime.MinValue)
                    {
                        lblDate.Text    = info.SubmitDate.ToString(ConstString.DateFormat.Normal);
                        lblDate.ToolTip = info.SubmitDate.ToString();
                    }
                    else
                    {
                        lblDate.Text = "";
                    }

                    //意见
                    Label lblYiJian = this.pnlCountSignList.Controls[i].FindControl("lblComment") as Label;
                    lblYiJian.ToolTip = info.Comment;
                    lblYiJian.Text    = SysString.TruncationString(info.Comment, 20);

                    //Repeater rptCurrentList = this.pnlCountSignList.Controls[i].FindControl("rptCurrentList") as Repeater;//主键ID
                    Label lblComment = this.pnlCountSignList.Controls[i].FindControl("lblComment") as Label;
                    lblComment.Text = SysString.TruncationString(info.Comment, 20);

                    List <CYiJian> yiJianList = new List <CYiJian>();
                    foreach (B_WorkRelation.DetailInfo detailInfo in info.DetailInfoList)
                    {
                        CYiJian yiJian = new CYiJian();

                        yiJian.Content       = detailInfo.Comment;
                        yiJian.DealCondition = detailInfo.DealCondition;
                        yiJian.FinishTime    = info.SubmitDate.ToString();
                        yiJian.ID            = info.TBID;
                        yiJian.ViewName      = ProcessConstString.StepName.WorkRelationStepName.STEP_DEPTSIGN;
                        yiJian.UserName      = info.Name;
                        yiJian.UserID        = info.ID;
                        yiJianList.Add(yiJian);
                    }
                    //rptCurrentList.DataSource = yiJianList;
                    //rptCurrentList.DataBind();
                }
            }
            HiddenField hfDeptSignCount = this.Parent.Parent.FindControl("hfDeptSignCount") as HiddenField;

            if (hfDeptSignCount != null)
            {
                hfDeptSignCount.Value = UCHQList.Count.ToString();
            }
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void LoadBindData()
        {
            if (UCHQList.Count > 0)
            {
                M_WorkRelation.DeptSign info = new M_WorkRelation.DeptSign();
                for (int i = 0; i < UCHQList.Count; i++)
                {
                    info = (M_WorkRelation.DeptSign)UCHQList[i];
                    Count++;
                    LoadUserControl(Count, false);

                    //TBID
                    Label lblTBID = this.pnlCountSignList.Controls[i].FindControl("lblTBID") as Label;
                    lblTBID.Text = info.TBID;

                    //部门ID
                    DropDownList ddlSignDept = pnlCountSignList.Controls[i].FindControl("ddlSignDept") as DropDownList;

                    FormsMethod.SelectedDropDownList(ddlSignDept, info.DeptID, info.DeptName);

                    //会签人ID
                    Label lblUserID = this.pnlCountSignList.Controls[i].FindControl("lblUserID") as Label;
                    lblUserID.Text = info.ID;

                    //会签人
                    Label lblUserName = this.pnlCountSignList.Controls[i].FindControl("lblUserName") as Label;
                    lblUserName.Text = info.Name;

                    //是否同意
                    Label lblTongYi = this.pnlCountSignList.Controls[i].FindControl("lblTongYi") as Label;
                    lblTongYi.Text = info.IsAgree;

                    if (!String.IsNullOrEmpty(info.IsAgree))
                    {
                        ddlSignDept.Enabled = false;
                        ddlSignDept.CssClass = "dropdownlist_blue";
                        CheckBox cb = this.pnlCountSignList.Controls[i].FindControl("cb") as CheckBox;
                        if (UCIsAllowDel && UCIsDisEnable == false)
                        {
                            cb.Enabled = true;
                            cb.Checked = info.IsExclude;
                        }
                        else
                        {
                            cb.Enabled = false;
                            cb.Checked = info.IsExclude;
                        }
                    }

                    //会签日期
                    Label lblDate = this.pnlCountSignList.Controls[i].FindControl("lblDate") as Label;
                    if (info.SubmitDate != DateTime.MinValue)
                    {
                        lblDate.Text = info.SubmitDate.ToString(ConstString.DateFormat.Normal);
                        lblDate.ToolTip = info.SubmitDate.ToString();
                    }
                    else
                    {
                        lblDate.Text = "";
                    }

                    //意见
                    Label lblYiJian = this.pnlCountSignList.Controls[i].FindControl("lblComment") as Label;
                    lblYiJian.ToolTip = info.Comment;
                    lblYiJian.Text = SysString.TruncationString(info.Comment, 20);

                    //Repeater rptCurrentList = this.pnlCountSignList.Controls[i].FindControl("rptCurrentList") as Repeater;//主键ID
                    Label lblComment = this.pnlCountSignList.Controls[i].FindControl("lblComment") as Label;
                    lblComment.Text = SysString.TruncationString(info.Comment, 20);

                    List<CYiJian> yiJianList = new List<CYiJian>();
                    foreach (B_WorkRelation.DetailInfo detailInfo in info.DetailInfoList)
                    {
                        CYiJian yiJian = new CYiJian();

                        yiJian.Content = detailInfo.Comment;
                        yiJian.DealCondition = detailInfo.DealCondition;
                        yiJian.FinishTime = info.SubmitDate.ToString();
                        yiJian.ID = info.TBID;
                        yiJian.ViewName = ProcessConstString.StepName.WorkRelationStepName.STEP_DEPTSIGN;
                        yiJian.UserName = info.Name;
                        yiJian.UserID = info.ID;
                        yiJianList.Add(yiJian);
                    }
                    //rptCurrentList.DataSource = yiJianList;
                    //rptCurrentList.DataBind();
                }
            }
            HiddenField hfDeptSignCount = this.Parent.Parent.FindControl("hfDeptSignCount") as HiddenField;
            if (hfDeptSignCount != null)
            { hfDeptSignCount.Value = UCHQList.Count.ToString(); }
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            B_GS_WorkItems rentity = base.EntityData != null ? base.EntityData as B_GS_WorkItems : new B_GS_WorkItems();
            //附件信息
            ViewState["filelist"] = this.ucAttachment.UCDataList;
            rentity.FileList = this.ucAttachment.UCDataList;
            rentity.CommentList.Clear();

            if (!IsSave)
            {
                rentity.PromptEdit = this.txtPromptEdit.Text;
                if (!string.IsNullOrEmpty(this.txtPromptEdit.Text))
                {
                    rentity.IsFormSave = false;
                    rentity.Prompt = this.txtPrompt.Text + "[" + (rentity.ReceiveUserName == string.Empty ? CurrentUserInfo.DisplayName : rentity.ReceiveUserName )+ "][" + System.DateTime.Now.ToString(ConstString.DateFormat.Long) + "]:" + this.txtPromptEdit.Text + m_strHuanHang;
                }
            }
            else
            {
                rentity.IsFormSave = true;
                rentity.Prompt = this.txtPrompt.Text;
                rentity.PromptEdit = this.txtPromptEdit.Text;
            }

            switch (base.StepName)
            {

                case ProcessConstString.StepName.ReceiveStepName.STEP_INITIAL://发起流程
                    //收文号
                    rentity.DocumentNo = this.txtReceiveNo.Text;

                    if (!string.IsNullOrEmpty(this.txtJinJi.Text))
                    {
                        rentity.UrgentDegree = this.txtJinJi.Text;
                    }
                    //发起人及日期
                    if (rentity.Drafter == string.Empty)
                    {
                        rentity.Drafter = CurrentUserInfo.DisplayName;
                        rentity.DrafterID = CurrentUserInfo.UserName;
                        rentity.ReceiveUserID = rentity.DrafterID;
                        rentity.ReceiveUserName = rentity.Drafter;
                    }
                    if (rentity.DraftDate == DateTime.MinValue)
                    {
                        rentity.DraftDate = System.DateTime.Now;
                    }

                    if (this.SubAction == ProcessConstString.SubmitAction.ACTION_SUBMIT)//公司办文书
                    {
                        rentity.CompanyWS = (OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_OFFICE_CLERK))[0].ToString();
                    }

                    //收文日期
                    rentity.DocumentReceiveDate = string.IsNullOrEmpty(this.txtReceiveDate.Text) ? DateTime.MinValue : DateTime.Parse(this.txtReceiveDate.Text);

                    //原文号
                    rentity.SendNo = this.txtSendLetterNo.Text;

                    //来文单位
                    rentity.CommunicationUnit = this.txtCommunicationUnit.Text;

                    //卷号
                    rentity.VolumeNo = this.txtPreVolumeNo.Text;

                    //文件名称
                    rentity.DocumentTitle = this.txtDocumentTitle.Text;

                    //公司办主任
                    rentity.OfficerName = this.ddlOfficer.SelectedItem.Text;
                    rentity.Officer = this.ddlOfficer.SelectedValue;

                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_OFFICE://办公室批阅

                    rentity.LeaderShipName = this.ddlLeadShip.SelectedItem.Text;
                    rentity.LeaderShip = this.ddlLeadShip.SelectedValue;
                    rentity.Officer_Date = DateTime.Now.ToString();

                    rentity.Officer_Comment = this.txtOfficerComment.Text;
                    if (this.SubAction == ProcessConstString.SubmitAction.ACTION_SUBMIT)//公司办文书
                    {
                        rentity.CompanyWS = (OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_OFFICE_CLERK))[0].ToString();
                    }
                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_INSTRUCTION://领导批示
                    if (!IsSave)
                    {
                        rentity.LS_Comment = this.txtLeaderComment.Text;
                        rentity.LS_CommentAdd = "";
                        rentity.LS_Date = DateTime.Now.ToString();
                        rentity.LS_Comment = this.txtLeaderComment.Text;
                        CYiJian l_objComment = new CYiJian();
                        l_objComment.Content = this.txtLeaderComment.Text;
                        l_objComment.FinishTime = DateTime.Now.ToString();
                        l_objComment.UserID = rentity.ReceiveUserID;
                        l_objComment.UserName = rentity.ReceiveUserName;
                        l_objComment.ViewName = base.StepName;
                        rentity.CommentList.Add(l_objComment);
                    }
                    else
                    {
                        rentity.LS_CommentAdd = this.txtLeaderComment.Text;
                    }
                    if (string.IsNullOrEmpty(rentity.CompanyWS))
                    {
                        rentity.CompanyWS = (OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_OFFICE_CLERK))[0].ToString();
                    }
                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_PROCESS_CENTER://收文处理中心
                    if (this.SubAction == ProcessConstString.SubmitAction.ACTION_SUBMIT)
                    {
                        rentity.CompanyWS = (OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_OFFICE_CLERK))[0].ToString();
                    }
                    else
                    {
                        rentity.CompanyWS = rentity.ReceiveUserID;
                    }
                    //公司领导
                    rentity.LeaderShipName = this.ddlLeadShip.SelectedItem.Text;
                    rentity.LeaderShip = this.ddlLeadShip.SelectedValue;

                    //传阅
                    rentity.CPeopleName = this.txtCirculatePeopleName.Text;
                    rentity.CPeopleID = this.txtCPeopleID.Text;
                    rentity.CDeptName = this.txtCirculateDeptName.Text;
                    rentity.CDeptID = this.txtCdeptID.Text;

                    rentity.UnderTakePeopleName = this.txtUnderTakeUserName.Text;
                    rentity.UnderTakeDeptName = this.txtUnderTakeDeptName.Text;

                    //承办部门、人员
                    if (!string.IsNullOrEmpty(this.txtUnderTakeDeptID.Text) || !string.IsNullOrEmpty(this.txtUnderTakeUserID.Text))
                    {
                        rentity.UnderTakeDept = this.txtUnderTakeDeptID.Text;
                        rentity.UnderTakeDeptLeaderID = OAUser.GetUserByDeptPostArray(this.txtUnderTakeDeptID.Text,null,true,true)[0];
                        rentity.UnderTakePeople = this.txtUnderTakeUserID.Text;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(this.txtUnderTakeDeptName.Text))
                        {
                            rentity.UnderTakeDept = "";
                        }
                        else
                        {
                            rentity.UnderTakeDeptLeaderID =OAUser.GetUserByDeptPostArray(rentity.UnderTakeDept,null,true,true)[0];
                        }
                        if (string.IsNullOrEmpty(this.txtUnderTakeUserName.Text))
                        {
                            rentity.UnderTakePeople = "";
                        }
                    }
                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_DIRECTOR://处室承办
                    if (this.dllUnderDept.SelectedIndex >= 0)
                    {
                        rentity.UnderTakeChief = this.dllUnderDept.SelectedValue;
                        rentity.UnderTakeChiefName = this.dllUnderDept.SelectedItem.Text;
                    }
                    if (this.ddlUnderPeople.SelectedIndex >= 0)
                    {
                        rentity.UnderTakePeople = this.ddlUnderPeople.SelectedValue;
                        rentity.UnderTakePeopleName = this.ddlUnderPeople.SelectedItem.Text;
                    }
                    rentity.UnderTakeChiefLeaderID = FormsMethod.GetUserIDByViewBase(OAUser.GetDeptManager(this.dllUnderDept.SelectedValue, 0));
                    rentity.UnderTakeDeptLeaderID = rentity.ReceiveUserID;

                    if (!IsSave)
                    {
                        if (this.SubAction == ProcessConstString.SubmitAction.ACTION_COMPLETE)//公司办文书
                        {
                            rentity.CompanyWS = (OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_OFFICE_CLERK))[0].ToString();
                        }
                        goto case ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_MEMBER;
                    }
                    else
                    {
                        rentity.UnderTake_CommentAdd = this.txtUnderComment.Text;
                    }
                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_CHIEF://科室承办
                    if (this.ddlUnderPeople.SelectedIndex >= 0)
                    {
                        rentity.UnderTakePeople = this.ddlUnderPeople.SelectedValue;
                        rentity.UnderTakePeopleName = this.ddlUnderPeople.SelectedItem.Text;
                    }
                    rentity.UnderTakeChiefLeaderID = rentity.ReceiveUserID;
                    if (rentity.DraftDate < base.OAStartTime && string.IsNullOrEmpty(rentity.UnderTakeDeptLeaderID))
                    {
                        rentity.UnderTakeDeptLeaderID = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_DIRECTOR, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                    }
                    if (!IsSave)
                    {
                        goto case ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_MEMBER;
                    }
                    else
                    {
                        rentity.UnderTake_CommentAdd = this.txtUnderComment.Text;
                    }
                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_MEMBER://人员承办
                    if (rentity.DraftDate < base.OAStartTime)
                    {
                        rentity.UnderTakeDeptLeaderID = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_DIRECTOR, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                        rentity.UnderTakeChiefLeaderID = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_CHIEF, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                    }
                    if (!IsSave)
                    {
                        rentity.UnderTake_CommentAdd = this.txtUnderComment.Text;
                        if (base.SubAction == ProcessConstString.SubmitAction.ACTION_COMPLETE)
                        {
                            rentity.UnderTake_Comment = this.txtUnderComment.Text;
                        }
                        CYiJian l_objComment = new CYiJian();
                        l_objComment.Content = this.txtUnderComment.Text;
                        l_objComment.FinishTime = DateTime.Now.ToString();
                        l_objComment.UserID = rentity.ReceiveUserID;
                        l_objComment.UserName = rentity.ReceiveUserName;
                        l_objComment.ViewName = base.StepName;
                        rentity.CommentList.Add(l_objComment);
                    }
                    else
                    {
                        rentity.UnderTake_CommentAdd = this.txtUnderComment.Text;
                    }
                    break;

                case ProcessConstString.StepName.ReceiveStepName.STEP_DISTRIBUTION:
                    if (rentity.DraftDate < base.OAStartTime && string.IsNullOrEmpty(rentity.UnderTakeDeptLeaderID))
                    {
                        rentity.UnderTakeDeptLeaderID = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_DIRECTOR, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                    }

                    if (!string.IsNullOrEmpty(this.txtCPeopleID.Text) || !string.IsNullOrEmpty(this.txtCdeptID.Text))
                    {
                        rentity.CPeopleName = this.txtCirculatePeopleName.Text;
                        rentity.CPeopleID = this.txtCPeopleID.Text;
                        rentity.CDeptName = this.txtCirculateDeptName.Text;
                        rentity.CDeptID = this.txtCdeptID.Text;
                    }
                    rentity.CompanyWS = rentity.ReceiveUserID;
                    break;
            }
            return rentity;
        }
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_PF entity = base.EntityData as B_PF;

            if (entity != null)
            {
                this.cbIsPrint.Checked = entity.IsProgramCompanCheck;//是否需要工程公司会签

                wfTimesFlag.Text = entity.TimesFlag;//次数标示

                wfChiefDept.Text = entity.SendDeptID;//主办部门ID
                wfSort.Text = entity.ProgramSort;//程序分类

                txtName.Text = entity.DocumentTitle;//程序文件名称
                txtCode.Text = entity.ProgramCode;//程序编码
                txtEdition.Text = entity.Edition;//程序版次
                txtPages.Text = entity.TextPageSum;//总页数
                lblApplyStyle.Text = entity.ApplyStyle;//申请类型
                wfReceiveUserID.Text = entity.ReceiveUserID;//接收人用户ID
                wfReceiveUserName.Text = entity.ReceiveUserName;//接收人用户姓名

                //if (lblApplyStyle.Text == ConstString.Miscellaneous.PROGRAM_DELETE)
                //{
                //    btnSend.Text = "注销分发";
                //}//注销程序

                txtWriteExplain.Text = entity.WriteExplain;//编制修订说明
                lblWrite.Text = entity.WriteName;//编制人员
                wfWriteID.Text = entity.WriteID;

                this.txtCheckName.Text = entity.CheckName;//校核人员  renjinquan+
                this.wfCheckID.Text = entity.CheckID;

                //ListItem temp = ddlApprove.Items.FindByText("孙云根");

                //ddlApprove.Items.Remove(temp);

                FormsMethod.SelectedDropDownList(ddlAudit, entity.AuditID, entity.AuditName);//审核人员
                FormsMethod.SelectedDropDownList(ddlApprove, entity.ApproverID, entity.ApproveName);//批准人员

                //同意、否决
                lblCheckAgree.Text = entity.CheckerIsAgree;
                lblAuditAgree.Text = entity.AuditorIsAgree;
                lblQGAgree.Text = entity.QualityIsAgree;
                lblApproveAgree.Text = entity.ApproverIsAgree;

                //校核
                lblCheckComment.ToolTip = entity.CheckComment;
                lblCheckComment.Text = SysString.TruncationString(entity.CheckComment, 30);
                tdCheckComment.Attributes.Add("onmouseover", "this.style.cursor='hand'");
                tdCheckComment.Attributes.Add("onclick", string.Format(@"OpenSignCommentDetail('{0}','{1}');ShowPopDiv('popDiv'); ",
                                                           Server.UrlEncode(ProcessConstString.StepName.ProgramFile.STEP_CHECK), string.Empty));
                if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.ProgramFile.STEP_CHECK)
                {
                    txtInfo.Text = entity.CheckComment;
                }

                //审核
                lblAuditComment.ToolTip = entity.AuditComment;
                lblAuditComment.Text = SysString.TruncationString(entity.AuditComment, 30);
                tdAuditComment.Attributes.Add("onmouseover", "this.style.cursor='hand'");
                tdAuditComment.Attributes.Add("onclick", string.Format(@"OpenSignCommentDetail('{0}','{1}');ShowPopDiv('popDiv'); ",
                                                              Server.UrlEncode(ProcessConstString.StepName.ProgramFile.STEP_AUDIT), string.Empty));
                if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.ProgramFile.STEP_AUDIT)
                {
                    txtInfo.Text = entity.AuditComment;
                }

                //质保
                lblQGComment.ToolTip = entity.QualityComment;
                lblQGComment.Text = SysString.TruncationString(entity.QualityComment, 30);
                tdQulityComment.Attributes.Add("onmouseover", "this.style.cursor='hand'");
                //判断质保审查是否已存在接收人员,存在:返回质保人员ID,否则为空,供查看质保意见历史信息使用
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG && base.IsPreview == false)
                {
                    if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                    {
                        lblQG.ToolTip = wfReceiveUserName.Text;
                        lblQG.Text = wfReceiveUserName.Text;
                        tdQulityComment.Attributes.Add("onclick", string.Format(@"OpenSignCommentDetail('{0}','{1}','{2}');ShowPopDiv('popDiv'); ",
                                                                  Server.UrlEncode(ProcessConstString.StepName.ProgramFile.STEP_QG), Server.UrlEncode(wfReceiveUserID.Text), string.Empty));
                        this.wfQualityIDs.Text = wfReceiveUserID.Text;
                    }
                    else
                    {
                        lblQG.ToolTip = CurrentUserInfo.DisplayName;
                        lblQG.Text = CurrentUserInfo.DisplayName;
                        tdQulityComment.Attributes.Add("onclick", string.Format(@"OpenSignCommentDetail('{0}','{1}','{2}');ShowPopDiv('popDiv'); ",
                                                                  Server.UrlEncode(ProcessConstString.StepName.ProgramFile.STEP_QG), Server.UrlEncode(CurrentUserInfo.UserName), string.Empty));
                        this.wfQualityIDs.Text = CurrentUserInfo.UserName;
                    }
                }
                else
                {
                    lblQG.ToolTip = entity.QualityNames;//质保人员
                    lblQG.Text = entity.QualityNames.Length > 3 ? entity.QualityNames.Substring(0, 3).Replace(";", "") + "..." : entity.QualityNames.Replace(";", "");
                    string qualityID = entity.QualityIDs.IndexOf(";") == -1 ? entity.QualityIDs : string.Empty;
                    tdQulityComment.Attributes.Add("onclick", string.Format(@"OpenSignCommentDetail('{0}','{1}','{2}');ShowPopDiv('popDiv'); ",
                                                                  Server.UrlEncode(ProcessConstString.StepName.ProgramFile.STEP_QG), Server.UrlEncode(qualityID), string.Empty));
                    this.wfQualityIDs.Text = entity.QualityIDs;
                }

                //批准
                string pizhunID = entity.ApproverID.IndexOf(";") == -1 ? entity.ApproverID : string.Empty;
                lblApproveComment.ToolTip = entity.ApproveComment;
                lblApproveComment.Text = SysString.TruncationString(entity.ApproveComment, 30);
                tdApprove.Attributes.Add("onclick", string.Format(@"OpenSignCommentDetail('{0}','{1}','{2}');ShowPopDiv('popDiv'); ",
                                                               Server.UrlEncode(ProcessConstString.StepName.ProgramFile.STEP_APPROVE), Server.UrlEncode(pizhunID), string.Empty));
                tdApprove.Attributes.Add("onmouseover", "this.style.cursor='hand'");//renjinquan 修改

                //提交日期
                lblWriteDate.Text = entity.WriteDate == DateTime.MinValue ? string.Empty : entity.WriteDate.ToString(ConstString.DateFormat.Normal);
                lblWriteDate.ToolTip = entity.WriteDate == DateTime.MinValue ? string.Empty : entity.WriteDate.ToString();
                lblCheckDate.Text = entity.CheckDate == DateTime.MinValue ? string.Empty : entity.CheckDate.ToString(ConstString.DateFormat.Normal);
                lblCheckDate.ToolTip = entity.CheckDate == DateTime.MinValue ? string.Empty : entity.CheckDate.ToString();
                lblAuditDate.Text = entity.AuditDate == DateTime.MinValue ? string.Empty : entity.AuditDate.ToString(ConstString.DateFormat.Normal);
                lblAuditDate.ToolTip = entity.AuditDate == DateTime.MinValue ? string.Empty : entity.AuditDate.ToString();
                lblQGDate.Text = entity.QualityDate == DateTime.MinValue ? string.Empty : entity.QualityDate.ToString(ConstString.DateFormat.Normal);
                lblQGDate.ToolTip = entity.QualityDate == DateTime.MinValue ? string.Empty : entity.QualityDate.ToString();
                lblApproveDate.Text = entity.ApproveDate == DateTime.MinValue ? string.Empty : entity.ApproveDate.ToString(ConstString.DateFormat.Normal);
                lblApproveDate.ToolTip = entity.ApproveDate == DateTime.MinValue ? string.Empty : entity.ApproveDate.ToString();

                ucFileControl.UCDataList = entity.FileList;//附件

                wfProcessID.Text = base.ProcessID;
                wfWorkItemID.Text = base.WorkItemID;

                wfDrafter.Text = entity.Drafter;//程序发起人
                wfDrafterID.Text = entity.DrafterID;//程序发起人ID
                //wfDraftDate.Text = entity.DraftDate.ToString(ConstString.DateFormat.Normal);//程序发起时间

                wfDocTitle.Text = entity.DocumentTitle;//文件标题
                wfProgramID.Text = entity.ProgramFileID;//程序文件ID
                wfSerialID.Text = entity.SerialID;//流水号
                wfYear.Text = entity.Year;//年份

                //发送传阅时间
                wfCirculateDate.Text = entity.CirculateDate == DateTime.MinValue ? string.Empty : entity.CirculateDate.ToString();//质保发起传阅时间

                //分发节点
                wfSenderIDs.Text = entity.SenderIDs;//分发人(公办)
                wfSender.Text = entity.Senders;
                wfSendDate.Text = entity.SendDate == DateTime.MinValue ? string.Empty : entity.SendDate.ToString();

                //传阅
                hfCirculateUserID.Value = entity.CirculateSignUserID;//被传阅人ID
                txtCirculateUserName.Text = entity.CirculateSignUserName;//被传阅人姓名
                txtCirculateDeptName.Text = entity.CirculateSignDept;
                hfCirculateDeptID.Value = entity.CirculateSignDeptID;

                //分发
                hfSendDeptID.Value = entity.CirculateDeptID;
                hfSendUserID.Value = entity.CirculateID;
                txtSendDeptName.Text = entity.CirculateDeptName;
                txtSendUserName.Text = entity.CirculateName;
                txtSendComemnt.Text = entity.CirculateComment;

                ucBuMenHuiQian.UCHQList = entity.DeptSignList;//部门会签
                ucBuMenHuiQian.IsHistory = base.IsPreview;
                ucBuMenHuiQian.UCReceiveUserID = entity.ReceiveUserID;
                ucLDHuiQian.UCHQList = entity.LeaderSignList;//领导会签
                ucLDHuiQian.IsHistory = base.IsPreview;
                ucLDHuiQian.UCReceiveUserID = entity.ReceiveUserID;

                #region 当前会签意见
                if (base.IsPreview == false)
                {
                    //当前质保意见
                    if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
                    {
                        foreach (B_PF.QualityCheck qualityCheck in entity.QualityCheckList)
                        {
                            if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                            {
                                if (entity.QualityIDs == wfReceiveUserID.Text)
                                {
                                    CYiJian yiJian = new CYiJian();

                                    yiJian.Content = qualityCheck.Comment;
                                    yiJian.DealCondition = qualityCheck.DealCondition;
                                    yiJian.FinishTime = entity.QualityDate == DateTime.MinValue ? string.Empty : entity.QualityDate.ToString();
                                    yiJian.ID = base.IdentityID.ToString();
                                    yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_QG;
                                    yiJian.UserName = entity.QualityNames;
                                    yiJian.UserID = entity.QualityIDs;
                                    yiJian.DealTime = DateTime.Now.ToString();
                                    YiJianInfoList.Add(yiJian);
                                }
                            }
                            else
                            {
                                if (entity.QualityIDs == CurrentUserInfo.UserName)
                                {
                                    CYiJian yiJian = new CYiJian();

                                    yiJian.Content = qualityCheck.Comment;
                                    yiJian.DealCondition = qualityCheck.DealCondition;
                                    yiJian.FinishTime = entity.QualityDate == DateTime.MinValue ? string.Empty : entity.QualityDate.ToString();
                                    yiJian.ID = base.IdentityID.ToString();
                                    yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_QG;
                                    yiJian.UserName = entity.QualityNames;
                                    yiJian.UserID = entity.QualityIDs;
                                    yiJian.DealTime = DateTime.Now.ToString();
                                    YiJianInfoList.Add(yiJian);
                                }
                            }
                        }
                    }
                    //当前部门会签意见
                    if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN)
                    {
                        foreach (B_PF.DeptSign deptSign in entity.DeptSignList)
                        {
                            foreach (B_PF.DetailInfo detailInfo in deptSign.DetailInfoList)
                            {
                                if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                                {
                                    if (deptSign.ID == wfReceiveUserID.Text)
                                    {
                                        CYiJian yiJian = new CYiJian();

                                        yiJian.Content = detailInfo.Comment;
                                        yiJian.DealCondition = detailInfo.DealCondition;
                                        yiJian.FinishTime = deptSign.SubmitDate.ToString();
                                        yiJian.ID = deptSign.TBID;
                                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN;
                                        yiJian.UserName = deptSign.Name;
                                        yiJian.UserID = deptSign.ID;
                                        yiJian.DeptID = deptSign.DeptID;
                                        yiJian.DealTime = DateTime.Now.ToString();
                                        YiJianInfoList.Add(yiJian);
                                    }
                                }
                                else
                                {
                                    if (deptSign.ID == CurrentUserInfo.UserName)
                                    {
                                        CYiJian yiJian = new CYiJian();

                                        yiJian.Content = detailInfo.Comment;
                                        yiJian.DealCondition = detailInfo.DealCondition;
                                        yiJian.FinishTime = deptSign.SubmitDate.ToString();
                                        yiJian.ID = deptSign.TBID;
                                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN;
                                        yiJian.UserName = deptSign.Name;
                                        yiJian.UserID = deptSign.ID;
                                        yiJian.DeptID = deptSign.DeptID;
                                        yiJian.DealTime = DateTime.Now.ToString();
                                        YiJianInfoList.Add(yiJian);
                                    }
                                }
                            }
                        }
                    }//部门会签保存
                    ucBuMenHuiQian.UCHQList = entity.DeptSignList;//部门会签

                    //部门会签
                    if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN)
                    {
                        if (!string.IsNullOrEmpty(entity.ChildProcessID))
                        {
                            btnAssign.Visible = false;
                            ucSelectAssign.Visible = false;
                            lblAssign.Text = "已交办:";
                        }//ChildProcessID不为空,存在子流程,不可再次交办
                    }

                    //当前领导会签意见
                    if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN)
                    {
                        foreach (B_PF.LeaderSign leaderSign in entity.LeaderSignList)
                        {
                            foreach (B_PF.DetailInfo detailInfo in leaderSign.DetailInfoList)
                            {
                                if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                                {
                                    if (leaderSign.ID == wfReceiveUserID.Text)
                                    {
                                        CYiJian yiJian = new CYiJian();

                                        yiJian.Content = detailInfo.Comment;
                                        yiJian.DealCondition = detailInfo.DealCondition;
                                        yiJian.FinishTime = leaderSign.Date.ToString();
                                        yiJian.ID = leaderSign.TBID;
                                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN;
                                        yiJian.UserName = leaderSign.Name;
                                        yiJian.UserID = leaderSign.ID;
                                        yiJian.DealTime = DateTime.Now.ToString();
                                        YiJianInfoList.Add(yiJian);
                                    }
                                }
                                else
                                {
                                    if (leaderSign.ID == CurrentUserInfo.UserName)
                                    {
                                        CYiJian yiJian = new CYiJian();

                                        yiJian.Content = detailInfo.Comment;
                                        yiJian.DealCondition = detailInfo.DealCondition;
                                        yiJian.FinishTime = leaderSign.Date.ToString();
                                        yiJian.ID = leaderSign.TBID;
                                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN;
                                        yiJian.UserName = leaderSign.Name;
                                        yiJian.UserID = leaderSign.ID;
                                        yiJian.DealTime = DateTime.Now.ToString();
                                        YiJianInfoList.Add(yiJian);
                                    }
                                }
                            }
                        }
                    }//领导会签保存
                    ucLDHuiQian.UCHQList = entity.LeaderSignList;//领导会签

                    //当前批准意见
                    if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.ProgramFile.STEP_APPROVE)
                    {
                        foreach (B_PF.PiZhun pizhun in entity.PiZhunList)
                        {
                            if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                            {
                                if (entity.ApproverID == wfReceiveUserID.Text)
                                {
                                    CYiJian yiJian = new CYiJian();
                                    yiJian.Content = pizhun.Comment;
                                    yiJian.DealCondition = pizhun.DealCondition;
                                    yiJian.ID = base.IdentityID.ToString();
                                    yiJian.UserName = pizhun.Name;
                                    yiJian.FinishTime = pizhun.SubmitDate == DateTime.MinValue ? string.Empty : pizhun.SubmitDate.ToString(); ;
                                    yiJian.UserID = wfReceiveUserID.Text;
                                    yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_APPROVE;
                                    yiJian.DealTime = DateTime.Now.ToString();
                                    YiJianInfoList.Add(yiJian);
                                }
                            }
                            else
                            {
                                if (entity.ApproverID == CurrentUserInfo.UserName)
                                {
                                    CYiJian yiJian = new CYiJian();
                                    yiJian.Content = pizhun.Comment;
                                    yiJian.DealCondition = pizhun.DealCondition;
                                    yiJian.ID = base.IdentityID.ToString();
                                    yiJian.UserName = pizhun.Name;
                                    yiJian.FinishTime = pizhun.SubmitDate == DateTime.MinValue ? string.Empty : pizhun.SubmitDate.ToString(); ;
                                    yiJian.UserID = CurrentUserInfo.UserName;
                                    yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_APPROVE;
                                    yiJian.DealTime = DateTime.Now.ToString();
                                    YiJianInfoList.Add(yiJian);
                                }
                            }
                        }
                    }
                    if (YiJianInfoList.Count > 0)
                    {
                        trYiJianHead.Visible = true;
                        rptComment.DataSource = YiJianInfoList;
                        rptComment.DataBind();
                    }
                }
                else
                {
                    if (entity.CommentList.Count > 0 && (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG ||
                        base.StepName == ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN ||
                        base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN ||
                        base.StepName == ProcessConstString.StepName.ProgramFile.STEP_APPROVE))
                    {
                        rptComment.ItemDataBound += new RepeaterItemEventHandler(rptComment_ItemDataBound);
                        trYiJianHead.Visible = true;
                        btnAdd.Visible = false;
                        rptComment.DataSource = entity.CommentList;
                        rptComment.DataBind();
                    }
                }//查看多条历史意见

                #endregion

                #region 多条处理意见
                //编制节点 处理部门会签、领导会签、质保意见落实
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE)
                {
                    //部门会签
                    List<B_PF.YiJian> deptYiJianList = new List<B_PF.YiJian>();
                    foreach (B_PF.DeptSign deptSign in entity.DeptSignList)
                    {
                        foreach (B_PF.DetailInfo detailInfo in deptSign.DetailInfoList)
                        {
                            B_PF.YiJian yiJian = new B_PF.YiJian();

                            yiJian.Content = detailInfo.Comment;
                            yiJian.DealCondition = detailInfo.DealCondition;
                            yiJian.FinishTime = deptSign.SubmitDate.ToString();//renjinquan 修改
                            yiJian.ID = deptSign.TBID;
                            yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN;
                            yiJian.UserName = deptSign.Name;
                            yiJian.UserID = deptSign.ID;
                            yiJian.DeptID = deptSign.DeptID;
                            yiJian.DeptName = deptSign.DeptName;
                            deptYiJianList.Add(yiJian);
                        }
                    }
                    //当前部门会签意见信息
                    if (deptYiJianList.Count > 0)
                    {
                        pnlDeptComment.Visible = true;
                        rptDept.DataSource = deptYiJianList;
                        rptDept.DataBind();
                    }
                    //领导会签
                    List<CYiJian> leadYiJianList = new List<CYiJian>();
                    foreach (B_PF.LeaderSign leaderSign in entity.LeaderSignList)
                    {
                        foreach (B_PF.DetailInfo detailInfo in leaderSign.DetailInfoList)
                        {
                            CYiJian yiJian = new CYiJian();

                            yiJian.Content = detailInfo.Comment;
                            yiJian.DealCondition = detailInfo.DealCondition;
                            yiJian.FinishTime = leaderSign.Date.ToString();//renjinquan修改
                            yiJian.ID = leaderSign.TBID;
                            yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN;
                            yiJian.UserName = leaderSign.Name;
                            yiJian.UserID = leaderSign.ID;
                            leadYiJianList.Add(yiJian);
                        }
                    }
                    //当前领导会签意见信息
                    if (leadYiJianList.Count > 0)
                    {
                        pnlLeaderComment.Visible = true;
                        rptLeader.DataSource = leadYiJianList;
                        rptLeader.DataBind();
                    }
                    //质保意见
                    List<CYiJian> qgYiJianList = new List<CYiJian>();
                    foreach (B_PF.QualityCheck qg in entity.QualityCheckList)
                    {
                        CYiJian yiJian = new CYiJian();
                        yiJian.Content = qg.Comment;
                        yiJian.DealCondition = qg.DealCondition;
                        yiJian.FinishTime = entity.QualityDate.ToString();//renjinquan修改
                        yiJian.ID = qg.TBID;
                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_QG;
                        yiJian.UserName = qg.Name;
                        yiJian.UserID = entity.QualityIDs;
                        qgYiJianList.Add(yiJian);
                    }
                    if (qgYiJianList.Count > 0)
                    {
                        pnlQGComment.Visible = true;
                        rptQG.DataSource = qgYiJianList;
                        rptQG.DataBind();
                    }
                }
                //编制、质保节点 处理批准意见落实
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE ||
                    base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
                {
                    //批准意见
                    List<CYiJian> PiZhunList = new List<CYiJian>();
                    foreach (B_PF.PiZhun pizhun in entity.PiZhunList)
                    {
                        CYiJian yiJian = new CYiJian();
                        yiJian.UserID = ""; //CurrentUserInfo.UserName;
                        yiJian.UserName = pizhun.Name;
                        yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_APPROVE;
                        yiJian.Content = pizhun.Comment;
                        yiJian.DealCondition = pizhun.DealCondition;
                        yiJian.FinishTime = pizhun.DealDate.ToString();
                        yiJian.ID = pizhun.TBID;
                        PiZhunList.Add(yiJian);
                    }
                    if (PiZhunList.Count > 0)
                    {
                        this.pnlApproveComment.Visible = true;
                        this.rptPiZhun.DataSource = PiZhunList;
                        this.rptPiZhun.DataBind();
                    }
                }
                #endregion

                //子流程+
                txtAssistInfo.Text = entity.AssistContent;
                wfChildProcessID.Text = entity.ChildProcessID;
                txtAssignMember.Text = entity.AssignedUserName;
                wfAssignUserName.Text = entity.AssignedUserName;
                wfAssignUserID.Text = entity.AssignedUserID;
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_ASSIST_SIGN)
                {
                    wfParentTBID.Text = entity.ParentTBID;
                }//协助会签
                else
                {
                    wfParentTBID.Text = base.IdentityID.ToString();
                }

                //批准后显示label形式的批准人
                if (entity.ApproveDate != DateTime.MinValue)
                {
                    //this.ddlApprove.Visible = false;
                    //this.needApprove.Visible = true;
                    //this.needApprove.Text = entity.ApproveName;
                }

                //审核后显示label形式的审核人
                if (entity.AuditDate != DateTime.MinValue)
                {
                    this.ddlAudit.Visible = false;
                    this.needAudit.Visible = true;
                    this.needAudit.Text = entity.AuditName;
                }

                //校核后显示label形式的校核人
                if (entity.CheckDate != DateTime.MinValue)
                {
                    this.txtCheckName.Visible = false;
                    this.needCheck.Visible = true;
                    this.needCheck.Text = entity.CheckName;
                }

            }
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(Boolean p_blnIsSaveDraft)
        {
            B_MergeReceiveBase l_objReceiveBase = base.EntityData != null ? base.EntityData as B_MergeReceiveBase : new B_MergeReceiveBase();

            l_objReceiveBase.TemplateName = this.SubTemplateName;

            l_objReceiveBase.RegisterID = base.RegisterID;

            l_objReceiveBase.Officer = ddlPoliticalOfficer.SelectedValue;
            if (!String.IsNullOrEmpty(l_objReceiveBase.Officer))
            {
                l_objReceiveBase.OfficerName = ddlPoliticalOfficer.SelectedItem.Text;
            }
            l_objReceiveBase.Officer_Comment = txtPoliticalOfficerComment.Text.TrimEnd();

            //附件信息
            l_objReceiveBase.FileList = this.ucAttachment.UCDataList;

            //意见列表
            l_objReceiveBase.CommentList = base.Comments;

            //收文号
            l_objReceiveBase.DocumentNo = this.txtReceiveNo.Text;

            //收文日期
            l_objReceiveBase.DocumentReceiveDate = this.txtReceiveDate.ValDate;

            //文件名称
            l_objReceiveBase.DocumentTitle = this.txtDocumentTitle.Text;

            //原文号
            l_objReceiveBase.SendNo = this.txtSendLetterNo.Text;

            //来文单位
            l_objReceiveBase.CommunicationUnit = this.txtCommunicationUnit.Text;

            //预立卷号
            l_objReceiveBase.VolumeNo = this.txtPreVolumeNo.Text;

            //紧急程度
            l_objReceiveBase.UrgentDegree = this.txtUrgentDegree.Text;

            //提交时间
            l_objReceiveBase.SubmitDate = DateTime.Now;

            if (String.IsNullOrEmpty(l_objReceiveBase.Drafter))
            {
                //发起人ID
                l_objReceiveBase.DrafterID = CurrentUserInfo.UserName;

                //发起人姓名
                l_objReceiveBase.Drafter = CurrentUserInfo.DisplayName;

                //发起日期
                l_objReceiveBase.DraftDate = DateTime.Now;
            }
            else
            {
                //发起人ID
                l_objReceiveBase.DrafterID = l_objReceiveBase.ReceiveUserID;

                //发起人姓名
                l_objReceiveBase.Drafter = l_objReceiveBase.ReceiveUserName;

                //发起日期
                l_objReceiveBase.DraftDate = txtDraftDate.ValDate;
            }

            //公司领导批示
            l_objReceiveBase.LeaderShip = this.ddlLeadShip.SelectedValue;
            if (!String.IsNullOrEmpty(this.ddlLeadShip.SelectedValue))
            {
                l_objReceiveBase.LeaderShipName = this.ddlLeadShip.SelectedItem.Text;
            }
            if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_INSTRUCTION)
            {
                l_objReceiveBase.LS_Comment = this.txtLeadCommentEdit.Text.TrimEnd();
                l_objReceiveBase.LS_Date    = System.DateTime.Now.ToString();
            }
            else
            {
                l_objReceiveBase.LS_Comment = this.txtLeadCommentView.Text.TrimEnd();
            }

            //承办部门
            if (!String.IsNullOrEmpty(this.txtUnderTakeDeptID.Text.TrimEnd()))
            {
                l_objReceiveBase.UnderTakeDept         = this.txtUnderTakeDeptID.Text;
                l_objReceiveBase.UnderTakeDeptName     = this.txtUnderTakeDeptName.Text;
                l_objReceiveBase.UnderTakeDeptLeaderID = OAUser.GetUserByDeptPostArray(this.txtUnderTakeDeptID.Text, null, true, true)[0];
            }

            //承办科室
            if (!String.IsNullOrEmpty(this.ddlUnderTakeSection.SelectedValue))
            {
                l_objReceiveBase.UnderTakeChief         = this.ddlUnderTakeSection.SelectedValue;
                l_objReceiveBase.UnderTakeChiefName     = this.ddlUnderTakeSection.SelectedItem.Text;
                l_objReceiveBase.UnderTakeChiefLeaderID = FormsMethod.GetUserIDByViewBase(OAUser.GetDeptManager(this.ddlUnderTakeSection.SelectedValue, 0));
            }

            //承办人员
            if (!String.IsNullOrEmpty(this.ddlUnderTakePeople.SelectedValue))
            {
                l_objReceiveBase.UnderTakePeople     = this.ddlUnderTakePeople.SelectedValue;
                l_objReceiveBase.UnderTakePeopleName = this.ddlUnderTakePeople.SelectedItem.Text;
            }

            if (p_blnIsSaveDraft)
            {
                l_objReceiveBase.UnderTake_Comment = this.txtUnderTakeCommentEdit.Text;
            }

            //传阅
            l_objReceiveBase.CPeopleName = this.txtCirculatePeopleName.Text;
            l_objReceiveBase.CPeopleID   = this.txtCirculatePeopleID.Text;
            l_objReceiveBase.CDeptName   = this.txtCirculateDeptName.Text;
            l_objReceiveBase.CDeptID     = this.txtCirculateDeptID.Text;

            if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_DIRECTOR ||
                base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_CHIEF ||
                base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_MEMBER)
            {
                if (!p_blnIsSaveDraft)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content    = this.txtUnderTakeCommentEdit.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID     = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName   = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName   = base.StepName;
                    l_objComment.Action     = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }
            else if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_PLOT)
            {
                if (!p_blnIsSaveDraft)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content    = this.txtPoliticalOfficerComment.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID     = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName   = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName   = base.StepName;
                    l_objComment.Action     = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }
            else if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_INSTRUCTION)
            {
                if (!p_blnIsSaveDraft)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content    = this.txtLeadCommentEdit.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID     = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName   = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName   = base.StepName;
                    l_objComment.Action     = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }
            else if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_PROCESS_CENTER)
            {
                if (!p_blnIsSaveDraft && m_strSubmitAction == ProcessConstString.SubmitAction.ReceiveBase.SUBMIT_UNDERTAKE)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content    = this.txtUnderTakeCommentEdit.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID     = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName   = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName   = base.StepName;
                    l_objComment.Action     = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }

            l_objReceiveBase.IsFormSave = p_blnIsSaveDraft;

            if (p_blnIsSaveDraft)
            {
                l_objReceiveBase.Prompt     = this.txtPrompt.Text;
                l_objReceiveBase.PromptEdit = this.txtPromptEdit.Text;
            }
            else
            {
                if (!String.IsNullOrEmpty(this.txtPromptEdit.Text.TrimEnd()))
                {
                    l_objReceiveBase.Prompt = this.txtPrompt.Text + "[" + (l_objReceiveBase.ReceiveUserName == string.Empty ? CurrentUserInfo.DisplayName : l_objReceiveBase.ReceiveUserName) + "][" + System.DateTime.Now.ToString(ConstString.DateFormat.Long) + "]:" + this.txtPromptEdit.Text + ConstString.Miscellaneous.NEW_LINE;
                }
            }

            return(l_objReceiveBase);
        }
        /// <summary>
        /// 实体赋值
        /// </summary>
        /// <param name="IsSave"></param>
        /// <returns></returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            B_PF entity = base.EntityData != null ? base.EntityData as B_PF : new B_PF();
            entity.IsProgramCompanCheck = this.cbIsPrint.Checked;

            entity.SendDeptID = wfChiefDept.Text;//主办部门ID
            entity.DocumentTitle = txtName.Text;//程序文件名称-DocumentTitle
            entity.DocumentNo = txtCode.Text;//程序编码
            entity.ProgramCode = txtCode.Text;//程序编码
            entity.Edition = txtEdition.Text;//程序版次
            entity.TextPageSum = txtPages.Text.Trim();//总页数
            entity.ApplyStyle = lblApplyStyle.Text;//申请类型
            entity.WriteExplain = SysString.InputText(txtWriteExplain.Text);//编制修订说明

            entity.Drafter = wfDrafter.Text;//程序发起人
            entity.DrafterID = wfDrafterID.Text;//程序发起人ID

            //编制
            entity.WriteID = wfWriteID.Text.ToString();//ddlWrite.SelectedValue.ToString();
            entity.WriteName = lblWrite.Text.ToString();
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE)
            {
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    entity.DraftDate = entity.DraftDate == DateTime.MinValue ? DateTime.Now : entity.DraftDate;//程序发起时间
                    entity.FirstDraftDate = entity.FirstDraftDate == DateTime.MinValue ? entity.DraftDate : entity.FirstDraftDate;
                    //将会签退回标识初始化(置为“False”)
                    entity.IsSignReject = ConstString.Miscellaneous.STATUS_FALSE;
                    entity.WriteDate = lblWriteDate.Text == string.Empty ? DateTime.Now : Convert.ToDateTime(lblWriteDate.ToolTip);
                }
                //编写节点处理落实情况
                if (wfSort.Text == ConstString.ProgramFile.PROGRAM_SORT_WORK)
                {
                    if (rdolstSignStyle.SelectedIndex == 0)
                    {
                        entity.DeptSignList = rptDept.Items.Count > 0 ? B_PF.GetDeptSignList(rptDept, ucBuMenHuiQian.UCGetHQList()) : ucBuMenHuiQian.UCGetHQList();//选择部门会签
                        entity.LeaderSignList.Clear();
                    }//选择部门会签
                    else
                    {
                        entity.DeptSignList.Clear();
                        entity.LeaderSignList = rptLeader.Items.Count > 0 ? B_PF.GetLeaderSignList(rptLeader, ucLDHuiQian.UCGetHQList()) : ucLDHuiQian.UCGetHQList(); ;//选择领导会签
                    }//选择领导会签
                }//工作程序
                else
                {
                    entity.DeptSignList = rptDept.Items.Count > 0 ? B_PF.GetDeptSignList(rptDept, ucBuMenHuiQian.UCGetHQList()) : ucBuMenHuiQian.UCGetHQList();//部门会签
                    entity.LeaderSignList = rptLeader.Items.Count > 0 ? B_PF.GetLeaderSignList(rptLeader, ucLDHuiQian.UCGetHQList()) : ucLDHuiQian.UCGetHQList();//领导会签
                    entity.QualityCheckList = B_PF.GetQualityCheckList(rptQG);//质保审查
                } //(部门级)管理程序
                entity.PiZhunList = B_PF.GetPiZhunList(rptPiZhun);
            }

            //校核
            entity.CheckID = this.wfCheckID.Text;
            entity.CheckName = this.txtCheckName.Text;
            //校核时间  任金权 改  使用第一次时间
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_CHECK)
            {
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    entity.CheckDate = DateTime.Now; //string.IsNullOrEmpty(this.lblCheckDate.Text) ? DateTime.Now : Convert.ToDateTime(lblCheckDate.Text.ToString());
                    entity.CheckerIsAgree = base.SubAction == ProcessConstString.SubmitAction.ACTION_DENY ? ConstString.ProgramFile.PROGRAM_REJECT : ConstString.ProgramFile.PROGRAM_AGREE;
                }//提交
                else
                {
                    //entity.CheckDate = DateTime.MinValue;
                    entity.CheckerIsAgree = string.Empty;
                }//保存
                entity.CheckComment = SysString.InputText(txtInfo.Text.Trim());
            }

            //审核
            entity.AuditID = ddlAudit.SelectedValue.ToString();
            entity.AuditName = ddlAudit.SelectedItem.Text.ToString();
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_AUDIT)
            {
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    entity.AuditDate = DateTime.Now; //string.IsNullOrEmpty(this.lblAuditDate.Text) ? DateTime.Now : Convert.ToDateTime(lblAuditDate.Text);
                    entity.AuditorIsAgree = base.SubAction == ProcessConstString.SubmitAction.ACTION_DENY ? ConstString.ProgramFile.PROGRAM_REJECT : ConstString.ProgramFile.PROGRAM_AGREE;
                }//提交
                else
                {
                    //entity.AuditDate = DateTime.MinValue;
                    entity.AuditorIsAgree = string.Empty;
                }//保存
                entity.AuditComment = SysString.InputText(txtInfo.Text.Trim());
            }

            //部门会签
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN && base.SubAction != ProcessConstString.SubmitAction.ProgramFile.ACTION_ASSIGN)
            {
                M_ProgramFile.DeptSign deptSign = new M_ProgramFile.DeptSign();
                string strAgreeOld = "";
                if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                {
                    foreach (M_ProgramFile.DeptSign signer in ucBuMenHuiQian.UCGetHQList())
                    {
                        if (signer.ID == wfReceiveUserID.Text && signer.IsExclude == false)
                        {
                            deptSign = signer;
                            strAgreeOld = deptSign.IsAgree;//记录上次的意见  任金权
                            break;
                        }
                    }
                }
                else
                {
                    foreach (M_ProgramFile.DeptSign signer in ucBuMenHuiQian.UCGetHQList())
                    {
                        if (signer.ID == CurrentUserInfo.UserName && signer.IsExclude == false)
                        {
                            deptSign = signer;
                            strAgreeOld = deptSign.IsAgree;//记录上次的意见  任金权
                            break;
                        }
                    }
                }

                //非保存操作
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)//任金权修改会签时间
                {
                    deptSign.IsAgree = YiJianInfoList.Count == 0 ? ConstString.ProgramFile.PROGRAM_AGREE : ConstString.ProgramFile.PROGRAM_REJECT;
                    if (deptSign.IsAgree == ConstString.ProgramFile.PROGRAM_REJECT || deptSign.SubmitDate == DateTime.MinValue || strAgreeOld == ConstString.ProgramFile.PROGRAM_REJECT)
                    {
                        deptSign.SubmitDate = DateTime.Now;
                    }
                    //判断是否会签退回(如果为同意,则需判断当前会签结果状态,否则为拒绝)
                    entity.IsSignReject = entity.IsSignReject == ConstString.Miscellaneous.STATUS_FALSE ? deptSign.IsAgree == ConstString.ProgramFile.PROGRAM_AGREE ?
                                            ConstString.Miscellaneous.STATUS_FALSE : ConstString.Miscellaneous.STATUS_TRUE : ConstString.Miscellaneous.STATUS_TRUE;

                    //    //修改标识:M_201004013
                    //    //修 改 者:黄琦
                    //    //修改描述:兼容老版本,IsSignReject为空的问题
                    //    if (entity.IsSignReject == ConstString.Miscellaneous.STATUS_FALSE)
                    //    {
                    //        if (deptSign.IsAgree == ConstString.ProgramFile.PROGRAM_AGREE)
                    //        {
                    //            entity.IsSignReject = ConstString.Miscellaneous.STATUS_FALSE;
                    //        }
                    //        else
                    //        {
                    //            entity.IsSignReject = ConstString.Miscellaneous.STATUS_TRUE;
                    //        }
                    //    }
                    //    else if (entity.IsSignReject == ConstString.Miscellaneous.STATUS_TRUE)
                    //    {
                    //        entity.IsSignReject = ConstString.Miscellaneous.STATUS_TRUE;
                    //    }
                    //    else
                    //    {
                    //        entity.IsSignReject = ConstString.Miscellaneous.STATUS_FALSE;
                    //        foreach (M_ProgramFile.DeptSign item in entity.DeptSignList)
                    //        {
                    //            if (item.IsAgree == ConstString.ProgramFile.PROGRAM_REJECT)
                    //            {
                    //                entity.IsSignReject = ConstString.Miscellaneous.STATUS_TRUE;
                    //                break;
                    //            }
                    //        }
                    //    }
                }

                List<M_ProgramFile.DetailInfo> detailInfoList = new List<M_ProgramFile.DetailInfo>();
                string strComment = string.Empty;//单条会签意见,用于表单列表显示

                foreach (RepeaterItem item in this.rptComment.Items)
                {
                    M_ProgramFile.DetailInfo detailInfo = new M_ProgramFile.DetailInfo();
                    Label lblContent = item.FindControl("lblContent") as Label;
                    detailInfo.Comment = lblContent.Text;

                    strComment = lblContent.Text;
                    detailInfoList.Add(detailInfo);
                }

                deptSign.DealCondition = string.Empty;//清空处理情况
                deptSign.DealDate = DateTime.MinValue;//清空处理日期
                deptSign.TBID = base.IdentityID.ToString();
                deptSign.Comment = SysString.InputText(strComment);
                deptSign.DetailInfoList = detailInfoList;//会签信息集合

                entity.DeptSignList = B_PF.SetDeptSignList(deptSign, ucBuMenHuiQian.UCGetHQList());
            }
            //领导会签
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN)
            {
                M_ProgramFile.LeaderSign leaderSign = new M_ProgramFile.LeaderSign();
                string strAgreeOld = "";//记录上次的意见  任金权
                if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                {
                    foreach (M_ProgramFile.LeaderSign signer in ucLDHuiQian.UCGetHQList())
                    {
                        if (signer.ID == wfReceiveUserID.Text)
                        {
                            leaderSign = signer;
                            strAgreeOld = leaderSign.IsAgree;
                            break;
                        }
                    }
                }
                else
                {
                    foreach (M_ProgramFile.LeaderSign signer in ucLDHuiQian.UCGetHQList())
                    {
                        if (signer.ID == CurrentUserInfo.UserName)
                        {
                            leaderSign = signer;
                            strAgreeOld = leaderSign.IsAgree;
                            break;
                        }
                    }
                }
                //非保存操作
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)//任金权修改会签时间
                {
                    leaderSign.IsAgree = YiJianInfoList.Count == 0 ? ConstString.ProgramFile.PROGRAM_AGREE : ConstString.ProgramFile.PROGRAM_REJECT;
                    if (leaderSign.IsAgree == ConstString.ProgramFile.PROGRAM_REJECT || leaderSign.Date == DateTime.MinValue || strAgreeOld == ConstString.ProgramFile.PROGRAM_REJECT)
                    {
                        leaderSign.Date = DateTime.Now;
                    }//过滤多次连续同意(取第一次同意时提交的时间)
                    //判断是否会签退回(如果为同意,则需判断当前会签结果状态,否则为拒绝)
                    entity.IsSignReject = entity.IsSignReject == ConstString.Miscellaneous.STATUS_FALSE ? leaderSign.IsAgree == ConstString.ProgramFile.PROGRAM_AGREE ?
                                                ConstString.Miscellaneous.STATUS_FALSE : ConstString.Miscellaneous.STATUS_TRUE : ConstString.Miscellaneous.STATUS_TRUE;
                }

                List<M_ProgramFile.DetailInfo> detailInfoList = new List<M_ProgramFile.DetailInfo>();
                string strComment = string.Empty;//单条会签意见,用于表单列表显示

                foreach (RepeaterItem item in this.rptComment.Items)
                {
                    B_PF.DetailInfo detailInfo = new B_PF.DetailInfo();
                    Label lblContent = item.FindControl("lblContent") as Label;
                    detailInfo.Comment = lblContent.Text;

                    strComment = lblContent.Text;
                    detailInfoList.Add(detailInfo);
                }

                leaderSign.DealCondition = string.Empty;//清空处理情况
                leaderSign.DealDate = DateTime.MinValue;//清空处理日期
                leaderSign.TBID = base.IdentityID.ToString();
                leaderSign.Comment = SysString.InputText(strComment);
                leaderSign.DetailInfoList = detailInfoList;//会签信息

                entity.LeaderSignList = B_PF.SetLeaderSignList(leaderSign, ucLDHuiQian.UCGetHQList());
            }

            //批准
            entity.ApproverID = ddlApprove.SelectedValue.ToString();
            entity.ApproveName = ddlApprove.SelectedItem.Text.ToString();
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_APPROVE)
            {
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    entity.ApproverIsAgree = YiJianInfoList.Count == 0 ? ConstString.ProgramFile.PROGRAM_AGREE : ConstString.ProgramFile.PROGRAM_REJECT;
                    entity.ApproveDate = DateTime.Now; //string.IsNullOrEmpty(lblApproveDate.Text) ? DateTime.Now : Convert.ToDateTime(lblApproveDate.Text.ToString());
                    string[] sendMember = OAUser.GetUserByRoleName(ConstString.RoleName.PROGRAM_ADMIN);
                    entity.SenderIDs = sendMember[0].ToString();//分发人(公办)
                    entity.Senders = sendMember[1].ToString();
                }
                else
                {
                    entity.ApproverIsAgree = string.Empty;
                }
                //批准

                entity.PiZhunList.Clear();
                foreach (CYiJian objYiJian in YiJianInfoList)
                {
                    M_ProgramFile.PiZhun approveInfo = new M_ProgramFile.PiZhun();
                    approveInfo.TBID = objYiJian.ID;
                    approveInfo.Name = objYiJian.UserName;
                    approveInfo.Comment = objYiJian.Content;
                    approveInfo.DealCondition = objYiJian.DealCondition;
                    approveInfo.SubmitDate = DateTime.Now;
                    entity.PiZhunList.Add(approveInfo);
                }
                //表单显示的批准意见信息
                if (YiJianInfoList.Count == 0)
                {
                    entity.ApproveComment = string.Empty;
                }
                else
                {
                    entity.ApproveComment = YiJianInfoList[YiJianInfoList.Count - 1].Content;
                }
            }
            //分发节点
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND)
            {
                entity.SendDate = DateTime.Now; //wfSendDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(wfSendDate.Text);
            }

            entity.ProgramSort = wfSort.Text;//程序分类
            entity.ProgramFileID = wfProgramID.Text;//程序文件ID
            entity.SerialID = wfSerialID.Text;//流水号
            entity.Year = wfYear.Text;//年份

            //质保审查
            entity.QualityIDs = wfQualityIDs.Text;//质保审查人ID
            entity.QualityNames = lblQG.ToolTip;//质保审查人
            //entity.QualityDate = lblQGDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(lblQGDate.ToolTip.ToString());
            //entity.QualityComment = lblQGComment.ToolTip;
            //发起传阅时间
            entity.CirculateDate = wfCirculateDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(wfCirculateDate.Text);
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
            {
                if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    entity.QualityIsAgree = YiJianInfoList.Count == 0 ? ConstString.ProgramFile.PROGRAM_AGREE : ConstString.ProgramFile.PROGRAM_REJECT;
                    entity.QualityDate = lblQGDate.ToolTip == string.Empty ? DateTime.Now : Convert.ToDateTime(lblQGDate.ToolTip.ToString());
                    string[] sendMember = OAUser.GetUserByRoleName(ConstString.RoleName.PROGRAM_ADMIN);
                    entity.SenderIDs = sendMember[0].ToString();//分发人(公办)
                    entity.Senders = sendMember[1].ToString();
                }
                else
                {
                    entity.QualityIsAgree = string.Empty;
                }
                //表单显示的质保意见信息
                if (YiJianInfoList.Count == 0)
                {
                    entity.QualityComment = string.Empty;
                }
                else
                {
                    entity.QualityComment = YiJianInfoList[YiJianInfoList.Count - 1].Content;
                }
                entity.QualityCheckList.Clear();
                if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                {
                    foreach (CYiJian yiJian in YiJianInfoList)
                    {
                        B_PF.QualityCheck qg = new B_PF.QualityCheck();
                        //Label lblContent = itm.FindControl("lblContent") as Label;
                        qg.Name = wfReceiveUserName.Text;
                        qg.TBID = base.IdentityID.ToString();
                        qg.Comment = yiJian.Content;
                        entity.QualityCheckList.Add(qg);
                    }
                }
                else
                {
                    foreach (CYiJian yiJian in YiJianInfoList)
                    {
                        B_PF.QualityCheck qg = new B_PF.QualityCheck();
                        //Label lblContent = itm.FindControl("lblContent") as Label;
                        qg.Name = CurrentUserInfo.DisplayName;
                        qg.TBID = base.IdentityID.ToString();
                        qg.Comment = yiJian.Content;
                        entity.QualityCheckList.Add(qg);
                    }
                }
                entity.PiZhunList = B_PF.GetPiZhunList(rptPiZhun);

                entity.DeptSignList = ucBuMenHuiQian.UCGetHQList();//部门会签
                entity.LeaderSignList = ucLDHuiQian.UCGetHQList();//领导会签
            }

            //传阅
            entity.CirculateSignUserID = hfCirculateUserID.Value;//被传阅人ID
            entity.CirculateSignUserName = txtCirculateUserName.Text;//被传阅人姓名
            entity.CirculateSignDept = txtCirculateDeptName.Text;//被传阅部门
            entity.CirculateSignDeptID = hfCirculateDeptID.Value;//被传阅部门ID

            //分发
            entity.CirculateDeptID = hfSendDeptID.Value;
            entity.CirculateID = hfSendUserID.Value;
            entity.CirculateDeptName = txtSendDeptName.Text;
            entity.CirculateName = txtSendUserName.Text;
            entity.CirculateComment = txtSendComemnt.Text;

            if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
            {
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG ||
                    base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN ||
                    base.StepName == ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN ||
                    base.StepName == ProcessConstString.StepName.ProgramFile.STEP_APPROVE)
                {
                    entity.CommentList.Clear();
                    foreach (CYiJian objYj in YiJianInfoList)
                    {
                        objYj.FinishTime = DateTime.Now.ToString();
                    }
                    entity.CommentList = YiJianInfoList;
                }
                else if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_CHECK ||
                         base.StepName == ProcessConstString.StepName.ProgramFile.STEP_AUDIT)
                {
                    //意见保存
                    CYiJian objYj = new CYiJian();
                    objYj.ID = base.IdentityID.ToString();
                    if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                    {
                        objYj.UserID = wfReceiveUserID.Text;
                        objYj.UserName = wfReceiveUserName.Text;
                    }
                    else
                    {
                        objYj.UserID = CurrentUserInfo.UserName;
                        objYj.UserName = CurrentUserInfo.DisplayName;
                    }
                    objYj.ViewName = base.StepName;//视图名称(当前流程步骤)
                    objYj.FinishTime = DateTime.Now.ToString();
                    objYj.Content = SysString.InputText(txtInfo.Text.Trim());
                    entity.CommentList.Clear();
                    entity.CommentList.Add(objYj);
                }//校核、审核
            }//非保存操作

            //交办相关
            entity.ParentTBID = wfParentTBID.Text;
            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_ASSIST_SIGN)
            {
                entity.AssistContent = txtAssistInfo.Text;
            }//协助部门会签步骤
            if (base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_ASSIGN)
            {
                entity.AssistContent = string.Empty;
            }

            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE ||
             base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG ||
             base.StepName == ProcessConstString.StepName.ProgramFile.STEP_APPROVE)
            {
                entity.AssistContent = string.Empty;
                entity.AssignedUserID = string.Empty;
                entity.AssignedUserName = string.Empty;
            }
            else
            {
                entity.AssignedUserName = string.IsNullOrEmpty(txtAssignMember.Text) ? wfAssignUserName.Text : txtAssignMember.Text;
                entity.AssignedUserID = wfAssignUserID.Text;
            }
            entity.ChildProcessID = wfChildProcessID.Text;
            if (base.SubAction != ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT &&
                (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE ||
                 base.StepName == ProcessConstString.StepName.ProgramFile.STEP_AUDIT ||
                 base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG ||
                 base.StepName == ProcessConstString.StepName.ProgramFile.STEP_APPROVE))
            {
                entity.TimesFlag = (int.Parse(string.IsNullOrEmpty(this.wfTimesFlag.Text) ? "1" : this.wfTimesFlag.Text) + 1).ToString();//次数标示
            }
            else
            {
                entity.TimesFlag = wfTimesFlag.Text;//次数标示
            }
            entity.FileList = ucFileControl.UCDataList;//附件信息

            return entity;
        }
        /// <summary>
        /// 提交按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            try
            {
                //提交动作
                string strActionName = ((Button)sender).Text.Trim();
                base.SubAction = strActionName;

                string strErrMsg = string.Empty;
                string strMessage = string.Empty;
                string strErrMessage = string.Empty;

                #region 传阅
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_CIRCULATE)
                {
                    if (string.IsNullOrEmpty(hfCirculateUserID.Value) && string.IsNullOrEmpty(hfCirculateDeptID.Value))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_CIRCULATE, true);
                        return;
                    }
                    try
                    {
                        base.Circulate(hfCirculateDeptID.Value, "0", string.Empty, hfCirculateUserID.Value, "1", true, string.Empty, false);

                        string strDay = OAConfig.GetConfig("传阅有效期", "天数");
                        int day = string.IsNullOrEmpty(strDay) ? -1 : int.Parse(strDay);
                        wfCirculateDate.Text = DateTime.Now.AddDays(day).ToString();
                        if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
                        {
                            QualityCheck();
                        }//质保审查
                        else if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_AUDIT)
                        {
                            AuditCheck();
                        }//审核
                        JScript.Alert(ConstString.PromptInfo.ACTION_CIRCULATE_SUC, true);
                        return;
                    }
                    catch (Exception ex)
                    {
                        JScript.Alert(ex.ToString(), true);
                        return;
                    }
                }
                #endregion

                #region 添加多条意见
                //添加意见按钮事件
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_ADD_COMMENT)
                {
                    this.pnlComment.Visible = true;
                    this.btnCancel.Visible = true;
                    this.btnConfirm.Visible = true;
                    this.btnAdd.Visible = false;
                    return;
                }
                //确定按钮事件
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_CONFIRM)
                {
                    if (string.IsNullOrEmpty(txtInfo2.Text.Trim()))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_ADD_COMMENT, true);
                        return;
                    }
                    if (txtInfo2.Text.Trim().Length > 500)
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_CONTENT_LEN500, true);
                        return;
                    }
                    if (string.IsNullOrEmpty(hfEditIndex.Value))
                    {
                        CYiJian objYj = new CYiJian();

                        objYj.Content = SysString.InputText(txtInfo2.Text.Trim());
                        objYj.FinishTime = DateTime.Now.ToString();
                        objYj.ID = base.IdentityID.ToString();
                        objYj.ViewName = base.StepName;

                        /*开始    流程代理         */
                        if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                        {
                            objYj.UserName = wfReceiveUserName.Text;
                            objYj.UserID = wfReceiveUserID.Text;
                        }
                        else
                        {
                            objYj.UserName = CurrentUserInfo.DisplayName;
                            objYj.UserID = CurrentUserInfo.UserName;
                        }
                        /*结束              */
                        objYj.DeptID = base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN ? B_PF.GetDeptIDByUserID(ucBuMenHuiQian.UCGetHQList(), objYj.UserID) : string.Empty;

                        YiJianInfoList.Add(objYj);
                        txtInfo2.Text = string.Empty;
                        trYiJianHead.Visible = YiJianInfoList.Count > 0 ? true : false; ;

                        rptComment.DataSource = YiJianInfoList;
                        rptComment.DataBind();
                    }//添加意见
                    else
                    {
                        int index = int.Parse(hfEditIndex.Value);
                        Label lblContent = rptComment.Items[index].FindControl("lblContent") as Label;
                        lblContent.Text = SysString.InputText(txtInfo2.Text);
                        YiJianInfoList[index].Content = lblContent.Text;

                        this.pnlComment.Visible = false;
                        this.btnCancel.Visible = false;
                        btnConfirm.Visible = false;
                        this.btnAdd.Visible = true;
                        txtInfo2.Text = string.Empty;
                        hfEditIndex.Value = string.Empty;
                    }//修改意见
                    return;
                }
                //取消按钮事件
                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_CANCLE)
                {
                    this.pnlComment.Visible = false;
                    this.btnCancel.Visible = false;
                    this.btnConfirm.Visible = false;
                    this.btnAdd.Visible = true;
                    txtInfo2.Text = string.Empty;
                    hfEditIndex.Value = string.Empty;
                    return;
                }
                #endregion

                #region 处理落实情况
                //编写节点 处理 质保、部门会签、领导会签、批准意见
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE && pnlDealSign.Visible == true)
                {
                    B_PF bllProFile = new B_PF();

                    List<M_ProgramFile.DeptSign> deptSignList = B_PF.GetDeptSignList(rptDept, ucBuMenHuiQian.UCGetHQList());//部门会签意见
                    List<M_ProgramFile.LeaderSign> leaderSignList = B_PF.GetLeaderSignList(rptLeader, ucLDHuiQian.UCGetHQList());//领导会签
                    List<M_ProgramFile.QualityCheck> qualityCheckList = B_PF.GetQualityCheckList(rptQG);//质保审查
                    List<M_ProgramFile.PiZhun> piZhunList = B_PF.GetPiZhunList(rptPiZhun);//批准意见
                    List<B_PF> entityList = B_PF.GetpfEntityList(deptSignList, leaderSignList, qualityCheckList, piZhunList);
                    if (!bllProFile.EnTransSave(entityList))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_SUBMIT_DEAL_FAIL, true);
                        return;
                    }//更新当前提交的意见落实情况

                }
                //质保审查节点 处理批准意见
                if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_QG)
                {
                    List<M_ProgramFile.PiZhun> piZhunList = B_PF.GetPiZhunList(rptPiZhun);//批准意见
                    if (piZhunList.Count > 0)
                    {
                        B_PF.UpdateApproveDealCondition(piZhunList);
                    }
                }

                #endregion

                //保存
                if (strActionName == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    B_PF bllProFile = ControlToEntity(true) as B_PF;

                    //用于提示信息
                    bllProFile.IsFormSave = true;

                    bllProFile.SubmitAction = strActionName;
                    if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_ASSIST_SIGN)
                    {
                        ReturnInfo l_objReturnInfo = FormSubmitForProFile(true, strActionName, string.Empty, FSWFStatus.Assigned.ToString(), bllProFile as EntityBase);
                        if (!l_objReturnInfo.IsSucess)
                        {
                            return;
                        }
                        JScript.Alert(ConstString.PromptInfo.ACTION_SAVE_SUC, true);
                    }
                    else
                    {
                        base.FormSubmit(true, strActionName, null, bllProFile as EntityBase);
                    }
                }
                else
                {
                    B_PF bllProFile = ControlToEntity(false) as B_PF;
                    bllProFile.IsFormSave = false;
                    bllProFile.SubmitAction = strActionName;
                    //撤销
                    if (strActionName == ProcessConstString.SubmitAction.ACTION_CANCEL)
                    {
                        base.FormCancel(bllProFile as EntityBase);
                    }
                    else
                    {
                        //验证及提示
                        bllProFile.GetSubmitMessage(base.StepName, strActionName, bllProFile, ref strErrMessage, ref strMessage);
                        if (!string.IsNullOrEmpty(strErrMessage))
                        {
                            JScript.Alert(strErrMessage, true);
                            return;
                        }

                        //表单验证
                        strErrMsg = bllProFile.SeverCheck(StepName, bllProFile);

                        if (!string.IsNullOrEmpty(strErrMsg))
                        {
                            JScript.Alert(strErrMsg, true);
                            return;
                        }
                        else
                        {
                            #region 分发节点 点击分发完成按钮 执行分发
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND &&
                                base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_SEND_COMPLETE)
                            {
                                if (string.IsNullOrEmpty(hfSendDeptID.Value) && string.IsNullOrEmpty(hfSendUserID.Value))
                                {
                                    JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_SEND, true);
                                    return;
                                }
                                try
                                {
                                    base.Circulate(hfSendDeptID.Value, "0", string.Empty, hfSendUserID.Value, "1", true, string.Empty, false);
                                }
                                catch (Exception ex)
                                {
                                    JScript.Alert(ex.ToString(), true);
                                    return;
                                }
                            }
                            #endregion

                            #region 分发节点 点击归档按钮 执行归档
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND &&
                               base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_ARCHIVE)
                            {
                                bllProFile.ProgramType1 = B_ProgramFileInfo.GetProTypeName(bllProFile.ProgramFileID);
                                bllProFile.ProgramType2 = B_ProgramFileInfo.GetProSubTypeName(bllProFile.ProgramFileID);
                                string strDeptName = OADept.GetDeptByDeptID(bllProFile.SendDeptID).Name;
                                string strRes = string.Empty;
                                try//renjinquan改
                                {
                                    string strArchiveResult = Devolve(bllProFile, strDeptName, CurrentUserInfo.DisplayName, out strRes);
                                    base.Devolved(base.ProcessID, base.TemplateName);
                                    JScript.Alert("归档成功!\\n流水号:" + strRes, true);
                                }
                                catch (Exception ex)
                                {
                                    base.WriteLog(ex.Message);
                                    JScript.Alert("归档失败!请查看配置是否正确!", true);
                                }
                                //Regex.IsMatch(strArchiveResult, @"^\d+$") ? ConstString.PromptInfo.ACTION_ARCHIVE_SUC : strArchiveResult, true);
                                return;
                            }
                            #endregion

                            #region 程序发起、分发节点 更新程序文件信息
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_WRITE)
                            {
                                ReturnInfo retInfo = B_ProgramFileInfo.GetUpdateMsg(bllProFile, ConstString.ProgramFile.PROGRAM_UNFINISHED);
                                if (retInfo.IsSucess == false)
                                {
                                    JScript.Alert(retInfo.ErrMessage, true);
                                    return;
                                }

                            }
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_SEND &&
                                base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_SEND_COMPLETE)
                            {
                                ReturnInfo retInfo = new ReturnInfo();
                                if (bllProFile.ApplyStyle == ConstString.ProgramFile.PROGRAM_DELETE)
                                {
                                    B_ProgramFileInfo bllFileInfo = new B_ProgramFileInfo();
                                    retInfo = bllFileInfo.IsLogout(bllProFile, ConstString.ProgramFile.PROGRAM_LOGOUT);
                                }//已注销
                                else
                                {
                                    retInfo = B_ProgramFileInfo.GetUpdateMsg(bllProFile, ConstString.ProgramFile.PROGRAM_ARCHIVED);
                                }//已归档
                                if (retInfo.IsSucess == false)
                                {
                                    JScript.Alert(retInfo.ErrMessage, true);
                                    return;
                                }
                            }

                            #endregion

                            Hashtable nValues = new Hashtable();

                            #region 协助会签
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN)
                            {
                                if (strActionName == ProcessConstString.SubmitAction.ProgramFile.ACTION_ASSIGN)
                                {
                                    nValues = bllProFile.GetProcNameValue(base.StepName, strActionName, bllProFile);
                                    string strSubProcInstID = GetCreateSubProcessID(ProcessConstString.TemplateName.PROGRAM_FILE_ASSIGN_SIGN, nValues);
                                    bllProFile.ChildProcessID = strSubProcInstID;
                                    ReturnInfo l_objReturnInfo = FormSubmitForProFile(false, strActionName, string.Empty, FSWFStatus.Assigned.ToString(), bllProFile as EntityBase);
                                    if (!l_objReturnInfo.IsSucess)
                                    {
                                        return;
                                    }
                                    this.ShowMsgBox(this.Page, MsgType.VbInformation, strMessage, base.EntryAction);
                                    return;
                                }//交办
                                if (!string.IsNullOrEmpty(bllProFile.ChildProcessID) && strActionName == ProcessConstString.SubmitAction.ACTION_SUBMIT)
                                {
                                    AgilePointWF ag = new AgilePointWF();
                                    WorkflowService api = ag.GetAPI();
                                    WFEvent wfEvnet = api.CancelProcInst(bllProFile.ChildProcessID);
                                    if (wfEvnet.Error != null)
                                    {
                                        JScript.Alert(wfEvnet.Error, true);
                                        return;
                                    }
                                    bllProFile.ChildProcessID = string.Empty;
                                }//存在交办子流程 继续提交 撤销子流程
                            }
                            if (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_ASSIST_SIGN)
                            {
                                if (strActionName == ProcessConstString.SubmitAction.ACTION_COMPLETE)
                                {
                                    ReturnInfo l_objReturnInfo = FormSubmitForProFile(false, strActionName, bllProFile.ParentTBID, FSWFStatus.Completed.ToString(), bllProFile as EntityBase);
                                    if (!l_objReturnInfo.IsSucess)
                                    {
                                        return;
                                    }
                                }
                                this.ShowMsgBox(this.Page, MsgType.VbInformation, strMessage, base.EntryAction);
                                return;
                            }

                            #endregion

                            //调用工作流
                            nValues = bllProFile.GetProcNameValue(base.StepName, strActionName, bllProFile);
                            base.FormSubmit(false, strActionName, nValues, bllProFile as EntityBase);
                        }
                    }
                }

                //流程节点结束提示
                if (!string.IsNullOrEmpty(strMessage))
                {
                    JScript.Alert(strMessage, true);
                }
            }
            catch (Exception ex)
            {
                JScript.Alert(ex.Message, true);
            }
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            B_LetterReceive rentity = base.EntityData != null ? base.EntityData as B_LetterReceive : new B_LetterReceive();
            switch (base.StepName)
            {
                #region 发起流程
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_INITIAL:
                    #region 函件收文基本信息
                    if (rentity.Drafter == string.Empty)
                    {
                        rentity.Drafter = CurrentUserInfo.DisplayName;
                        rentity.DrafterID = CurrentUserInfo.UserName;
                        rentity.ReceiveUserName = rentity.Drafter;
                        rentity.ReceiveUserID = rentity.DrafterID;
                    }
                    rentity.DraftDate = rentity.DraftDate.ToString() == DateTime.MinValue.ToString() ? DateTime.Now : DateTime.MinValue;
                    rentity.FileList = this.ucAttachment.UCDataList;
                    rentity.DocumentNo = this.txtReceiveNo.Text;
                    rentity.ReceiptDate = string.IsNullOrEmpty(this.txtReceiveTime.Text) ? System.DateTime.MinValue : DateTime.Parse(this.txtReceiveTime.Text);
                    rentity.UrgentDegree = this.txtUrgentDegree.Text;
                    rentity.FileEncoding = this.txtFileEncoding.Text;
                    rentity.CommunicationUnit = this.txtCommunicationUnit.Text;
                    rentity.DocumentTitle = this.txtDocumentTitle.Text;
                    rentity.Remarks = this.txtRemark.Text;
                    rentity.Pages = this.txtPageNum.Text;
                    #endregion

                    //附件
                    rentity.FileList = this.ucAttachment.UCDataList;
                    rentity.RegisterID = this.RegisterID;

                    //拟办人
                    rentity.NiBanRenName = this.txtPlotMember.Text;
                    if (!string.IsNullOrEmpty(this.txtPlotMemberID.Text) || string.IsNullOrEmpty(this.txtPlotMember.Text))
                    {
                        rentity.NiBanRen = this.txtPlotMemberID.Text;
                    }

                    //传阅领导
                    if (!string.IsNullOrEmpty(this.txtCirculateLeaderID.Text))
                    {
                        rentity.ChuanYueLeader = this.txtCirculateLeader.Text;
                        rentity.ChuanYueLeaderID = this.txtCirculateLeaderID.Text;
                    }

                    //传阅部门
                    if (!string.IsNullOrEmpty(this.txtCirculateDeptID.Text))
                    {
                        rentity.ChuanYueDept = this.txtCirculateDeptName.Text;
                        if (string.IsNullOrEmpty(rentity.ChuanYueLeaderID))
                        {
                            rentity.ChuanYueLeaderID = this.txtCirculateDeptID.Text;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(this.txtCirculateDeptID.Text))
                            {
                                rentity.ChuanYueLeaderID = rentity.ChuanYueLeaderID + "," + this.txtCirculateDeptID.Text;
                            }
                        }
                    }

                    //承办
                    if (!string.IsNullOrEmpty(this.txtUnderTakeID.Text))
                    {
                        rentity.UnderTake = this.txtUnderTake.Text;
                        rentity.UnderTakeID = this.txtUnderTakeID.Text;
                    }

                    //协办
                    if (!string.IsNullOrEmpty(this.txtAssistID.Text))
                    {
                        rentity.AssistDeptName = this.txtAssistance.Text;
                        rentity.AssistDept = this.txtAssistID.Text;
                    }

                    //传阅
                    if (!string.IsNullOrEmpty(this.txtCirculatePersonID.Text))
                    {
                        rentity.CirculateUserName = this.txtCirculatePerson.Text;
                        rentity.CirculateUserID = this.txtCirculatePersonID.Text;
                        rentity.CirculateUserComment = this.txtCirculateComment.Text;
                        this.ucAttachment.UCIsEditable = false;
                    }

                    rentity.LetterAdmin = FormsMethod.GetUserIDByViewBase(OAUser.GetUserByRole(OUConstString.RoleName.LETTER_ADMIN));
                    rentity.UnderTakeLeaders = OAUser.GetUserByDeptPostArray(rentity.UnderTakeID,null,true,true)[0];
                    //rentity.AssistMenber = FormsMethod.GetUserIDByViewBase(OAUser.GetDeptLeader(rentity.AssistDept, 0));
                    string[] strAssistMember1 = rentity.AssistDept.Split(';');
                    if (strAssistMember1.Length > 0)
                    {
                        rentity.AssistMenber = String.Empty;
                    }
                    foreach (string str in strAssistMember1)
                    {
                        rentity.AssistMenber += FormsMethod.GetUserIDByViewBase(OAUser.GetDeptManager(str, 0)) + ";";
                    }
                    if (rentity.AssistMenber.Length > 0)
                    {
                        rentity.AssistMenber = rentity.AssistMenber.Substring(0, rentity.AssistMenber.Length - 1);
                    }
                    break;
                #endregion

                #region 拟办
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_CHECK:
                    //拟办意见
                    rentity.NiBanComment = this.txtPlotComment.Text;
                    rentity.NiBanDate = string.IsNullOrEmpty(this.txtPlotTime.Text) ? System.DateTime.Now.ToString(ConstString.DateFormat.Long) : rentity.NiBanDate;
                    if (rentity.FirstDraftDate == DateTime.MinValue)
                    {
                        rentity.FirstDraftDate = DateTime.Now;
                    }

                    //传阅领导
                    if (!string.IsNullOrEmpty(this.txtCirculateLeaderID.Text))
                    {
                        rentity.ChuanYueLeader = this.txtCirculateLeader.Text;
                        rentity.ChuanYueLeaderID = this.txtCirculateLeaderID.Text;
                    }
                    //传阅部门
                    if (!string.IsNullOrEmpty(this.txtCirculateDeptID.Text))
                    {
                        rentity.ChuanYueDept = this.txtCirculateDeptName.Text;
                        if (string.IsNullOrEmpty(rentity.ChuanYueLeaderID))
                        {
                            rentity.ChuanYueLeaderID = this.txtCirculateDeptID.Text;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(this.txtCirculateDeptID.Text))
                            {
                                rentity.ChuanYueLeaderID = rentity.ChuanYueLeaderID + "," + this.txtCirculateDeptID.Text;
                            }
                        }
                    }
                    //承办
                    if (!string.IsNullOrEmpty(this.txtUnderTakeID.Text))
                    {
                        rentity.UnderTake = this.txtUnderTake.Text;
                        rentity.UnderTakeID = this.txtUnderTakeID.Text;
                    }
                    //协办
                    if (!string.IsNullOrEmpty(this.txtAssistID.Text))
                    {
                        rentity.AssistDeptName = this.txtAssistance.Text;
                        rentity.AssistDept = this.txtAssistID.Text;
                    }
                    //传阅
                    if (!string.IsNullOrEmpty(this.txtCirculatePersonID.Text))
                    {
                        rentity.CirculateUserName = this.txtCirculatePerson.Text;
                        rentity.CirculateUserID = this.txtCirculatePersonID.Text;
                        rentity.CirculateUserComment = this.txtCirculateComment.Text;
                    }
                    //公司领导
                    rentity.LeaderShipName = this.ddlLeadShip.SelectedItem.Text;
                    rentity.LeaderShip = this.ddlLeadShip.SelectedValue;
                    //rentity.LeaderShip = "hnpc\\wangran";

                    if (!IsSave && !string.IsNullOrEmpty(this.txtPlotComment.Text))
                    {
                        rentity.CommentList.Clear();
                        CYiJian l_objComment = new CYiJian();
                        l_objComment.Content = this.txtPlotComment.Text;
                        l_objComment.FinishTime = DateTime.Now.ToString();
                        l_objComment.UserID = rentity.ReceiveUserID;
                        l_objComment.UserName = rentity.ReceiveUserName;
                        l_objComment.ViewName = base.StepName;
                        //l_objComment.Action = base.SubAction;
                        rentity.CommentList.Add(l_objComment);
                    }

                    rentity.LetterAdmin = FormsMethod.GetUserIDByViewBase(OAUser.GetUserByRole(OUConstString.RoleName.LETTER_ADMIN));
                    rentity.UnderTakeLeaders = OAUser.GetUserByDeptPostArray(rentity.UnderTakeID,null,true,true)[0];
                    string[] strAssistMember = rentity.AssistDept.Split(';');
                    if (strAssistMember.Length > 0)
                    {
                        rentity.AssistMenber = String.Empty;
                    }
                    foreach (string str in strAssistMember)
                    {
                        rentity.AssistMenber += FormsMethod.GetUserIDByViewBase(OAUser.GetDeptManager(str, 0)) + ";";
                    }
                    if (rentity.AssistMenber.Length > 0)
                    {
                        rentity.AssistMenber = rentity.AssistMenber.Substring(0, rentity.AssistMenber.Length - 1);
                    }
                    break;
                #endregion

                #region 领导批示
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_INSTRUCTION:

                    if (!IsSave && !string.IsNullOrEmpty(this.txtLeaderComment.Text))
                    {
                        rentity.LS_Comment = this.txtLeaderComment.Text;
                        rentity.LS_Date = System.DateTime.Now.ToString(ConstString.DateFormat.Long);
                        rentity.LS_CommentAdd = "";
                        rentity.CommentList.Clear();
                        rentity.LS_Comment = this.txtLeaderComment.Text;
                        CYiJian l_objComment = new CYiJian();
                        l_objComment.Content = this.txtLeaderComment.Text;
                        l_objComment.FinishTime = DateTime.Now.ToString();
                        l_objComment.UserID = rentity.ReceiveUserID;
                        l_objComment.UserName = rentity.ReceiveUserName;
                        l_objComment.ViewName = base.StepName;
                        //l_objComment.Action = base.SubAction;
                        rentity.CommentList.Add(l_objComment);
                    }
                    else
                    {
                        rentity.LS_CommentAdd = this.txtLeaderComment.Text;
                    }
                    break;
                #endregion

                #region 协办
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_HELP_DIRECTOR:
                    //传阅
                    rentity.AssistMenber = rentity.ReceiveUserID;
                    rentity.CirculateUserName = this.txtCirculatePerson.Text;
                    rentity.CirculateUserID = this.txtCirculatePersonID.Text;
                    rentity.CirculateUserComment = this.txtCirculateComment.Text;
                    break;
                #endregion

                #region 处室承办
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_DIRECTOR:
                    //处室承办领导
                    rentity.UnderTakeLeaders = rentity.ReceiveUserID;
                    rentity.UDDeptLeadName = rentity.ReceiveUserName;
                    rentity.UnderTake_Comment = this.txtUnderTakeComment.Text;
                    rentity.UDDeptLeadNameTime = System.DateTime.Now.ToString(ConstString.DateFormat.Long);
                    //承办科室
                    if (base.SubAction == ProcessConstString.SubmitAction.LetterReceiveAction.ACTION_JBKS)
                    {
                        rentity.IsChuShiToPeople = false;
                        rentity.UDSectionLeadName = this.txtUDSectionLeader.Text;
                        if (!string.IsNullOrEmpty(this.txtAssignID.Text) || string.IsNullOrEmpty(this.txtUDSectionLeader.Text))
                        {
                            rentity.UDSectionLeadID = this.txtAssignID.Text;
                        }
                    }
                    if (!string.IsNullOrEmpty(this.txtShiefID.Text))
                    {
                        rentity.UDSection = this.txtShiefID.Text;
                    }
                    //rentity.UDSectionLeadID = "hnpc\\wangran";
                    //人员承办
                    if (base.SubAction == ProcessConstString.SubmitAction.LetterReceiveAction.ACTION_JBRY)
                    {
                        rentity.IsChuShiToPeople = true;
                        rentity.UDSectionPeopleName = this.txtUDPeople.Text;
                        if (!string.IsNullOrEmpty(this.txtAssignPersonID.Text) || string.IsNullOrEmpty(this.txtUDPeople.Text))
                        {
                            rentity.UDSectionPeopleID = this.txtAssignPersonID.Text;
                        }
                    }
                    //rentity.UDSectionPeopleID = "hnpc\\wangran";
                    //传阅
                    if (!string.IsNullOrEmpty(this.txtCirculatePersonID.Text))
                    {
                        rentity.CirculateUserName = this.txtCirculatePerson.Text;
                        rentity.CirculateUserID = this.txtCirculatePersonID.Text;
                        rentity.CirculateUserComment = this.txtCirculateComment.Text;
                    }
                    if (string.IsNullOrEmpty(rentity.LetterAdmin))
                    {
                        rentity.LetterAdmin = FormsMethod.GetUserIDByViewBase(OAUser.GetUserByRole(OUConstString.RoleName.LETTER_ADMIN));
                    }
                    goto Default1;
                #endregion

                #region 科室承办
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_CHIEF:
                    if (rentity.DraftDate < base.OAStartTime && string.IsNullOrEmpty(rentity.UnderTakeLeaders))
                    {
                        rentity.UnderTakeLeaders = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_DIRECTOR, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                    }
                    rentity.UDSectionLeadID = rentity.ReceiveUserID;
                    rentity.UDSectionLeadName =rentity.ReceiveUserName;
                    rentity.UnderTake_Comment = this.txtUnderTakeComment.Text;
                    rentity.UDSectionLeadNameTime = System.DateTime.Now.ToString(ConstString.DateFormat.Long);

                    //人员承办
                    rentity.UDSectionPeopleName = this.txtUDPeople.Text;
                    if (!string.IsNullOrEmpty(this.txtAssignPersonID.Text) || string.IsNullOrEmpty(this.txtUDPeople.Text))
                    {
                        rentity.UDSectionPeopleID = this.txtAssignPersonID.Text;
                    }
                    //传阅
                    if (!string.IsNullOrEmpty(this.txtCirculatePersonID.Text))
                    {
                        rentity.CirculateUserName = this.txtCirculatePerson.Text;
                        rentity.CirculateUserID = this.txtCirculatePersonID.Text;
                        rentity.CirculateUserComment = this.txtCirculateComment.Text;
                    }
                    goto Default1;
                #endregion

                #region 人员承办
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_MEMBER:
                    if (rentity.DraftDate < base.OAStartTime && string.IsNullOrEmpty(rentity.UDSectionLeadID))
                    {
                        rentity.UDSectionLeadID = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_CHIEF, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                        if (string.IsNullOrEmpty(rentity.UDSectionLeadID))
                        {
                            rentity.IsChuShiToPeople = true;
                            rentity.UnderTakeLeaders = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_DIRECTOR, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                        }
                        else
                        {
                            rentity.IsChuShiToPeople = false;
                        }
                    }
                    rentity.UnderTake_Comment = this.txtUnderTakeComment.Text;
                    rentity.UDSectionPeopleNameTime = System.DateTime.Now.ToString(ConstString.DateFormat.Long);

                Default1: if (!IsSave)
                    {
                        rentity.CommentList.Clear();
                        rentity.UnderTake_Comment = this.txtUnderTakeComment.Text;
                        CYiJian l_objComment = new CYiJian();
                        l_objComment.Content = this.txtUnderTakeComment.Text;
                        l_objComment.FinishTime = DateTime.Now.ToString();
                        l_objComment.UserID = rentity.ReceiveUserID;
                        l_objComment.UserName = rentity.ReceiveUserName;
                        l_objComment.ViewName = base.StepName;
                        //l_objComment.Action = base.SubAction;
                        rentity.CommentList.Add(l_objComment);
                    }
                break;
                #endregion

                #region 函件管理员处理
                case ProcessConstString.StepName.LetterReceiveStepName.STEP_LETTER_ADMIN:
                //附件
                rentity.FileList = this.ucAttachment.UCDataList;
                //补偿老版oa处室承办人数据
                if (rentity.DraftDate < base.OAStartTime && string.IsNullOrEmpty(rentity.UnderTakeLeaders))
                {
                    rentity.UnderTakeLeaders = FormsMethod.GetReceiveUserID(base.ProcessID, ProcessConstString.StepName.LetterReceiveStepName.STEP_SECTION_DIRECTOR, "", ProcessConstString.StepStatus.STATUS_COMPLETED);
                }
                //传阅
                if (!string.IsNullOrEmpty(this.txtCirculatePersonID.Text))
                {
                    rentity.CirculateUserName = this.txtCirculatePerson.Text;
                    rentity.CirculateUserID = this.txtCirculatePersonID.Text;
                    rentity.CirculateUserComment = this.txtCirculateComment.Text;
                }
                rentity.LetterAdmin =rentity.ReceiveUserID;

                break;
                #endregion
            }
            return rentity;
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            EntityLetterSend entity = null;
            entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();

            entity.DocumentTitle = txtSubject.Text;
            entity.ccCompany = txtccCompany.Text;
            entity.company = txtCompany.Text;
            entity.company1 = txtCompany.Text;
            //entity.content = SysString.TextToHtmlCode(txtContent.Text);
            entity.content = txtContent.Text;

            entity.pages = txtPages.Text;

            entity.subject = txtSubject.Text;
            entity.title = txtTitle.Text;
            entity.to = txtTo.Text;
            entity.yourRef = txtYourRef.Text;
            entity.jinJi = chkJinJi.Checked;
            entity.UrgentDegree = chkJinJi.Checked ? ConstString.CommonStr.Urgent : ConstString.CommonStr.Normal;
            entity.huiZhi = chkHuiZhi.Checked;
            entity.ccDept = txtccDept.Text;
            entity.ccDeptIDs = this.txtccDeptIDs.Text;
            entity.ccLeader = txtccLeader.Text;
            entity.companyID = txtCompanyID.Text;

            //流程数据和隐藏数据
            entity.deptLeaderIDs = txtDeptLeaderIDs.Text;

            entity.ccLeaderIDs = txtccLeaderIDs.Text;
            entity.wfChuanYueRenIDs = wfChuanYueRenIDs.Text;

            if (wfChuanYueRenIDs.Text != "")
            {
                string[] strCYarr = wfChuanYueRenIDs.Text.Split(';');

                for (int i = 0; i < strCYarr.Length; i++)
                {
                    ChuanYues cy = new ChuanYues();
                    bool isHas = false;
                    for (int j = 0; j < entity.chuanyues.Count; j++)
                    {
                        if (entity.chuanyues[j].UserID.ToLower() == strCYarr[i].ToLower())
                        {
                            isHas = true;
                        }
                    }
                    if (!isHas)
                    {
                        cy.UserID = strCYarr[i];
                        cy.UserName = OAUser.GetUserName(strCYarr[i]);
                        cy.Date = DateTime.Now.ToShortDateString();
                        entity.chuanyues.Add(cy);
                    }
                }
            }
            //附件数据绑定
            entity.FileList = this.ucAttachment.UCDataList;

            //函件类型
            entity.hanJian1 = drpHanJian.SelectedItem == null ? "" : drpHanJian.SelectedItem.Text;
            entity.hanJianID1 = drpHanJian.SelectedValue == null ? "" : drpHanJian.SelectedValue;

            //add
            entity.equipmentCode1 = this.txtEquipmentCode.Text;
            entity.contractNo1 = this.txtContractNo.Text;

            //意见
            if (IsSave == false)
            {
                entity.isSave = false;
                CYiJian so = new CYiJian();
                so.UserID = entity.ReceiveUserID == string.Empty ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                so.UserName = entity.ReceiveUserName == string.Empty ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                so.ViewName = base.StepName;
                so.FinishTime = DateTime.Now.ToString();
                so.Content = "(" + base.SubAction + ")" + txtComment.Text;
                entity.yiJian.Add(so);
            }
            else
            {
                entity.isSave = true;
                entity.syiJian = txtComment.Text;
            }

            switch (base.StepName)
            {
                case ProcessConstString.StepName.LetterSend.发起函件:

                    //核稿
                    entity.heGaoRen = txtHeGaoRen.Text;
                    entity.wfHeGaoRenID = wfHeGaoRenID.Text;
                    //会签
                    entity.huiQianRen = txtHuiQianRen.Text;
                    entity.wfHuiQianRenIDs = wfHuiQianRenIDs.Text;
                    //签发
                    entity.qianFaRen = txtQianFaRen.Text;
                    entity.wfQianFaRenID = wfQianFaRenID.Text;

                    if (txtNiGaoRenDate.Text.Trim() == "") //不是第一次
                    {
                        //发起人
                        if (IsSave == false)
                        {
                            entity.UserDate = DateTime.Now.ToString();
                            entity.niGaoRenDate = (entity.niGaoRenDate == string.Empty ? CurrentUserInfo.DisplayName : entity.ReceiveUserName) + " " + entity.UserDate;
                            entity.DraftDate = SysConvert.ToDateTime(entity.UserDate);
                        }
                        if (entity.Drafter == string.Empty)
                        {
                            entity.Drafter = CurrentUserInfo.DisplayName;
                            entity.DrafterID = CurrentUserInfo.UserName;
                            entity.wfFaQiRenID = CurrentUserInfo.UserName;
                        }
                    }
                    if (base.SubAction == "提交会签" || base.SubAction == "提交签发") //如果是被退回的 再次提交会签 不经过核稿 则清空核稿人和核稿日期
                    {
                        if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                        {
                            entity.heGaoRen = "";
                            entity.heGaoRenDate = "";
                            entity.wfHeGaoRenID = "";
                            entity.heGaoYiJian = "";
                        }
                        else
                        {
                            entity.heGaoRen = txtHeGaoRen.Text;
                            entity.wfHeGaoRenID = wfHeGaoRenID.Text;
                        }
                    }
                    if (base.SubAction == "提交签发") //如果是被退回的 再次提交签发 不经过会签 则清空会签人和会签日期
                    {
                        if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                        {
                            entity.huiqianDates = "";
                            entity.huiQianRen = "";
                            entity.huiQian.Clear();
                        }
                    }

                    //发文部门
                    entity.sendDept1 = drpSendDept.SelectedItem == null ? "" : drpSendDept.SelectedItem.Text;
                    entity.sendDeptID1 = drpSendDept.SelectedValue;

                    //是否会签驳回
                    entity.isHuiQianBoHui = false;
                    if (base.SubAction == "提交会签")
                    {
                        entity.iHuiQianCount = entity.iHuiQianCount + 1;
                    }
                    break;
                case ProcessConstString.StepName.LetterSend.核稿:
                    //核稿
                    entity.heGaoRen = entity.ReceiveUserName;
                    if (IsSave == false)
                    {
                        entity.heGaoRenDate = DateTime.Now.ToString();
                    }
                    entity.heGaoYiJian = txtComment.Text;

                    //会签
                    entity.huiQianRen = txtHuiQianRen.Text;
                    entity.wfHuiQianRenIDs = wfHuiQianRenIDs.Text;

                    //签发
                    entity.qianFaRen = txtQianFaRen.Text;
                    entity.wfQianFaRenID = wfQianFaRenID.Text;
                    if (base.SubAction == "提交会签")
                    {
                        entity.iHuiQianCount = entity.iHuiQianCount + 1;
                    }
                    if (base.SubAction == "提交签发") //如果是被核稿退回的 再次提交签发 不经过会签 则清空会签人和会签日期
                    {
                        if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                        {
                            entity.huiqianDates = "";
                            entity.huiQianRen = "";
                            entity.huiQian.Clear();
                        }
                    }
                    break;
                case ProcessConstString.StepName.LetterSend.会签:
                    if (IsSave == false)
                    {
                        if (entity.huiqianDates == "")
                            entity.huiqianDates = entity.ReceiveUserName + " " + DateTime.Now.ToString(DateFormat);
                        else
                            entity.huiqianDates = entity.huiqianDates + ";" + entity.ReceiveUserName + " " + DateTime.Now.ToString(DateFormat);

                        HanJianHuiQian hjhq = new HanJianHuiQian();
                        hjhq.UserID = entity.ReceiveUserID;
                        hjhq.UserName = entity.ReceiveUserName;
                        hjhq.Date = DateTime.Now;
                        hjhq.YiJian = txtComment.Text;
                        hjhq.ICount = entity.iHuiQianCount;
                        entity.huiQian.Add(hjhq);
                    }
                    //签发
                    entity.qianFaRen = txtQianFaRen.Text;
                    entity.wfQianFaRenID = wfQianFaRenID.Text;

                    if (base.SubAction == "退回")
                    {
                        entity.isHuiQianBoHui = true;
                    }
                    break;
                case ProcessConstString.StepName.LetterSend.签发:
                    if (IsSave == false)
                    {
                        if (base.SubAction != "退回")
                            entity.signDate = DateTime.Now.ToString(DateFormat);
                    }
                    entity.HanJianAdminID = OAUser.GetUserByRoleName("函件管理员")[0];
                    entity.HanJianAdmin = OAUser.GetUserByRoleName("函件管理员")[1];
                    break;
                case ProcessConstString.StepName.LetterSend.函件分发:
                    entity.ourRef = txtOurRef.Text;
                    entity.DocumentNo = txtOurRef.Text;
                    break;
                case ProcessConstString.StepName.LetterSend.二次分发:
                    break;
                default: break;
            }

            return entity;
        }
示例#14
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindData()
        {
            if (UCHQList.Count > 0)
            {
                M_ProgramFile.DeptSign info = new M_ProgramFile.DeptSign();
                for (int i = 0; i < UCHQList.Count; i++)
                {
                    info = (M_ProgramFile.DeptSign)UCHQList[i];
                    Count++;
                    LoadUserControl(Count, false);

                    //TBID
                    Label lblTBID = this.PlaceHolder1.Controls[i].FindControl("lblTBID") as Label;
                    lblTBID.Text = info.TBID;

                    //部门ID
                    DropDownList drpDept = PlaceHolder1.Controls[i].FindControl("drpDept") as DropDownList;

                    Label lbDept = PlaceHolder1.Controls[i].FindControl("lbDept") as Label;
                    lbDept.Text = info.DeptName;

                    FormsMethod.SelectedDropDownList(drpDept, info.DeptID, info.DeptName);

                    //会签人ID
                    Label lblUserID = this.PlaceHolder1.Controls[i].FindControl("lblUserID") as Label;
                    lblUserID.Text = info.ID;
                    //会签人
                    Label lblUserName = this.PlaceHolder1.Controls[i].FindControl("lblUserName") as Label;
                    lblUserName.Text = info.Name;

                    if (!string.IsNullOrEmpty(info.IsAgree))
                    {
                        drpDept.Enabled  = false;
                        drpDept.CssClass = "dropdownlist_blue";
                        CheckBox cb = this.PlaceHolder1.Controls[i].FindControl("cb") as CheckBox;
                        if (UCIsAllowDel && UCIsDisEnable == false)
                        {
                            cb.Enabled = true;           //显示是否参加会签的checkbox
                            cb.Checked = info.IsExclude; //设置checkbox的状态
                            //cb.Enabled = !UCIsDisEnable;
                        }//部门会签控件允许删除并且可用
                        else
                        {
                            cb.Enabled = false;          //隐藏是否参加会签的checkbox
                            cb.Checked = info.IsExclude; //设置checkbox的状态
                        }//不可用
                    }//已通过会签则不可重新选择


                    Label lblDate1 = this.PlaceHolder1.Controls[i].FindControl("lblDate1") as Label;
                    if (info.SubmitDate != DateTime.MinValue)
                    {
                        //会签日期
                        lblDate1.Text    = info.SubmitDate.ToString(DateFormat);
                        lblDate1.ToolTip = info.SubmitDate.ToString();

                        lbDept.Text     = info.DeptName;
                        lbDept.Visible  = true;
                        drpDept.Visible = false;
                    }
                    else
                    {
                        lblDate1.Text   = "";
                        lbDept.Visible  = false;
                        drpDept.Visible = true;
                    }

                    //意见
                    Label lblYiJian = this.PlaceHolder1.Controls[i].FindControl("lblYiJian") as Label;
                    lblYiJian.ToolTip = info.Comment;
                    lblYiJian.Text    = SysString.TruncationString(info.Comment, 20);

                    //是否同意
                    Label lblTongYi = this.PlaceHolder1.Controls[i].FindControl("lblTongYi") as Label;
                    lblTongYi.Text = info.IsAgree;

                    ////落实情况
                    //TextBox txtDealCondition = this.PlaceHolder1.Controls[i].FindControl("txtDealCondition2") as TextBox;
                    //txtDealCondition.Text = info.DealCondition;

                    HiddenField hfLuoShi = this.PlaceHolder1.Controls[i].FindControl("hfLuoShi") as HiddenField;
                    hfLuoShi.Value = info.DealCondition;

                    //处理落实日期
                    Label lblDate2 = this.PlaceHolder1.Controls[i].FindControl("lblDate2") as Label;
                    if (info.DealDate != DateTime.MinValue)
                    {
                        lblDate2.Text = info.DealDate.ToShortDateString();
                    }
                    else
                    {
                        lblDate2.Text = "";
                    }
                    //绑定会签意见、落实情况///////////
                    Repeater rptCurrentList = this.PlaceHolder1.Controls[i].FindControl("rptCurrentList") as Repeater;//主键ID
                    Label    lblComment     = this.PlaceHolder1.Controls[i].FindControl("lblComment") as Label;
                    lblComment.Text = SysString.TruncationString(info.Comment, 20);

                    List <CYiJian> yiJianList = new List <CYiJian>();
                    foreach (B_PF.DetailInfo detailInfo in info.DetailInfoList)
                    {
                        CYiJian yiJian = new CYiJian();

                        yiJian.Content       = detailInfo.Comment;
                        yiJian.DealCondition = detailInfo.DealCondition;
                        yiJian.FinishTime    = info.SubmitDate.ToString();
                        yiJian.ID            = info.TBID;
                        yiJian.ViewName      = ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN;
                        yiJian.UserName      = info.Name;
                        yiJian.UserID        = info.ID;
                        yiJianList.Add(yiJian);
                    }
                    rptCurrentList.DataSource = yiJianList;
                    rptCurrentList.DataBind();

                    if (!this.IsHistory && this.UCReceiveUserID == info.ID)
                    {
                        lblDate1.Visible   = false;
                        lblYiJian.Visible  = false;
                        lblTongYi.Visible  = false;
                        lblComment.Visible = false;
                    }
                }
            }
            HiddenField hfDeptSignCount = this.Parent.Parent.FindControl("hfDeptSignCount") as HiddenField;

            if (hfDeptSignCount != null)
            {
                hfDeptSignCount.Value = UCHQList.Count.ToString();
            }
        }
        /// <summary>
        /// 提交按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            try
            {
                //提交动作
                base.SubAction = ((Button)sender).Text.Trim();

                string strErrorMessage = string.Empty;

                #region 添加多条意见
                //添加意见按钮事件
                if (base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_ADD_COMMENT)
                {
                    this.pnlComment.Visible = true;
                    this.btnCancel1.Visible = true;
                    this.btnConfirm.Visible = true;
                    this.btnAdd.Visible = false;
                    return;
                }
                //确定按钮事件
                if (base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_CONFIRM)
                {
                    if (string.IsNullOrEmpty(txtInfo2.Text.Trim()))
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_ADD_COMMENT, true);
                        return;
                    }
                    if (txtInfo2.Text.Trim().Length > 100)
                    {
                        JScript.Alert(ConstString.PromptInfo.ACTION_CHECK_CONTENT_LEN100, true);
                        return;
                    }
                    if (string.IsNullOrEmpty(hfEditIndex.Value))
                    {
                        CYiJian objYj = new CYiJian();

                        objYj.Content = SysString.InputText(txtInfo2.Text.Trim());
                        objYj.FinishTime = DateTime.Now.ToString();
                        objYj.ID = base.IdentityID.ToString();
                        objYj.ViewName = base.StepName;

                        /*开始    流程代理         */
                        if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                        {
                            objYj.UserName = wfReceiveUserName.Text;
                            objYj.UserID = wfReceiveUserID.Text;
                        }
                        else
                        {
                            objYj.UserName = CurrentUserInfo.DisplayName;
                            objYj.UserID = CurrentUserInfo.UserName;
                        }
                        /*结束              */
                        objYj.DeptID = base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN ? B_WorkRelation.GetDeptIDByUserID(ucBuMenHuiQian.UCGetHQList(), objYj.UserID) : string.Empty;

                        YiJianInfoList.Add(objYj);
                        txtInfo2.Text = string.Empty;
                        trYiJianHead.Visible = YiJianInfoList.Count > 0 ? true : false; ;

                        rptComment.DataSource = YiJianInfoList;
                        rptComment.DataBind();
                    }//添加意见
                    else
                    {
                        int index = int.Parse(hfEditIndex.Value);
                        Label lblContent = rptComment.Items[index].FindControl("lblContent") as Label;
                        lblContent.Text = SysString.InputText(txtInfo2.Text);
                        YiJianInfoList[index].Content = lblContent.Text;

                        this.pnlComment.Visible = false;
                        this.btnCancel.Visible = false;
                        btnConfirm.Visible = false;
                        this.btnAdd.Visible = true;
                        txtInfo2.Text = string.Empty;
                        hfEditIndex.Value = string.Empty;
                    }//修改意见
                    return;
                }
                //取消按钮事件
                if (base.SubAction == ProcessConstString.SubmitAction.ProgramFile.ACTION_CANCLE)
                {
                    this.pnlComment.Visible = false;
                    this.btnCancel1.Visible = false;
                    this.btnConfirm.Visible = false;
                    this.btnAdd.Visible = true;
                    txtInfo2.Text = string.Empty;
                    hfEditIndex.Value = string.Empty;
                    return;
                }
                #endregion

                //#region 处理落实情况
                ////编写节点 处理 质保、部门会签、领导会签、批准意见
                //if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && pnlDealSign.Visible == true)
                //{
                //    B_WorkRelation bWorkRelation = new B_WorkRelation();

                //    List<M_WorkRelation.DeptSign> deptSignList = B_WorkRelation.GetDeptSignList(rptDept, ucBuMenHuiQian.UCGetHQList());//部门会签意见
                //    List<B_WorkRelation> entityList = B_WorkRelation.GetpfEntityList(deptSignList);
                //    if (!bWorkRelation.EnTransSave(entityList))
                //    {
                //        JScript.Alert(ConstString.PromptInfo.ACTION_SUBMIT_DEAL_FAIL, true);
                //        return;
                //    }//更新当前提交的意见落实情况

                //}
                //#endregion

                //保存
                if (base.SubAction == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT)
                {
                    B_WorkRelation entity = ControlToEntity(true) as B_WorkRelation;
                    entity.SubmitAction = base.SubAction;
                    base.FormSubmit(true, base.SubAction, null, entity);
                }
                else
                {
                    B_WorkRelation entity = ControlToEntity(false) as B_WorkRelation;
                    entity.SubmitAction = base.SubAction;

                    //撤销
                    if (base.SubAction == ProcessConstString.SubmitAction.ACTION_CANCEL)
                    {
                        base.FormCancel(entity);
                    }
                    else
                    {
                        //返回验证提示和流程提示
                        entity.GetSubmitMessage(base.StepName, base.SubAction, ref strErrorMessage);
                        if (!string.IsNullOrEmpty(strErrorMessage))
                        {
                            JScript.Alert(strErrorMessage, false);
                            return;
                        }
                        else
                        {
                            switch (base.StepName)
                            {
                                case ProcessConstString.StepName.STEP_DRAFT:
                                    if (base.SubAction == ProcessConstString.SubmitAction.WorkRelationAction.ACTION_TJQF)
                                    {
                                        if (!string.IsNullOrEmpty(entity.HeGaoRenID))
                                        {
                                            if (!B_WorkRelation.IsHaveChecked(base.ProcessID, entity.HeGaoRenID))
                                            {
                                                JScript.Alert("核稿人未处理过核稿,请提交核稿或清空核稿人", false);
                                                return;
                                            }
                                        }
                                    }
                                    break;

                                case ProcessConstString.StepName.WorkRelationStepName.STEP_SIGN:
                                    if (base.SubAction == ProcessConstString.SubmitAction.WorkRelationAction.ACTION_QF &&
                                       (!string.IsNullOrEmpty(entity.ChaoSongBuMenID) || !string.IsNullOrEmpty(entity.ChaoSongID)))
                                    {
                                        base.Circulate(entity.ChaoSongBuMenID, "1", string.Empty, entity.ChaoSongID, "1", false, string.Empty, false);
                                    }
                                    break;

                                case ProcessConstString.StepName.WorkRelationStepName.STEP_DIRECTOR:
                                    if (base.SubAction == ProcessConstString.SubmitAction.ACTION_COMPLETE)
                                    {
                                        //传阅给编校审及“抄送”
                                        base.Circulate(entity.ChaoSongBuMenID, "1", string.Empty, FormsMethod.FilterRepeat(entity.ChaoSongID + ";" +
                                            entity.DrafterID + ";" + entity.HeGaoRenID + ";" + entity.FuZeRenID), "1", true, string.Empty, false);

                                        //工作联系单归档
                                        //Devolve();
                                    }
                                    //处室承办可选传阅
                                    else if (!string.IsNullOrEmpty(entity.ChuanYueRenYuanID))
                                    {
                                        base.Circulate(string.Empty, string.Empty, string.Empty, entity.ChuanYueRenYuanID, "1", false, string.Empty, false);
                                    }
                                    break;

                                case ProcessConstString.StepName.WorkRelationStepName.STEP_CHIEF:
                                    if (!string.IsNullOrEmpty(entity.ChuanYueRenYuanID))
                                    {
                                        base.Circulate(string.Empty, string.Empty, string.Empty, entity.ChuanYueRenYuanID, "1", false, string.Empty, false);
                                    }
                                    break;

                                case ProcessConstString.StepName.WorkRelationStepName.STEP_MEMBER:
                                    if (!string.IsNullOrEmpty(entity.ChuanYueRenYuanID))
                                    {
                                        base.Circulate(string.Empty, string.Empty, string.Empty, entity.ChuanYueRenYuanID, "1", false, string.Empty, false);
                                    }
                                    break;
                            }

                            //调用工作流
                            Hashtable nValues = entity.GetProcNameValue(base.StepName, base.SubAction);
                            base.FormSubmit(false, base.SubAction, nValues, entity);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                JScript.Alert(ex.Message, false);
                return;
            }
        }
示例#16
0
        private void BindData()
        {
            if (UCHQList.Count > 0)
            {
                M_ProgramFile.LeaderSign info = new M_ProgramFile.LeaderSign();
                for (int i = 0; i < UCHQList.Count; i++)
                {
                    info = (M_ProgramFile.LeaderSign)UCHQList[i];
                    Count++;
                    LoadUserControl(false, Count);

                    //TBID
                    Label lblTBID = this.PlaceHolder1.Controls[i].FindControl("lblTBID") as Label;
                    lblTBID.Text = info.TBID;

                    //会签人ID
                    DropDownList drpUser = PlaceHolder1.Controls[i].FindControl("drpUser") as DropDownList;
                    Label        lbUser  = PlaceHolder1.Controls[i].FindControl("lbUser") as Label;

                    lbUser.Text = info.Name;

                    FormsMethod.SelectedDropDownList(drpUser, info.ID, info.Name);

                    //是否同意
                    Label lblTongYi = this.PlaceHolder1.Controls[i].FindControl("lblTongYi") as Label;
                    lblTongYi.Text = info.IsAgree;

                    if (!string.IsNullOrEmpty(info.IsAgree))
                    {
                        drpUser.Enabled  = false;
                        drpUser.CssClass = "dropdownlist_blue";
                    }//已通过会签则不可重新选择

                    //会签日期
                    Label lblDate1 = this.PlaceHolder1.Controls[i].FindControl("lblDate1") as Label;
                    if (info.Date != DateTime.MinValue)
                    {
                        lblDate1.Text    = info.Date.ToString(DateFormat);
                        lblDate1.ToolTip = info.Date.ToString();

                        lbUser.Text     = info.Name;
                        lbUser.Visible  = true;
                        drpUser.Visible = false;
                    }
                    else
                    {
                        lblDate1.Text   = "";
                        lbUser.Visible  = false;
                        drpUser.Visible = true;
                    }

                    //意见
                    Label lblYiJian = this.PlaceHolder1.Controls[i].FindControl("lblYiJian") as Label;
                    lblYiJian.ToolTip = info.Comment;
                    lblYiJian.Text    = SysString.TruncationString(info.Comment, 20);

                    ////落实情况
                    //TextBox txtDealCondition = this.PlaceHolder1.Controls[i].FindControl("txtDealCondition") as TextBox;
                    //txtDealCondition.Text = info.DealCondition;

                    HiddenField hfLuoShi = this.PlaceHolder1.Controls[i].FindControl("hfLuoShi") as HiddenField;
                    hfLuoShi.Value = info.DealCondition;

                    //处理落实日期
                    Label lblDate2 = this.PlaceHolder1.Controls[i].FindControl("lblDate2") as Label;
                    if (info.DealDate != DateTime.MinValue)
                    {
                        lblDate2.Text = info.DealDate.ToShortDateString();
                    }
                    else
                    {
                        lblDate2.Text = "";
                    }

                    //绑定会签意见、落实情况//
                    Repeater rptCurrentList = this.PlaceHolder1.Controls[i].FindControl("rptCurrentList") as Repeater;//主键ID
                    Label    lblComment     = this.PlaceHolder1.Controls[i].FindControl("lblComment") as Label;
                    lblComment.Text = SysString.TruncationString(info.Comment, 20);
                    List <CYiJian> yiJianList = new List <CYiJian>();
                    foreach (B_PF.DetailInfo detailInfo in info.DetailInfoList)
                    {
                        CYiJian yiJian = new CYiJian();

                        yiJian.Content       = detailInfo.Comment;
                        yiJian.DealCondition = detailInfo.DealCondition;
                        yiJian.FinishTime    = info.Date.ToString();
                        yiJian.ID            = info.TBID;
                        yiJian.ViewName      = ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN;
                        yiJian.UserName      = info.Name;
                        yiJian.UserID        = info.ID;
                        yiJianList.Add(yiJian);
                    }
                    rptCurrentList.DataSource = yiJianList;
                    rptCurrentList.DataBind();
                    if (!this.IsHistory && this.UCReceiveUserID == info.ID)
                    {
                        lblDate1.Visible   = false;
                        lblYiJian.Visible  = false;
                        lblTongYi.Visible  = false;
                        lblComment.Visible = false;
                    }
                }
            }
            HiddenField hfLeaderSignCount = this.Parent.Parent.FindControl("hfLeaderSignCount") as HiddenField;

            if (hfLeaderSignCount != null)
            {
                hfLeaderSignCount.Value = UCHQList.Count.ToString();
            }
        }
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_WorkRelation entity = base.EntityData != null ? base.EntityData as B_WorkRelation : new B_WorkRelation();

            if (entity != null)
            {
                this.wfTimesFlag.Text = entity.TimesFlag;//次数标示

                //附件
                ucAttachment.UCDataList = entity.FileList;

                //主送
                if ((base.StepName == ProcessConstString.StepName.STEP_DRAFT ||
                    base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_CHECK ||
                    base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_SIGN) && !base.IsPreview)
                {
                    OADept.GetDeptByIfloor(this.ddlZhuSong, 1);
                    FormsMethod.SelectedDropDownList(this.ddlZhuSong, entity.MainSendDeptID);
                }
                else
                {
                    FormsMethod.SetDropDownList(this.ddlZhuSong, entity.MainSendDeptID, entity.MainSend);
                }

                //编制部门
                if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
                {
                    OADept.GetDeptByUser(this.ddlBianZhiBuMen, string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID, 1, true, false);

                    FormsMethod.SelectedDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID);
                }
                else
                {
                    FormsMethod.SetDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID, entity.Department);
                }

                //部门负责人
                if (base.StepName == ProcessConstString.StepName.STEP_DRAFT ||
                    base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_CHECK && !base.IsPreview)
                {
                    if (this.ddlBianZhiBuMen.Items.Count > 0)
                    {
                        OAUser.GetUserByDeptPost(this.ddlFuZeRen, this.ddlBianZhiBuMen.SelectedValue, OUConstString.PostName.FUCHUZHANG, true, true);
                    }
                    FormsMethod.SelectedDropDownList(this.ddlFuZeRen, entity.FuZeRenID);
                }
                else
                {
                    FormsMethod.SetDropDownList(this.ddlFuZeRen, entity.FuZeRenID, entity.DeptPrincipal);
                }

                //承办
                if (base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_DIRECTOR && !base.IsPreview)
                {
                    OADept.GetChildDept(this.ddlKeShiLingDao, entity.MainSendDeptID, 2, true, true);
                    OAUser.GetUserByDeptID(this.ddlChengBanRen, entity.MainSendDeptID, -1);
                    FormsMethod.SelectedDropDownList(this.ddlKeShiLingDao, entity.KeShiID);
                    FormsMethod.SelectedDropDownList(this.ddlChengBanRen, entity.ChengBanRenID);

                    //部门领导
                    this.txtBuMenLingDao.Text = entity.DeptLeader;
                }
                else if (base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_CHIEF && !base.IsPreview)
                {
                    OAUser.GetUserByDeptID(this.ddlChengBanRen, entity.KeShiID, 1);
                    FormsMethod.SelectedDropDownList(this.ddlChengBanRen, entity.ChengBanRenID);
                    FormsMethod.SetDropDownList(this.ddlKeShiLingDao, entity.KeShiLingDaoID, entity.SectionLeader);

                    this.txtBuMenLingDao.Text = entity.DeptLeader;
                }
                else
                {
                    this.txtBuMenLingDao.Text = entity.DeptLeader;
                    FormsMethod.SetDropDownList(this.ddlKeShiLingDao, entity.KeShiLingDaoID, entity.SectionLeader);
                    FormsMethod.SetDropDownList(this.ddlChengBanRen, entity.ChengBanRenID, entity.Contractor);
                }

                //拟稿人
                if (entity.DraftDate != DateTime.MinValue)
                {
                    this.lblNiGaoRiQi.Text = entity.DraftDate.ToString(ConstString.DateFormat.Long);

                    this.txtNiGaoRen.Visible = false;
                    this.lbNiGaoRen.Visible = true;
                    this.lbNiGaoRen.Text = entity.Drafter + strNewLine + entity.DraftDate.ToString(ConstString.DateFormat.Long);
                }

                //签发人
                if (entity.ConfirmDate != DateTime.MinValue)
                {
                    this.txtQianFaRiQi.Text = entity.ConfirmDate.ToString(ConstString.DateFormat.Long);
                    this.txtQianFaRiQi.Visible = false;
                    this.ddlFuZeRen.Visible = false;
                    this.lbRiQiTitle.Visible = false;
                    this.lbLeader.Visible = true;
                    this.lbLeader.Text = entity.DeptPrincipal + strNewLine + entity.ConfirmDate.ToString(ConstString.DateFormat.Long);
                }

                //核稿人
                if (entity.CheckDate != DateTime.MinValue)
                {
                    this.txtHeGaoRen.Visible = false;
                    this.OASelectUC2.Visible = false;
                    this.lbHeGaoRen.Visible = true;
                    this.lbHeGaoRen.Text = entity.CheckDrafter + strNewLine + entity.CheckDate.ToString(ConstString.DateFormat.Long);
                }

                //编号
                this.txtBianHao.Text = entity.Number;

                //抄送
                this.txtChaoSong.Text = entity.CopySend;
                this.txtChaoSongIDs.Text = entity.ChaoSongID;
                this.txtChaoSongDeptIDs.Text = entity.ChaoSongBuMenID;

                //主题
                this.txtZhuTi.Text = entity.DocumentTitle;

                //内容
                //this.txtNeiRong.Text = SysString.HtmlToTextCode(entity.Content);
                this.txtNeiRong.Text =entity.Content;

                //办理意见
                this.txtChuLiYiJian.Text = entity.UndertakeCircs;
                this.txtBanLiYiJian.Text = entity.BanLiYiJian;

                //提示信息
                this.txtTiShiXinXi.Text = entity.Message;
                this.txtTianJia.Text = entity.MessageAdd;

                this.wfReceiveUserName.Text = entity.ReceiveUserName;//renjinquan+
                this.wfReceiveUserID.Text = entity.ReceiveUserID;
                //核稿人
                this.txtHeGaoRen.Text = entity.CheckDrafter;
                this.txtHeGaoRenID.Text = entity.HeGaoRenID;

                //拟稿人
                this.txtNiGaoRen.Text = entity.Drafter;
                this.txtNiGaoRenID.Text = entity.NiGaoRenID;

                //是否核稿或签发退回
                this.txtIsBack.Text = entity.IsBack.ToString();

                //传阅
                if (base.IsPreview == false)
                {
                    this.txtChuanYueRenYuan.Text = entity.IsFormSave == true ? entity.ChuanYueRenYuan : string.Empty;
                    this.txtChuanYueRenYuanID.Text = entity.IsFormSave == true ? entity.ChuanYueRenYuanID : string.Empty;
                }
                else
                {
                    this.txtChuanYueRenYuan.Text = entity.ChuanYueRenYuan;
                    this.txtChuanYueRenYuanID.Text = entity.ChuanYueRenYuanID;
                }

                //当前部门会签意见
                if (entity.IsFormSave && base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_DEPTSIGN)
                {
                    foreach (B_WorkRelation.DeptSign deptSign in entity.DeptSignList)
                    {
                        foreach (B_WorkRelation.DetailInfo detailInfo in deptSign.DetailInfoList)
                        {
                            if (OAConfig.GetConfig(ConstString.Config.Section.Start_WORKFLOW_AGENT, ConstString.Config.Key.IS_START) == "1" && wfReceiveUserID.Text != CurrentUserInfo.UserName)
                            {
                                if (deptSign.ID == wfReceiveUserID.Text)
                                {
                                    CYiJian yiJian = new CYiJian();

                                    yiJian.Content = detailInfo.Comment;
                                    yiJian.DealCondition = detailInfo.DealCondition;
                                    yiJian.FinishTime = deptSign.SubmitDate.ToString();
                                    yiJian.ID = deptSign.TBID;
                                    yiJian.ViewName = ProcessConstString.StepName.WorkRelationStepName.STEP_DEPTSIGN;
                                    yiJian.UserName = deptSign.Name;
                                    yiJian.UserID = deptSign.ID;
                                    yiJian.DeptID = deptSign.DeptID;
                                    yiJian.DealTime = DateTime.Now.ToString();
                                    YiJianInfoList.Add(yiJian);
                                }
                            }
                            else
                            {
                                if (deptSign.ID == CurrentUserInfo.UserName)
                                {
                                    CYiJian yiJian = new CYiJian();

                                    yiJian.Content = detailInfo.Comment;
                                    yiJian.DealCondition = detailInfo.DealCondition;
                                    yiJian.FinishTime = deptSign.SubmitDate.ToString();
                                    yiJian.ID = deptSign.TBID;
                                    yiJian.ViewName = ProcessConstString.StepName.WorkRelationStepName.STEP_DEPTSIGN;
                                    yiJian.UserName = deptSign.Name;
                                    yiJian.UserID = deptSign.ID;
                                    yiJian.DeptID = deptSign.DeptID;
                                    yiJian.DealTime = DateTime.Now.ToString();
                                    YiJianInfoList.Add(yiJian);
                                }
                            }
                        }
                    }
                }//部门会签保存
                ucBuMenHuiQian.UCHQList = entity.DeptSignList;//部门会签

                if (base.StepName == ProcessConstString.StepName.STEP_DRAFT)
                {
                    //部门会签
                    List<B_WorkRelation.YiJian> deptYiJianList = new List<B_WorkRelation.YiJian>();
                    foreach (B_WorkRelation.DeptSign deptSign in entity.DeptSignList)
                    {
                        foreach (B_WorkRelation.DetailInfo detailInfo in deptSign.DetailInfoList)
                        {
                            B_WorkRelation.YiJian yiJian = new B_WorkRelation.YiJian();

                            yiJian.Content = detailInfo.Comment;
                            yiJian.DealCondition = detailInfo.DealCondition;
                            yiJian.FinishTime = deptSign.SubmitDate.ToString();
                            yiJian.ID = deptSign.TBID;
                            yiJian.ViewName = ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN;
                            yiJian.UserName = deptSign.Name;
                            yiJian.UserID = deptSign.ID;
                            yiJian.DeptID = deptSign.DeptID;
                            yiJian.DeptName = deptSign.DeptName;
                            deptYiJianList.Add(yiJian);
                        }
                    }
                    //当前部门会签意见信息
                    if (deptYiJianList.Count > 0)
                    {
                        //pnlDeptComment.Visible = true;
                        //rptDept.DataSource = deptYiJianList;
                        //rptDept.DataBind();
                    }
                }
            }
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(Boolean p_blnIsSaveDraft)
        {
            B_MergeReceiveBase l_objReceiveBase = base.EntityData != null ? base.EntityData as B_MergeReceiveBase : new B_MergeReceiveBase();

            l_objReceiveBase.TemplateName = this.SubTemplateName;

            l_objReceiveBase.RegisterID = base.RegisterID;

            l_objReceiveBase.Officer = ddlPoliticalOfficer.SelectedValue;
            if (!String.IsNullOrEmpty(l_objReceiveBase.Officer))
            {
                l_objReceiveBase.OfficerName = ddlPoliticalOfficer.SelectedItem.Text;
            }
            l_objReceiveBase.Officer_Comment = txtPoliticalOfficerComment.Text.TrimEnd();

            //附件信息
            l_objReceiveBase.FileList = this.ucAttachment.UCDataList;

            //意见列表
            l_objReceiveBase.CommentList = base.Comments;

            //收文号
            l_objReceiveBase.DocumentNo = this.txtReceiveNo.Text;

            //收文日期
            l_objReceiveBase.DocumentReceiveDate = this.txtReceiveDate.ValDate;

            //文件名称
            l_objReceiveBase.DocumentTitle = this.txtDocumentTitle.Text;

            //原文号
            l_objReceiveBase.SendNo = this.txtSendLetterNo.Text;

            //来文单位
            l_objReceiveBase.CommunicationUnit = this.txtCommunicationUnit.Text;

            //预立卷号
            l_objReceiveBase.VolumeNo = this.txtPreVolumeNo.Text;

            //紧急程度
            l_objReceiveBase.UrgentDegree = this.txtUrgentDegree.Text;

            //提交时间
            l_objReceiveBase.SubmitDate = DateTime.Now;

            if (String.IsNullOrEmpty(l_objReceiveBase.Drafter))
            {
                //发起人ID
                l_objReceiveBase.DrafterID = CurrentUserInfo.UserName;

                //发起人姓名
                l_objReceiveBase.Drafter = CurrentUserInfo.DisplayName;

                //发起日期
                l_objReceiveBase.DraftDate = DateTime.Now;
            }
            else
            {
                //发起人ID
                l_objReceiveBase.DrafterID = l_objReceiveBase.ReceiveUserID;

                //发起人姓名
                l_objReceiveBase.Drafter = l_objReceiveBase.ReceiveUserName;

                //发起日期
                l_objReceiveBase.DraftDate = txtDraftDate.ValDate;
            }

            //公司领导批示
            l_objReceiveBase.LeaderShip = this.ddlLeadShip.SelectedValue;
            if (!String.IsNullOrEmpty(this.ddlLeadShip.SelectedValue))
            {
                l_objReceiveBase.LeaderShipName = this.ddlLeadShip.SelectedItem.Text;
            }
            if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_INSTRUCTION)
            {
                l_objReceiveBase.LS_Comment = this.txtLeadCommentEdit.Text.TrimEnd();
                l_objReceiveBase.LS_Date = System.DateTime.Now.ToString();
            }
            else
            {
                l_objReceiveBase.LS_Comment = this.txtLeadCommentView.Text.TrimEnd();
            }

            //承办部门
            if (!String.IsNullOrEmpty(this.txtUnderTakeDeptID.Text.TrimEnd()))
            {
                l_objReceiveBase.UnderTakeDept = this.txtUnderTakeDeptID.Text;
                l_objReceiveBase.UnderTakeDeptName = this.txtUnderTakeDeptName.Text;
                l_objReceiveBase.UnderTakeDeptLeaderID = OAUser.GetUserByDeptPostArray(this.txtUnderTakeDeptID.Text,null,true,true)[0];
            }

            //承办科室
            if (!String.IsNullOrEmpty(this.ddlUnderTakeSection.SelectedValue))
            {
                l_objReceiveBase.UnderTakeChief = this.ddlUnderTakeSection.SelectedValue;
                l_objReceiveBase.UnderTakeChiefName = this.ddlUnderTakeSection.SelectedItem.Text;
                l_objReceiveBase.UnderTakeChiefLeaderID = FormsMethod.GetUserIDByViewBase(OAUser.GetDeptManager(this.ddlUnderTakeSection.SelectedValue, 0));
            }

            //承办人员
            if (!String.IsNullOrEmpty(this.ddlUnderTakePeople.SelectedValue))
            {
                l_objReceiveBase.UnderTakePeople = this.ddlUnderTakePeople.SelectedValue;
                l_objReceiveBase.UnderTakePeopleName = this.ddlUnderTakePeople.SelectedItem.Text;
            }

            if (p_blnIsSaveDraft)
            {
                l_objReceiveBase.UnderTake_Comment = this.txtUnderTakeCommentEdit.Text;
            }

            //传阅
            l_objReceiveBase.CPeopleName = this.txtCirculatePeopleName.Text;
            l_objReceiveBase.CPeopleID = this.txtCirculatePeopleID.Text;
            l_objReceiveBase.CDeptName = this.txtCirculateDeptName.Text;
            l_objReceiveBase.CDeptID = this.txtCirculateDeptID.Text;

            if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_DIRECTOR ||
                base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_CHIEF ||
                base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_SECTION_MEMBER)
            {
                if (!p_blnIsSaveDraft)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content = this.txtUnderTakeCommentEdit.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName = base.StepName;
                    l_objComment.Action = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }
            else if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_PLOT)
            {
                if (!p_blnIsSaveDraft)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content = this.txtPoliticalOfficerComment.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName = base.StepName;
                    l_objComment.Action = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }
            else if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_INSTRUCTION)
            {
                if (!p_blnIsSaveDraft)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content = this.txtLeadCommentEdit.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName = base.StepName;
                    l_objComment.Action = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }
            else if (base.StepName == ProcessConstString.StepName.ReceiveStepName.STEP_PROCESS_CENTER)
            {
                if (!p_blnIsSaveDraft && m_strSubmitAction == ProcessConstString.SubmitAction.ReceiveBase.SUBMIT_UNDERTAKE)
                {
                    CYiJian l_objComment = new CYiJian();
                    l_objComment.Content = this.txtUnderTakeCommentEdit.Text;
                    l_objComment.FinishTime = DateTime.Now.ToString();
                    l_objComment.UserID = l_objReceiveBase.ReceiveUserID;
                    l_objComment.UserName = l_objReceiveBase.ReceiveUserName;
                    l_objComment.ViewName = base.StepName;
                    l_objComment.Action = m_strSubmitAction;
                    l_objReceiveBase.CommentList.Add(l_objComment);
                }
            }

            l_objReceiveBase.IsFormSave = p_blnIsSaveDraft;

            if (p_blnIsSaveDraft)
            {
                l_objReceiveBase.Prompt = this.txtPrompt.Text;
                l_objReceiveBase.PromptEdit = this.txtPromptEdit.Text;
            }
            else
            {
                if (!String.IsNullOrEmpty(this.txtPromptEdit.Text.TrimEnd()))
                {
                    l_objReceiveBase.Prompt = this.txtPrompt.Text + "[" + (l_objReceiveBase.ReceiveUserName == string.Empty ? CurrentUserInfo.DisplayName : l_objReceiveBase.ReceiveUserName) + "][" + System.DateTime.Now.ToString(ConstString.DateFormat.Long) + "]:" + this.txtPromptEdit.Text + ConstString.Miscellaneous.NEW_LINE;
                }
            }

            return l_objReceiveBase;
        }
        /// <summary>
        /// 实体赋值
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns></returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            B_DJGTSend entity = base.EntityData != null ? base.EntityData as B_DJGTSend : new B_DJGTSend();

            entity.SendDate = this.txtSendDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(this.txtSendDate.Text);

            //附件
            entity.FileList = ucAttachment.UCDataList;

            CYiJian YJ = new CYiJian();

            //提示信息
            if (!IsSave)
            {
                if (!string.IsNullOrEmpty(this.txtMyPrompt.Text))
                {
                    entity.MyPrompt = string.Empty;
                    entity.Prompt = this.txtAllPrompt.Text + (string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName) + "[" +
                        System.DateTime.Now.ToString(ConstString.DateFormat.Long) + "]:(" + base.StepName + ")" + this.txtMyPrompt.Text + "\n";
                }
            }
            else
            {
                entity.Prompt = this.txtAllPrompt.Text;
                entity.MyPrompt = this.txtMyPrompt.Text;
            }

            switch (base.StepName)
            {
                #region 拟稿
                case ProcessConstString.StepName.STEP_DRAFT:
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;

                    if (this.ddlHostDept.Items.Count > 0)
                    {
                        entity.HostDeptID = this.ddlHostDept.SelectedValue;
                        entity.HostDept = this.ddlHostDept.SelectedItem.Text;
                    }

                    if (this.ddlCheckDrafter.Items.Count > 0)
                    {
                        entity.CheckDrafterID = this.ddlCheckDrafter.SelectedValue;
                        entity.CheckDrafter = this.ddlCheckDrafter.SelectedItem.Text;
                    }

                    entity.PhoneNum = this.txtPhoneNum.Text;
                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord = this.txtSubjectWord.Text;
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;

                    //拟稿人、拟稿日期
                    entity.Drafter = this.txtDrafter.Text;
                    entity.DrafterID = this.wfDrafterID.Text;
                    entity.DraftDate = DateTime.Now;
                    if (entity.FirstDraftDate == DateTime.MinValue)//第一次的拟稿日期,以前的实体FirstDraftDate没值,取DraftDate。renjinquan+
                    {
                        entity.FirstDraftDate = DateTime.Now;
                    }
                    entity.IsCheckDraftBack = Convert.ToBoolean(this.wfIsDeny.Text);

                    //发文类型
                    entity.SendType = this.ddlType.SelectedValue;
                    break;
                #endregion

                #region 审稿
                case ProcessConstString.StepName.SendStepName.STEP_CHECK:
                    if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                    {
                        entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                        entity.PhoneNum = this.txtPhoneNum.Text;
                        entity.DocumentTitle = this.txtDocumentTitle.Text;
                        entity.SubjectWord = this.txtSubjectWord.Text;
                        entity.MainSenders = this.txtMainSender.Text;
                        entity.CopySenders = this.txtCopySender.Text;

                        //if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_BMHQ)//renjinquan改。防止覆盖掉前面的会签人
                        //{
                        //部门会签
                        entity.NewDeptSignerIDs = this.wfDeptSignIDs.Text;
                        entity.NewDeptSigners = this.txtDeptSigners.Text;
                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_BMHQ)//renjinquan改。防止覆盖掉前面的会签人
                        {
                            entity.DeptSignerIDs = SysString.FilterRepeat(entity.DeptSignerIDs + (entity.DeptSignerIDs != string.Empty ? ";" : "") + this.wfDeptSignIDs.Text);
                            entity.DeptSigners = SysString.FilterRepeat(entity.DeptSigners + (entity.DeptSigners != string.Empty ? ";" : "") + this.txtDeptSigners.Text);
                            entity.NewDeptSignerIDs = "";
                            entity.NewDeptSigners = "";
                        }
                        //entity.DeptSignerIDs = this.wfDeptSignIDs.Text;
                        //entity.DeptSigners = this.txtDeptSigners.Text;
                        //}

                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_TJHG)
                        {
                            //党群秘书组
                            string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.PartysSecretary);
                            entity.VerifierIDs = array[0].ToString();
                            entity.Verifiers = array[1].ToString();
                        }
                        entity.CheckDraftDate = DateTime.Now;

                        //清除CommonList值
                        entity.CommentList.Clear();
                    }
                    else
                    {
                        entity.IsCheckDraftBack = true;
                    }
                    break;
                #endregion

                #region 部门会签
                case ProcessConstString.StepName.SendStepName.STEP_DEPT:
                    if (IsSave)
                    {
                        entity.DeptSignComment = this.txtComment.Text;
                    }
                    else
                    {
                        entity.DeptSignComment = string.Empty;

                        if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                        {
                            //意见列表
                            YJ.UserID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                            YJ.UserName = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                            YJ.ViewName = ProcessConstString.StepName.SendStepName.STEP_DEPT;
                            YJ.FinishTime = DateTime.Now.ToString();
                            YJ.Content = this.txtComment.Text;
                            entity.CommentList.Add(YJ);
                        }
                    }
                    break;

                #endregion

                #region 核稿
                //秘书核稿
                case ProcessConstString.StepName.SendStepName.STEP_VERIFY:
                    if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                    {
                        entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                        entity.DocumentTitle = this.txtDocumentTitle.Text;
                        entity.SubjectWord = this.txtSubjectWord.Text;

                        if (this.ddlSigner.Items.Count > 0)
                        {
                            //签发人
                            entity.SignerID = this.ddlSigner.SelectedValue;
                            entity.Signer = this.ddlSigner.SelectedItem.Text;
                        }

                        //领导会签
                        entity.NewLeadSignerIDs = this.wfLeaderSignIDs.Text;
                        entity.NewLeadSigners = this.txtLeadSigners.Text;
                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_LDHQ)//renjinquan改。防止覆盖掉前面的会签人
                        {
                            entity.LeadSignerIDs = SysString.FilterRepeat(entity.LeadSignerIDs + (entity.LeadSignerIDs != string.Empty ? ";" : "") + this.wfLeaderSignIDs.Text);
                            entity.LeadSigners = SysString.FilterRepeat(entity.LeadSigners + (entity.LeadSigners != string.Empty ? ";" : "") + this.txtLeadSigners.Text);
                            entity.NewLeadSignerIDs = "";
                            entity.NewLeadSigners = "";
                            //entity.LeadSignerIDs = this.wfLeaderSignIDs.Text;
                            //entity.LeadSigners = this.txtLeadSigners.Text;
                        }

                        //秘书核稿
                        entity.Verifier = this.txtSecretaryChecker.Text;
                        entity.VerifierID = this.wfVerifierID.Text;
                        entity.VerifyDate = DateTime.Now;

                        entity.MainSenders = this.txtMainSender.Text;
                        entity.CopySenders = this.txtCopySender.Text;

                        //清除CommonList值
                        entity.CommentList.Clear();
                    }
                    break;
                #endregion

                #region 领导会签
                case ProcessConstString.StepName.SendStepName.STEP_LEADER:
                    if (IsSave)
                    {
                        entity.LeadSignComment = this.txtComment.Text;
                    }
                    else
                    {
                        entity.LeadSignComment = string.Empty;
                        entity.CommentList.Clear();
                        if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                        {
                            YJ.UserID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                            YJ.UserName = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                            YJ.ViewName = ProcessConstString.StepName.SendStepName.STEP_LEADER;
                            YJ.FinishTime = DateTime.Now.ToString();
                            YJ.Content = this.txtComment.Text;
                            entity.CommentList.Add(YJ);
                        }
                    }
                    break;
                #endregion

                #region 签发
                case ProcessConstString.StepName.SendStepName.STEP_SIGN:
                    if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                    {
                        //党群文书组
                        string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.PartysDocument);
                        entity.AssignerIDs = array[0].ToString();
                        entity.Assigners = array[1].ToString();
                        entity.SignDate = DateTime.Now;
                        entity.SendDate = DateTime.Now;

                        entity.SubjectWord = this.txtSubjectWord.Text;

                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_QF)
                        {
                            entity.DeptHaveSigners = this.txtDeptSigners.Text;
                            entity.LeadHaveSigners = this.txtLeadSigners.Text;
                        }
                    }

                    if (IsSave)
                    {
                        entity.SignComment = this.txtComment.Text;
                    }
                    else
                    {
                        entity.SignComment = this.txtComment.Text;
                        if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                        {
                            YJ.UserID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                            YJ.UserName = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                            YJ.ViewName = ProcessConstString.StepName.SendStepName.STEP_SIGN;
                            YJ.FinishTime = DateTime.Now.ToString();
                            YJ.Content = this.txtComment.Text;
                            entity.CommentList.Add(YJ);
                        }
                    }
                    break;

                #endregion

                #region 分发
                case ProcessConstString.StepName.SendStepName.STEP_DISTRIBUTE:
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                    entity.DocumentYear = this.txtDocumentYear.Text;
                    entity.DocumentNum = this.txtDocumentNum.Text;
                    entity.DocumentNo = this.txtDocumentNo.Text;

                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord = this.txtSubjectWord.Text;
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;

                    entity.ShareCount = this.txtShareCount.Text;
                    entity.SheetCount = this.txtSheetCount.Text;

                    entity.Typist = this.txtTypist.Text;
                    entity.ReChecker = this.txtReChecker.Text;

                    entity.AssignerID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                    entity.Assigner = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;

                    //传阅
                    entity.CirculateDeptIDs = this.hDeptID.Value;
                    entity.CirculateDepts = this.txtDeptName.Text;
                    entity.CirculateLeaderIDs = this.hUserID.Value;
                    entity.CirculateLeaders = this.txtUserName.Text;
                    break;
                #endregion

                #region 校对
                case ProcessConstString.StepName.SendStepName.STEP_PROOF:
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                    entity.PhoneNum = this.txtPhoneNum.Text;

                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord = this.txtSubjectWord.Text;
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;
                    entity.Checker = this.txtChecker.Text;

                    entity.IsHaveChecked = true;
                    break;
                #endregion
            }
            return entity;
        }
        /// <summary>
        /// 实体赋值
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns></returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            EntitySend entity = base.EntityData != null ? base.EntityData as EntitySend : new EntitySend();

            entity.SendDate = this.txtSendDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(this.txtSendDate.Text);

            //附件
            entity.FileList = ucAttachment.UCDataList;

            //意见列表
            CYiJian YJ = new CYiJian();

            //提示信息
            if (!IsSave)
            {
                if (!string.IsNullOrEmpty(this.txtMyPrompt.Text))
                {
                    entity.MyPrompt = string.Empty;
                    entity.Prompt = this.txtAllPrompt.Text + (string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName) + "[" +
                        System.DateTime.Now.ToString(ConstString.DateFormat.Long) + "]:(" + base.StepName + ")" + this.txtMyPrompt.Text + "\n";
                }
            }
            else
            {
                entity.Prompt = this.txtAllPrompt.Text;
                entity.MyPrompt = this.txtMyPrompt.Text;
            }

            //数据补偿(老版本没保存)
            if (string.IsNullOrEmpty(entity.HostDeptName))
            {
                entity.HostDeptName = OADept.GetDeptName(entity.HostDept);
            }

            if (string.IsNullOrEmpty(entity.SignerName))
            {
                entity.SignerName = OAUser.GetUserName(entity.Signer);
            }

            switch (base.StepName)
            {
                #region 拟稿
                case ProcessConstString.StepName.STEP_DRAFT:
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;

                    if (this.ddlHostDept.Items.Count > 0)
                    {
                        entity.HostDept = this.ddlHostDept.SelectedValue;
                        entity.HostDeptName = this.ddlHostDept.SelectedItem.Text;
                    }

                    if (this.ddlVerifier.Items.Count > 0)
                    {
                        entity.CheckDrafterID = this.ddlVerifier.SelectedValue;
                        entity.CheckDrafter = this.ddlVerifier.SelectedValue;
                        entity.CheckDrafterName = this.ddlVerifier.SelectedItem.Text;
                    }

                    entity.PhoneNum = this.txtPhoneNum.Text;
                    //entity.DocumentTitle = SysString.Text2Html(this.txtDocumentTitle.Text);
                    entity.DocumentTitle = this.txtDocumentTitle.Text;//renjinquan+
                    entity.SubjectWord = this.txtSubjectWord.Text;
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;

                    //拟稿人、拟稿日期
                    entity.Drafter = this.txtDrafter.Text;
                    entity.DrafterID = this.txtDrafterID.Text;

                    entity.DraftDate = DateTime.Now;
                    if (entity.FirstDraftDate == DateTime.MinValue)//第一次的拟稿日期,以前的实体FirstDraftDate没值,取DraftDate。renjinquan+
                    {
                        entity.FirstDraftDate = DateTime.Now;
                    }

                    entity.IsHeGaoBack = Convert.ToBoolean(this.txtIsDeny.Text);
                    break;
                #endregion

                #region 审稿
                case ProcessConstString.StepName.SendStepName.STEP_CHECK:
                    if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                    {
                        entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                        entity.PhoneNum = this.txtPhoneNum.Text;
                        entity.DocumentTitle = this.txtDocumentTitle.Text;
                        entity.SubjectWord = this.txtSubjectWord.Text;
                        entity.MainSenders = this.txtMainSender.Text;
                        entity.CopySenders = this.txtCopySender.Text;
                        //会签部门
                        entity.NewDeptSIDs = this.txtCounterSignDept.Text;
                        entity.NewDeptSignerIDs = this.txtCounterSignDeptLeaders.Text;
                        entity.NewDeptSigners = this.txtDeptSigners.Text;
                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_BMHQ)
                        {
                            entity.DeptSIDs = SysString.FilterRepeat(entity.DeptSIDs + (entity.DeptSIDs != string.Empty ? ";" : "") + this.txtCounterSignDept.Text);
                            entity.DeptSigners = SysString.FilterRepeat(entity.DeptSigners + (entity.DeptSigners != string.Empty ? ";" : "") + this.txtDeptSigners.Text);
                            //entity.DeptSIDs = this.txtCounterSignDept.Text;
                            //entity.DeptSigners = this.txtDeptSigners.Text;
                            entity.DeptSignerIDs = SysString.FilterRepeat(entity.DeptSignerIDs + (entity.DeptSignerIDs != string.Empty ? ";" : "") + this.txtCounterSignDeptLeaders.Text);
                            entity.NewDeptSIDs = "";
                            entity.NewDeptSignerIDs = "";
                            entity.NewDeptSigners = "";
                        }
                        //string[] array = OAUser.GetDeptManagerArrays(this.txtCounterSignDept.Text, 0);
                        //entity.DeptSignerIDs = array[0].ToString().Replace(',', ';');
                        //entity.DeptSignerIDs = this.txtCounterSignDeptLeaders.Text.Replace(',', ';');

                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_TJHG)
                        {
                            //公司办秘书科秘书
                            string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_SECRETARY);
                            entity.VerifierID = array[0].ToString();
                            entity.Verifiers = array[1].ToString();
                        }
                        entity.CheckDate = DateTime.Now;
                        //清除CommonList值
                        entity.CommentList.Clear();
                    }
                    else
                    {
                        entity.IsHeGaoBack = true;
                    }
                    break;
                #endregion

                #region 部门会签
                case ProcessConstString.StepName.SendStepName.STEP_DEPT:
                    if (IsSave)
                    {
                        entity.DeptSignComment = this.txtComment.Text;
                    }
                    else
                    {
                        entity.DeptSignComment = string.Empty;

                        if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                        {
                            //意见列表
                            YJ.UserID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                            YJ.UserName = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                            YJ.ViewName = ProcessConstString.StepName.SendStepName.STEP_DEPT;
                            YJ.FinishTime = DateTime.Now.ToString();
                            YJ.Content = this.txtComment.Text;
                            entity.CommentList.Add(YJ);
                        }
                    }

                    //是否已提交部门会签
                    entity.IsSubmitDeptSign = "true";
                    break;

                #endregion

                #region 核稿
                //秘书核稿
                case ProcessConstString.StepName.SendStepName.STEP_VERIFY:
                    if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                    {
                        entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                        entity.DocumentTitle = this.txtDocumentTitle.Text;
                        entity.SubjectWord = this.txtSubjectWord.Text;

                        if (this.ddlSigner.Items.Count > 0)
                        {
                            //签发人
                            entity.Signer = this.ddlSigner.SelectedValue;
                            entity.SignerName = this.ddlSigner.SelectedItem.Text;
                        }

                        //领导会签
                        //if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_LDHQ)//将新的会签人添加到已经会签过的人。多次会签
                        //{
                        entity.NewLeadSignerIDs = this.txtComCounterSignLeaders.Text;
                        entity.NewLeadSigners = this.txtLeadSigners.Text;
                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_LDHQ)//将新的会签人添加到已经会签过的人。多次会签
                        {
                            entity.LeadSignerIDs = SysString.FilterRepeat(entity.LeadSignerIDs + (entity.LeadSignerIDs != string.Empty ? ";" : "") + this.txtComCounterSignLeaders.Text);
                            entity.LeadSigners = SysString.FilterRepeat(entity.LeadSigners + (entity.LeadSigners != string.Empty ? ";" : "") + this.txtLeadSigners.Text);
                            entity.NewLeadSignerIDs = "";
                            entity.NewLeadSigners = "";
                        }
                        //}

                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_ZRHG)
                        {
                            //处长副处长
                            //string strDeptID = OAConfig.GetConfig("公司发文主任核稿", "部门ID");
                            //string[] array = OAUser.GetUserByDeptPostArray(strDeptID, "公司办主任", 0);
                            string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_CHIEF);//2010-4-29 改成角色取人
                            entity.ZhuRenSignerID = array[0].ToString();
                            entity.ZhuRenSigners = array[1].ToString();
                        }

                        //秘书核稿
                        entity.MainSenders = this.txtMainSender.Text;
                        entity.CopySenders = this.txtCopySender.Text;
                        entity.Verifier = this.txtSecretaryChecker.Text;
                        entity.VerifierMainID = this.txtVerifierID.Text;
                        entity.VerifyDate = DateTime.Now;

                        //清除CommonList值
                        entity.CommentList.Clear();
                    }
                    break;
                #endregion

                #region 主任核稿
                //主任核稿
                case ProcessConstString.StepName.SendStepName.STEP_ZRVERIFY:
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord = this.txtSubjectWord.Text;

                    //主任核稿
                    entity.ZhuRenSigner = this.txtDirectorChecker.Text;
                    entity.ZhuRenSignerMainID = this.txtDirectorCheckerID.Text;
                    entity.ZhuRenSignDate = DateTime.Now;
                    break;
                #endregion

                #region 领导会签
                case ProcessConstString.StepName.SendStepName.STEP_LEADER:
                    if (IsSave)
                    {
                        entity.LeadSignComment = this.txtComment.Text;
                    }
                    else
                    {
                        entity.LeadSignComment = string.Empty;
                        entity.CommentList.Clear();
                        if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                        {
                            YJ.UserID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                            YJ.UserName = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                            YJ.ViewName = ProcessConstString.StepName.SendStepName.STEP_LEADER;
                            YJ.FinishTime = DateTime.Now.ToString();
                            YJ.Content = this.txtComment.Text;
                            entity.CommentList.Add(YJ);
                        }
                    }

                    //是否已领导会签
                    entity.IsSubmitLeadSign = true;
                    break;
                #endregion

                #region 签发
                case ProcessConstString.StepName.SendStepName.STEP_SIGN:
                    if (base.SubAction != ProcessConstString.SubmitAction.ACTION_DENY)
                    {
                        //公司办文书
                        string[] array = OAUser.GetUserByRoleName(OUConstString.RoleName.COMPANY_OFFICE_CLERK);
                        entity.FenFaRenIDs = array[0].ToString();
                        entity.FenFaRenNames = array[1].ToString();
                        entity.SignDate = DateTime.Now;
                        entity.SendDate = DateTime.Now;

                        if (base.SubAction == ProcessConstString.SubmitAction.CompanySendAction.ACTION_QF)
                        {
                            entity.DeptHaveSigners = this.txtDeptSigners.Text;
                            entity.LeadHaveSigners = this.txtLeadSigners.Text;
                        }

                        entity.SubjectWord = this.txtSubjectWord.Text.Trim();
                    }

                    if (IsSave)
                    {
                        entity.SignComment = this.txtComment.Text;
                    }
                    else
                    {
                        entity.SignComment = this.txtComment.Text;
                        if (!string.IsNullOrEmpty(this.txtComment.Text.Trim()))
                        {
                            YJ.UserID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                            YJ.UserName = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                            YJ.ViewName = ProcessConstString.StepName.SendStepName.STEP_SIGN;
                            YJ.FinishTime = DateTime.Now.ToString();
                            YJ.Content = this.txtComment.Text;
                            entity.CommentList.Add(YJ);
                        }
                    }
                    break;

                #endregion

                #region 分发
                case ProcessConstString.StepName.SendStepName.STEP_DISTRIBUTE:
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                    entity.DocumentYear = this.txtDocumentYear.Text;
                    entity.DocumentNum = this.txtDocumentNum.Text;
                    entity.DocumentNo = this.txtDocumentNo.Text;

                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord = this.txtSubjectWord.Text;
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;

                    entity.ShareCount = this.txtShareCount.Text == string.Empty ? 0 : SysConvert.ToInt32(this.txtShareCount.Text);
                    entity.SheetCount = this.txtSheetCount.Text == string.Empty ? 0 : SysConvert.ToInt32(this.txtSheetCount.Text);

                    entity.Typist = this.txtTypist.Text;
                    entity.ReChecker = this.txtReChecker.Text;

                    entity.FenFaMainIDs = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;

                    //传阅
                    entity.CirculateIDs = this.hDeptID.Value;
                    entity.CirculateNames = this.txtDeptName.Text;
                    entity.CirculateLeadIDs = this.hUserID.Value;
                    entity.CirculateLeadNames = this.txtUserName.Text;

                    //追加分发
                    entity.CirculateAddIDs = this.hDeptID1.Value;
                    entity.CirculateAddNames = this.txtDeptName1.Text;
                    entity.CirculateAddLeadIDs = this.hUserID1.Value;
                    entity.CirculateAddLeadNames = this.txtUserName1.Text;

                    entity.CommentList.Clear();
                    break;
                #endregion

                #region 校对
                case ProcessConstString.StepName.SendStepName.STEP_PROOF:
                    entity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                    entity.PhoneNum = this.txtPhoneNum.Text;

                    entity.DocumentTitle = this.txtDocumentTitle.Text;
                    entity.SubjectWord = this.txtSubjectWord.Text;
                    entity.MainSenders = this.txtMainSender.Text;
                    entity.CopySenders = this.txtCopySender.Text;
                    entity.Checker = this.txtChecker.Text;

                    entity.IsSubmitCheck = true;
                    break;
                #endregion
            }
            return entity;
        }