private void btndelete_Click(object sender, EventArgs e) { StudentInfoBLL stubll = new StudentInfoBLL(); string p = (string)dgvStudent.CurrentRow.Cells[0].Value; stubll.deleteStudentInfo(p); }
private void btnall_Click(object sender, EventArgs e) { StudentInfoBLL stubll = new StudentInfoBLL(); List <StudentInfoModel> list = stubll.getAllStudentInfoList(); this.dgvStudent.DataSource = list; }
private void btnsearch_Click(object sender, EventArgs e) { string txtstuid = textBox1.Text; StudentInfoBLL stubll = new StudentInfoBLL(); List <StudentInfoModel> list = stubll.getStudentInfoID(txtstuid); this.dgvStudent.DataSource = list; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; List <StudentInfoModel> ls = new StudentInfoBLL().GetAll().ToList(); JavaScriptSerializer js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(ls)); }
private void btnupdate_Click(object sender, EventArgs e) { StudentInfoModel stu = new StudentInfoModel(); stu = (StudentInfoModel)dgvStudent.CurrentRow.DataBoundItem; StudentInfoBLL stubll = new StudentInfoBLL(); stubll.updateStudentInfo(stu); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string filename = "学生信息.xls"; string filepath = context.Request.MapPath("..\\download\\") + filename; StudentInfoModel[] ls = new StudentInfoBLL().GetAll().ToArray(); Excel.ExportToExcel(filepath, "学生信息", "学生信息一览", ls); //context.Response.Redirect(filepath); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request.Form["id"]; //string stuname = new StudentInfoBLL().GetNameByStuId(id); StudentInfoModel m = new StudentInfoBLL().GetByStuCardId(id); JavaScriptSerializer js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(m)); //context.Response.Write(stuname); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string className = context.Request.Form["className"]; List <WanChengQingkuangModel> m = new StudentInfoBLL().GetWanChengQingKuang(new ClassBLL().Get(new Guid(className)).ClassName).ToList(); var memberList = from n in m orderby n.JhNum descending, n.WanCheng descending select n; JavaScriptSerializer js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(memberList)); }
//头像选择 private void btnpicture_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.ShowDialog(); if (!string.IsNullOrEmpty(open.FileName)) { string file = open.FileName; headPath.Image = Image.FromFile(file); StudentInfoBLL bll = new StudentInfoBLL(); if (bll.updateStudentHeadpath(stuID, file) == 1) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败"); } } }
private void btnSure_Click(object sender, EventArgs e) { string pwd = txtp.Text; string pp = txtPwd.Text; if (pwd != pp) { MessageBox.Show("密码不一致", "错误"); } else { StudentInfoBLL stubll = new StudentInfoBLL(); StudentInfoModel stu = stubll.getStudentInfoByID(stuID); stu.StuPwd = pwd; if (stubll.updateStudentInfo(stu) == 1) { this.Close(); this.Dispose(); } } }
public void ProcessRequest(HttpContext context) { HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; StudentsUser user = context.Session["user_"] as StudentsUser; string fileName = context.Server.MapPath("~/uploads") + "//" + user.Sfzh + ".jpg"; file.SaveAs(fileName); using (StudentInfoBLL bll = new StudentInfoBLL()) { StudentInfo selectInfo = bll.getEntity(user.Sfzh); selectInfo.PicPath = "//uploads//" + user.Sfzh + ".jpg"; bll.Update(selectInfo); } } //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); }
void initContracts() { //如果存在Student.xml查询所有学生信息,如果不存在,则创建后在查询 if (File.Exists(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"/xml/Student.xml")) { dataGridView1.DataSource = StudentInfoBLL.GetAllStudentInfo(); } else { StudentInfoBLL.CreateStudentXml(); dataGridView1.DataSource = StudentInfoBLL.GetAllStudentInfo(); } //初始化数据表格dataGitlView的列标题 dataGridView1.Columns[0].HeaderText = "学生编号"; dataGridView1.Columns[1].HeaderText = "学生姓名"; dataGridView1.Columns[2].HeaderText = "学生性别"; dataGridView1.Columns[3].HeaderText = "学生年龄"; dataGridView1.Columns[4].HeaderText = "出生日期"; dataGridView1.Columns[5].HeaderText = "手机号码"; dataGridView1.Columns[6].HeaderText = "家庭住址"; dataGridView1.Columns[7].HeaderText = "电子邮箱"; dataGridView1.Columns[8].HeaderText = "专 业"; }
//check student whether exist private bool checkStudent(out StudentInfoModel stu) { StudentInfoBLL bll = new StudentInfoBLL(); stu = bll.getStudentInfoByID(txtUser.Text.Trim()); if (stu == null) { lblU.Visible = true; return(false); } else { if (stu.StuPwd == txtPwd.Text.Trim()) { return(true); } else { lblP.Visible = true; return(false); } } }
//注册 private void btnLogin_Click(object sender, EventArgs e) { if (txtStuID.Text.Trim() == "") { MessageBox.Show("学号不能为空"); return; } if (txtStuName.Text.Trim() == "") { MessageBox.Show("姓名不能为空"); return; } StudentInfoModel stu = new StudentInfoModel(); stu.StuID = txtStuID.Text.Trim(); stu.StuName = txtStuName.Text.Trim(); stu.StuPwd = stu.StuID; stu.NowBorrows = 0; stu.NowsCredit = 10; stu.SchoolID = ((SchoolGroup)combSchool.SelectedItem).SchoolID; stu.CollegeID = ((CollegeGroup)combCollege.SelectedItem).CollegeID; stu.ProfessionID = ((ProfessionGroup)combProfession.SelectedItem).ProfessionID; stu.HeadPath = txtpic.Text.Trim(); stu.StuClass = numClass.Value.ToString(); stu.Entrance = dtpEntrance.Value; StudentInfoBLL bll = new StudentInfoBLL(); if (bll.insertStudentInfo(stu) == 1) { MessageBox.Show("注册成功"); } else { MessageBox.Show("注册失败"); } this.Close(); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { StudentInfo studentInfo = new StudentInfo(); if (treeView1.SelectedNode.Text == "计算机科学与技术") { studentInfo.Profession = "计算机科学与技术"; dataGridView1.DataSource = StudentInfoBLL.GetStudentInfoList(studentInfo); } else if (treeView1.SelectedNode.Text == "电子信息科学与技术") { studentInfo.Profession = "电子信息科学与技术"; dataGridView1.DataSource = StudentInfoBLL.GetStudentInfoList(studentInfo); } else if (treeView1.SelectedNode.Text == "信息安全") { studentInfo.Profession = "信息安全"; dataGridView1.DataSource = StudentInfoBLL.GetStudentInfoList(studentInfo); } else { dataGridView1.DataSource = StudentInfoBLL.GetAllStudentInfo(); } }
private void toolStrip_delete_Click(object sender, EventArgs e) { //选中某一个学生信息,删除学生信息 if (dataGridView1.SelectedRows.Count == 1) { if (MessageBox.Show("确定删除此学生信息?", "确认信息", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { int selectrow = Int32.Parse(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString()); if (StudentInfoBLL.DeleteStudentInfo(selectrow)) { MessageBox.Show("删除学生信息成功!"); } else { MessageBox.Show("删除学生信息失败,请确认是否选中学生信息"); } initContracts(); } } else { MessageBox.Show("请选中一行后再点击删除!"); } }
public static string getSelectInfo(string id) { int code = 1; string message = "返回数据成功"; string str3 = string.Empty; if (HttpContext.Current.Session["user_"] == null) { code = 0; message = "您还没有登录,请您登录!"; str3 = JsonConvert.SerializeObject(new { code = code, message = message }); } else { StudentsUser user = new StudentsUser(); if (HttpContext.Current.Session["user_"] == null && id != "0") { using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.GetEntity(int.Parse(id)); } } else if (HttpContext.Current.Session["user_"] != null) { user = HttpContext.Current.Session["user_"] as StudentsUser; } List <Nation> listNation = new List <Nation>(); //民族列表 List <ZZMM> listZZMM = new List <ZZMM>(); //政治面貌 List <AreaCode_> listShiAreaCode = new List <AreaCode_>(); //城市列表 List <KSLB> listKslb = new List <KSLB>(); //考生类别 List <BYLB> listBylb = new List <BYLB>(); //毕业类别 List <ZY> listZy = new List <ZY>(); //专业名称 StudentInfo stuInfo = new StudentInfo(); Wish wish = new Wish(); //考生志愿信息 ZY Zy_ = new ZY(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AreaCodeBLL bll = new AreaCodeBLL()) { listShiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { stuInfo = bll.getEntity(user.Sfzh); if (stuInfo != null) { HttpContext.Current.Session["PicPath_"] = stuInfo.PicPath; } } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } } else { code = 0; message = "请您登陆后再填写详细信息!"; } str3 = JsonConvert.SerializeObject(new { code = code, message = message, listNation = listNation, ListZZMM = listZZMM, listShiAreaCode = listShiAreaCode, listKslb = listKslb, listBylb = listBylb, listZy = listZy, user = user, stuInfo = stuInfo, wish = wish, } ); } return(str3); }
private void InfoBaseForm_Load(object sender, EventArgs e) { StudentInfoBLL stubll = new StudentInfoBLL(); StudentInfoModel stuModel = new StudentInfoModel(); GetGroupsBLL group = new GetGroupsBLL(); stuModel = stubll.getStudentInfoByID(stuID); txtstuName.Text = stuModel.StuName; txtstuName.ReadOnly = true; txtstuID.Text = stuModel.StuID; txtstuID.ReadOnly = true; txtentrance.Text = stuModel.StuClass; txtentrance.ReadOnly = true; BorrowHistoryBLL bll = new BorrowHistoryBLL(); List <ShowBorrowHistory> list = bll.getListBorrowHisoryNow(stuModel.StuID); txtnowBorrows.Text = list.Count.ToString(); string sql = "select schoolName from SchoolType where schoolid='" + stuModel.SchoolID + "'"; SQLHelper h = new SQLHelper(); SqlParameter[] psa = { new SqlParameter("@stuID", stuID), }; string s = h.ExecuteScalar(sql, psa).ToString(); txtschool.Text = s; txtschool.ReadOnly = true; string sqla = "select CollegeName from Collegetype where CollegeId=" + "'" + stuModel.CollegeID + "'"; SQLHelper a = new SQLHelper(); SqlParameter[] psb = { new SqlParameter("@stuID", stuID), }; string t = a.ExecuteScalar(sqla, psb).ToString(); txtcollege.Text = t; txtcollege.ReadOnly = true; string sqlb = "select ProfessionName from professiontype where ProfessionID=" + "'" + stuModel.ProfessionID + "'"; SQLHelper b = new SQLHelper(); SqlParameter[] psc = { new SqlParameter("@stuID", stuID), }; string u = b.ExecuteScalar(sqlb, psc).ToString(); txtprofession.Text = u; txtprofession.ReadOnly = true; txtstuClass.Text = stuModel.StuClass; txtstuClass.ReadOnly = true; StudentInfoBLL stublld = new StudentInfoBLL(); int m = stublld.timeoutBorrowsBook(stuID); stuModel.NowsCredit = stuModel.NowsCredit - m; txtnowsCredit.Text = stuModel.NowsCredit.ToString(); stublld.updateStudentInfo(stuModel); }
public static string getSelectInfo(string id) { int code = 1; string message = "返回数据成功"; StudentsUser user = new StudentsUser(); if (HttpContext.Current.Session["user_"] == null && id != "0") { using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.GetEntity(int.Parse(id)); } } else if (HttpContext.Current.Session["user_"] != null) { user = HttpContext.Current.Session["user_"] as StudentsUser; } List <Nation> listNation = new List <Nation>(); List <ZZMM> listZZMM = new List <ZZMM>(); List <AreaCode_> shiAreaCode = new List <AreaCode_>(); List <KSLB> listKslb = new List <KSLB>(); List <BYLB> listBylb = new List <BYLB>(); List <ZY> listZy = new List <ZY>(); StudentInfo info = new StudentInfo(); Wish wish = new Wish(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AfficheBLL bll = new AfficheBLL()) { shiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { info = bll.getEntity(user.Sfzh); } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } } else { code = 0; message = "请登录后在操作"; } string str3 = JsonConvert.SerializeObject(new { code = code, message = message, listNation = listNation, listZZMM = listZZMM, shiAreaCode = shiAreaCode, listBylb = listBylb, listKslb = listKslb, listZy = listZy, user = user, info = info, wish = wish }); return(str3); }
public static string saveInfo(string SignUpNum, string Zkzh, string Sfzh, string Mobile, string Nation, string ZZMM, int Health, string KSLB, string AreaCode, string Byxx, string BYLB, string LikeSpecial, string Tel, string Yzbm, string Txdz, string FrsZY, string SecZy, int IsAdjust, string AcceptPeople) { int code = 1; string message = "保存成功!!"; string strCsrq = Sfzh.Substring(6, 4) + "-" + Sfzh.Substring(10, 2) + "-" + Sfzh.Substring(12, 2); int _XB = 0;//n女 if (int.Parse(Sfzh.Substring(14, 3)) % 2 != 0) { _XB = 1;//男 } string PicPath = HttpContext.Current.Session["PicPath_"].ToString(); if (PicPath != null) { try { StudentInfo _setInfo = new StudentInfo(); _setInfo.AcceptPeople = AcceptPeople; _setInfo.AreaCode = AreaCode; _setInfo.BYLB = BYLB; _setInfo.Byyx = Byxx; _setInfo.Csrq = DateTime.Parse(strCsrq); _setInfo.Health = Health; _setInfo.KSLB = KSLB; _setInfo.LikeSpecial = LikeSpecial; _setInfo.Mobile = Mobile; _setInfo.Nation = Nation; _setInfo.Sfzh = Sfzh; _setInfo.Tel = Tel; _setInfo.Txdz = Txdz; _setInfo.Xb = _XB; _setInfo.Yzbm = Yzbm; _setInfo.ZZMM = ZZMM; _setInfo.PicPath = PicPath; using (StudentInfoBLL bll = new StudentInfoBLL()) { if (bll.getEntity(Sfzh) == null) { bll.Insert(_setInfo); } else { bll.Update(_setInfo); } } Wish _Wish = new Wish(); _Wish.IsAdjust = IsAdjust; _Wish.FrsZY = FrsZY; _Wish.SecZY = SecZy; _Wish.Sfzh = Sfzh; using (WishBLL bll = new WishBLL()) { if (bll.getEntity(Sfzh) == null) { bll.Insert(_Wish); } else { bll.Update(_Wish); } } } catch (Exception) { code = 0; message = "数据合法性错误,请检查!"; } } else { code = 0; message = "后台数据错误!!"; } return(JsonConvert.SerializeObject(new { code = code, message = message })); }
public static String printInfo() { int code = 1; string message = "打印成功!!"; StudentsUser user = HttpContext.Current.Session["user_"] as StudentsUser; List <Nation> listNation = new List <Nation>(); //民族列表 List <ZZMM> listZZMM = new List <ZZMM>(); //政治面貌 List <AreaCode_> listShiAreaCode = new List <AreaCode_>(); //城市列表 List <KSLB> listKslb = new List <KSLB>(); //考生类别 List <BYLB> listBylb = new List <BYLB>(); //毕业类别 List <ZY> listZy = new List <ZY>(); //专业名称 StudentInfo stuInfo = new StudentInfo(); Wish wish = new Wish(); //考生志愿信息 Nation nation_ = new Nation(); AreaCode_ areaCode, areaShiCode = new AreaCode_(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AreaCodeBLL bll = new AreaCodeBLL()) { listShiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { stuInfo = bll.getEntity(user.Sfzh); //if (stuInfo.PicPath.Trim().Length != null) //{ // HttpContext.Current.Session["PicPath_"] =stuInfo.PicPath; //} } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } Document doc = new Document(System.Web.HttpContext.Current.Server.MapPath("~/uploads") + "//templet.doc"); foreach (Bookmark item in doc.Range.Bookmarks) { if (item != null) { switch (item.Name) { case "SignUpNum": item.Text = user.SignUpNum; break; ///sfzh case "Sfzh_1": item.Text = user.Sfzh.Substring(0, 1); break; case "Sfzh_2": item.Text = user.Sfzh.Substring(1, 1); break; case "Sfzh_3": item.Text = user.Sfzh.Substring(2, 1); break; case "Sfzh_4": item.Text = user.Sfzh.Substring(3, 1); break; case "Sfzh_5": item.Text = user.Sfzh.Substring(4, 1); break; case "Sfzh_6": item.Text = user.Sfzh.Substring(5, 1); break; case "Sfzh_7": item.Text = user.Sfzh.Substring(6, 1); break; case "Sfzh_8": item.Text = user.Sfzh.Substring(7, 1); break; case "Sfzh_9": item.Text = user.Sfzh.Substring(8, 1); break; case "Sfzh_10": item.Text = user.Sfzh.Substring(9, 1); break; case "Sfzh_11": item.Text = user.Sfzh.Substring(10, 1); break; case "Sfzh_12": item.Text = user.Sfzh.Substring(11, 1); break; case "Sfzh_13": item.Text = user.Sfzh.Substring(12, 1); break; case "Sfzh_14": item.Text = user.Sfzh.Substring(13, 1); break; case "Sfzh_15": item.Text = user.Sfzh.Substring(14, 1); break; case "Sfzh_16": item.Text = user.Sfzh.Substring(15, 1); break; case "Sfzh_17": item.Text = user.Sfzh.Substring(16, 1); break; case "Sfzh_18": item.Text = user.Sfzh.Substring(17, 1); break; ///zkzh case "Zkzh_1": item.Text = user.Zkzh.Substring(0, 1); break; case "Zkzh_2": item.Text = user.Zkzh.Substring(1, 1); break; case "Zkzh_3": item.Text = user.Zkzh.Substring(2, 1); break; case "Zkzh_4": item.Text = user.Zkzh.Substring(3, 1); break; case "Zkzh_5": item.Text = user.Zkzh.Substring(4, 1); break; case "Zkzh_6": item.Text = user.Zkzh.Substring(5, 1); break; case "Zkzh_7": item.Text = user.Zkzh.Substring(6, 1); break; case "Zkzh_8": item.Text = user.Zkzh.Substring(7, 1); break; case "Zkzh_9": item.Text = user.Zkzh.Substring(8, 1); break; case "Zkzh_10": item.Text = user.Zkzh.Substring(9, 1); break; case "Zkzh_11": item.Text = user.Zkzh.Substring(10, 1); break; case "Zkzh_12": item.Text = user.Zkzh.Substring(11, 1); break; case "Zkzh_13": item.Text = user.Sfzh.Substring(12, 1); break; case "Zkzh_14": item.Text = user.Sfzh.Substring(13, 1); break; ///picpath case "PicPath": DocumentBuilder builder = new DocumentBuilder(doc); string imgPath = System.Web.HttpContext.Current.Server.MapPath("~/uploads") + "\\" + user.Sfzh + ".jpg"; if (File.Exists(imgPath)) { builder.MoveToBookmark("PicPath"); builder.InsertImage(imgPath, RelativeHorizontalPosition.Margin, 1, RelativeVerticalPosition.Margin, 1, 80, 100, WrapType.Square); } break; ///StuName case "StuName": item.Text = user.StuName; break; ///Tel case "Tel": item.Text = stuInfo.Tel; break; ///Txdz case "Txdz": item.Text = stuInfo.Txdz; break; ///Xb case "Xb": item.Text = (stuInfo.Xb == 0 ? "女" : "男"); break; ///Yzbm case "Yzbm": item.Text = stuInfo.Yzbm; break; ///AcceptPeople case "AcceptPeople": item.Text = stuInfo.AcceptPeople; break; ///Byyx case "Byyx": item.Text = stuInfo.Byyx; break; ///Csrq case "Csrq": item.Text = stuInfo.Csrq.ToString("yyyy-MM-dd"); break; ///Health case "Health": if (stuInfo.Health == 0) { item.Text = "好"; } else if (stuInfo.Health == 1) { item.Text = "一般"; } else if (stuInfo.Health == 2) { item.Text = "比较好"; } else if (stuInfo.Health == 3) { item.Text = "差"; } break; ///IsAdjust case "IsAdjust": item.Text = (wish.IsAdjust == 0 ? "否" : "是"); break; ///LikeSpecial case "LikeSpecial": item.Text = stuInfo.LikeSpecial; break; ///Mobile case "Mobile": item.Text = stuInfo.Mobile; break; ///Nation case "Nation": using (NationBLL bll = new NationBLL()) { nation_ = bll.getNationName(stuInfo.Nation); } item.Text = nation_.NationName.ToString(); break; ///AreaCode case "AreaCode": using (AreaCodeBLL bll = new AreaCodeBLL()) { areaCode = bll.getAreaName(stuInfo.AreaCode.Substring(0, 4)); areaShiCode = bll.getAreaName(stuInfo.AreaCode); } item.Text = areaCode.AreaName.ToString() + areaShiCode.AreaName.ToString(); break; ///ZZMM case "ZZMM": var answerZzmm = (from p in listZZMM where p.ZzmmDm == stuInfo.ZZMM select p).Single(); item.Text = answerZzmm.ZzmmMc.ToString(); break; ///BYLB case "BYLB": var answerBylb = (from p in listBylb where p.BylbDm == stuInfo.BYLB select p).Single(); item.Text = answerBylb.BylbMc.ToString(); break; ///KSLB case "KSLB": var answerKslb = (from p in listKslb where p.KslbDm == stuInfo.KSLB select p).Single(); item.Text = answerKslb.KslbMc.ToString(); break; ///FrsZY case "FrsZY": var answerFrszy = (from p in listZy where p.ZYDM == wish.FrsZY.Trim() select p); string stringFrstzy = string.Empty; foreach (var item1 in answerFrszy) { stringFrstzy = item1.ZYMC; } item.Text = stringFrstzy.ToString(); break; ///SecZY case "SecZY": var answerSeczy = (from pp in listZy where pp.ZYDM == wish.SecZY.Trim() select pp); string stringSeczy = string.Empty; foreach (var item2 in answerSeczy) { stringSeczy = item2.ZYMC; } item.Text = stringSeczy.ToString(); break; } } doc.Print(); //doc.Save("d:\\adc.doc"); message = "打印成功,请请前往D盘查看!!"; } } else { code = 0; message = "打印失败,后台信息错误!"; } return(JsonConvert.SerializeObject(new { code = code, message = message })); }