protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["USER_GUID"] == null) { if (Page.Request.QueryString["userid"] == null) { // no user parameter Page.ClientScript.RegisterStartupScript(typeof(string), "chkuser", "chkuserfailed(1);", true); return; } // Check user if (V_Sys_UserDAL.GetModel(Page.Request.QueryString["userid"]) == null) { // user not exist Page.ClientScript.RegisterStartupScript(typeof(string), "chkuser", "chkuserfailed(2);", true); return; } Session["USER_GUID"] = Page.Request.QueryString["userid"]; } RefreshGUI(); } }
private void InitCtrl() { //DataSet dsProject = ApplicationDAL.GetProjectList(); //this.ddlProject.DataSource = dsProject; //this.ddlProject.DataBind(); //Session["dsProject"] = dsProject; this.CreateDropdownListGroup(); //DataSet dsLoction = ApplicationDAL.GetLoctionList("1"); //this.ddlLocation.DataSource = dsLoction; //this.ddlLocation.DataBind(); //Session["dsLoction"] = dsLoction; //ddlLocation_SelectedIndexChanged(null, null); lblStatus.Text = "未提交"; this.txtName.Enabled = false; this.txtMobile.Enabled = false; this.txtEmail.Enabled = false; // New app if (Request.QueryString["guid"] == null) { // When create new application, using current login user context // When view and update, should use last saved user context V_Sys_UserMdl model = V_Sys_UserDAL.GetModel(Session["USER_GUID"].ToString()); this.txtName.Text = model.name; this.txtMobile.Text = model.login_name; this.txtEmail.Text = model.email; this.hidUserGUID.Value = Session["USER_GUID"].ToString(); } // View and update app if (Request.QueryString["guid"] != null) { string guid = Request.QueryString["guid"]; Consult_ApplicationDAL dal = new Consult_ApplicationDAL(); Consult_ApplicationMdl mdl = dal.GetModel(guid); BindGUI(mdl); } }
private void BindGUI(Consult_ApplicationMdl applicationMdl) { // Very importand, remember the uid this.hidGUID.Value = applicationMdl.guid; this.hidUserGUID.Value = applicationMdl.user_guid; this.hidStatus.Value = applicationMdl.status.ToString(); this.lblStatus.Text = GlobalConstant.dicApplicationStatus[applicationMdl.status]; // Check status and Open/Enable the GUI #region if (applicationMdl.status == 0) { this.panReject.Visible = true; } else if (applicationMdl.status == 1) { // 已提交,客服审核 this.panReject.Visible = true; this.panFirstpay.Visible = true; this.panReject.Enabled = true; this.panFirstpay.Enabled = true; this.txtRejectComments.Text = "补充资料"; } else if (applicationMdl.status == 3) { // 3 已付初审费,确认收费 this.panFirstpay.Visible = true; } else if (applicationMdl.status == 4) { // 4 初审中,计算会诊费 this.panFirstpay.Visible = true; this.panPreliminary_conclusions.Visible = true; this.panPreliminary_conclusions.Enabled = true; this.panConsultPay.Visible = true; this.panConsultPay.Enabled = true; } else if (applicationMdl.status == 6 || applicationMdl.status == 7 || applicationMdl.status == 8 || applicationMdl.status == 9 || applicationMdl.status == 99) { // 6 已付会诊费,确认收款 this.panFirstpay.Visible = true; this.panPreliminary_conclusions.Visible = true; this.panConsultPay.Visible = true; } #endregion // Bind System User Info #region MyRegion V_Sys_UserMdl model = V_Sys_UserDAL.GetModel(applicationMdl.user_guid); this.txtName.Text = model.name; this.txtMobile.Text = model.login_name; this.txtEmail.Text = model.email; #endregion // Bind Patient Info DataSet dsApplication = Consult_ApplicationDAL.GetApplication(applicationMdl.guid); #region MyRegion if (dsApplication != null && dsApplication.Tables.Count > 0 && dsApplication.Tables[0].Rows.Count > 0) { this.txtPatientName.Text = dsApplication.Tables[0].Rows[0]["name"].ToString().Trim(); WebCtrlUtil.SetDropDownText(this.ddlGender, dsApplication.Tables[0].Rows[0]["gender"].ToString().Trim()); DateTime dtDOB = DateTime.Now; if (!(dsApplication.Tables[0].Rows[0]["birthday"] is DBNull)) { DateTime.TryParse(dsApplication.Tables[0].Rows[0]["birthday"].ToString().Trim(), out dtDOB); } this.txtDOB.Text = dtDOB.ToString("yyyy-MM-dd"); this.txtApplicationPurpose.Text = dsApplication.Tables[0].Rows[0]["purpose"].ToString().Trim(); // Location type WebCtrlUtil.SetDropDownText(this.ddlLocalType, dsApplication.Tables[0].Rows[0]["location_type"].ToString().Trim()); } #endregion // Reject Info this.txtRejectComments.Text = dsApplication.Tables[0].Rows[0]["service_comments_for_user"].ToString().Trim(); this.txtPreliminary_conclusions.Text = dsApplication.Tables[0].Rows[0]["Preliminary_conclusions"].ToString().Trim(); // fill payinfo this.txtPreTypePay.Text = Consult_ApplicationDAL.getFirstPayInfo(applicationMdl.guid); this.txtConsultPay.Text = Consult_ApplicationDAL.getSecondPayInfo(applicationMdl.guid); // Bind consult_application_consultant Info #region MyRegion dsApplication = Consult_ApplicationDAL.GetApplicationConsultant(applicationMdl.guid); if (dsApplication != null && dsApplication.Tables.Count > 0 && dsApplication.Tables[0].Rows.Count > 0) { WebCtrlUtil.SetDropDownText(this.ddlHospitalCount, dsApplication.Tables[0].Rows.Count.ToString()); CreateDropdownListGroup(); for (int i = 0; i < dsApplication.Tables[0].Rows.Count; i++) { // Bind Hospital DropDownList ddlHospital = this.panDoctorGroup.FindControl("ddlHospital" + (i + 1)) as DropDownList; WebCtrlUtil.SetDropDownText(ddlHospital, dsApplication.Tables[0].Rows[i]["hospital_guid"].ToString().Trim()); ddlHospital_SelectedIndexChanged(ddlHospital, null); // Bind Doctor DropDownList ddlDoctor = this.panDoctorGroup.FindControl("ddlDoctor" + (i + 1)) as DropDownList; WebCtrlUtil.SetDropDownText(ddlDoctor, dsApplication.Tables[0].Rows[i]["doctor_guid"].ToString().Trim()); } } #endregion // Bind the PurposeImage DataSet dsPurposeImage = Consult_ApplicationDAL.GetPurposeThumbnail(applicationMdl.guid); if (dsPurposeImage != null && dsPurposeImage.Tables.Count > 0 && dsPurposeImage.Tables[0].Rows.Count > 0) { string strTempFolder = ImageUtils.GetTempFolderPath(); byte[] bImage = (byte[])(dsPurposeImage.Tables[0].Rows[0]["thumbnail"]); string strFileName = Guid.NewGuid().ToString() + ".jpg"; string strFilePath = Path.Combine(strTempFolder, strFileName); File.WriteAllBytes(strFilePath, bImage); ImageUtils.ShowThumbnail(this.litPurposeImg, strFileName); this.hidPurposeImg.Value = strFilePath; this.hidPurposeImgGUID.Value = dsPurposeImage.Tables[0].Rows[0]["guid"].ToString(); } }