📄 biopsiesform.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 BiopsiesForm : DataEntryControl
{
protected HtmlSelect SurgeryId;
protected HtmlInputHidden BiopsyId;
protected HtmlInputText BxCPT_Code;
protected HtmlInputText BxCPT_Description;
protected HtmlInputCheckBox BxPending;
protected HtmlInputText BxPathNum;
protected HtmlInputText BxDateText;
protected HtmlInputText BxDate;
protected HtmlSelect BxType;
protected ComboBox BxIndication;
protected ComboBox BxSite;
protected ComboBox BxSubsite;
protected HtmlSelect BxSide;
protected ComboBox BxResult;
protected ComboBox BxGrade;
protected ComboBox BxHistology;
protected ComboBox BxPathologist;
protected ComboBox BxInstitution;
protected HtmlTextArea BxNotes;
protected ComboBox BxDataSource;
protected HtmlSelect BxQuality;
protected Caisis.UI.Core.Classes.PDLabel PdLabel1; //add all tool tip Ids
protected HtmlImage BxDateTextCal;
protected Literal setSurgeryDateJsVar;
override protected void Page_Load(object sender, System.EventArgs e)
{
//******need to query surgery table and fill drop down with patients sugeries and dates
SurgeryDa da = new SurgeryDa();
DataSet surgeryDs = da.GetRecords(this.patientID);
if (surgeryDs.Tables.Count > 0)
{
SurgeryId.DataSource = surgeryDs.Tables[0].DefaultView;
SurgeryId.DataValueField = "SurgeryId";
SurgeryId.DataTextField = "SurgDateText";
SurgeryId.DataBind();
SurgeryId.Items.Insert(0,new ListItem(""));
PageUtil.SelectDropDownItem(SurgeryId, ViewState[SurgeryId.UniqueID]);
SurgeryId.Attributes.Add("onchange", "setSurgeryChildDate('" + SurgeryId.ClientID + "', '" + BxDateText.ClientID + "', '" + BxDate.ClientID + "');");
BxDateText.Attributes.Add("onfocus", "checkIfSurgeryDateIsSet(document.getElementById('" + BxDateText.ClientID + "'));");
}
//populate look up and distinct value select boxes
//PageUtil.FillLkpDropDown(BxCPT_Code, "CPT_Codes", ViewState);
PageUtil.FillLkpDropDown(BxType, "BxType", ViewState);
PageUtil.FillLkpDropDown(BxSide, "ProstateSide", ViewState);
PageUtil.FillLkpDropDown(BxQuality, "DataQuality", ViewState);
//create arrays that populate combo boxes
Page.RegisterClientScriptBlock("BxInstitution", PageUtil.FillComboDropDown(BxInstitution.RefBy, "Institution"));
Page.RegisterClientScriptBlock("BxIndication", PageUtil.FillComboDropDown(BxIndication.RefBy, "Indication"));
Page.RegisterClientScriptBlock("BxSite", PageUtil.FillComboDropDown(BxSite.RefBy, "BxSite"));
Page.RegisterClientScriptBlock("BxSubsite", PageUtil.FillComboDropDown(BxSubsite.RefBy, "BxSubsite"));
Page.RegisterClientScriptBlock("BxResult", PageUtil.FillComboDropDown(BxResult.RefBy, "BxResult"));
Page.RegisterClientScriptBlock("BxGrade", PageUtil.FillComboDropDown(BxGrade.RefBy, "PathGrade"));
Page.RegisterClientScriptBlock("BxHistology", PageUtil.FillComboDropDown(BxHistology.RefBy, "PathHistologyProstate"));
Page.RegisterClientScriptBlock("BxPathologist", PageUtil.FillComboDropDown(BxPathologist.RefBy, "Pathologist"));
Page.RegisterClientScriptBlock("BxDataSource", PageUtil.FillComboDropDown(BxDataSource.RefBy, "DataSource"));
string reqFieldArray = PageUtil.CreateValidationScript("'"+BxType.ClientID+"'");
Page.RegisterClientScriptBlock("RequiredFieldArray", reqFieldArray);
PageUtil.AddCalendarFunction(BxDateTextCal, BxDateText);
PageUtil.AddFuzzyDateFunction(BxDateText, BxDate);
base.Page_Load(sender, e);
}
override protected object SaveViewState()
{
//add select and combo boxes to view state
//PageUtil.AddSelectToViewState(ViewState,BxCPT_Code);
PageUtil.AddSelectToViewState(ViewState,BxType);
PageUtil.AddSelectToViewState(ViewState,BxSide);
PageUtil.AddSelectToViewState(ViewState,BxQuality);
PageUtil.AddComboToViewState(ViewState,BxInstitution);
PageUtil.AddComboToViewState(ViewState,BxIndication);
PageUtil.AddComboToViewState(ViewState,BxSubsite);
PageUtil.AddComboToViewState(ViewState,BxHistology);
PageUtil.AddComboToViewState(ViewState,BxPathologist);
PageUtil.AddComboToViewState(ViewState,BxDataSource);
PageUtil.AddComboToViewState(ViewState,BxResult);
PageUtil.AddComboToViewState(ViewState,BxSite);
return base.SaveViewState();
}
override public HtmlInputHidden GetPrimKeyField()
{
return BiopsyId;
}
override protected DataEntryController GetController()
{
return new DataEntryController(new BiopsyDa(), Biopsy.BiopsyId); //NOTE: fix args
}
override protected void SetDataEntryInfo()
{
this._tableInfo = "Biopsies";
this._dataEntryTitle = "Biopsies";
}
override protected BizObject GetParams()
{
Biopsy biz = new Biopsy();
DataRow dr = biz.Tables[Biopsy.Table_Biopsies].NewRow();
if (!BiopsyId.Value.Equals(""))
{
dr[Biopsy.BiopsyId] = BiopsyId.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[Biopsy.PatientId] = this.patientID;
dr[Biopsy.SurgeryId] = PageUtil.ObjToInt(Request.Form[SurgeryId.UniqueID]);;
//dr[Biopsy.BxCPT_Code] = Request.Form[BxCPT_Code.UniqueID].ToString();
dr[Biopsy.BxCPT_Code] = BxCPT_Code.Value;
dr[Biopsy.BxCPT_Description] = BxCPT_Description.Value;
dr[Biopsy.BxPending] = BxPending.Checked;
dr[Biopsy.BxPathNum] = BxPathNum.Value;
dr[Biopsy.BxDateText] = Request.Form[BxDateText.UniqueID].ToString();
dr[Biopsy.BxDate] = PageUtil.ObjToDateTime(BxDate.Value);
dr[Biopsy.BxType] = Request.Form[BxType.UniqueID].ToString();
dr[Biopsy.BxIndication] = Request.Form[BxIndication.UniqueID].ToString();
dr[Biopsy.BxSite] = Request.Form[BxSite.UniqueID].ToString();
dr[Biopsy.BxSubsite] = Request.Form[BxSubsite.UniqueID].ToString();
dr[Biopsy.BxSide] = Request.Form[BxSide.UniqueID].ToString();
dr[Biopsy.BxResult] = Request.Form[BxResult.UniqueID].ToString();
dr[Biopsy.BxGrade] = Request.Form[BxGrade.UniqueID].ToString();
dr[Biopsy.BxHistology] = Request.Form[BxHistology.UniqueID].ToString();
dr[Biopsy.BxPathologist] = Request.Form[BxPathologist.UniqueID].ToString();
dr[Biopsy.BxInstitution] = Request.Form[BxInstitution.UniqueID].ToString();
dr[Biopsy.BxNotes] = BxNotes.Value;
dr[Biopsy.BxDataSource] = Request.Form[BxDataSource.UniqueID].ToString();
dr[Biopsy.BxQuality] = Request.Form[BxQuality.UniqueID].ToString();
AddBaseParams(dr);
biz.Tables[Biopsy.Table_Biopsies].Rows.Add(dr);
biz.AcceptChanges();
return biz;
}
protected override void SetFields(BizObject bz)
{
Biopsy biz = (Biopsy)bz;
DataRow dr = biz.Tables[Biopsy.Table_Biopsies].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]);
//PageUtil.SelectDropDownItem(BxCPT_Code, dr[Biopsy.BxCPT_Code]);
PageUtil.SelectDropDownItem(BxType, dr[Biopsy.BxType]);
PageUtil.SelectDropDownItem(BxSide, dr[Biopsy.BxSide]);
PageUtil.SelectDropDownItem(BxQuality, dr[Biopsy.BxQuality]);
BxCPT_Code.Value = dr[Biopsy.BxCPT_Code].ToString();
SurgeryId.Value = dr[Biopsy.SurgeryId].ToString();
BiopsyId.Value = dr[Biopsy.BiopsyId].ToString();
BxCPT_Description.Value = dr[Biopsy.BxCPT_Description].ToString();
PageUtil.SetCheckBox(BxPending, dr[Biopsy.BxPending]);
BxPathNum.Value = dr[Biopsy.BxPathNum].ToString();
BxDateText.Value = dr[Biopsy.BxDateText].ToString();
BxDate.Value = PageUtil.ObjToDateString(dr[Biopsy.BxDate]);
BxIndication.Value = dr[Biopsy.BxIndication].ToString();
BxSite.Value = dr[Biopsy.BxSite].ToString();
BxSubsite.Value = dr[Biopsy.BxSubsite].ToString();
BxResult.Value = dr[Biopsy.BxResult].ToString();
BxGrade.Value = dr[Biopsy.BxGrade].ToString();
BxHistology.Value = dr[Biopsy.BxHistology].ToString();
BxPathologist.Value = dr[Biopsy.BxPathologist].ToString();
BxNotes.Value = dr[Biopsy.BxNotes].ToString();
BxDataSource.Value = dr[Biopsy.BxDataSource].ToString();
BxInstitution.Value = dr[Biopsy.BxInstitution].ToString();
SetBaseFields(dr);
if (dr[Biopsy.SurgeryId] != null && dr[Biopsy.SurgeryId].ToString().Length > 0)
{
setSurgeryDateJsVar.Text = "<SCRIPT LANGUAGE=javascript>surgeryDateIsSet = true;</SCRIPT>";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -