📄 medicationsclinical.ascx.cs
字号:
namespace Caisis.UI.Modules.All.Eforms
{
using System;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Caisis.BusinessObject;
using Caisis.UI.Core.Classes;
using Caisis.UI.Modules.Prostate.PaperForms;
using Caisis.DataAccess;
/// <summary>
/// Summary description for MedicationsClinical.
/// </summary>
public class MedicationsClinical : BaseEFormControl
{
protected Repeater medicationsAll;
override protected void Page_Load(object sender, System.EventArgs e)
{
base.Page_Load(sender, e);
// BuildMedications(this._patientId, this._eformName, "Dynamic");
BuildAllMedications(this._patientId, this._eformName, "Dynamic");
}
protected void BuildAllMedications(int PatientID, string FormName, string FormType)
{
MedicationDa medDa = new MedicationDa();
DataSet medDs = medDa.FormGetRecords(PatientID, FormName, FormType, null);
if (medDs.Tables.Count > 0 && medDs.Tables[0].Rows.Count > 0)
{
medicationsAll.DataSource = medDs.Tables[0].DefaultView;
medicationsAll.DataBind();
}
}
/// <summary>
/// For customization reasons, this method reimplements BaseEFormControl.EFormRepeaterOnDataBound(...)
/// and appends functionality to hide rows that have "past" MedStopDates
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DecorateMedicationsAll(object sender, RepeaterItemEventArgs e)
{
DataRowView rowView = (DataRowView) e.Item.DataItem;
HtmlImage LockImage;
LockImage = (HtmlImage) e.Item.FindControl("LockImage");
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if(!(rowView["LockedBy"] != null && rowView["LockedBy"].ToString().Length > 0))
{
if (LockImage != null)
{
LockImage.Visible = false;
}
}
}
// decorate tr
HtmlTableRow tr = (HtmlTableRow) e.Item.FindControl("_tr_");
string medId = rowView["MedicationId"].ToString();
tr.Attributes["onclick"] = "LoadDataEntryForm('Medications'," + medId + ",'MedDateText,MedDate,Medication,MedDose,MedUnits,MedSchedule,MedStopDateText,MedStopDate', 'MedicationsClinical');";
// if the stop date < current clinic date, set parentTR.style.display = 'none'
object objStopDate = rowView["MedStopDate"];
if (objStopDate != DBNull.Value)
{
DateTime stopDate = DateTime.Parse(objStopDate.ToString());
DateTime clinDate = DateTime.Parse(DateTime.Now.ToShortDateString());
if (Session[SessionKey.CurrentClinicDate] != null)
{
clinDate = DateTime.Parse(Session[SessionKey.CurrentClinicDate].ToString());
}
if (stopDate < clinDate)
{
tr.Style["DISPLAY"] = "none";
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -