<%@ WebHandler Language="C#" Class="CheckPriKey" %> using System; using System.Collections.Generic; using System.Web; using System.Data; using System.IO; using eMIS.Data; using System.Data.Common; using System.Text; using System.Web.SessionState; using eMIS; public class CheckPriKey : IHttpHandler, IRequiresSessionState { public void ProcessRequest (HttpContext context) { string programId = context.Request.QueryString["pid"].ToString(); string fieldName = context.Request.QueryString["fn"].ToString(); string primaryKeyValue = context.Request.QueryString["pkv"].ToString(); string dv = context.Request.QueryString["dv"].ToString(); string eid = context.Request.QueryString["eid"].ToString(); DataManager dm = new DataManager(); ProgramManager prog = new ProgramManager(dm,programId); string defaultValue = prog.GetEditElementByID(eid)["mrz"].ToString(); string v = ""; if (dv != "") { object obj = dm.ExecuteScalar("select " + fieldName + " from " + prog.EditTableName + " where " + prog.PrimaryKey + "='" + primaryKeyValue + "'"); if (obj != null) v = obj.ToString(); } if (v == "" && defaultValue != "") { InstanceManager inst = new InstanceManager(context); v = inst.Tag.ReplaceExpression(defaultValue, ""); } context.Response.Write(v); } public bool IsReusable { get { return false; } } }