public string GetCallbackResult() { string fName = _callBackArgs["FirstName"]; string lName = _callBackArgs["LastName"]; fName = fName == null ? string.Empty : fName; lName = lName == null ? string.Empty : lName; UserDa da = new UserDa(); DataTable userRecords = da.GetUserIdByFirstAndLastName(fName, lName).Tables[0]; if (userRecords.Rows.Count > 0) { string[] colNames = new string[] { Caisis.BOL.User.UserId, Caisis.BOL.User.UserFirstName, Caisis.BOL.User.UserLastName, Caisis.BOL.User.UserEmail }; string jsArray = PageUtil.DataTableToJSArray(userRecords, colNames, true); return(jsArray); } else { return(string.Empty); } return(string.Empty); }
/// <summary> /// Registers the client array of LkpFieldNames for filtering client side. /// </summary> private void RegisterSearchCodes() { if (_lkpCodesTable != null) { string lkpFieldNames = PageUtil.DataTableToJSArray(_lkpCodesTable, new string[] { LookupCode.LkpFieldName }, false); Page.ClientScript.RegisterArrayDeclaration("LkpFieldNames", lkpFieldNames); } }
protected void Page_Load(object sender, EventArgs e) { string type = Request.Form["type"]; string filterExpr = Request.Form["filter"]; string[] menuFields = Request.Form["fields"].Split(new char[] { ',' }); DataTable menuItems = GetFilteredPatientMenuItems(type, filterExpr); string output = PageUtil.DataTableToJSArray(menuItems, menuFields, true); Response.Write(output); }
/// <summary> /// Returns a js array used by client to populate dropdowns /// </summary> /// <returns></returns> public string GetCallbackResult() { string[] keys = _callbackOrgId.Split(';'); string orgId = keys[0]; string contactClientId = keys[1]; ProjectManagementDa da = new ProjectManagementDa(); DataTable contacts = da.GetAllContactsByOrgId(int.Parse(orgId)); string clientArray = PageUtil.DataTableToJSArray(contacts, new string[] { "Name", "ContactId" }, true); string clientObject = "['" + contactClientId + "'," + clientArray + " ]"; return(clientObject); }
protected void Page_Load(object sender, EventArgs e) { string output = ""; string methodName = Request.Form["methodName"]; string lookupField = Request.Form["field"]; string searchTerm = Request.Form["search"]; bool isDistinct = string.IsNullOrEmpty(Request.Form["isDistinct"]) ? false : bool.Parse(Request.Form["isDistinct"]); switch (methodName) { case ("GetParentCodeByChildCode"): string childLkpField = Request.Form["childLkpField"]; string childLkpCode = Request.Form["childLkpCode"]; string parentLkpField = Request.Form["parentLkpField"]; LookupCodeDa da = new LookupCodeDa(); DataTable dt = da.GetParentLookupCodeByChildCode(parentLkpField, childLkpField, childLkpCode); // 0 || > 1 results, return empty value (prevent ambiguity) output = dt.Rows.Count == 1 ? dt.Rows[0][LookupCode.LkpCode].ToString() : ""; break; default: if (!string.IsNullOrEmpty(lookupField)) { DataTable lkpTable = GetLookupCodes(lookupField, isDistinct); if (lkpTable.Columns.Contains(LookupCode.LkpCode)) { string[] lkpFields = new string[] { LookupCode.LkpCode, LookupCode.LkpDescription }; output = PageUtil.DataTableToJSArray(lkpTable, lkpFields, false); } else { string[] lkpFields = new string[] { "DropDownValue", "DropDownText" }; output = PageUtil.DataTableToJSArray(lkpTable, lkpFields, false); } } break; } Response.Write(output); }