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

📄 surveysform.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 SurveysForm : DataEntryControl
	{
		protected HtmlInputText SurveyDateText;
		protected HtmlInputText SurveyDate;
		public  HtmlSelect SurveyType;
		protected HtmlInputText SurveyResult;
		protected HtmlInputText SurveyTotal;
		protected HtmlSelect SurveyVersion;
		protected HtmlTextArea SurveyNotes;
		protected ComboBox SurveyDataSource;
		protected HtmlSelect SurveyQuality;
		public HtmlInputHidden SurveyId;
		protected HtmlImage SurveyDateTextCal;

		protected HyperLink SurveyItemsFormLink;

		protected HtmlImage ItemsDetailFlagOn;
		protected HtmlImage ItemsDetailFlagOff;

		override protected void Page_Load(object sender, System.EventArgs e)
		{
//			ItemsDetailFlagOn.Visible = false;
//			ItemsDetailFlagOff.Visible = true;
			//populate look up and distinct value select boxes
			
			PageUtil.FillLkpDropDown(SurveyType, "SurveyType", ViewState);
			PageUtil.FillLkpDropDown(SurveyVersion, "SurveyVersion", ViewState);
			PageUtil.FillLkpDropDown(SurveyQuality, "DataQuality", ViewState);

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

			//array created holding required fields
			Page.RegisterArrayDeclaration("requiredFieldArray","'"+SurveyType.ClientID+"'");


			PageUtil.AddCalendarFunction(SurveyDateTextCal, SurveyDateText);

			PageUtil.AddFuzzyDateFunction(SurveyDateText, SurveyDate);



			base.Page_Load(sender, e);
		}

		
		
		override protected object SaveViewState()
		{
			//add select and combo boxes to view state
			
			PageUtil.AddSelectToViewState(ViewState,SurveyType);
			PageUtil.AddSelectToViewState(ViewState,SurveyVersion);
			PageUtil.AddSelectToViewState(ViewState,SurveyQuality);
			
			PageUtil.AddComboToViewState(ViewState,SurveyDataSource);

			return base.SaveViewState();
		}

		override public HtmlInputHidden GetPrimKeyField()
		{
			return SurveyId;
		}


		override protected void SetDataEntryInfo()
		{
			this._tableInfo = "Surveys";
			this._dataEntryTitle = "Surveys";
		}

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

			if (!SurveyId.Value.Equals(""))
			{
				dr[Survey.SurveyId] = SurveyId.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[Survey.PatientId] = this.patientID;
			 
			dr[Survey.SurveyDateText] = Request.Form[SurveyDateText.UniqueID].ToString();
			dr[Survey.SurveyDate] = PageUtil.ObjToDateTime(SurveyDate.Value);
			dr[Survey.SurveyType] = Request.Form[SurveyType.UniqueID].ToString();
			dr[Survey.SurveyResult] = SurveyResult.Value;
			dr[Survey.SurveyTotal] = SurveyTotal.Value;
			dr[Survey.SurveyVersion] = Request.Form[SurveyVersion.UniqueID].ToString();
			dr[Survey.SurveyNotes] = SurveyNotes.Value;
			dr[Survey.SurveyDataSource] = Request.Form[SurveyDataSource.UniqueID].ToString();
			dr[Survey.SurveyQuality] = Request.Form[SurveyQuality.UniqueID].ToString();

			AddBaseParams(dr);
			biz.Tables[Survey.Table_Surveys].Rows.Add(dr);
			biz.AcceptChanges();
			return biz;

		}

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

			//selects use: PageUtil.SelectDropDownItem(fieldIdName, dr[Object.FieldName]);
		
			SurveyId.Value = dr[Survey.SurveyId].ToString();
			SurveyDateText.Value = dr[Survey.SurveyDateText].ToString();
			SurveyDate.Value = PageUtil.ObjToDateString(dr[Survey.SurveyDate]);
			PageUtil.SelectDropDownItem(SurveyType, dr[Survey.SurveyType]);
			SurveyResult.Value = dr[Survey.SurveyResult].ToString();
			SurveyTotal.Value = dr[Survey.SurveyTotal].ToString();
			PageUtil.SelectDropDownItem(SurveyVersion, dr[Survey.SurveyVersion]);
			SurveyNotes.Value = dr[Survey.SurveyNotes].ToString();
			SurveyDataSource.Value = dr[Survey.SurveyDataSource].ToString();
			PageUtil.SelectDropDownItem(SurveyQuality, dr[Survey.SurveyQuality]);

			SetBaseFields(dr);
//			SetDetailsFlag();
//			SetSubPageLinks();
		}

//		protected void SetDetailsFlag()
//		{
//			//check if there are Cores entered
//			if(SurveyId != null && !SurveyId.Value.Equals(""))
//			{
//				SurveyItemDa da = new SurveyItemDa();
//				DataSet ds = da.GetRecords(int.Parse(SurveyId.Value));
//				if(ds.Tables[0].Rows.Count > 0)
//				{//make icon visible
//					ItemsDetailFlagOn.Visible = true;
//					ItemsDetailFlagOff.Visible = false;
//				}			
//			}
//		}

//		protected void SetSubPageLinks()
//		{
//			//enable links and set the url's
//			if(SurveyId != null && !SurveyId.Value.Equals(""))
//			{
//				
//				string survType = "";
//				if(SurveyType != null && !SurveyType.Value.Equals(""))
//				{
//					survType = SurveyType.Value.Replace(" ", "");
//				}
//				
//				SurveyItemsFormLink.NavigateUrl = "../../../Core/DataEntryForms/DataEntryContainer.aspx?dataForm=SurveyItemsForm&parentKey="+SurveyId.Value+"&Relationship=many&surveyType=" + survType + "";
//				SurveyItemsFormLink.Enabled = true;
//			}
//		}

		protected override void OnInit(EventArgs e)
		{			
			this._containsGrid = true;
			base.OnInit (e);
		}

	}
}

⌨️ 快捷键说明

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