Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loginModel"] == null)
        {
            Response.Write("<script>alert('请重新登录');opener.top.location.href='../../Default.aspx';window.close();</script>");
            return;
        }
        id = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["id"]));

        rescuePatientRecordsModel = new RescuePatientRecordsModel();
        rescuePatientRecordsBLL   = new RescuePatientRecordsBLL();

        rescuePatientRecordsModel    = rescuePatientRecordsBLL.GetModelById(id);
        StudentsRealName.Text        = rescuePatientRecordsModel.StudentsRealName.ToString();
        TrainingBaseName.Text        = rescuePatientRecordsModel.TrainingBaseName.ToString();
        ProfessionalBaseName.Text    = rescuePatientRecordsModel.ProfessionalBaseName.ToString();
        RotaryDept.SelectedItem.Text = rescuePatientRecordsModel.DeptName.ToString();
        RotaryDept.SelectedValue     = rescuePatientRecordsModel.DeptCode.ToString();
        Teacher.SelectedItem.Text    = rescuePatientRecordsModel.TeacherName.ToString();
        Teacher.SelectedItem.Value   = rescuePatientRecordsModel.TeacherId.ToString();

        PatientName.Text   = rescuePatientRecordsModel.PatientName.ToString();
        CaseId.Text        = rescuePatientRecordsModel.CaseId.ToString();
        DiseaseName.Text   = rescuePatientRecordsModel.DiseaseName.ToString();
        Condition.Text     = rescuePatientRecordsModel.Condition.ToString();
        RescueMeasure.Text = rescuePatientRecordsModel.RescueMeasure.ToString();
        Comment.Text       = rescuePatientRecordsModel.Comment.ToString();
        Writor.Text        = rescuePatientRecordsModel.Writor.ToString();
        RegisterDate.Text  = rescuePatientRecordsModel.RegisterDate.ToString();
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loginModel"] == null)
        {
            Response.Write("<script>alert('请重新登录');opener.top.location.href='../../Default.aspx';window.close();</script>");
            return;
        }

        id = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["id"]));
        pi = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["pi"]));
        if (!IsPostBack)
        {
            loginModel = new LoginModel();
            studentsPersonalInformationModel = new StudentsPersonalInformation2Model();
            studentsPersonalInformationBLL   = new StudentsPersonalInformation2BLL();
            dt = new DataTable();


            professionalBaseDeptBLL = new ProfessionalBaseDeptBLL();

            loginModel            = (LoginModel)Session["loginModel"];
            Writor.Text           = loginModel.real_name;
            StudentsRealName.Text = loginModel.real_name; StudentsRealName.ReadOnly = true;
            RegisterDate.Text     = DateTime.Now.Date.ToString("yyyy-MM-dd");
            RegisterDate.ReadOnly = true;

            na = loginModel.name;
            StudentsName.Value = na;
            tbcode             = loginModel.training_base_code;

            studentsPersonalInformationModel = studentsPersonalInformationBLL.GetModelByNameTBCode(na, tbcode);

            if (studentsPersonalInformationModel == null)
            {
                Response.Write("<script> alert('请完善个人基本信息');window.close();</script>");
                return;
            }
            else
            {
                TrainingBaseCode.Value = studentsPersonalInformationModel.TrainingBaseCode.ToString();
                TrainingBaseName.Text  = studentsPersonalInformationModel.TrainingBaseName.ToString(); TrainingBaseName.ReadOnly = true;

                ProfessionalBaseCode.Value = studentsPersonalInformationModel.ProfessionalBaseCode.ToString();
                ProfessionalBaseName.Text  = studentsPersonalInformationModel.ProfessionalBaseName.ToString(); ProfessionalBaseName.ReadOnly = true;

                dt = professionalBaseDeptBLL.GetDeptDataTableByCode(studentsPersonalInformationModel.ProfessionalBaseCode.ToString());

                RotaryDept.DataSource = dt;

                RotaryDept.DataTextField  = "dept_name";
                RotaryDept.DataValueField = "dept_code";
                RotaryDept.DataBind();
                RotaryDept.Items.Insert(0, new ListItem("==请选择==", "0"));
            }


            if (!string.IsNullOrEmpty(id))
            {//如果不是表单提交,并且带了id值来做修改操作,则在界面上把值都呈现出来
                rescuePatientRecordsModel = new RescuePatientRecordsModel();
                rescuePatientRecordsBLL   = new RescuePatientRecordsBLL();

                rescuePatientRecordsModel = rescuePatientRecordsBLL.GetModelById(id);
                StudentsRealName.Text     = rescuePatientRecordsModel.StudentsRealName.ToString();
                TrainingBaseName.Text     = rescuePatientRecordsModel.TrainingBaseName.ToString();
                ProfessionalBaseName.Text = rescuePatientRecordsModel.ProfessionalBaseName.ToString();
                //RotaryDept.SelectedItem.Text = rescuePatientRecordsModel.DeptName.ToString();
                RotaryDept.SelectedValue = rescuePatientRecordsModel.DeptCode.ToString();
                //RotaryDept.Items.Insert(0, new ListItem("==请选择==", "0"));
                dt = new LoginBLL().GetTeachersDtByDeptCode(rescuePatientRecordsModel.TrainingBaseCode, rescuePatientRecordsModel.ProfessionalBaseCode, rescuePatientRecordsModel.DeptCode, "teachers");
                Teacher.DataSource     = dt;
                Teacher.DataTextField  = "real_name";
                Teacher.DataValueField = "name";
                Teacher.DataBind();
                Teacher.Items.Insert(0, new ListItem("==请选择==", "0"));
                Teacher.SelectedValue = rescuePatientRecordsModel.TeacherId;
                //Teacher.SelectedItem.Text = rescuePatientRecordsModel.TeacherName.ToString();
                //Teacher.SelectedItem.Value = rescuePatientRecordsModel.TeacherId.ToString();

                PatientName.Text   = rescuePatientRecordsModel.PatientName.ToString();
                CaseId.Text        = rescuePatientRecordsModel.CaseId.ToString();
                DiseaseName.Text   = rescuePatientRecordsModel.DiseaseName.ToString();
                Condition.Text     = rescuePatientRecordsModel.Condition.ToString();
                RescueMeasure.Text = rescuePatientRecordsModel.RescueMeasure.ToString();
                Comment.Text       = rescuePatientRecordsModel.Comment.ToString();
                Writor.Text        = rescuePatientRecordsModel.Writor.ToString();
                RegisterDate.Text  = rescuePatientRecordsModel.RegisterDate.ToString();
            }
        }
    }