⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 patientprotocolstatusform.ascx.cs

📁 医疗决策支持系统
💻 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;

	public abstract class PatientProtocolStatusForm : DataGridControl
	{

		override protected DataEntryController GetController()
		{
			return new DataGridController(new PatientProtocolStatusDa(), PatientProtocolStatus.PatientProtocolStatusId);
		}

		override protected void SetDataEntryInfo()
		{
			this._tableInfo = "PatientProtocolStatus";
			this._dataEntryTitle = "<a href=\"DataEntryContainer.aspx?dataForm=PatientProtocolsForm&primKey="+Request.QueryString["parentKey"]+"\"> Protocols</a> > Protocol Status";
			}

		protected override DataTable PhysicalDataRead()
		{
			DataGridController ct = new DataGridController(new PatientProtocolStatusDa(), PatientProtocolStatus.PatientProtocolStatusId);
			DataSet ds = ct.GetDataGridRecords(int.Parse(Request.QueryString["parentKey"].ToString()));
			return ds.Tables[0];
		}

		protected override DataSet GetGridRow(DataGridCommandEventArgs e)
		{
			PatientProtocolStatus biz = new PatientProtocolStatus();
			DataSet ds = new DataSet();
			ds.Tables.Add(biz);
			DataRow dr = biz.NewRow();

			HtmlInputText PtProtocolStatusDateText = (HtmlInputText) e.Item.FindControl("PtProtocolStatusDateText");
//			PtProtocolStatusDateText.Style = "width:80";
			//should be DATE

			HtmlInputText PtProtocolStatusDate		= (HtmlInputText)  e.Item.FindControl("PtProtocolStatusDate");
//			PtProtocolStatusDate.Style = "width:80";
			HtmlSelect PtProtocolStatus			= (HtmlSelect) e.Item.FindControl("PtProtocolStatus");
			HtmlSelect PtProtocolStatusReason	= (HtmlSelect) e.Item.FindControl("PtProtocolStatusReason");
			TextBox PtProtocolStatusNotes		= (TextBox) e.Item.Cells[5].Controls[0];
			PtProtocolStatusNotes.Width = 300;

			dr[PatientProtocolStatus.PatientProtocolId]			= Request.QueryString["parentKey"].ToString();
			dr[PatientProtocolStatus.PatientProtocolStatusId]	= grid.DataKeys[e.Item.ItemIndex];
			dr[PatientProtocolStatus.PtProtocolStatusDateText]	= PtProtocolStatusDateText.Value;

			//DATE
/*			if (PtProtocolStatusDate.Text != null && PtProtocolStatusDate.Text != "")
			{
				dr[PatientProtocolStatus.PtProtocolStatusDate]	= PageUtil.ObjToDateTime(PtProtocolStatusDate.Text);
			}
			else
			{
				dr[PatientProtocolStatus.PtProtocolStatusDate] = System.DBNull.Value;
			}
*/			
			if (Request.Form[PtProtocolStatusDate.UniqueID] != null && Request.Form[PtProtocolStatusDate.UniqueID].ToString().Length > 0)
			{
				dr[PatientProtocolStatus.PtProtocolStatusDate]		= Request.Form[PtProtocolStatusDate.UniqueID].ToString();
			}
			dr[PatientProtocolStatus.PtProtocolStatus]			= Request.Form[PtProtocolStatus.UniqueID].ToString();
			dr[PatientProtocolStatus.PtProtocolStatusReason]	= Request.Form[PtProtocolStatusReason.UniqueID].ToString();
			dr[PatientProtocolStatus.PtProtocolStatusNotes]		= PtProtocolStatusNotes.Text;

			biz.Rows.Add(dr);
			return ds;
		}

		public void ItemBound(Object sender, DataGridItemEventArgs e)
		{
			if(e.Item.ItemType == ListItemType.EditItem)
			{
				DataRowView drv = (DataRowView) e.Item.DataItem;

				//make objects below lowercase to differ from above method and match Lkp Arguments
			 
				HtmlInputText ptprotocolstatusdatetext = (HtmlInputText) e.Item.FindControl("PtProtocolStatusDateText");
				//				ptprotocolstatusdatetext.Width = 80;
				ptprotocolstatusdatetext.Value = drv[PatientProtocolStatus.PtProtocolStatusDateText].ToString();


				//should be DATE: 

				HtmlInputText ptprotocolstatusdate = (HtmlInputText) e.Item.FindControl("PtProtocolStatusDate");
				/*				ptprotocolstatusdate.Text = PageUtil.ObjToDateString(ptprotocolstatusdate.Text);
								if (ptprotocolstatusdate.Text != null && ptprotocolstatusdate.Text != "")
								{
									ptprotocolstatusdate.Text = PageUtil.ObjToDateString(ptprotocolstatusdate.Text);
									ptprotocolstatusdate.Text = Convert.ToDateTime(ptprotocolstatusdate.Text).ToShortDateString();
								}
				*/	//			ptprotocolstatusdate.Width = 50;

				if (drv[PatientProtocolStatus.PtProtocolStatusDate] != null && drv[PatientProtocolStatus.PtProtocolStatusDate].ToString() !="")
				{
					ptprotocolstatusdate.Value = PageUtil.ObjToDateString(drv[PatientProtocolStatus.PtProtocolStatusDate]);
				}
				//			ptprotocolstatusdate.Disabled = true;

				PageUtil.AddFuzzyDateFunction(ptprotocolstatusdatetext, ptprotocolstatusdate);


				// if (ptprotocolstatusdate.Text != null && ptprotocolstatusdate.Text.
				// ptprotocolstatusdate.Text = Convert.ToDateTime(ptprotocolstatusdate.Text).ToShortDateString();
				
				HtmlSelect ptprotocolstatus = (HtmlSelect) e.Item.FindControl("PtProtocolStatus");
				HtmlSelect ptprotocolstatusreason = (HtmlSelect) e.Item.FindControl("PtProtocolStatusReason");
				TextBox ptprotocolstatusnotes = (TextBox) e.Item.Cells[5].Controls[0];
				ptprotocolstatusnotes.Width = 300;

			
				//PageUtil.FillLkpDropDown(ptprotocolstatusdatetext, "DateText");
				//PageUtil.SelectDropDownItem(ptprotocolstatusdatetext, drv[PatientProtocolStatu.PtProtocolStatusDateText].ToString());
				PageUtil.FillLkpDropDown(ptprotocolstatus, "PtProtocolStatus");
				PageUtil.SelectDropDownItem(ptprotocolstatus, drv[PatientProtocolStatus.PtProtocolStatus].ToString());
				PageUtil.FillLkpDropDown(ptprotocolstatusreason, "ProtStatusReason");
				PageUtil.SelectDropDownItem(ptprotocolstatusreason, drv[PatientProtocolStatus.PtProtocolStatusReason].ToString());

				 
				TextBox patientprotocolId = (TextBox) e.Item.FindControl("PatientProtocolId");
				patientprotocolId.Text = drv[PatientProtocolStatus.PatientProtocolId].ToString();
				TextBox updateTime = (TextBox)e.Item.FindControl("UpdateTime");
				updateTime.Text = drv[BizObject.UpdatedTime].ToString();
			}
			else if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
			{
				DataRowView drv = (DataRowView) e.Item.DataItem;
				Label PtProtocolStatusDate = (Label) e.Item.FindControl("PtProtocolStatusDate");

				if (drv[PatientProtocolStatus.PtProtocolStatusDate] != null && drv[PatientProtocolStatus.PtProtocolStatusDate].ToString() !="")
				{
					PtProtocolStatusDate.Text = PageUtil.ObjToDateString(drv[PatientProtocolStatus.PtProtocolStatusDate]);
				}

			}



/*			else if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
			{
				DataRowView drv = (DataRowView) e.Item.DataItem;

//				Label ptprotocolstatusdatetext = (Label) e.Item.FindControl("PtProtocolStatusDateText");

				if (drv[PatientProtocolStatus.PtProtocolStatusDate] != null && drv[PatientProtocolStatus.PtProtocolStatusDate].ToString() != "")
				{
					Label ptprotocolstatusdate = (Label) e.Item.FindControl("PtProtocolStatusDate");
					ptprotocolstatusdate.Text = Convert.ToDateTime(drv[PatientProtocolStatus.PtProtocolStatusDate]).ToShortDateString();
				}


//				e.Item.Cells[2].Text = PageUtil.ObjToDateString(e.Item.Cells[2].Text);
				if (e.Item.Cells[2].Text != null && e.Item.Cells[2].Text != "")
				{
					e.Item.Cells[2].Text = PageUtil.ObjToDateString(e.Item.Cells[2].Text);
//					e.Item.Cells[2].Text = Convert.ToDateTime(e.Item.Cells[2].Text).ToShortDateString();
				}
*/
//			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -