Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack) {
            String title = this.GetLocalResourceObject("titleLabel.Text").ToString();
            PageUtility.SetContentTitle(this.Page, title);

            // 用户信息,职位信息
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            AuthorizationDS.PositionRow rowUserPosition = (AuthorizationDS.PositionRow)Session["Position"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            this.ViewState["PositionID"] = rowUserPosition.PositionId;

            this.StuffNameCtl.Text = CommonUtility.GetStaffFullName(stuffUser);
            this.PositionNameCtl.Text = rowUserPosition.PositionName;
            this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName;
            this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId;
            this.StuffNoCtl.Text = stuffUser.IsStuffNoNull() ? "" : stuffUser.StuffNo;
            this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString();

            if (this.Request["RejectObjectID"] != null) {
                this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString());
            }
            VATTypeDDL.DataBind();
            PaymentTypeDDL.DataBind();
            PaymentTypeDDL_SelectedIndexChanged(null, null);
            InvoiceStatusDDL.DataBind();
            //如果是草稿进行赋值
            int formApplyID;
            if (Request["ObjectId"] != null) {
                this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]);
                FormDS.FormMarketingPaymentRow rowFormPayment = this.FormMarketingBLL.GetFormMarketingPaymentByID(int.Parse(this.ViewState["ObjectId"].ToString()));
                formApplyID = rowFormPayment.FormMarketingApplyID;
                this.ViewState["FormMarketingApplyID"] = formApplyID;
                if (this.Request["RejectObjectID"] == null) {
                    this.DeleteBtn.Visible = true;
                } else {
                    this.DeleteBtn.Visible = false;
                }
                //赋值备注等
                this.PaymentTypeDDL.SelectedValue = rowFormPayment.PaymentTypeID.ToString();
                PaymentTypeDDL_SelectedIndexChanged(null, null);
                this.InvoiceStatusDDL.SelectedValue = rowFormPayment.InvoiceStatusID.ToString();
                if (!rowFormPayment.IsVATTypeIDNull()) {
                    VATTypeDDL.SelectedValue = rowFormPayment.VATTypeID.ToString();
                }
                if (!rowFormPayment.IsPaymentFileNameNull()) {
                    this.UCFliePayment.AttachmentFileName = rowFormPayment.PaymentFileName;
                }
                if (!rowFormPayment.IsPaymentRealFileNameNull()) {
                    this.UCFliePayment.RealAttachmentFileName = rowFormPayment.PaymentRealFileName;
                }
                if (!rowFormPayment.IsRemarkNull()) {
                    this.RemarkCtl.Text = rowFormPayment.Remark;
                }
                new FormMarketingPaymentDetailTableAdapter().FillCurrentData(this.InnerDS.FormMarketingPaymentDetail, rowFormPayment.FormMarketingPaymentID, rowFormPayment.FormMarketingApplyID);
                new FormInvoiceTableAdapter().FillByFormID(this.InnerDS.FormInvoice, rowFormPayment.FormMarketingPaymentID);
            } else {
                formApplyID = int.Parse(Request["FormMarketingApplyID"]);
                this.ViewState["FormMarketingApplyID"] = formApplyID;
                new FormMarketingPaymentDetailTableAdapter().FillByMarketingApplyID(this.InnerDS.FormMarketingPaymentDetail, formApplyID);
            }
            MasterDataBLL mdBLL = new MasterDataBLL();
            this.FormNoCtl.Text = this.FormMarketingBLL.GetFormByID(formApplyID)[0].FormNo;
            FormDS.FormMarketingApplyRow rowFormApply = this.FormMarketingBLL.GetFormMarketingApplyByID(formApplyID)[0];
            this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM");

            this.CustomerChannelCtl.Text = new CustomerChannelTableAdapter().GetDataByID(rowFormApply.CustomerChannelID)[0].CustomerChannelName;
            this.BrandCtl.Text = new BrandTableAdapter().GetDataByID(rowFormApply.BrandID)[0].BrandName;
            this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormApply.CurrencyID)[0].CurrencyShortName;
            this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString();
            this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowFormApply.ExpenseCategoryID).ExpenseCategoryName;
            this.ProjectNameCtl.Text = mdBLL.GetMarketingProjectById(rowFormApply.MarketingProjectID).MarketingProjectName;

            this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc;
            if (!rowFormApply.IsApplyFileNameNull())
                this.UCFileApply.AttachmentFileName = rowFormApply.ApplyFileName;
            if (!rowFormApply.IsApplyRealFileNameNull())
                this.UCFileApply.RealAttachmentFileName = rowFormApply.ApplyRealFileName;

            if (!rowFormApply.IsActivityBeginDateNull()) {
                this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsActivityEndDateNull()) {
                this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd");
            }
            this.ViewState["CostCenterID"] = this.FormMarketingBLL.GetFormByID(int.Parse(this.ViewState["FormMarketingApplyID"].ToString()))[0].CostCenterID;
            this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(int.Parse(this.ViewState["CostCenterID"].ToString()));
        }
    }