Detail.aspx.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. //using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. //using System.Xml.Linq;
  13. namespace Com.Jpsoft.Hospital.Web.Module.jp_druginfo
  14. {
  15. public partial class Detail : Com.Jpsoft.Hospital.Web.Common.BasePage//System.Web.UI.Page
  16. {
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. if (!IsPostBack)
  20. {
  21. SetDDL();
  22. if (Request.Params["id"] != null || Request.Params["id"].Trim() != "")
  23. {
  24. string id = Request.Params["id"];
  25. ShowInfo(int.Parse(id));
  26. }
  27. }
  28. }
  29. #region
  30. /// <summary>
  31. /// 显示药品详情
  32. /// </summary>
  33. /// <param name="id"></param>
  34. private void ShowInfo(int id)
  35. {
  36. Com.Jpsoft.Hospital.BLL.jp_druginfo bll = new Com.Jpsoft.Hospital.BLL.jp_druginfo();
  37. Com.Jpsoft.Hospital.Model.jp_druginfo model = bll.GetModel(id);
  38. this.txtdrugname.Value = model.drugname;
  39. this.txtbusinessname.Value = model.businessname;
  40. Com.Jpsoft.Hospital.BLL.jp_drugtype tpbll = new Com.Jpsoft.Hospital.BLL.jp_drugtype();
  41. Com.Jpsoft.Hospital.Model.jp_drugtype tpmode = tpbll.GetModel(model.drugtype);
  42. DropDownList1.SelectedValue = tpmode.fatherid.ToString();
  43. SetDDLChild(tpmode.fatherid.ToString());
  44. this.DropDownList2.SelectedValue = model.drugtype.ToString();
  45. this.txtapprovalnumber.Value = model.approvalnumber;
  46. this.txtstandard.Value = model.standard;
  47. this.txtmanufacturer.Value = model.manufacturer;
  48. this.txtcompany.Value = model.company;
  49. this.txtintroduction.Value = model.introduction;
  50. this.txtgoodinfo.Value = model.goodinfo;
  51. //this.txtimgpath.Value = model.imgpath;
  52. this.Image1.ImageUrl = "~/Upload/drugimg/" + model.imgpath;
  53. this.txtingredients.Value = model.ingredients;
  54. this.txttraits.Value = model.traits;
  55. this.txtusedosage.Value = model.usedosage;
  56. this.txtdrugaffect.Value = model.drugaffect;
  57. this.txtfunctions.Value = model.functions;
  58. this.txtbadreaction.Value = model.badreaction;
  59. this.txttaboo.Value = model.taboo;
  60. this.txtnotice.Value = model.notice;
  61. this.txtvalidity.Value = model.validity;
  62. }
  63. /// <summary>
  64. /// 绑定父类别
  65. /// </summary>
  66. private void SetDDL()
  67. {
  68. Jpsoft.Hospital.BLL.jp_drugtype bll = new Com.Jpsoft.Hospital.BLL.jp_drugtype();
  69. DataTable dt = bll.GetList(" fatherid=0 ").Tables[0];
  70. for (int i = 0; i < dt.Rows.Count; i++)
  71. {
  72. DropDownList1.Items.Add(new ListItem(dt.Rows[i]["typename"].ToString(), dt.Rows[i]["id"].ToString()));
  73. }
  74. DropDownList1.Items.Insert(0, new ListItem("--请选择一级类别--", "0"));
  75. }
  76. /// <summary>
  77. /// 绑定子类别
  78. /// </summary>
  79. private void SetDDLChild(string id)
  80. {
  81. string where = string.Empty;
  82. if (id != "" )
  83. {
  84. where = " fatherid='" + id + "' ";
  85. }
  86. DropDownList2.Items.Clear();
  87. if (DropDownList1.SelectedValue != "0")
  88. {
  89. Jpsoft.Hospital.BLL.jp_drugtype bll = new Com.Jpsoft.Hospital.BLL.jp_drugtype();
  90. DataTable dt = bll.GetList(where).Tables[0];
  91. for (int i = 0; i < dt.Rows.Count; i++)
  92. {
  93. DropDownList2.Items.Add(new ListItem(dt.Rows[i]["typename"].ToString(), dt.Rows[i]["id"].ToString()));
  94. }
  95. }
  96. DropDownList2.Items.Insert(0, new ListItem("--请选择一级类别--", "0"));
  97. }
  98. #endregion
  99. }
  100. }