protected void FormView1_DataBound(object sender, EventArgs e) { switch (this.FormView1.CurrentMode) { case FormViewMode.Edit: HtmlInputControl TemplateNameHIC = (HtmlInputControl)this.FormView1.Row.FindControl("txtTemplateName"); HtmlInputControl TemplateHIC = (HtmlInputControl)this.FormView1.Row.FindControl("txtTemplateCode"); TemplateNameHIC.Value = RmsDM.BFL.FileTemplateBFL.GetTemplateName(TemplateHIC.Value); HtmlInputHidden tbxUnitCode = (HtmlInputHidden)this.FormView1.Row.FindControl("txtUnit"); HtmlInputText tbxUnitName = (HtmlInputText)this.FormView1.Row.FindControl("txtUnitName"); tbxUnitName.Value = RmsPM.BLL.SystemRule.GetUnitName(tbxUnitCode.Value); break; case FormViewMode.Insert: RmsDM.BFL.DocumentDirectoryBFL docDirBFL = new RmsDM.BFL.DocumentDirectoryBFL(); RmsDM.MODEL.DocumentDirectoryModel ddModel = docDirBFL.GetDocumentDirectory(int.Parse(Request["DirectorCode"])); int FileTemplateCode = ddModel.FileTemplateCode; string DepartmentCode = ddModel.DepartmentCode; Label labFileTemplateCode = (Label)this.FormView1.Row.FindControl("FileTemplateCodeLabel"); labFileTemplateCode.Text = RmsDM.BFL.FileTemplateBFL.GetTemplateName(Convert.ToString(FileTemplateCode)); Label labDepartmentCode = (Label)this.FormView1.Row.FindControl("ApplyDepartmentCodeLabel"); labDepartmentCode.Text = RmsPM.BLL.SystemRule.GetUnitName(DepartmentCode); TextBox txtCounts = (TextBox)this.FormView1.Row.FindControl("txtCounts"); txtCounts.Text = "1"; TextBox txtLeaves = (TextBox)this.FormView1.Row.FindControl("txtLeaves"); txtLeaves.Text = "1"; break; case FormViewMode.ReadOnly: Label tbxUnit = (Label)this.FormView1.Row.FindControl("ApplyDepartmentCodeLabel"); tbxUnit.Text = RmsPM.BLL.SystemRule.GetUnitName(tbxUnit.Text); Label labUser = (Label)this.FormView1.Row.FindControl("ApplyUserCodeLabel"); labUser.Text = WebFunctionRule.GetUserNameByCode(labUser.Text); Label labGreateUser = (Label)this.FormView1.Row.FindControl("CreateUserCodeLabel"); labGreateUser.Text = WebFunctionRule.GetUserNameByCode(labGreateUser.Text); Label labLastModifyUser = (Label)this.FormView1.Row.FindControl("LastModifyByUserCodeLabel"); labLastModifyUser.Text = WebFunctionRule.GetUserNameByCode(labLastModifyUser.Text); break; } }
protected void DocumentFileFormView_DataBound(object sender, EventArgs e) { HiddenField UserCodeHiddenField = (HiddenField)this.DocumentFileFormView.Row.FindControl("ApplyUserCodeHiddenField"); Label UserCodeLabel = (Label)this.DocumentFileFormView.Row.FindControl("ApplyUserCodeLabel"); switch (this.DocumentFileFormView.CurrentMode) { case FormViewMode.Edit: UserCodeLabel.Text = WebFunctionRule.GetUserNameByCode(UserCodeHiddenField.Value); Label AppDepLabel = (Label)this.DocumentFileFormView.Row.FindControl("ApplyDepartmentCodeLabel"); HiddenField AppDepHiddenField = (HiddenField)this.DocumentFileFormView.Row.FindControl("ApplyDepartmentCodeHiddenField"); AppDepLabel.Text = RmsPM.BLL.SystemRule.GetUnitName(AppDepHiddenField.Value); break; case FormViewMode.Insert: User u = (User)Session["User"]; UserCodeHiddenField.Value = u.UserCode; UserCodeLabel.Text = WebFunctionRule.GetUserNameByCode(u.UserCode); string SortCode = ""; string MarkingSNCode = ""; if (!string.IsNullOrEmpty(FileTemplateCode)) { FileTemplateModel template = FTBFL.GetFileTemplate(int.Parse(FileTemplateCode)); if (template != null) { SortCode = template.SortCode; Web.SelectBox_SelectSessionUserUnit Unitddl = (Web.SelectBox_SelectSessionUserUnit) this.DocumentFileFormView.Row.FindControl("SelectSessionUserUnit"); MarkingSNCode = GetTempMarkingSN(Unitddl.SelectedValue, this.FileTemplateCode); } } Label SCLabel = (Label)this.DocumentFileFormView.Row.FindControl("SortCodeLabel"); //质量分类号 SCLabel.Text = SortCode; TextBox DMSN = (TextBox)this.DocumentFileFormView.Row.FindControl("DoucmentMarkingSNLabel"); //标识序列号 DMSN.Text = MarkingSNCode; break; } }