Hi,
My code works fine the first time around. The second time, if I change the cascadign dropdownlist , the treeview turns up null.
View - cshtml file
Controller
My code works fine the first time around. The second time, if I change the cascadign dropdownlist , the treeview turns up null.
View - cshtml file
@using MedAssets.AMS.Workflow.Rules @using MedAssets.AMS.Web.ViewModels @model RulesViewModel <table border="1" width="50%"> <tr> <td style="width: 20%">@Html.Label("Name :") </td> <td>@Html.TextBoxFor(m => m.Rule.Name)</td> </tr> <tr> <td>@Html.Label("Status")</td> <td>@Html.CheckBoxFor(m => m.Rule.IsActive) @Html.Label("Active")</td> </tr> <tr> </tr> </table> <div style="height: 50px;"></div> <table id="tblFacility"> <tr> <td> @foreach (var objFacility in Model.FacilityList) { <div> @Html.CheckBox(objFacility.FacilityId.ToString(), new { id = objFacility.FacilityId.ToString() }) @Html.Label(objFacility.FacilityId.ToString(), objFacility.FacilityName, new { @for = objFacility.FacilityId.ToString() }) </div> } </td> </tr> </table> <div style="height: 50px"></div> <table id="tblRulePart" width="auto" border="1"> <tr> @* <td style="width: 10px"> @Html.Label("Compare") </td>*@ <td style="width: 30px" align="center" class="k-header"> @Html.Label("Account Context") </td> <td style="width: 100px" align="center" class="k-header"> @Html.Label("Rule Property") </td> <td style="width: 100px" align="center" class="k-header"> @Html.Label("Comparison Operator") </td> <td style="width: 400px" align="center" class="k-header"> @* @Html.Label("Property Values")*@ </td> <td style="width: 40px" align="center" class="k-header"> @Html.Label("") </td> </tr> <tr> @* <td> @Html.CheckBox("chkCompare", false) </td>*@ <td align="center"> @(Html.Kendo().DropDownList() .Name("Context") .OptionLabel("--Select Context--") .DataTextField("Text") .DataValueField("Value") .AutoBind(false) .BindTo(Model.RuleAccountContextList) ) </td> <td align="center"> @(Html.Kendo().DropDownList() .Name("Attribute") .HtmlAttributes(new { style = "width:200px" }) .OptionLabel("--Select Attribute--") .DataTextField("DisplayName") .DataValueField("Id") .AutoBind(false) .BindTo(Model.RuleAttributeModelList) ) </td> <td align="center"> @(Html.Kendo().DropDownList() .Name("RuleCompare") .HtmlAttributes(new { style = "width:200px" }) .OptionLabel("--Comparison--") .DataTextField("DisplayName") .DataValueField("Id") .CascadeFrom("Attribute") .DataSource(source => { source.Read(read => { read.Action("GetCascadeOperators", "Rule") .Data("filterOperator"); }) .ServerFiltering(true); }) .Enable(false) .AutoBind(false) ) <script> function filterOperator() { return { property: $("#Attribute").val() + "*" + $("#Context").val() }; } </script> </td> <td align="left"> <div id="list"> <table> <tr> <td> <div style="height: 100px; width:400px; overflow-y: auto"> <div id="treeView"></div> </div> </td> </tr> </table> </div> </td> <td align="center"> <input id="btnAdd" type="submit" name="AddRulePart" value="ADD" /> </td> </tr> <tr> </tr> </table> <script type="text/javascript"> var selectedTreeNodes = new Array(); var saveData = new Array(); $(document).ready( function () { $("#Context").change(function () { var selectedId = $('#Context').val(); if (selectedId == 3) { $('#list').hide(); } else { $('#list').show(); } }) $('#Attribute').change(function () { var selectedId = $('#Attribute').val(); var selectedFacility = new Array(); $("#tblFacility").find("input:checked").each(function () { var facId = $(this).attr('name'); var facname = $('label[for=' + facId + ']').text(); selectedFacility.push({ 'FacilityId': facId, 'FacilityName': facname }); }); var facData = JSON.stringify(selectedFacility); var selData = { 'id': selectedId, 'facilityIds': facData }; $.ajax({ url: "GetAttributeValues", data: selData, type: "GET", success: function (result) { // debugger; var tempView = $("#treeView").data("kendoTreeView"); var treeObj = []; for (var i = 0; i < result.length; i++) { treeObj.push({ id: result[i].id, Name: result[i].Name, items: result[i].Children, hasChildren: result[i].hasChildren }); } var treeDs = new kendo.data.HierarchicalDataSource( { data: treeObj }); //if (tempView == null || tempView == undefined || tempView.data == null) { //tempView.dataSource.data([]); //tempView.dataSource.data(result); //} $("#treeView").kendoTreeView( { dataSource: result, dataTextField: "Name", hasChildren : "hasChildren", dataValueField: "id", loadOnDemand: true, expanded: true, checkboxTemplate: kendo.template($("#treeview-checkbox-template").html()), }); }, error: function () { //alert("error"); }, }); }) function getNodeIndex(node) { return node.parentsUntil(".k-treeview", ".k-item").map(function () { return $(this).index(); }).toArray().reverse().join(":"); } var treeview = $("#treeView"); treeview.on("change", ":checkbox", function (e) { //var checkbox = $(this), // dataItem = treeview.data("kendoTreeView").dataItem(checkbox.closest(".k-item")), // index = getNodeIndex(checkbox); // debugger; var nodeDesc = ''; var nodeId = 0; if ($(this).is(':checked')) { nodeId = $(this).attr('value'); $(this).parent().siblings().each(function () { var text = $(this).text(); if (text && text != undefined) { nodeDesc = text.replace(/&/g, '&'); return false; } }); //uncheck all checked checkboxes //$("input:checked[name=checkedNodes]").each(function () { // $(this).attr('checked', false); //}); ////recheck this //$(this).attr('checked', true); } selectedTreeNodes.push({ "NodeId": nodeId, "NodeDesc": nodeDesc }); }) }); $("#btnAdd").click(function () { var ddlContext = $("#Context").data("kendoDropDownList"); var contextDataItem = ddlContext.text(); var contextId = $("#Context").val(); var ddlAttribute = $("#Attribute").data("kendoDropDownList"); var attrDataItem = ddlAttribute.text(); var attrtId = $("#Attribute").val(); var ddlRuleCompare = $("#RuleCompare").data("kendoDropDownList"); var cmpDataItem = ddlRuleCompare.text(); var cmpId = $("#RuleCompare").val(); var selFaclist = []; $("#tblFacility").find("input:checked").each(function () { var facId = $(this).attr('name'); var facname = $('label[for=' + facId + ']').text(); selFaclist.push({ 'FacilityId': facId, 'FacilityName': facname }); }); //var rulePartMemberList; //for (var i = 0; i < selectedTreeNodes.length; i++) var seldata = { "ContextId": contextId, "ContextValue": contextDataItem, "AttributeId": attrtId, "AttributeValue": attrDataItem, "CompareId": cmpId, "CompareValue": cmpDataItem, "SelectedFacility" :selFaclist, "SelectedValues": selectedTreeNodes, }; //saveData.push({ "Data": seldata }); saveData.push({ "ContextId": contextId, "ContextValue": contextDataItem, "AttributeId": attrtId, "AttributeValue": attrDataItem, "CompareId": cmpId, "CompareValue": cmpDataItem, "SelectedFacility": selFaclist, "SelectedValues": selectedTreeNodes, }); var jsonObj = []; for (var i = 0; i < selectedTreeNodes.length; i++) { jsonObj.push({ id: selectedTreeNodes[i].NodeId, optionValue: selectedTreeNodes[i].NodeDesc }); } var dataDefault = new kendo.data.HierarchicalDataSource( { data: jsonObj }); var col1 = "<td style='width: 30px' align='center'>" + contextDataItem + "</td>"; var col2 = "<td style='width: 100px' align='center'>" + attrDataItem + "</td>"; var col3 = "<td style='width: 100px' align='center'>" + cmpDataItem + "</td>"; var col4 = "<td style='width: 100px' align='left'> <div id='treeview'></div></td>"; var col5 = "<td align='center'><a onclick='removeRow(this);' href='#' class='delete-link' > Delete </a></td>"; var nextRow = $("<tr>" + col1 + col2 + col3 + col4 + col5 + "</tr>"); $('#tblRulePart tr:last').after(nextRow); $("#treeview").kendoTreeView({ checkboxes: { checkChildren: false, template: kendo.template( '<input type ="checkbox" checked="checked" />') }, dataSource: dataDefault, dataTextField: "optionValue", dataValueField: "id", }); selectedTreeNodes = []; return false; }); function removeRow() { if (!confirm('Are you sure you want to delete?')) { ev.preventDefault(); return false; } else { $("#tblRulePart").delegate('a.delete-link', 'click', function (e) { e.preventDefault(); $(this).closest('tr').remove(); }); } } </script> <script id="treeview-checkbox-template" type="text/kendo-ui-template"> <input type="checkbox" name="checkedFiles[#= item.id #]" value="#= item.id #" /> </script> </div>Controller
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MedAssets.AMS.Business.Domain.Common; using MedAssets.AMS.Business.Domain; using MedAssets.AMS.Business.Domain.Enums; using MedAssets.AMS.Business.Domain.Interfaces; using MedAssets.AMS.Business.Domain.Managers.Interfaces; //using MedAssets.Aaa.Security; //using MedAssets.Aaa.Users; using MedAssets.AMS.Business.Domain; //using MedAssets.AMS.Business.WorkDistribution; using MedAssets.AMS.Common; //using MedAssets.AMS.Web.Controls; using MedAssets.AMS.Web.Models; using MedAssets.AMS.Web.Util; using MedAssets.AMS.Workflow; //using Microsoft.IdentityModel.Claims; using StructureMap; using MedAssets.AMS.Web.ViewModels; using Kendo.Mvc.UI; using Kendo.Mvc.Extensions; using MedAssets.AMS.Workflow.Rules; using MedAssets.Aaa.Facilities; using MedAssets.Aaa.Security; using MedAssets.AMS.Business.WorkDistribution; using System.Web.Script.Serialization; using System.Runtime.Serialization.Json; namespace MedAssets.AMS.Web.WorkflowRules.Controllers { public class RuleController : Controller { // public int ClientId = 3503; public Guid facilityId = new Guid("AA33D4E9-A389-41B4-BE85-A1F7EFF4B37B"); public const string UserGroupImageUrl = "../../App_Themes/Default/images/userGroup.png"; public const string UserImageUrl = "../../App_Themes/Default/images/user.png"; private IWorkflowService WorkflowService { get { return ObjectFactory.GetInstance<IWorkflowService>(); } } private IUserTreeManager UserTreeManager { get { return ObjectFactory.GetInstance<IUserTreeManager>(); } } private UserTree GetUserList(Guid userGroupId) { return UserTreeManager.GetUserTreeByUserGroup(ClientId, userGroupId, CurrentPrincipal.Identity.IsInternalUser); } private RuleUtil _ruleUtil = new RuleUtil(); public IAaaPrincipal CurrentPrincipal { get { return System.Web.HttpContext.Current.User.AsAaaPrincipal(); } } public int ClientId { get { return CurrentPrincipal.Identity.ClientId; } } public Guid FacilityId { get { return CurrentPrincipal.Identity.HomeFacilityId; } } private UserTree UserTreeModel { get { var userTree = (UserTree)Session["UserTreeModel"]; if (userTree == null) { userTree = ObjectFactory.GetInstance<IUserTreeManager>().GetUserTree(ClientId, ((AaaClaimsIdentity)CurrentPrincipal.Identity).IsAmsInternal()); UserTreeModel = userTree; } return userTree; } set { Session["UserTreeModel"] = value; } } public ActionResult About() { var principal = ObjectFactory.GetInstance<IAaaPrincipal>(); var clientId = principal.Identity.ClientId; var facilityId = principal.Identity.HomeFacilityId; var ut = UserTreeModel; // var values = WorkflowService.GetRuleSourceObjects().ToList(); return View("RuleObject"); } [AcceptVerbs(HttpVerbs.Get)] public JsonResult AlphaSplitUsers(Guid userGroupId) { var dataContext = UserTreeModel.Children.Where(e => e.QueueId == userGroupId).FirstOrDefault(); var userTree = GetUserList(dataContext.Id).Children; var Users = from t in userTree select new { id = t.QueueId, Name = t.Name, }; return Json(Users, JsonRequestBehavior.AllowGet); } public JsonResult Users(Guid? id) { var dataContext = UserTreeModel; if (id == null) { var parentusers = from e in dataContext.Children select new { id = e.QueueId, Name = e.Name, ImageUrl = e.IsUserGroup ? UserGroupImageUrl : UserImageUrl, ToolTip = e.IsUser ? e.ContactInfo : null, hasChildren = e.Children.Any() }; return Json(parentusers, JsonRequestBehavior.AllowGet); } else { var users = dataContext.Children.Where(e => e.QueueId == id).FirstOrDefault().Children; var childUsers = from t in users select new { id = t.QueueId, Name = t.Name, ImageUrl = t.IsUser ? UserGroupImageUrl : UserImageUrl, //hasChildren = t.Children.Any() }; return Json(childUsers, JsonRequestBehavior.AllowGet); } } public ActionResult Add() { return null; } [AcceptVerbs(HttpVerbs.Post)] // public ActionResult Save(RuleModel RuleData) public ActionResult Save(string sdata) { var t = sdata; // var data = RuleData; return null; } [AllowAnonymous] [HttpGet] public ActionResult Get() { RulesViewModel Rule = _ruleUtil.GetRulesViewModel(); return View("CreateRule", Rule); } [AllowAnonymous] [HttpGet] public ActionResult Create() { CreateRuleViewModel objRuleViewModel = new CreateRuleViewModel(); RulesViewModel Rule = _ruleUtil.GetRulesViewModel(); objRuleViewModel.RulesViewModel = Rule; return View("RuleObject", objRuleViewModel); } public ActionResult GetCascadeOperators(string property) { string context = string.Empty; string attr = string.Empty; string[] tProperty; if (!String.IsNullOrEmpty(property)) { //context = property.Substring(property.LastIndexOf('*')); tProperty = property.Split('*'); if (tProperty.Length != 0) { attr = tProperty[0]; context = tProperty[1]; } } List<PropertyOperatorModel> operators = null; if (!string.IsNullOrEmpty(attr)) { if (context != "3") { operators = _ruleUtil.GetRulePropertyOperator(int.Parse(attr)); } else { operators = _ruleUtil.GetRulePropertyForBothContext(); } } return Json(operators, JsonRequestBehavior.AllowGet); } [HttpGet] public JsonResult GetAttributeValues(int? id, string facilityIds) { JavaScriptSerializer jss = new JavaScriptSerializer(); List<ClientFacilityModel> lstSelected = jss.Deserialize<List<ClientFacilityModel>>(facilityIds); List<FacilitywiseLookupModel> attributeLookup = new List<FacilitywiseLookupModel>(); attributeLookup = GetObjectPropertyLookup(id.Value, lstSelected).ToList(); var attr = from e in attributeLookup where(e.FacId != null) select new { id = e.FacId, Name = e.FaceName, items = e.Lookupmodel, hasChildren = e.Lookupmodel.Any(), }; return Json(attr, JsonRequestBehavior.AllowGet); } public JsonResult BindRulePartData(RulePartMemberModel objRulePartMember) { var gridData = 1; return Json(gridData, JsonRequestBehavior.AllowGet); } public ActionResult RuleContext_Read([DataSourceRequest] DataSourceRequest request) { var ddlData = _ruleUtil.GetRuleAccountContext(); return Json(ddlData.ToDataSourceResult(request)); } public ActionResult RuleAttribute_Read([DataSourceRequest] DataSourceRequest request) { var ddlData = _ruleUtil.GetRuleObjectPropertyLookup(); return Json(ddlData.ToDataSourceResult(request)); } public ActionResult RuleCompare_Read([DataSourceRequest] DataSourceRequest request) { var ddlData = _ruleUtil.GetRuleObjectPropertyLookup(); return Json(ddlData.ToDataSourceResult(request)); } public ActionResult CompareContext(bool IsChecked) { List<SelectListItem> lstContext = new List<SelectListItem>(); if (!IsChecked) { lstContext = _ruleUtil.GetRuleAccountContext(); } else { SelectListItem objSel = new SelectListItem { Text = "Both", Value = "1" }; lstContext.Add(objSel); } return Json(lstContext, JsonRequestBehavior.AllowGet); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult RulePart_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<RulesViewModel> attribute) { var results = new List<RulesViewModel>(); if (attribute != null && ModelState.IsValid) { foreach (var attr in attribute) { results.Add(attr); } } return Json(results.ToDataSourceResult(request, ModelState)); } public IEnumerable<FacilitywiseLookupModel> GetObjectPropertyLookup(int id, List<ClientFacilityModel> faclist) { IEnumerable<FacilitywiseLookupModel> _lookup = default(IEnumerable<FacilitywiseLookupModel>); switch (id) { case 1: _lookup = PopulateFacilities(); break; case 2: break; case 3: _lookup = PopulatePhysicians(faclist); break; case 4: case 5: _lookup = PopulatePlanType(faclist); //Primary Insurance Plan Type break; case 6: _lookup = PopulateVisitTypesForSelectedFacilities(faclist); break; case 7: _lookup = PopulatePatientTypesForSelectedFacilities(faclist); break; case 8: _lookup = PopulateServiceTypesForSelectedFacilities(faclist); break; case 9: _lookup = PopulatePatientLocationssForSelectedFacilities(faclist); break; case 10: _lookup = PopulatePatientStatusesForSelectedFacilities(faclist); break; case 11: _lookup = PopulateFinancialClassesForSelectedFacilities(faclist); break; case 12: case 13: case 15: case 16: _lookup = PopulatePlans(faclist); //Primary Insurance Plan break; case 14: _lookup = PopulatePayors(faclist); break; } return _lookup; } public IEnumerable<FacilitywiseLookupModel> PopulatePhysicians(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); List<LookupViewModel> PhysicianList = new List<LookupViewModel>(); var connectionString = ObjectFactory.GetInstance<IResourceLocator>().GetAppDbConnectString(ClientId); System.Data.SqlClient.SqlDataReader dr = default(System.Data.SqlClient.SqlDataReader); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connectionString)) { con.Open(); using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = con; cmd.CommandText = "select (GivenName+(' ')+MiddleName+(' ')+FamilyName) as PhysicianName, PhysicianId from Physician where facilityid=@facilityid"; cmd.Parameters.Add("@facilityid", System.Data.SqlDbType.VarChar, 100).Value = facility.FacilityId.ToString(); dr = cmd.ExecuteReader(); while (dr.Read()) { LookupViewModel physician = new LookupViewModel(); physician.id = dr["PhysicianId"].ToString(); physician.Name = dr["PhysicianName"].ToString(); PhysicianList.Add(physician); } } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = PhysicianList; faclkplst.Add(faclkp); } } return faclkplst; } public IEnumerable<FacilitywiseLookupModel> PopulatePlans(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> planlist = new List<LookupViewModel>(); var planList = ObjectFactory.GetInstance<IPayorPlanManager>().GetInsurancePlanList(facility.FacilityId); faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; foreach (var plan in planList) { LookupViewModel planmodel = new LookupViewModel(); planmodel.id = plan.Id.ToString(); planmodel.Name = plan.Description; planlist.Add(planmodel); } faclkp.Lookupmodel = planlist; faclkplst.Add(faclkp); } return faclkplst; } public IEnumerable<FacilitywiseLookupModel> PopulatePlanType(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> plantypes = new List<LookupViewModel>(); foreach (int plantypevalue in Enum.GetValues(typeof(PlanType))) { LookupViewModel plantypemodel = new LookupViewModel(); plantypemodel.id = plantypevalue.ToString(); plantypemodel.Name = Enum.GetName(typeof(PlanType), plantypevalue); plantypes.Add(plantypemodel); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = plantypes; faclkplst.Add(faclkp); } return faclkplst; } public IEnumerable<FacilitywiseLookupModel> PopulatePayors(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); var payorList = ObjectFactory.GetInstance<IPayorPlanManager>().GetPayorList(ClientId).OrderBy(e => e.CompanyName); List<LookupViewModel> _payorlist = new List<LookupViewModel>(); foreach (var payor in payorList) { LookupViewModel _payor = new LookupViewModel(); _payor.id = payor.ClientPayorId.ToString(); _payor.Name = payor.CompanyName; _payorlist.Add(_payor); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = _payorlist; faclkplst.Add(faclkp); } return faclkplst; } public IEnumerable<FacilitywiseLookupModel> PopulateFacilities() { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); var facilityService = ObjectFactory.GetInstance<IFacilityService>(); var facilities = facilityService.GetList(ClientId).ToList().OrderBy(e => e.Name); foreach (var facility in facilities) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> facilitylist = new List<LookupViewModel>(); LookupViewModel _lookup = new LookupViewModel(); _lookup.id = facility.FacilityId.ToString(); _lookup.Name = facility.Name; facilitylist.Add(_lookup); faclkp.Lookupmodel = facilitylist; faclkplst.Add(faclkp); } return faclkplst; } private ILookupManager _lookupManager; private ILookupManager LookupManager { get { return _lookupManager ?? (_lookupManager = ObjectFactory.GetInstance<ILookupManager>()); } } private IEnumerable<FacilitywiseLookupModel> PopulateVisitTypesForSelectedFacilities(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> visityTypes = new List<LookupViewModel>(); var facGuid = facility.FacilityId; var types = LookupManager.GetLookupsForWebAdmin(facGuid, LookupType.VisitType).OrderBy(e => e.Name); foreach (var addType in types) { LookupViewModel visitTypelookup = new LookupViewModel(); visitTypelookup.Name = addType.NameDescription; visitTypelookup.id = addType.Id.ToString(); visityTypes.Add(visitTypelookup); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = visityTypes; faclkplst.Add(faclkp); } return faclkplst; } private IEnumerable<FacilitywiseLookupModel> PopulatePatientTypesForSelectedFacilities(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> patientTypes = new List<LookupViewModel>(); var facGuid = facility.FacilityId; var types = LookupManager.GetLookupsForWebAdmin(facGuid, LookupType.PatientType).OrderBy(e => e.Name); foreach (var addType in types) { LookupViewModel patientTypelookup = new LookupViewModel(); patientTypelookup.Name = addType.NameDescription; patientTypelookup.id = addType.Id.ToString(); patientTypes.Add(patientTypelookup); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = patientTypes; faclkplst.Add(faclkp); } return faclkplst; } private IEnumerable<FacilitywiseLookupModel> PopulateServiceTypesForSelectedFacilities(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> serviceTypes = new List<LookupViewModel>(); var facGuid = facility.FacilityId; var types = LookupManager.GetLookupsForWebAdmin(facGuid, LookupType.ServiceType).OrderBy(e => e.Name); foreach (var addType in types) { LookupViewModel serviceTypeLookup = new LookupViewModel(); serviceTypeLookup.Name = addType.NameDescription; serviceTypeLookup.id = addType.Id.ToString(); serviceTypes.Add(serviceTypeLookup); } faclkp.FaceName = facility.FacilityName; faclkp.FacId = facility.FacilityId; faclkp.Lookupmodel = serviceTypes; faclkplst.Add(faclkp); } return faclkplst; } private IEnumerable<FacilitywiseLookupModel> PopulatePatientLocationssForSelectedFacilities(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> patientLocations = new List<LookupViewModel>(); var facGuid = facility.FacilityId; var types = LookupManager.GetLookupsForWebAdmin(facGuid, LookupType.PatientLocation).OrderBy(e => e.Name); foreach (var addType in types) { LookupViewModel patientLocationlookup = new LookupViewModel(); patientLocationlookup.Name = addType.NameDescription; patientLocationlookup.id = addType.Id.ToString(); patientLocations.Add(patientLocationlookup); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = patientLocations; faclkplst.Add(faclkp); } return faclkplst; } private IEnumerable<FacilitywiseLookupModel> PopulatePatientStatusesForSelectedFacilities(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> patientStatuses = new List<LookupViewModel>(); var facGuid = facility.FacilityId; var types = LookupManager.GetLookupsForWebAdmin(facGuid, LookupType.PatientStatus).OrderBy(e => e.Name); foreach (var addType in types) { LookupViewModel patientStatuslookup = new LookupViewModel(); patientStatuslookup.Name = addType.NameDescription; patientStatuslookup.id = addType.Id.ToString(); patientStatuses.Add(patientStatuslookup); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = patientStatuses; faclkplst.Add(faclkp); } return faclkplst; } private IEnumerable<FacilitywiseLookupModel> PopulateFinancialClassesForSelectedFacilities(List<ClientFacilityModel> _faclist) { List<FacilitywiseLookupModel> faclkplst = new List<FacilitywiseLookupModel>(); foreach (var facility in _faclist) { FacilitywiseLookupModel faclkp = new FacilitywiseLookupModel(); List<LookupViewModel> financialClasses = new List<LookupViewModel>(); var facGuid = facility.FacilityId; var types = LookupManager.GetLookupsForWebAdmin(facGuid, LookupType.FinancialClass).OrderBy(e => e.Name); foreach (var addType in types) { LookupViewModel financialClasslookup = new LookupViewModel(); financialClasslookup.Name = addType.NameDescription; financialClasslookup.id = addType.Id.ToString(); financialClasses.Add(financialClasslookup); } faclkp.FacId = facility.FacilityId; faclkp.FaceName = facility.FacilityName; faclkp.Lookupmodel = financialClasses; faclkplst.Add(faclkp); } return faclkplst; } [AcceptVerbs(HttpVerbs.Get)] public ActionResult BindAssignmentGrid(WorkflowRuleActionModel workflowRuleActionModel) { foreach (var item in workflowRuleActionModel.Activ) { item.NewActionType = workflowRuleActionModel.ActionType; item.NewAssignedUser = workflowRuleActionModel.AssignedUser; item.NewAssignedUserId = workflowRuleActionModel.AssignedUserId; } return Json(workflowRuleActionModel.Activ, JsonRequestBehavior.AllowGet); } public ActionResult GetActivities() { //v//ar act= WorkflowService.geta return null; } public ViewResult GetData() { return null; } } }