示例#1
0
    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"];
    }
    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.PersonalReimburseBLL.GetFormByID(formID)[0];
            FormDS.FormPersonalReimburseRow rowPersonalReimburse = this.PersonalReimburseBLL.GetFormPersonalReimburseByID(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.txtPeriod.Text = rowPersonalReimburse.Period.ToString("yyyyMM");
            if (!rowPersonalReimburse.IsRemarkNull()) {
                this.RemarkCtl.Text = rowPersonalReimburse.Remark;
            }

            // ����ϸ��
            FormPersonalReimburseDetailTableAdapter taDetail = new FormPersonalReimburseDetailTableAdapter();
            taDetail.FillByFormID(this.InnerDS.FormPersonalReimburseDetail, formID);

            //��ʷ����
            if (rowForm.IsRejectedFormIDNull()) {
                lblRejectFormNo.Text = "��";
            } 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/PersonalReimburseApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //����ҳ�洦��&��ť����&Ԥ����Ϣ
            this.txtTotalBudget.Text = rowPersonalReimburse.TotalBudget.ToString("N");
            this.txtApprovingAmount.Text = rowPersonalReimburse.ApprovingAmount.ToString("N");
            this.txtApprovedAmount.Text = rowPersonalReimburse.ApprovedAmount.ToString("N");
            this.txtRemainAmount.Text = rowPersonalReimburse.RemainAmount.ToString("N");

            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 && stuffUser.StuffUserId == rowForm.UserID) {
                this.EditBtn.Visible = true;
                this.ScrapBtn.Visible = true;
            } else {
                this.EditBtn.Visible = false;
                this.ScrapBtn.Visible = false;
            }

            if (rowForm.UserID == stuffUser.StuffUserId) {
                this.BudgetTitleDIV.Visible = false;
                this.BudgetInfoDIV.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;
                }
            }

            //�Ƿ���ʾ���ư�ť
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && stuffUser.StuffUserId == rowForm.UserID) {
                this.UCPeriod.Visible = true;
                this.CopyBtn.Visible = true;
            } else {
                this.UCPeriod.Visible = false;
                this.CopyBtn.Visible = false;
            }

            //����ʵ����ť
            int opSaveId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FormPersonalReimburse, SystemEnums.OperateEnum.Other);
            AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"];
            if (new PositionRightBLL().CheckPositionRight(position.PositionId, opSaveId) && (rowForm.StatusID == 1 || rowForm.StatusID == 2)) {
                HasSaveRight = true;
            } else {
                HasSaveRight = false;
            }
            if (HasSaveRight) {
                this.SaveBtn.Visible = true;
            } else {
                this.SaveBtn.Visible = false;
            }

        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
示例#3
0
    public static string GetNameByFormID(int FormTypeID, int FormID)
    {
        string ApplyName = string.Empty;

        if (FormTypeID == (int)SystemEnums.FormType.SalesApply) {
            FormDS.FormApplyRow applyRow = new SalesApplyBLL().GetFormApplyByID(FormID)[0];
            if (!applyRow.IsFormApplyNameNull()) {
                ApplyName = applyRow.FormApplyName.Length > 10 ? applyRow.FormApplyName.Substring(0, 10) : applyRow.FormApplyName;
            }
        }

        if (FormTypeID == (int)SystemEnums.FormType.ContractApply) {
            FormDS.FormContractRow applyRow = new ContractApplyBLL().GetFormContractByID(FormID)[0];
            ApplyName = applyRow.ContractName.Length > 10 ? applyRow.ContractName.Substring(0, 10) : applyRow.ContractName;
        }

        return ApplyName;
    }