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

📄 dietaryintakeform.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;
	using Caisis.UI.Core.Classes.CustomControls;

	public abstract class DietaryIntakeForm : DataEntryControl
	{

		protected HtmlInputText IntakeDateText;
		protected HtmlInputText IntakeDate;
		protected HtmlInputText IntakeTotalFluidAmount;
		protected HtmlSelect IntakeTotalFluidUnits;
		protected HtmlInputText IntakeTotalSolidAmount;
		protected HtmlSelect IntakeTotalSolidUnits;
		protected HtmlTextArea IntakeNotes;
		protected ComboBox IntakeDataSource;
		protected HtmlSelect IntakeQuality;
		protected HtmlInputHidden DietaryIntakeId;
		protected HtmlImage IntakeDateTextCal;
		protected HyperLink DietaryIntakeItemsFormLink;

		override protected void Page_Load(object sender, System.EventArgs e)
		{
			//populate look up and distinct value select boxes
			
			PageUtil.FillLkpDropDown(IntakeTotalFluidUnits, "IntakeUnits", ViewState);
			PageUtil.FillLkpDropDown(IntakeTotalSolidUnits, "IntakeUnits", ViewState);
			PageUtil.FillLkpDropDown(IntakeQuality, "DataQuality", ViewState);

			//create arrays that populate combo boxes
			
			Page.RegisterClientScriptBlock("IntakeDataSource", PageUtil.FillComboDropDown(IntakeDataSource.RefBy, "DataSource"));

			string reqFieldArray = PageUtil.CreateValidationScript("");
			Page.RegisterClientScriptBlock("requiredFieldArray", reqFieldArray);


			PageUtil.AddCalendarFunction(IntakeDateTextCal, IntakeDateText);
			PageUtil.AddFuzzyDateFunction(IntakeDateText, IntakeDate);



			base.Page_Load(sender, e);
		}

		override protected object SaveViewState()
		{
			//add select and combo boxes to view state
			
			PageUtil.AddSelectToViewState(ViewState,IntakeTotalFluidUnits);
			PageUtil.AddSelectToViewState(ViewState,IntakeTotalSolidUnits);
			PageUtil.AddSelectToViewState(ViewState,IntakeQuality);

			PageUtil.AddComboToViewState(ViewState,IntakeDataSource);

			return base.SaveViewState();
		}

		override public HtmlInputHidden GetPrimKeyField()
		{
			return DietaryIntakeId;
		}

		override protected DataEntryController GetController()
		{
			return new DataEntryController(new DietaryIntakeDa(), DietaryIntake.DietaryIntakeId); //NOTE: fix args
		}

		override protected void SetDataEntryInfo()
		{
			this._tableInfo = "DietaryIntake";
			this._dataEntryTitle = "Dietary Intake";
		}

		override protected BizObject GetParams()
		{
			DietaryIntake biz = new DietaryIntake();
			DataRow dr = biz.Tables[DietaryIntake.Table_DietaryIntake].NewRow();

			if (!DietaryIntakeId.Value.Equals(""))
			{
				dr[DietaryIntake.DietaryIntakeId] = DietaryIntakeId.Value;
			}

			//below assignment only valid for text and textarea input.. need to modify for other form elements
			//selects use: Request.Form[FieldName.UniqueID].ToString();
			//dates use: PageUtil.ObjToDateTime(FieldName.Value);
			//checkbox use: if(SurgPending.Checked){dr[Surgery.SurgPending] = 1;}
			//Patient ID should = this.patientID
			
			dr[DietaryIntake.PatientId] = this.patientID;
			 
			dr[DietaryIntake.IntakeDateText] = Request.Form[IntakeDateText.UniqueID].ToString();
			dr[DietaryIntake.IntakeDate] = PageUtil.ObjToDateTime(IntakeDate.Value);
			dr[DietaryIntake.IntakeTotalFluidAmount] = IntakeTotalFluidAmount.Value;
			dr[DietaryIntake.IntakeTotalFluidUnits] = Request.Form[IntakeTotalFluidUnits.UniqueID].ToString();
			dr[DietaryIntake.IntakeTotalSolidAmount] = IntakeTotalSolidAmount.Value;
			dr[DietaryIntake.IntakeTotalSolidUnits] = Request.Form[IntakeTotalSolidUnits.UniqueID].ToString();
			dr[DietaryIntake.IntakeNotes] = IntakeNotes.Value;
			dr[DietaryIntake.IntakeDataSource] = Request.Form[IntakeDataSource.UniqueID].ToString();
			dr[DietaryIntake.IntakeQuality] = Request.Form[IntakeQuality.UniqueID].ToString();

			AddBaseParams(dr);
			biz.Tables[DietaryIntake.Table_DietaryIntake].Rows.Add(dr);
			biz.AcceptChanges();
			return biz;

		}

		protected override void SetFields(BizObject bz)
		{
			DietaryIntake biz = (DietaryIntake)bz;
			DataRow dr = biz.Tables[DietaryIntake.Table_DietaryIntake].Rows[0];

			//below assignment good only for text and input fields, checkboxes, selects, radios need additional logic
			//selects use: PageUtil.SelectDropDownItem(fieldIdName, dr[Object.FieldName]);
			
			DietaryIntakeId.Value = dr[DietaryIntake.DietaryIntakeId].ToString();
			IntakeDateText.Value = dr[DietaryIntake.IntakeDateText].ToString();
			IntakeDate.Value = PageUtil.ObjToDateString(dr[DietaryIntake.IntakeDate]);
			IntakeTotalFluidAmount.Value = dr[DietaryIntake.IntakeTotalFluidAmount].ToString();
			PageUtil.SelectDropDownItem(IntakeTotalFluidUnits, dr[DietaryIntake.IntakeTotalFluidUnits]);
			IntakeTotalSolidAmount.Value = dr[DietaryIntake.IntakeTotalSolidAmount].ToString();
			PageUtil.SelectDropDownItem(IntakeTotalSolidUnits, dr[DietaryIntake.IntakeTotalSolidUnits]);
			IntakeNotes.Value = dr[DietaryIntake.IntakeNotes].ToString();
			IntakeDataSource.Value = dr[DietaryIntake.IntakeDataSource].ToString();
			PageUtil.SelectDropDownItem(IntakeQuality, dr[DietaryIntake.IntakeQuality]);

			SetBaseFields(dr);
			SetSubPageLinks();
		}

		protected void SetSubPageLinks()
		{
			//enable links and set the url's
			if(DietaryIntakeId != null && !DietaryIntakeId.Value.Equals(""))
			{
				DietaryIntakeItemsFormLink.NavigateUrl = "DataEntryContainer.aspx?dataForm=DietaryIntakeItemsForm&parentKey="+DietaryIntakeId.Value+"&Relationship=many";
				DietaryIntakeItemsFormLink.Enabled = true;
			}
		}
	}
}

⌨️ 快捷键说明

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