Beispiel #1
0
    public static object GetVideos(DataTableAjaxPostModel model)
    {
        var cols = new List <string>()
        {
            "LOWER(TRIM(pe.video_name))", "LOWER(TRIM(pe.video_url))", "LOWER(TRIM(sm.speciality_name))"
        };
        // Initialization.
        DataTableData <PatientEducationModel> result = new DataTableData <PatientEducationModel>();

        try
        {
            // Initialization.
            string draw     = model.draw.ToString();
            int    startRec = model.start;
            int    pageSize = model.length;

            var c_order = "";
            foreach (var o in model.order)
            {
                var columnName = cols[o.column];
                c_order += string.IsNullOrWhiteSpace(c_order) ? columnName + " " + o.dir : ", " + columnName + " " + o.dir;
            }
            if (!string.IsNullOrWhiteSpace(c_order))
            {
                c_order = " order by " + c_order;
            }

            var c_search = "";
            foreach (var s in model.columns)
            {
                if (!string.IsNullOrWhiteSpace(s.search.value) && s.searchable)
                {
                    var i          = model.columns.IndexOf(s);
                    var columnName = cols[i];
                    c_search += i == 1 ? " and " + columnName + " like '%" + s.search.value.Trim().ToLower() + "%'" : " and " + columnName + " like '%" + s.search.value + "%'";
                }
            }
            var patientVideos = new PatientEduManager().GetAllPatientEducationsPaginated(startRec, pageSize, c_order, c_search);

            var patientVideoList = patientVideos.Data;
            foreach (var patientVideo in patientVideoList)
            {
                patientVideo.Link = "<a href='javascript:void(0);' style='margin-right:10px' class='edit-pe' data-id='" + patientVideo.Id + "'>Edit</a><a href='javascript:void(0);' style='margin-left:10px' class='delete-pe' data-id='" + patientVideo.Id + "'>Delete</a>";
            }

            int recFilter = patientVideos.Data.Count;

            result.draw            = Convert.ToInt32(draw);
            result.recordsTotal    = patientVideos.TotalCount;
            result.recordsFiltered = patientVideos.TotalCount;
            result.data            = patientVideoList;
        }
        catch (Exception ex)
        {
            // Info
            Console.Write(ex);
        }
        // Return info.
        return(result);
    }
Beispiel #2
0
    public static object DeleteVideoById(string id)
    {
        var resp = new PatientEduManager().DeletePatientEducation(id);

        return(resp);
    }
Beispiel #3
0
    public static object GetVideoById(string id)
    {
        var patientVideo = new PatientEduManager().GetPatientEducationById(id);

        return(patientVideo);
    }