Esempio n. 1
0
    protected void OpenForm(int formID)
    {
        FormTableAdapter taForm = new FormTableAdapter();

        FormDS.FormRow           rowForm        = taForm.GetDataByID(formID)[0];
        FormContractTableAdapter taFormContract = new FormContractTableAdapter();

        FormDS.FormContractRow rowFormContract = taFormContract.GetDataById(formID)[0];
        //赋值
        TextBox txtBeginDate = (TextBox)(this.UCPeriodBegin.FindControl("txtDate"));
        TextBox txtEndDate   = (TextBox)(this.UCPeriodEnd.FindControl("txtDate"));

        this.txtFirstCompany.Text = rowFormContract.FirstCompany;
        if (!rowFormContract.IsSecondCompanyNull())
        {
            this.txtSecondCompany.Text = rowFormContract.SecondCompany;
        }
        if (!rowFormContract.IsThirdCompanyNull())
        {
            this.txtThirdCompany.Text = rowFormContract.ThirdCompany;
        }
        this.txtContractName.Text          = rowFormContract.ContractName;
        this.txtContractAmount.Text        = rowFormContract.ContractAmount.ToString();
        this.txtPageNumber.Text            = rowFormContract.PageNumber.ToString();
        this.dplContractType.SelectedValue = rowFormContract.ContractTypeID.ToString();
        if (!rowFormContract.IsPaymentTypeNull())
        {
            this.txtPaymentType.Text = rowFormContract.PaymentType;
        }
        if (!rowFormContract.IsBeginDateNull())
        {
            txtBeginDate.Text = rowFormContract.BeginDate.ToShortDateString();
        }
        if (!rowFormContract.IsEndDateNull())
        {
            txtEndDate.Text = rowFormContract.EndDate.ToShortDateString();
        }
        if (!rowFormContract.IsMainContentNull())
        {
            this.txtMainContent.Text = rowFormContract.MainContent;
        }
        if (!rowFormContract.IsChangePartNull())
        {
            this.txtChangePart.Text = rowFormContract.ChangePart;
        }
        if (!rowFormContract.IsAttachedFileNameNull())
        {
            this.UCFileUpload.AttachmentFileName = rowFormContract.AttachedFileName;
        }
        if (!rowFormContract.IsRealAttachedFileNameNull())
        {
            this.UCFileUpload.RealAttachmentFileName = rowFormContract.RealAttachedFileName;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "合同审批");
            this.Page.Title = "合同审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow         rowForm         = this.ContractApplyBLL.GetFormByID(formID)[0];
            FormDS.FormContractRow rowFormContract = this.ContractApplyBLL.GetFormContractByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            //对控件赋值
            this.txtFormNo.Text    = rowForm.FormNo;
            this.ApplyDateCtl.Text = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString();

            this.txtContractName.Text = rowFormContract.ContractName;
            this.txtFirstCompany.Text = rowFormContract.FirstCompany;
            if (!rowFormContract.IsSecondCompanyNull())
            {
                this.txtSecondCompany.Text = rowFormContract.SecondCompany;
            }
            if (!rowFormContract.IsThirdCompanyNull())
            {
                this.txtThirdCompany.Text = rowFormContract.ThirdCompany;
            }
            this.txtContractNo.Text     = rowFormContract.ContractNo;
            this.txtContractAmount.Text = rowFormContract.ContractAmount.ToString();
            this.txtPageNumber.Text     = rowFormContract.PageNumber.ToString();
            this.txtContractType.Text   = new MasterDataBLL().GetContractTypeById(rowFormContract.ContractTypeID).ContractTypeName;
            if (!rowFormContract.IsPaymentTypeNull())
            {
                this.txtPaymentType.Text = rowFormContract.PaymentType;
            }
            if (!rowFormContract.IsBeginDateNull())
            {
                this.txtBeginDate.Text = rowFormContract.BeginDate.ToShortDateString();
            }
            if (!rowFormContract.IsEndDateNull())
            {
                this.txtEndDate.Text = rowFormContract.EndDate.ToShortDateString();
            }
            if (!rowFormContract.IsMainContentNull())
            {
                this.txtMainContent.Text = rowFormContract.MainContent;
            }
            if (!rowFormContract.IsChangePartNull())
            {
                this.txtChangePart.Text = rowFormContract.ChangePart;
            }
            if (!rowFormContract.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormContract.AttachedFileName;
            }
            if (!rowFormContract.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormContract.RealAttachedFileName;
            }

            //历史单据
            if (rowForm.IsRejectedFormIDNull())
            {
                lblRejectFormNo.Text = "无";
                trHistory.Visible    = false;
            }
            else
            {
                FormDS.FormRow rejectedForm = new ContractApplyBLL().GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text        = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/OtherForm/ContractApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //审批页面处理&按钮处理
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P"))
            {
                this.SubmitBtn.Visible   = true;
                this.cwfAppCheck.IsView  = false;
                this.ViewState["IsView"] = false;
            }
            else
            {
                this.SubmitBtn.Visible   = false;
                this.cwfAppCheck.IsView  = true;
                this.ViewState["IsView"] = true;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId == rowForm.UserID)
            {
                this.EditBtn.Visible  = true;
                this.ScrapBtn.Visible = true;
            }
            else
            {
                this.EditBtn.Visible  = false;
                this.ScrapBtn.Visible = false;
            }

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }

            //判断是否盖章
            this.IsStampCtl.Checked    = rowFormContract.IsisStampedNull() ? false : rowFormContract.isStamped;
            this.IsRecoveryCtl.Checked = rowFormContract.IsisRecoveryNull() ? false : rowFormContract.isRecovery;
            int opContractInfoId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FormContract, SystemEnums.OperateEnum.Other);
            AuthorizationDS.PositionRow ViewerPosition = (AuthorizationDS.PositionRow) this.Session["Position"];
            if (new PositionRightBLL().CheckPositionRight(ViewerPosition.PositionId, opContractInfoId) && rowForm.StatusID == 2)
            {
                if (!rowFormContract.IsisStampedNull() && rowFormContract.isStamped)
                {
                    this.StampBtn.Visible = false;
                }
                else
                {
                    this.StampBtn.Visible = true;
                }
                if (!rowFormContract.IsisRecoveryNull() && rowFormContract.isRecovery)
                {
                    this.RecoveryBtn.Visible = false;
                }
                else
                {
                    this.RecoveryBtn.Visible = true;
                }
            }
            else
            {
                this.StampBtn.Visible    = false;
                this.RecoveryBtn.Visible = false;
            }
        }

        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }