Beispiel #1
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;
        }