public ActionResult SaveProvider(ProviderAddEditViewModel providerAddEditViewModel)
        {
            string token = HttpContext.Session.GetString("access_token");

            string sql = string.Empty;

            if (providerAddEditViewModel.provider.provider_id is null)
            {
                providerAddEditViewModel.provider.provider_id = System.Guid.NewGuid().ToString();
            }

            string result = APIservice.PostObject <ProviderModel>(providerAddEditViewModel.provider, "synapsenamespace=core&synapseentityname=provider", token);

            if (result == "OK")
            {
                this.toastNotification.AddSuccessToastMessage("Provider details is successfully saved.");
            }
            else
            {
                this.toastNotification.AddErrorToastMessage("Error while saving Provider details.");
            }

            providerAddEditViewModel.providerroles = GetProviderRoles();

            return(View("AddEditProvider", providerAddEditViewModel));
        }
Exemple #2
0
        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());
        }
Exemple #3
0
        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());
        }
        public ActionResult saveNewModule(ModulesModel ModulesModel)
        {
            string token = HttpContext.Session.GetString("access_token");
            List <ModulesModel> result = APIservice.GetList <ModulesModel>("synapsenamespace=meta&synapseentityname=module", token);
            int count = result.Where(x => x.modulename == ModulesModel.modulename.Trim()).Count();

            if (count == 0)
            {
                ModulesModel Model = new ModulesModel();
                Guid         id    = Guid.NewGuid();
                Model.module_id         = id.ToString();
                Model.modulename        = ModulesModel.modulename.Trim();
                Model.jsurl             = ModulesModel.jsurl ?? "";
                Model.moduledescription = ModulesModel.moduledescription;
                Model.domselector       = ModulesModel.domselector ?? "";
                Model.displayorder      = result.Max(x => x.displayorder);
                Model.displayorder++;
                APIservice.PostObject <ModulesModel>(Model, "synapsenamespace=meta&synapseentityname=module", token);
                return(RedirectToAction(nameof(ApplicationManager)));
            }
            else
            {
                @ViewBag.errormessage = "(Module name already Exists ";
                return(View("AddNewModule"));
            }
        }
        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());
        }
Exemple #6
0
        /// <summary>
        /// New Application API call
        /// </summary>
        /// <returns></returns>
        public string NewApplication()
        {
            ApplicationModule Model = new ApplicationModule();
            Guid id = Guid.NewGuid();

            Model.application_id  = id.ToString();
            Model.applicationname = txtApplication.Text.Trim();
            Model.displayorder    = Convert.ToInt32(Request.QueryString["displayorder"]);
            string result = APIservice.PostObject <ApplicationModule>(Model, "synapsenamespace=meta&synapseentityname=application");

            return(result);
        }
Exemple #7
0
        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());
        }
Exemple #8
0
        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));
        }
Exemple #9
0
        public string ADDNewModule()
        {
            ModulesModel Model = new ModulesModel();
            Guid         id    = Guid.NewGuid();

            Model.module_id         = id.ToString();
            Model.modulename        = txtmodulename.Text.Trim();
            Model.jsurl             = txtjsurl.Text.Trim();
            Model.moduledescription = txtmoduledescription.Text;
            Model.domselector       = txtdomselector.Text.Trim();
            Model.displayorder      = Convert.ToInt32(Request.QueryString["displayorder"]);
            string result = APIservice.PostObject <ModulesModel>(Model, "synapsenamespace=meta&synapseentityname=module");

            return(result);
        }
        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));
        }
Exemple #12
0
        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));
        }
Exemple #13
0
        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 ActionResult saveNewApplication(ApplicationModule Actionmodel)
        {
            string token = HttpContext.Session.GetString("access_token");
            List <ApplicationModule> resultj = APIservice.GetList <ApplicationModule>("synapsenamespace=meta&synapseentityname=application", token);
            int count = resultj.Where(x => x.applicationname == Actionmodel.applicationname.Trim()).Count();

            if (count == 0)
            {
                ApplicationModule Model = new ApplicationModule();
                Guid id = Guid.NewGuid();
                Model.application_id  = id.ToString();
                Model.applicationname = Actionmodel.applicationname.Trim();
                Model.displayorder    = resultj.Max(x => x.displayorder);
                Model.displayorder++;
                string result = APIservice.PostObject <ApplicationModule>(Model, "synapsenamespace=meta&synapseentityname=application", token);
                return(RedirectToAction(nameof(ApplicationManager)));
            }
            else
            {
                @ViewBag.errormessage = "Application name already Exists ";
                return(View("AddNewApplication"));
            }
        }
Exemple #15
0
        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));
        }
Exemple #16
0
        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));
        }