コード例 #1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            IDiseases DiseaseManager;

            try
            {
                if (!IsPostBack)
                {
                    DiseaseManager = (IDiseases)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDiseases, BusinessProcess.Administration");
                    DataSet theDS = DiseaseManager.GetDiseases();
                    this.grdDisease.DataSource = theDS.Tables[0];
                    this.grdDisease.DataBind();
                    if (ViewState["grdDataSource"] == null)
                    {
                        ViewState["grdDataSource"] = theDS.Tables[0];
                    }
                    ViewState["SortDirection"] = "Desc";
                    BindGrid();
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                DiseaseManager = null;
            }
        }