Exemplo n.º 1
0
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (FormsMethod.CheckRole(ConstString.RoleName.QUALITY_MEMBER) == false)
         {
             lblPrompt.Text = "只有质保人员" + OAUser.GetUserByRoleName(ConstString.RoleName.QUALITY_MEMBER)[1].ToString() + "可以添加程序文件。";
         }
         else
         {
             lblPrompt.Text = string.Empty;
         }
         txtName.ToolTip = "内容不能超过50个字符";
         txtCode.ToolTip = "内容不能超过20个字符";
         this.gvProgramFileList.ShowPagerRow = true;
         this.gvProgramFileList.PageType     = PageType.ExteriorPage;
         BindProgramFileList(false, 0, 0, "", "", "", "", "", "");
         BindProgramSort(ddlSort);
         BindProgramSort(ddlSorts);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 新增按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (FormsMethod.CheckRole(ConstString.RoleName.QUALITY_MEMBER) == false)
            {
                IMessage ms = new WebFormMessage(Page, "只有质保人员" + OAUser.GetUserByRoleName(ConstString.RoleName.QUALITY_MEMBER)[1].ToString() + "可以添加程序文件。");
                ms.Show();
                return;
            }
            if (txtName.Text.ToString().Contains("#") || txtName.Text.ToString().Contains("'"))
            {
                IMessage ms = new WebFormMessage(Page, "含有特殊字符,请替换后再上传");
                ms.Show();
                return;
            }
            B_ProgramFileInfo enProFile = new B_ProgramFileInfo();

            enProFile.Name = txtName.Text.ToString().Trim();
            //bProFile.Edition = "1";//txtEdition.Text.ToString().Trim();
            enProFile.Code        = txtCode.Text.ToString().Trim();
            enProFile.Sort        = ddlSort.SelectedItem.Text.ToString().Trim();
            enProFile.ProTypId    = int.Parse(ddlProgramType.SelectedItem.Value.ToString().Trim());
            enProFile.ProTypSubId = int.Parse(ddlProgramSubType.SelectedItem.Value.ToString().Trim());

            enProFile.ActivationDate = DateTime.Now;

            if (enProFile.Save())
            {
                BindProgramFileList(false, 0, 0, "", "", "", "", "", "");
                ClearData();
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC);
                ms.Show();
            }
            else
            {
                IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString());
                ms.Show();
            }
        }
        /// <summary>
        /// 控件初始设置
        /// </summary>
        protected override void SetControlStatus()
        {
            btnSetNo.Visible = false;
            btnCheck.Visible = false;

            lblPages.Visible  = false;
            lblOurRef.Visible = false;

            ucAttachment.UCTemplateName = base.TemplateName;
            ucAttachment.UCProcessID    = base.ProcessID;
            ucAttachment.UCWorkItemID   = base.WorkItemID;
            ucAttachment.UCTBID         = base.IdentityID.ToString();

            OAControl controls = new OAControl();

            OAControl controlsCommon = new OAControl();

            controlsCommon.DisEnableControls = new Control[]
            {
                txtSignDate, txtHuiQianRenDates, txtHeGaoRenDate, txtNiGaoRenDate
            };

            controlsCommon.DisVisibleControls = new Control[]
            {
                //btnSetNo,btnCheck
            };


            if (IsPreview == false)
            {
                //给于用户提示
                txtSubject.ToolTip   = "200字符以内";
                txtSubject.MaxLength = 200;

                txtQianFaRen.ToolTip  = "公司领导";
                txtHuiQianRen.ToolTip = "函件会签组";

                txtSignDate.ToolTip        = "签发后自动生成";
                txtHeGaoRenDate.ToolTip    = "核稿后自动生成";
                txtHuiQianRenDates.ToolTip = "会签后自动生成";
                txtNiGaoRenDate.ToolTip    = "拟稿后自动生成";

                #region 弹出选择
                //签发人
                UCQianFa.UCRoleName        = "函件签发组";
                UCQianFa.UCUserIDControl   = wfQianFaRenID.ClientID;
                UCQianFa.UCUserNameControl = txtQianFaRen.ClientID;
                UCQianFa.UCIsSingle        = true;

                //会签人
                UCHuiQian.UCRoleName        = "函件会签组";
                UCHuiQian.UCUserIDControl   = wfHuiQianRenIDs.ClientID;
                UCHuiQian.UCUserNameControl = txtHuiQianRen.ClientID;
                UCHuiQian.UCIsSingle        = false;

                //抄送部门
                UCDeptcc.UCDeptIDControl   = txtccDeptIDs.ClientID;
                UCDeptcc.UCDeptNameControl = txtccDept.ClientID;
                UCDeptcc.UCDeptShowType    = "1010";
                UCDeptcc.UCSelectType      = "0";
                UCDeptcc.UCLevel           = "2";
                UCDeptcc.UCALLChecked      = "1";

                //抄送领导
                UCccLingDao.UCIsSingle        = false;
                UCccLingDao.UCRoleName        = "公司领导";
                UCccLingDao.UCUserIDControl   = txtccLeaderIDs.ClientID;
                UCccLingDao.UCUserNameControl = txtccLeader.ClientID;

                //主送单位
                UCCompany.UCNoControl   = txtCompanyID.ClientID;
                UCCompany.UCNameControl = txtCompany.ClientID;
                UCCompany.UCIsSingle    = true;

                //抄送单位
                UCCompanycs.UCNameControl = txtccCompany.ClientID;
                UCCompanycs.UCIsSingle    = false;
                ////UCCompanycc.UCNameControl = txtccCompany.ClientID;
                //////UCCompanycc.UCIsSingle = false;
                #endregion

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

                    wfFaQiRen.Text      = CurrentUserInfo.DisplayName;
                    wfFaQiRenID.Text    = CurrentUserInfo.UserName;
                    drpSendDept.ToolTip = "我所属的处室";
                    lblYiJian.Text      = "备注";

                    //核稿人
                    HeGaoRen();

                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo, drpSendDept,
                        txtSubject, txtContent, txtTo
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtHeGaoRen, txtQianFaRen, txtHuiQianRen, txtCompany, txtccDept, txtccLeader, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef,
                    };
                    if (string.IsNullOrEmpty(base.WorkItemID))
                    {
                        controls.DisVisibleControls = new Control[]
                        {
                            btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnCancel, btnBack
                        };
                    }
                    else     //是被退回的 可撤销流程
                    {
                        if (base.IsFromDraft == false)
                        {
                            controls.DisVisibleControls = new Control[]
                            {
                                btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnBack
                            };
                            btnCancel.Attributes.Add("onclick", "javascript: if(!confirm('确定要撤销该流程吗?')){return false;}else{DisableButtons();}");
                        }
                        else
                        {
                            controls.DisVisibleControls = new Control[]
                            {
                                btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnBack, btnCancel
                            };
                        }
                    }
                    break;
                    #endregion

                    #region 核稿
                case ProcessConstString.StepName.LetterSend.核稿:
                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo, drpSendDept,
                        txtSubject, txtContent, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef, txtHeGaoRen, drpSendDept
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtQianFaRen, txtHuiQianRen, txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHeGao,
                        btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnCancel, btnSubmitHeGao
                    };
                    break;
                    #endregion

                    #region 会签
                case ProcessConstString.StepName.LetterSend.会签:
                    ucAttachment.UCIsEditable = false;
                    btnSumitQianFa.Text       = "同意";
                    controls.EnableControls   = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                        txtSubject, txtContent, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef, txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtQianFaRen, txtHuiQianRen, txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHuiQian, UCHeGao,
                        btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnCancel, btnSubmitHeGao, btnSubmitHuiQian, btnWanCheng, btnQianFa
                    };
                    break;
                    #endregion

                    #region 签发
                case ProcessConstString.StepName.LetterSend.签发:
                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                        txtSubject, txtContent, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef, txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHuiQian, UCHeGao, UCQianFa,
                        btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnCancel, btnSubmitHeGao, btnSubmitHuiQian, btnSumitQianFa, btnWanCheng
                    };

                    btnQianFa.ToolTip = "提交给函件管理员:" + OAUser.GetUserByRoleName("函件管理员")[1];
                    break;
                    #endregion

                    #region 函件分发
                case ProcessConstString.StepName.LetterSend.函件分发:
                    btnSetNo.Visible = true;
                    btnCheck.Visible = true;

                    lblPages.Visible  = true;
                    lblOurRef.Visible = true;
                    drpHanJian.SelectedIndexChanged += new EventHandler(drpHanJian_SelectedIndexChanged);
                    txtCompanyID.TextChanged        += new EventHandler(txtCompanyID_TextChanged);

                    if (base.IsDevolve)
                    {
                        this.btnGD.Attributes.Add("onclick", "javascript: if(!confirm('该流程已经归档,是否重新归档?')){return false;}else{DisableButtons();}");
                    }
                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                        txtSubject, txtContent, txtOurRef, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHuiQian, UCHeGao, UCQianFa,
                        btnAddFenfa, btnSencondFenfa, btnCancel, btnSubmitHeGao, btnSubmitHuiQian, btnSumitQianFa, btnQianFa
                    };
                    break;
                    #endregion

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

                default: break;
                }

                controlsCommon.SetControls();
                controls.SetControls();
            }
            //历史表单
            else
            {
                EntityLetterSend entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();
                ucAttachment.UCIsEditable  = false;
                controls.DisEnableControls = new Control[]
                {
                    txtOurRef, txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                    txtSubject, txtContent, txtTo,
                    txtCompany, txtccCompany, txtccDept, txtccLeader, txtComment,
                };
                controls.DisVisibleControls = new Control[]
                {
                    UCHeGao, UCHuiQian, UCQianFa, UCCompany, UCCompanycc, UCccLingDao, UCDeptcc,
                    btnSubmitHeGao, btnSubmitHuiQian, btnSumitQianFa, btnSave, btnSencondFenfa, btnSetNo, btnWanCheng, btnGD, btnCancel, btnQianFa, btnBack, btnAddFenfa
                };

                controlsCommon.SetControls();
                controls.SetControls();
                switch (base.StepName)
                {
                    #region 发起函件
                case ProcessConstString.StepName.LetterSend.发起函件:

                    break;
                    #endregion

                    #region 核稿
                case ProcessConstString.StepName.LetterSend.核稿:
                    break;
                    #endregion

                    #region 会签
                case ProcessConstString.StepName.LetterSend.会签:
                    break;
                    #endregion

                    #region 签发
                case ProcessConstString.StepName.LetterSend.签发:
                    break;
                    #endregion

                    #region 函件分发
                case ProcessConstString.StepName.LetterSend.函件分发:
                    if (entity.ReceiveUserID == CurrentUserInfo.UserName)     //自己办理的公办才允许追加分发
                    {
                        btnAddFenfa.Visible     = true;
                        btnSencondFenfa.Visible = true;

                        //抄送部门
                        UCDeptcc.UCDeptIDControl   = txtccDeptIDs.ClientID;
                        UCDeptcc.UCDeptNameControl = txtccDept.ClientID;
                        UCDeptcc.UCDeptShowType    = "1010";
                        UCDeptcc.UCSelectType      = "0";
                        UCDeptcc.UCLevel           = "2";

                        //抄送领导
                        UCccLingDao.UCIsSingle        = false;
                        UCccLingDao.UCRoleName        = "公司领导";
                        UCccLingDao.UCUserIDControl   = txtccLeaderIDs.ClientID;
                        UCccLingDao.UCUserNameControl = txtccLeader.ClientID;

                        UCDeptcc.Visible        = true;
                        UCccLingDao.Visible     = true;
                        base.StepName           = "二次分发";
                        btnSencondFenfa.Visible = true;
                        btnAddFenfa.Visible     = true;

                        ucAttachment.UCIsAgain = "1";
                    }
                    break;

                    #endregion
                default: break;
                }
                if (base.IsCanDevolve)
                {
                    this.btnGD.Visible = true;
                    if (base.IsDevolve)
                    {
                        this.btnGD.Attributes.Add("onclick", "javascript: if(!confirm('该流程已经归档,是否重新归档?')){return false;}else{DisableButtons();}");
                    }
                }
            }
        }
        /// <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);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_Finance entity = base.EntityData != null ? base.EntityData as B_Finance : new B_Finance();

            //拟稿人
            this.txtNiGaoRen.Text   = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
            this.txtNiGaoRenID.Text = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
            //新版OA时间精确到秒(控制时间的显示格式)
            //bool isOld = entity.DraftDate < base.OAStartTime;
            //职务
            drpZhiWu.DataSource = GetPostList();
            drpZhiWu.DataBind();
            drpZhiCheng.DataSource = GetTitleList();
            drpZhiCheng.DataBind();
            //附件
            ucAttachment.UCDataList   = entity.FileList;
            this.txtFeeYuSuan.Text    = entity.FeeYuSuan;
            this.txtFeeFaSheng.Text   = entity.FeeFaSheng;
            this.txtShenPiYiJian.Text = entity.ShenPiYiJian;
            //编制部门及预算
            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); B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                M_FinanceDeptInfo info = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlBianZhiBuMen.SelectedValue);

                this.txtFeeYuSuan.Text  = info.TripBudgetCost;
                this.txtFeeFaSheng.Text = info.TripUseCost;

                string ManagerDeptID = OADept.GetDeptID("总经理部");

                Double FeeFa = Convert.ToDouble(string.IsNullOrEmpty(txtFeeFaSheng.Text) ? "0" : txtFeeFaSheng.Text);
                Double FeeYu = Convert.ToDouble(string.IsNullOrEmpty(txtFeeYuSuan.Text) ? "0" : txtFeeYuSuan.Text);
                Double Rate  = (string.IsNullOrEmpty(FeeRate) == true ? 0.1 : Convert.ToDouble(FeeRate));
                if ((FeeFa - FeeYu) / FeeYu > Rate)
                {
                    OAUser.GetUserByDeptPost(ddlZongJingLi, ManagerDeptID, OUConstString.PostName.ZONGJINGLI, true, false, 1);
                    ddlZongJingLi.Enabled = true;
                    this.SubmitStatus     = 1;
                }
                else if (FeeFa > FeeYu)
                {
                    OAUser.GetUserByDeptPost(ddlZhuGuanLingDao, ManagerDeptID, OUConstString.PostName.FUZONGJINGLI, true, false, 1);
                    ddlZhuGuanLingDao.Enabled = true;
                    this.SubmitStatus         = 2;
                }
                else if (FeeFa <= FeeYu)
                {
                    OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlBianZhiBuMen.SelectedValue, OUConstString.PostName.CHUZHANG, false, true, 0);
                    ddlChuLingDao.Enabled = true;
                    this.SubmitStatus     = 3;
                }
                ListItem item = new ListItem(this.txtNiGaoRen.Text, this.txtNiGaoRenID.Text);
                if (ddlChuLingDao.Items.Contains(item))
                {
                    ddlChuLingDao.Items.Clear();
                    OAUser.GetUserByDeptPost(ddlZhuGuanLingDao, ManagerDeptID, OUConstString.PostName.FUZONGJINGLI, true, false, 1);
                    ddlZhuGuanLingDao.Enabled = true;
                    this.SubmitStatus         = 2;
                }
                else if (ddlZhuGuanLingDao.Items.Contains(item))
                {
                    ddlZhuGuanLingDao.Items.Clear();
                    OAUser.GetUserByDeptPost(ddlZongJingLi, ManagerDeptID, OUConstString.PostName.ZONGJINGLI, true, false, 1);
                    ddlZongJingLi.Enabled = true;
                    this.SubmitStatus     = 1;
                }
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID, entity.Department);
                FormsMethod.SetDropDownList(this.ddlZongJingLi, entity.GeneralManagerID, entity.GeneralManager);
                FormsMethod.SetDropDownList(this.ddlZhuGuanLingDao, entity.ChargeLeaderID, entity.ChargeLeader);
                FormsMethod.SetDropDownList(this.ddlChuLingDao, entity.DepartmentLeaderID, entity.DepartmentLeader);
            }
            //申请单编号
            this.txtBianHao.Text = entity.DocumentNo;
            FormsMethod.SelectedDropDownList(this.drpZhiWu, entity.ZhiWu);
            FormsMethod.SelectedDropDownList(this.drpZhiCheng, entity.ZhiCheng);

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

            //订票处
            if (base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_DepartLeader ||
                base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_ChargeLeader ||
                base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_GeneralManager &&
                !base.IsPreview)
            {
                string[] arrayBookingOffice = OAUser.GetUserByRoleName(OUConstString.RoleName.BookingOffice);
                this.txtBookingOfficeID.Text = arrayBookingOffice[0];
            }

            //是否退回
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT)
            {
                this.txtIsBack.Text = entity.IsBack.ToString();
            }

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

                //拟稿人显示非下拉列表框形式
                this.txtNiGaoRen.Visible = false;
                this.lbNiGaoRen.Visible  = true;
                //this.lbNiGaoRen.Text = entity.Drafter + strNewLine + entity.DraftDate.ToString(ConstString.DateFormat.Long);
                this.lbNiGaoRen.Text = entity.Drafter;
            }
            else
            {
                this.lblNiGaoRiQi.Text = DateTime.Now.ToString(DateFormat);
            }

            //抄送
            this.txtChaoSong.Text       = entity.CopySend;
            this.txtChaoSongID.Text     = entity.ChaoSongID;
            this.txtChaoSongDeptID.Text = entity.ChaoSongDeptID;

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

            this.txtTongXing.Text = entity.TongXingRenYuan;

            //出差任务
            //this.txtNeiRong.Text = SysString.HtmlToTextCode(entity.Content);
            this.txtChuChaiRenWu.Text = entity.ChuChaiRenWu;
            this.timeChuFa.Text       = entity.ChuFaShiJian;
            this.timeHuiCheng.Text    = entity.HuiChengShiJian;

            //商务信息
            this.txtShangWu.Text = entity.ShangWuXinXi;

            //目的地
            this.txtDestination.Text = entity.Destination;

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

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

            //提示信息添加
            this.txtTianJia.Text = entity.MessageAdd;

            this.txtGeneralManagerID.Text = entity.GeneralManagerID;

            this.txtChargeLeaderID.Text = entity.ChargeLeaderID;

            this.txtDepartmentLeaderID.Text = entity.DepartmentLeaderID;
        }