📄 actionsform.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 ActionsForm : DataEntryControl
{
protected HtmlInputCheckBox ActionPending;
protected HtmlInputText ActionDateText;
protected HtmlInputText ActionDate;
protected ComboBox ActionItem;
protected HtmlTextArea ActionNotes;
protected HtmlInputHidden ActionId;
protected Caisis.UI.Core.Classes.PDLabel PdLabel1; //add all tool tip Ids
protected HtmlImage ActionDateTextCal;
override protected void Page_Load(object sender, System.EventArgs e)
{
//populate look up and distinct value select boxes
//array created for combo boxes. One for each ComboBox
Page.RegisterClientScriptBlock("ActionItem", PageUtil.FillComboDropDown(ActionItem.RefBy, "ActionItem"));
//array created holding required fields
string reqFieldArray = PageUtil.CreateValidationScript("'"+ActionDateText.ClientID+"', '"+ActionItem.ClientID+"'");
Page.RegisterClientScriptBlock("RequiredFieldArray", reqFieldArray);
PageUtil.AddCalendarFunction(ActionDateTextCal, ActionDateText);
PageUtil.AddFuzzyDateFunction(ActionDateText, ActionDate);
base.Page_Load(sender, e);
}
/*
override protected object SaveViewState()
{
//add select and combo boxes to view state
PageUtil.AddComboToViewState(ViewState,ActionItem);
return base.SaveViewState();
}
*/
override public HtmlInputHidden GetPrimKeyField()
{
return ActionId;
}
override protected DataEntryController GetController()
{
return new DataEntryController(new ActionDa(), Action.ActionId); //NOTE: fix args
}
override protected void SetDataEntryInfo()
{
this._tableInfo = "Actions";
this._dataEntryTitle = "Actions";
}
override protected BizObject GetParams()
{
Action biz = new Action();
DataRow dr = biz.Tables[Action.Table_Actions].NewRow();
if (!ActionId.Value.Equals(""))
{
dr[Action.ActionId] = ActionId.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[Action.PatientId] = this.patientID;
dr[Action.ActionPending] = ActionPending.Checked;
dr[Action.ActionDateText] = Request.Form[ActionDateText.UniqueID].ToString();
dr[Action.ActionDate] = PageUtil.ObjToDateTime(ActionDate.Value);
dr[Action.ActionItem] = Request.Form[ActionItem.UniqueID].ToString();
dr[Action.ActionNotes] = ActionNotes.Value;
AddBaseParams(dr);
biz.Tables[Action.Table_Actions].Rows.Add(dr);
biz.AcceptChanges();
return biz;
}
protected override void SetFields(BizObject bz)
{
Action biz = (Action)bz;
DataRow dr = biz.Tables[Action.Table_Actions].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]);
ActionId.Value = dr[Action.ActionId].ToString();
PageUtil.SetCheckBox(ActionPending, dr[Action.ActionPending]);
ActionDateText.Value = dr[Action.ActionDateText].ToString();
ActionDate.Value = PageUtil.ObjToDateString(dr[Action.ActionDate]);
ActionItem.Value = dr[Action.ActionItem].ToString();
ActionNotes.Value = dr[Action.ActionNotes].ToString();
SetBaseFields(dr);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -