public ActionResult Edit(string id) { string token = HttpContext.Session.GetString("access_token"); List <WardModel> ward = APIservice.GetListById <WardModel>(id, "synapsenamespace=meta&synapseentityname=ward&synapseattributename=ward_id&attributevalue=", token); return(View(ward.Select(w => w).First())); }
public IActionResult SaveDisplayName(string listId, string Modelid, string displayname, bool isdefaultmodule) { string token = HttpContext.Session.GetString("access_token"); List <ModulesModel> listModulesModel = APIservice.GetList <ModulesModel>("synapsenamespace=meta&synapseentityname=module", token); List <Mappedmodule> listMappedmodules = APIservice.GetListById <Mappedmodule>(listId.Trim(), "synapsenamespace=meta&synapseentityname=applicationmodulemapping&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.displayorder).ToList(); if (isdefaultmodule) { Mappedmodule getselectedModel = listMappedmodules.FirstOrDefault(s => s.isdefaultmodule == true); if (getselectedModel != null) { getselectedModel.isdefaultmodule = false; string updatedresult = APIservice.PostObject <Mappedmodule>(getselectedModel, "synapsenamespace=meta&synapseentityname=applicationmodulemapping", token); } } List <Mappedmodule> Mappedmodule = listMappedmodules; Mappedmodule Model = Mappedmodule.Single(s => s.applicationmodulemapping_id == Modelid); Model.displayname = displayname; Model.isdefaultmodule = isdefaultmodule; string results = APIservice.PostObject <Mappedmodule>(Model, "synapsenamespace=meta&synapseentityname=applicationmodulemapping", token); return(new EmptyResult()); }
public IActionResult GetMappedModules(string listId) { string token = HttpContext.Session.GetString("access_token"); List <MappedList> Mappedmodule = APIservice.GetListById <MappedList>(listId.Trim(), "synapsenamespace=meta&synapseentityname=applicationlist&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.displayorder).ToList(); List <PatientListModel> list = getListofListModel(); List <ApplicationModuleMappingModel> mapping = new List <ApplicationModuleMappingModel>(); mapping = (from customer in list select customer) .Select(x => new ApplicationModuleMappingModel() { module_id = x.list_id, modulename = x.listname }).ToList(); var query = from x in mapping join y in Mappedmodule on x.module_id equals y.listid select new { x, y }; foreach (var match in query) { match.x.isselected = true; match.x.applicationmodulemapping_id = match.y.applicationlist_id; match.x.displayorder = match.y.displayorder; } return(Json(JsonConvert.SerializeObject(Mappedmodule))); }
public IActionResult LoadApplicationQuestion(string applicationId) { string token = HttpContext.Session.GetString("access_token"); List <Question> questionList = getListofQuestions(); List <ApplicationQuestion> applicationQuestion = APIservice.GetListById <ApplicationQuestion>(applicationId.Trim(), "synapsenamespace=meta&synapseentityname=applicationquestion&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.ordinalposition).ToList(); List <ApplicationQuestionMapping> mappingList; mappingList = (from qlist in questionList select new ApplicationQuestionMapping() { application_id = applicationId, questionid = qlist.question_id, questionquickname = qlist.questionquickname, labeltext = qlist.labeltext, isselected = false }).ToList(); foreach (ApplicationQuestion ques in applicationQuestion) { int mappedIndex = mappingList.FindIndex(m => m.questionid == ques.questionid); if (mappedIndex > -1) { mappingList[mappedIndex].applicationquestion_id = ques.applicationquestion_id; mappingList[mappedIndex].isselected = true; } } return(Json(JsonConvert.SerializeObject(mappingList))); }
public EmptyResult MapModuletoApplication(string listId, string attributename, int ordinalposition) { string token = HttpContext.Session.GetString("access_token"); List <PatientListModel> listModulesModel = getListofListModel(); List <MappedList> listMappedmodules = APIservice.GetListById <MappedList>(listId.Trim(), "synapsenamespace=meta&synapseentityname=applicationlist&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.displayorder).ToList(); MappedList Model = new MappedList(); Guid id = Guid.NewGuid(); PatientListModel moduleobj = listModulesModel.Single(s => s.list_id == attributename); Model.applicationlist_id = id.ToString(); Model.application_id = listId.Trim(); Model.listid = attributename; Model.listname = moduleobj.listname; if (listMappedmodules.Count == 0) { Model.displayorder = 1; } else { Model.displayorder = listMappedmodules.Max(x => x.displayorder.Value) + 1; } string results = APIservice.PostObject <MappedList>(Model, "synapsenamespace=meta&synapseentityname=applicationlist", token); listMappedmodules = APIservice.GetListById <MappedList>(listId.Trim(), "synapsenamespace=meta&synapseentityname=applicationlist&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.displayorder).ToList();; return(new EmptyResult()); }
public EmptyResult MapQuestiontoApplication(string applicationId, string questionid, int ordinalposition) { string token = HttpContext.Session.GetString("access_token"); List <ApplicationQuestion> applicationQuestion = APIservice.GetListById <ApplicationQuestion>(applicationId.Trim(), "synapsenamespace=meta&synapseentityname=applicationquestion&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.ordinalposition).ToList(); int?ordinalpos = applicationQuestion.Select(app => app.ordinalposition).Max(); ApplicationQuestion Model = new ApplicationQuestion(); Guid id = Guid.NewGuid(); Model.applicationquestion_id = id.ToString(); Model.application_id = applicationId.Trim(); Model.questionid = questionid; Model.ordinalposition = ordinalpos is null? 1: ordinalpos + 1; Model.isselected = true; string results = APIservice.PostObject <ApplicationQuestion>(Model, "synapsenamespace=meta&synapseentityname=applicationquestion", token); if (results == "OK") { this.toastNotification.AddSuccessToastMessage("Question is mapped to the application."); } return(new EmptyResult()); }
private List <WardBayBedModel> GetWardBayBeds(string wardCode, string bayCode) { string token = HttpContext.Session.GetString("access_token"); List <WardBayBedModel> wardBayBeds = new List <WardBayBedModel>(); if (wardCode is null) { wardBayBeds = APIservice.GetList <WardBayBedModel>("synapsenamespace=meta&synapseentityname=wardbaybed", token); } else { wardBayBeds = APIservice.GetListById <WardBayBedModel>(wardCode, "synapsenamespace=meta&synapseentityname=wardbaybed&synapseattributename=wardcode&attributevalue=", token); } if (bayCode is null) { return(wardBayBeds.OrderBy(w => w.wardcode).ThenBy(w => w.baycode).ThenBy(w => w.bedcode).ToList()); } else { return(wardBayBeds.Where(w => w.baycode == bayCode).OrderBy(w => w.wardcode).ThenBy(w => w.baycode).ThenBy(w => w.bedcode).ToList()); } }
public static String UnMapModulefromApplication(string listId, string attributename) { string results = APIservice.DeleteObject(listId, "synapsenamespace=meta&synapseentityname=applicationmodulemapping&id="); listMappedmodules = APIservice.GetListById <Mappedmodule>(ApplicationId, "synapsenamespace=meta&synapseentityname=applicationmodulemapping&synapseattributename=application_id&attributevalue=").OrderBy(o => o.displayorder).ToList();; return(results); }
public ActionResult Edit(string id) { string token = HttpContext.Session.GetString("access_token"); List <SpecialtyModel> specialties = APIservice.GetListById <SpecialtyModel>(id, "synapsenamespace=core&synapseentityname=specialty&synapseattributename=specialty_id&attributevalue=", token); SpecialtyModel specialty = specialties.Select(s => s).FirstOrDefault(); return(View("AddEditSpecialty", specialty)); }
public IActionResult Edit(string id) { string token = HttpContext.Session.GetString("access_token"); AddEditWardBayViewModel addEditWardBay = new AddEditWardBayViewModel(); addEditWardBay.Wards = GetWards(); addEditWardBay.WardBay = APIservice.GetListById <WardBayModel>(id, "synapsenamespace=meta&synapseentityname=wardbay&synapseattributename=wardbay_id&attributevalue=", token).FirstOrDefault(); return(View("AddEditWardBay", addEditWardBay)); }
public IActionResult SaveDisplayName(string listId, string Modelid, string displayname, bool isdefaultmodule) { string token = HttpContext.Session.GetString("access_token"); List <MappedList> Mappedmodule = APIservice.GetListById <MappedList>(listId.Trim(), "synapsenamespace=meta&synapseentityname=applicationlist&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.displayorder).ToList(); MappedList Model = Mappedmodule.Single(s => s.applicationlist_id == Modelid); Model.listname = displayname; string results = APIservice.PostObject <MappedList>(Model, "synapsenamespace=meta&synapseentityname=applicationlist", token); return(new EmptyResult()); }
public ActionResult Edit(string id) { ProviderAddEditViewModel providerAddEditViewModel = new ProviderAddEditViewModel(); string token = HttpContext.Session.GetString("access_token"); List <ProviderModel> provider = APIservice.GetListById <ProviderModel>(id, "synapsenamespace=core&synapseentityname=provider&synapseattributename=provider_id&attributevalue=", token); providerAddEditViewModel.provider = provider.Select(w => w).First(); providerAddEditViewModel.providerroles = GetProviderRoles(); return(View("AddEditProvider", providerAddEditViewModel)); }
public ActionResult Edit(string id) { string token = HttpContext.Session.GetString("access_token"); List <LocationModel> locations = APIservice.GetListById <LocationModel>(id, "synapsenamespace=core&synapseentityname=location&synapseattributename=location_id&attributevalue=", token); LocationAddEditViewModel locationAddEditViewModel = new LocationAddEditViewModel(); locationAddEditViewModel.location = locations.Select(s => s).FirstOrDefault(); locationAddEditViewModel.locationTypes = GetLocationTypes(); return(View("AddEditLocation", locationAddEditViewModel)); }
public IActionResult SaveWardBayBed(WardBayBedAddEditViewModel wardBayBedAddEditViewModel) { string token = HttpContext.Session.GetString("access_token"); if (wardBayBedAddEditViewModel.WardBayBed.wardbaybed_id is null) { List <WardBayBedModel> wardBayBeds = APIservice.GetListById <WardBayBedModel>(wardBayBedAddEditViewModel.WardBayBed.wardcode, "synapsenamespace=meta&synapseentityname=wardbaybed&synapseattributename=wardcode&attributevalue=", token); if (wardBayBeds.Where(w => w.baycode == wardBayBedAddEditViewModel.WardBayBed.baycode && w.bedcode == wardBayBedAddEditViewModel.WardBayBed.bedcode).ToList().Count > 0) { this.toastNotification.AddErrorToastMessage("Bed Code already exists for the ward and bay."); wardBayBedAddEditViewModel.Wards = GetWards(); wardBayBedAddEditViewModel.WardBays = new List <WardBayModel>(); wardBayBedAddEditViewModel.WardBayBed = null; return(View("AddEditWardBayBed", wardBayBedAddEditViewModel)); } else { wardBayBedAddEditViewModel.WardBayBed.wardbaybed_id = System.Guid.NewGuid().ToString(); } List <WardModel> wards = APIservice.GetListById <WardModel>(wardBayBedAddEditViewModel.WardBayBed.wardcode, "synapsenamespace=meta&synapseentityname=ward&synapseattributename=wardcode&attributevalue=", token); wardBayBedAddEditViewModel.WardBayBed.warddisplay = wards.Select(w => w.warddisplay).FirstOrDefault(); List <WardBayModel> wardBays = APIservice.GetListById <WardBayModel>(wardBayBedAddEditViewModel.WardBayBed.baycode, "synapsenamespace=meta&synapseentityname=wardbay&synapseattributename=baycode&attributevalue=", token); wardBayBedAddEditViewModel.WardBayBed.baydisplay = wardBays.Select(w => w.baydisplay).FirstOrDefault(); } string result = APIservice.PostObject <WardBayBedModel>(wardBayBedAddEditViewModel.WardBayBed, "synapsenamespace=meta&synapseentityname=wardbaybed", token); if (result == "OK") { this.toastNotification.AddSuccessToastMessage("Ward Bay Bed details saved successfully."); } else { this.toastNotification.AddErrorToastMessage("Error while saving Ward Bay Bed details"); } wardBayBedAddEditViewModel.WardBays = GetWardBays(wardBayBedAddEditViewModel.WardBayBed.wardcode); return(View("AddEditWardBayBed", wardBayBedAddEditViewModel)); }
private List <WardBayModel> GetWardBays(string wardCode) { List <WardBayModel> wardBays = new List <WardBayModel>(); string token = HttpContext.Session.GetString("access_token"); if (wardCode != null) { wardBays = APIservice.GetListById <WardBayModel>(wardCode, "synapsenamespace=meta&synapseentityname=wardbay&synapseattributename=wardcode&attributevalue=", token).OrderBy(w => w.baydisplay).ToList(); } return(wardBays); }
public IActionResult Edit(string id) { string token = HttpContext.Session.GetString("access_token"); WardBayBedAddEditViewModel editWardBayBed = new WardBayBedAddEditViewModel(); editWardBayBed.Wards = GetWards(); editWardBayBed.WardBayBed = APIservice.GetListById <WardBayBedModel>(id, "synapsenamespace=meta&synapseentityname=wardbaybed&synapseattributename=wardbaybed_id&attributevalue=", token).FirstOrDefault(); editWardBayBed.WardBays = GetWardBays(editWardBayBed.WardBayBed.wardcode); return(View("AddEditWardBayBed", editWardBayBed)); }
public static string SaveDisplayName(string listId, string displayname, bool isdefaultmodule) { if (isdefaultmodule) { } List <MappedList> Mappedmodule = listMappedmodules; MappedList Model = Mappedmodule.Single(s => s.applicationlist_id == listId); Model.listname = displayname; string results = APIservice.PostObject <MappedList>(Model, "synapsenamespace=meta&synapseentityname=applicationlist"); listMappedmodules = APIservice.GetListById <MappedList>(ApplicationId, "synapsenamespace=meta&synapseentityname=applicationlist&synapseattributename=application_id&attributevalue=").OrderBy(o => o.displayorder).ToList();; return(results); }
public IActionResult SaveWardBay(AddEditWardBayViewModel addEditWardBayViewModel) { string token = HttpContext.Session.GetString("access_token"); if (addEditWardBayViewModel.WardBay.wardbay_id is null) { List <WardBayModel> wardBays = APIservice.GetListById <WardBayModel>(addEditWardBayViewModel.WardBay.wardcode, "synapsenamespace=meta&synapseentityname=wardbay&synapseattributename=wardcode&attributevalue=", token); if (wardBays.Where(w => w.baycode == addEditWardBayViewModel.WardBay.baycode.Trim()).ToList().Count > 0) { AddEditWardBayViewModel addEditWardBay = new AddEditWardBayViewModel(); addEditWardBay.Wards = GetWards(); addEditWardBay.WardBay = null; this.toastNotification.AddErrorToastMessage("Bay Code already exists for the ward."); addEditWardBay.WardBay = null; return(View("AddEditWardBay", addEditWardBay)); } else { addEditWardBayViewModel.WardBay.wardbay_id = System.Guid.NewGuid().ToString(); } } List <WardModel> wards = APIservice.GetListById <WardModel>(addEditWardBayViewModel.WardBay.wardcode, "synapsenamespace=meta&synapseentityname=ward&synapseattributename=wardcode&attributevalue=", token); addEditWardBayViewModel.WardBay.warddisplay = wards.Select(w => w.warddisplay).FirstOrDefault(); string result = APIservice.PostObject <WardBayModel>(addEditWardBayViewModel.WardBay, "synapsenamespace=meta&synapseentityname=wardbay", token); if (result == "OK") { this.toastNotification.AddSuccessToastMessage("Ward Bay details saved successfully."); } else { this.toastNotification.AddErrorToastMessage("Error while saving Ward Bay details"); } addEditWardBayViewModel.Wards = GetWards(); return(View("AddEditWardBay", addEditWardBayViewModel)); }
public EmptyResult UnMapQuestionfromApplication(string applicationId, string questionid) { string token = HttpContext.Session.GetString("access_token"); List <ApplicationQuestion> applicationQuestion = APIservice.GetListById <ApplicationQuestion>(applicationId.Trim(), "synapsenamespace=meta&synapseentityname=applicationquestion&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.ordinalposition).ToList(); string applicationquestion_id = applicationQuestion.Where(app => app.questionid == questionid).Select(app => app.applicationquestion_id).FirstOrDefault(); string results = APIservice.DeleteObject(applicationquestion_id.Trim(), "synapsenamespace=meta&synapseentityname=applicationquestion&id=", token); if (results == "OK") { this.toastNotification.AddSuccessToastMessage("Question is unmapped from the application."); } return(new EmptyResult()); }
protected void Page_Load(object sender, EventArgs e) { ApplicationId = Request.QueryString["id"].ToString(); if (!IsPostBack) { List <ApplicationModule> listapplication = APIservice.GetList <ApplicationModule>("synapsenamespace=meta&synapseentityname=application"); if (listapplication != null) { string applicationname = listapplication.FirstOrDefault(s => s.application_id == ApplicationId).applicationname; lblapplicationname.Text = applicationname; listModulesModel = APIservice.GetList <ModulesModel>("synapsenamespace=meta&synapseentityname=module"); listMappedmodules = APIservice.GetListById <Mappedmodule>(ApplicationId, "synapsenamespace=meta&synapseentityname=applicationmodulemapping&synapseattributename=application_id&attributevalue=").OrderBy(o => o.displayorder).ToList(); } } }
public JsonResult LoadWardBays(string wardCode) { List <WardBayModel> wardBays = new List <WardBayModel>(); WardBayBedAddEditViewModel addWardBayBed = new WardBayBedAddEditViewModel(); addWardBayBed.Wards = GetWards(); addWardBayBed.WardBays = new List <WardBayModel>(); string token = HttpContext.Session.GetString("access_token"); if (wardCode != null && wardCode != "") { wardBays = APIservice.GetListById <WardBayModel>(wardCode, "synapsenamespace=meta&synapseentityname=wardbay&synapseattributename=wardcode&attributevalue=", token); } return(Json(wardBays)); }
public ActionResult SaveLocation(LocationAddEditViewModel locationAddEditViewModel) { string token = HttpContext.Session.GetString("access_token"); string sql = string.Empty; locationAddEditViewModel.location.locationtypetext = GetLocationTypes().Where(lt => lt.locationtypecode == locationAddEditViewModel.location.locationtypecode).Select(lt => lt.locationtypetext).FirstOrDefault(); if (locationAddEditViewModel.location.location_id is null) { List <LocationModel> locations = APIservice.GetListById <LocationModel>(locationAddEditViewModel.location.locationcode, "synapsenamespace=core&synapseentityname=location&synapseattributename=locationcode&attributevalue=", token); if (locations.Count > 0) { this.toastNotification.AddErrorToastMessage("Location Code already exists."); locationAddEditViewModel.location = null; locationAddEditViewModel.locationTypes = GetLocationTypes(); return(View("AddEditLocation", locationAddEditViewModel)); } locationAddEditViewModel.location.location_id = System.Guid.NewGuid().ToString(); } locationAddEditViewModel.location.statustext = locationAddEditViewModel.location.statuscode; string result = APIservice.PostObject <LocationModel>(locationAddEditViewModel.location, "synapsenamespace=core&synapseentityname=location", token); if (result == "OK") { this.toastNotification.AddSuccessToastMessage("Location is successfully saved."); } else { this.toastNotification.AddErrorToastMessage("Error while saving Location."); } locationAddEditViewModel.locationTypes = GetLocationTypes(); return(View("AddEditLocation", locationAddEditViewModel)); }
public static string SaveDisplayName(string listId, string displayname, bool isdefaultmodule) { if (isdefaultmodule) { Mappedmodule getselectedModel = listMappedmodules.FirstOrDefault(s => s.isdefaultmodule == true); if (getselectedModel != null) { getselectedModel.isdefaultmodule = false; string updatedresult = APIservice.PostObject <Mappedmodule>(getselectedModel, "synapsenamespace=meta&synapseentityname=applicationmodulemapping"); } } List <Mappedmodule> Mappedmodule = listMappedmodules; Mappedmodule Model = Mappedmodule.Single(s => s.applicationmodulemapping_id == listId); Model.displayname = displayname; Model.isdefaultmodule = isdefaultmodule; string results = APIservice.PostObject <Mappedmodule>(Model, "synapsenamespace=meta&synapseentityname=applicationmodulemapping"); listMappedmodules = APIservice.GetListById <Mappedmodule>(ApplicationId, "synapsenamespace=meta&synapseentityname=applicationmodulemapping&synapseattributename=application_id&attributevalue=").OrderBy(o => o.displayorder).ToList();; return(results); }
public IActionResult GetWardBaysForWard(WardBayViewModel wardBay) { string token = HttpContext.Session.GetString("access_token"); List <WardModel> wardList = GetWards(); List <WardBayModel> wardBayList = new List <WardBayModel>(); if (wardBay.SelectedWardCode is null) { wardBayList = APIservice.GetList <WardBayModel>("synapsenamespace=meta&synapseentityname=wardbay", token); } else { wardBayList = APIservice.GetListById <WardBayModel>(wardBay.SelectedWardCode, "synapsenamespace=meta&synapseentityname=wardbay&synapseattributename=wardcode&attributevalue=", token); } WardBayViewModel wardBayViewModel = new WardBayViewModel(); wardBayViewModel.Wards = wardList; wardBayViewModel.WardBays = wardBayList.OrderBy(w => w.wardcode).ThenBy(w => w.warddisplay).ThenBy(w => w.baycode).ToList(); return(View("WardBayList", wardBayViewModel)); }
public ActionResult SaveSpecialty(SpecialtyModel specialtyModel) { string token = HttpContext.Session.GetString("access_token"); string sql = string.Empty; if (specialtyModel.specialty_id is null) { List <SpecialtyModel> specialties = APIservice.GetListById <SpecialtyModel>(specialtyModel.specialtycode, "synapsenamespace=core&synapseentityname=specialty&synapseattributename=specialtycode&attributevalue=", token); if (specialties.Count > 0) { this.toastNotification.AddErrorToastMessage("Specialty Code already exists."); specialtyModel = null; return(View("AddEditSpecialty", specialtyModel)); } specialtyModel.specialty_id = System.Guid.NewGuid().ToString(); } specialtyModel.statustext = specialtyModel.statuscode; string result = APIservice.PostObject <SpecialtyModel>(specialtyModel, "synapsenamespace=core&synapseentityname=specialty", token); if (result == "OK") { this.toastNotification.AddSuccessToastMessage("Specialty details is successfully saved."); } else { this.toastNotification.AddErrorToastMessage("Error while saving Specialty details."); } return(View("AddEditSpecialty", specialtyModel)); }
public static void MapModuletoApplication(string listId, string attributename, int ordinalposition) { Mappedmodule Model = new Mappedmodule(); Guid id = Guid.NewGuid(); ModulesModel moduleobj = listModulesModel.Single(s => s.module_id == attributename); Model.applicationmodulemapping_id = id.ToString(); Model.application_id = ApplicationId; Model.module_id = attributename; Model.displayname = moduleobj.modulename; Model.isdefaultmodule = false; if (listMappedmodules.Count == 0) { Model.displayorder = 1; } else { Model.displayorder = listMappedmodules.Max(x => x.displayorder.Value) + 1; } string results = APIservice.PostObject <Mappedmodule>(Model, "synapsenamespace=meta&synapseentityname=applicationmodulemapping"); listMappedmodules = APIservice.GetListById <Mappedmodule>(ApplicationId, "synapsenamespace=meta&synapseentityname=applicationmodulemapping&synapseattributename=application_id&attributevalue=").OrderBy(o => o.displayorder).ToList();; }
public ActionResult AddEditWard(WardModel wardModel) { string token = HttpContext.Session.GetString("access_token"); string context = string.Empty; string sql = string.Empty; if (wardModel.ward_id is null) { List <WardModel> ward = APIservice.GetListById <WardModel>(wardModel.wardcode, "synapsenamespace=meta&synapseentityname=ward&synapseattributename=wardcode&attributevalue=", token); if (ward.Count > 0) { this.toastNotification.AddErrorToastMessage("Ward Code already exists for the ward."); wardModel = null; return(View("Edit", wardModel)); } context = "ADD"; wardModel.ward_id = System.Guid.NewGuid().ToString(); } else { context = "UPDATE"; } string result = APIservice.PostObject <WardModel>(wardModel, "synapsenamespace=meta&synapseentityname=ward", token); if (result == "OK") { if (context == "ADD") { sql = "INSERT INTO entitystorematerialised.meta_personacontext(personacontext_id, displayname, contextname, persona_id, displayorder) "; sql += "SELECT ward_id, warddisplay, wardcode, '4', ROW_NUMBER() OVER(ORDER BY warddisplay) FROM entitystorematerialised.meta_ward "; sql += "WHERE wardcode = @wardcode;"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("wardcode", wardModel.wardcode) }; DataServices.executeSQLStatement(sql, paramList); } else { sql = "UPDATE entitystorematerialised.meta_personacontext SET displayname = @warddisplay WHERE contextname = @wardcode"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("warddisplay", wardModel.warddisplay), new KeyValuePair <string, string>("wardcode", wardModel.wardcode) }; DataServices.executeSQLStatement(sql, paramList); } this.toastNotification.AddSuccessToastMessage("Ward is successfully saved."); } else { this.toastNotification.AddErrorToastMessage("Error while saving ward details."); } return(View("Edit", wardModel)); }