📄 patientconsentform.ascx.cs
字号:
namespace Caisis.UI.Modules.All.DataEntryForms
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections.Specialized;
using System.Collections;
using Caisis.Controller;
using Caisis.DataAccess;
using Caisis.BusinessObject;
using Caisis.UI.Core.Classes;
/// <summary>
/// Summary description for PatientConsent.
/// </summary>
public abstract class PatientConsentForm : DataEntryControl
{
protected System.Web.UI.HtmlControls.HtmlSelect PtPatientConsent_drop;
protected System.Web.UI.HtmlControls.HtmlSelect PtConsentVersion_Drop;
protected System.Web.UI.HtmlControls.HtmlSelect PtCopyGiven_Drop;
protected Caisis.UI.Core.Classes.PDLabel Protocol;
protected System.Web.UI.HtmlControls.HtmlSelect Protocol_Drop;
protected Caisis.UI.Core.Classes.PDLabel PtDateObtained;
protected HtmlInputHidden ConsentId;
protected System.Web.UI.HtmlControls.HtmlInputText ConsentDate;
protected System.Web.UI.HtmlControls.HtmlInputText AuthorizedPerson;
protected System.Web.UI.HtmlControls.HtmlInputText PersonGiven;
protected System.Web.UI.HtmlControls.HtmlInputText DateObtained;
protected System.Web.UI.HtmlControls.HtmlSelect FutureConsent_Drop;
protected System.Web.UI.HtmlControls.HtmlSelect PtRelationship_drop;
protected HtmlInputHidden PatientId;
//Added calendar function, but may need to add datetext field
protected HtmlImage ConsentDateCal, DateObtainedCal;
override protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
PageUtil.FillLkpDropDown(PtPatientConsent_drop, "PatientConsent", ViewState);
PageUtil.FillLkpDropDown(FutureConsent_Drop, "PatientConsent", ViewState);
PageUtil.FillLkpDropDown(PtRelationship_drop, "ConsentRelationship", ViewState);
PageUtil.FillLkpDropDown(PtConsentVersion_Drop, "ConsentVersion", ViewState);
PageUtil.FillLkpDropDown(PtCopyGiven_Drop, "ConsentCopy", ViewState);
PageUtil.FillLkpDropDown(Protocol_Drop, "ConsentProtocol", ViewState);
string reqFieldArray = PageUtil.CreateValidationScript("");
Page.RegisterClientScriptBlock("requiredFieldArray", reqFieldArray);
//Calendar Function TODO: Possibly add Datetext Field
PageUtil.AddCalendarFunction(ConsentDateCal, ConsentDate);
//PageUtil.AddFuzzyDateFunction(PtConsentDate, PtConsentDateCal);
PageUtil.AddCalendarFunction(DateObtainedCal, DateObtained);
//PageUtil.AddFuzzyDateFunction(PtDateObtained, PtDateObtained);
base.Page_Load(sender, e);
}
override protected object SaveViewState()
{
//add select and combo boxes to view state
PageUtil.AddSelectToViewState(ViewState,PtPatientConsent_drop);
PageUtil.AddSelectToViewState(ViewState,FutureConsent_Drop);
PageUtil.AddSelectToViewState(ViewState,PtRelationship_drop);
PageUtil.AddSelectToViewState(ViewState,PtConsentVersion_Drop);
PageUtil.AddSelectToViewState(ViewState,PtCopyGiven_Drop);
PageUtil.AddSelectToViewState(ViewState,Protocol_Drop);
return base.SaveViewState();
}
override public HtmlInputHidden GetPrimKeyField()
{
return ConsentId;
}
override protected DataEntryController GetController()
{
//return new GenericDataEntryController(new PatientConsentDa(), PatientConsent.ConsentId); //NOTE: fix args
return new DataEntryController(new PatientConsentDa(), PatientConsent.ConsentId); //NOTE: fix args
}
override protected void SetDataEntryInfo()
{
this._tableInfo = "PatientConsent";
this._dataEntryTitle = "Patient Consent";
}
override protected BizObject GetParams()
{
PatientConsent biz = new PatientConsent();
DataRow dr = biz.Tables[PatientConsent.Table_PatientConsent].NewRow();
if (!ConsentId.Value.Equals(""))
{
dr[PatientConsent.ConsentId] = ConsentId.Value;
}
//selects use: Request.Form[FieldName.UniqueID].ToString();
//dates use: PageUtil.ObjToDateTime(FieldName.Value);
//checkbox use: if(FieldName.Checked){dr[BizObject.FieldName] = 1;}
//Patient ID should = this.patientID
dr[PatientConsent.PatientId] = this.patientID;
dr[PatientConsent.DBConsented] = Request.Form[PtPatientConsent_drop.UniqueID].ToString();
dr[PatientConsent.ResearchConsented]= Request.Form[FutureConsent_Drop.UniqueID].ToString();
dr[PatientConsent.ConsentDate] = PageUtil.ObjToDateTime(ConsentDate.Value);
dr[PatientConsent.AuthorizedPerson] = AuthorizedPerson.Value;
dr[PatientConsent.ConsentRelationship] = Request.Form[PtRelationship_drop.UniqueID].ToString();
dr[PatientConsent.ConsentVer]= Request.Form[PtConsentVersion_Drop.UniqueID].ToString();
dr[PatientConsent.CopyToPatient]= Request.Form[PtCopyGiven_Drop.UniqueID].ToString();
dr[PatientConsent.ObtainPerson]= PersonGiven.Value;
dr[PatientConsent.ObtainDate] = PageUtil.ObjToDateTime(DateObtained.Value);
dr[PatientConsent.ConsentProtocol] = Request.Form[Protocol_Drop.UniqueID].ToString();
AddBaseParams(dr);
biz.Tables[PatientConsent.Table_PatientConsent].Rows.Add(dr);
biz.AcceptChanges();
return biz;
}
protected override void SetFields(BizObject bz)
{
PatientConsent biz = (PatientConsent)bz;
DataRow dr = biz.Tables[PatientConsent.Table_PatientConsent].Rows[0];
//selects use: PageUtil.SelectDropDownItem(PtPatientConsent_drop, dr[PatientConsent.FieldName]);
ConsentId.Value = dr[PatientConsent.ConsentId].ToString();
PageUtil.SelectDropDownItem(PtPatientConsent_drop, dr[PatientConsent.DBConsented]);
PageUtil.SelectDropDownItem(FutureConsent_Drop, dr[PatientConsent.ResearchConsented]);
//ConsentDate.Value = String.Format("{0:mm/dd/yyyy}", dr[PatientConsent.ConsentDate].ToString() );
ConsentDate.Value = PageUtil.ObjToDateString(dr[PatientConsent.ConsentDate]);
//ConsentDate.Value = ((DateTime)(dr[PatientConsent.ConsentDate])).ToString("MM/dd/yyyy");
AuthorizedPerson.Value = dr[PatientConsent.AuthorizedPerson].ToString();
PageUtil.SelectDropDownItem(PtRelationship_drop, dr[PatientConsent.ConsentRelationship]);
PageUtil.SelectDropDownItem(PtConsentVersion_Drop, dr[PatientConsent.ConsentVer]);
PageUtil.SelectDropDownItem(PtCopyGiven_Drop, dr[PatientConsent.CopyToPatient]);
PersonGiven.Value = dr[PatientConsent.ObtainPerson].ToString();
DateObtained.Value = PageUtil.ObjToDateString(dr[PatientConsent.ObtainDate]);
PageUtil.SelectDropDownItem(Protocol_Drop, dr[PatientConsent.ConsentProtocol]);
SetBaseFields(dr);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -