📄 qol_therapyform.ascx.cs
字号:
namespace Caisis.UI.Modules.All.DataEntryForms
{
using System;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Specialized;
using Caisis.Controller;
using Caisis.DataAccess;
using Caisis.BusinessObject;
using Caisis.UI.Core.Classes;
using Caisis.UI.Core.Classes.CustomControls;
public abstract class QOL_TherapyForm : DataEntryControl
{
protected HtmlInputText QOL_TxDateText;
protected HtmlInputText QOL_TxDate;
protected ComboBox QOL_TxIndication;
protected ComboBox QOL_TherapyFld;
protected HtmlInputText QOL_TxStopDateText;
protected HtmlInputText QOL_TxStopDate;
protected HtmlTextArea QOL_TxNotes;
protected ComboBox QOL_TxDataSource;
protected HtmlSelect QOL_TxQuality;
protected HtmlInputHidden QOL_TherapyId;
protected HtmlImage QOL_TxDateTextCal, QOL_TxStopDateTextCal;
override protected void Page_Load(object sender, System.EventArgs e)
{
//populate look up and distinct value select boxes
PageUtil.FillLkpDropDown(QOL_TxQuality, "DataQuality", ViewState);
//create arrays that populate combo boxes
Page.RegisterClientScriptBlock("QOL_TxIndication", PageUtil.FillComboDropDown(QOL_TxIndication.RefBy, "Indication"));
Page.RegisterClientScriptBlock("QOL_TherapyFld", PageUtil.FillComboDropDown(QOL_TherapyFld.RefBy, "QOL_Therapy"));
Page.RegisterClientScriptBlock("QOL_TxDataSource", PageUtil.FillComboDropDown(QOL_TxDataSource.RefBy, "DataSource"));
//array created holding required fields
Page.RegisterArrayDeclaration("requiredFieldArray", "'" + QOL_TherapyFld.ClientID + "','" + QOL_TxIndication.ClientID + "'");
PageUtil.AddCalendarFunction(QOL_TxDateTextCal, QOL_TxDateText);
PageUtil.AddFuzzyDateFunction(QOL_TxDateText, QOL_TxDate);
PageUtil.AddCalendarFunction(QOL_TxStopDateTextCal, QOL_TxStopDateText);
PageUtil.AddFuzzyDateFunction(QOL_TxStopDateText, QOL_TxStopDate);
base.Page_Load(sender, e);
}
override protected object SaveViewState()
{
//add select and combo boxes to view state
PageUtil.AddSelectToViewState(ViewState,QOL_TxQuality);
PageUtil.AddComboToViewState(ViewState,QOL_TxIndication);
PageUtil.AddComboToViewState(ViewState,QOL_TherapyFld);
PageUtil.AddComboToViewState(ViewState,QOL_TxDataSource);
return base.SaveViewState();
}
override public HtmlInputHidden GetPrimKeyField()
{
return QOL_TherapyId;
}
override protected DataEntryController GetController()
{
return new DataEntryController(new QOL_TherapyDa(), QOL_Therapy.QOL_TherapyId); //NOTE: fix args
}
override protected void SetDataEntryInfo()
{
this._tableInfo = "QOL_Therapy";
this._dataEntryTitle = "QOL Therapies";
}
override protected BizObject GetParams()
{
QOL_Therapy biz = new QOL_Therapy();
DataRow dr = biz.Tables[QOL_Therapy.Table_QOL_Therapy].NewRow();
if (!QOL_TherapyId.Value.Equals(""))
{
dr[QOL_Therapy.QOL_TherapyId] = QOL_TherapyId.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[QOL_Therapy.PatientId] = this.patientID;
dr[QOL_Therapy.QOL_TxDateText] = Request.Form[QOL_TxDateText.UniqueID].ToString();
dr[QOL_Therapy.QOL_TxDate] = PageUtil.ObjToDateTime(QOL_TxDate.Value);
dr[QOL_Therapy.QOL_TxIndication] = Request.Form[QOL_TxIndication.UniqueID].ToString();
dr[QOL_Therapy.QOL_TherapyFld] = Request.Form[QOL_TherapyFld.UniqueID].ToString();
dr[QOL_Therapy.QOL_TxStopDateText] = Request.Form[QOL_TxStopDateText.UniqueID].ToString();
dr[QOL_Therapy.QOL_TxStopDate] = PageUtil.ObjToDateTime(QOL_TxStopDate.Value);
dr[QOL_Therapy.QOL_TxNotes] = QOL_TxNotes.Value;
dr[QOL_Therapy.QOL_TxDataSource] = Request.Form[QOL_TxDataSource.UniqueID].ToString();
dr[QOL_Therapy.QOL_TxQuality] = Request.Form[QOL_TxQuality.UniqueID].ToString();
AddBaseParams(dr);
biz.Tables[QOL_Therapy.Table_QOL_Therapy].Rows.Add(dr);
biz.AcceptChanges();
return biz;
}
protected override void SetFields(BizObject bz)
{
QOL_Therapy biz = (QOL_Therapy)bz;
DataRow dr = biz.Tables[QOL_Therapy.Table_QOL_Therapy].Rows[0];
//selects use: PageUtil.SelectDropDownItem(fieldIdName, dr[Object.FieldName]);
QOL_TherapyId.Value = dr[QOL_Therapy.QOL_TherapyId].ToString();
QOL_TxDateText.Value = dr[QOL_Therapy.QOL_TxDateText].ToString();
QOL_TxDate.Value = PageUtil.ObjToDateString(dr[QOL_Therapy.QOL_TxDate]);
QOL_TxIndication.Value = dr[QOL_Therapy.QOL_TxIndication].ToString();
QOL_TherapyFld.Value = dr[QOL_Therapy.QOL_TherapyFld].ToString();
QOL_TxStopDateText.Value = dr[QOL_Therapy.QOL_TxStopDateText].ToString();
QOL_TxStopDate.Value = PageUtil.ObjToDateString(dr[QOL_Therapy.QOL_TxStopDate]);
QOL_TxNotes.Value = dr[QOL_Therapy.QOL_TxNotes].ToString();
QOL_TxDataSource.Value = dr[QOL_Therapy.QOL_TxDataSource].ToString();
PageUtil.SelectDropDownItem(QOL_TxQuality, dr[QOL_Therapy.QOL_TxQuality]);
SetBaseFields(dr);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -