protected void Button_ExportExcel_Click(object sender, EventArgs e) { string exception = ""; string evaluatedID = Request.QueryString["id"]; string evaluatedName = Request.QueryString["name"]; PostBook postBook = new PostBook(); if (PostBookManagementCtrl.GetPostBook(ref postBook, evaluatedID, ref exception)) { string filename = ""; if (ExportManagementCtrl.ExportPostBook(ref filename, evaluatedName, postBook, ref exception)) { Response.ClearContent(); Response.ContentType = "application/excel"; Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(filename)); string path = Server.MapPath("..\\..\\downloadfiles\\" + filename); Response.TransmitFile(path); } else { Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error); } } else { Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error); } }
/// <summary> /// 载入岗位责任书 /// </summary> private void loadPostBook(string id) { string exception = ""; string evaluatedID = ""; if (id == "" || id == "0") { evaluatedID = Request.QueryString["id"]; } else { evaluatedID = id; } string name = Request.QueryString["name"]; Panel1.Title = name + "的岗位责任书"; PostBook pb = new PostBook(); Label_Depart.Text = Request.QueryString["depart"]; Radio_PostType.SelectedValue = Request.QueryString["posttype"]; Radio_Employer.SelectedValue = Request.QueryString["company"]; if (PostBookManagementCtrl.GetPostBook(ref pb, evaluatedID, ref exception)) { foreach (string[] content in pb.WorkContentRequest) { if (content.Length != 4) { return; } } string evaluatedName = Request.QueryString["name"]; Label_Comment.Text = pb.Comment; TextBox_LaborDepart.Text = pb.LaborDepart; Label_PostName.Text = pb.PostName; TextArea_EduBg.Text = pb.EduBg; TextArea_Certificate.Text = pb.Certificate; TextArea_Experience.Text = pb.Experience; TextArea_Skill.Text = pb.Skill; TextArea_Personality.Text = pb.Personality; TextArea_PhyCond.Text = pb.PhyCond; TextArea_WorkOutline.Text = pb.WorkOutline; TextArea_Power.Text = pb.Power; TextArea_Response.Text = pb.Response; TextBox_DirectLeader.Text = pb.DirectLeader; TextBox_Subordinate.Text = pb.Subordinate; TextBox_Colleague.Text = pb.Colleague; TextBox_Services.Text = pb.Services; TextBox_Relations.Text = pb.Relations; TextArea_WorkEnter.Text = pb.WorkEnter; TextArea_PostAssess.Text = pb.PostAssess; TextArea_Others.Text = pb.Others; addWorkContentRequest(pb.WorkContentRequest); } else { TextBox_LaborDepart.Text = Request.QueryString["labordepart"]; Label_PostName.Text = Request.QueryString["postname"]; } }