Example #1
0
        /// <summary>
        /// Adds all the user fields to the search.
        /// </summary>
        public static void SetExtraListUsers()
        {
            ExtraList.Clear();
            DataDesc tmpData = new DataDesc();

            tmpData.IdData        = SearchEnum.USERNAME;
            tmpData.Name          = Text.Username;
            tmpData.Kind          = Data.SIMPLE_TEXT;
            tmpData.CustomQuery   = "IdUser IN (SELECT IdUser FROM Users WHERE Username LIKE '%#SEARCH_VALUE#%')";
            tmpData.IdDataGroup   = SearchEnum.USERS;
            tmpData.DataGroupName = Text.Users;
            ExtraList.Add(tmpData);

            tmpData             = new DataDesc();
            tmpData.IdData      = SearchEnum.LAST_NAME;
            tmpData.Name        = Text.LastName;
            tmpData.Kind        = Data.SIMPLE_TEXT;
            tmpData.CustomQuery = "IdUser IN (SELECT IdUser FROM Users WHERE LastName LIKE '%#SEARCH_VALUE#%')";
            tmpData.IdDataGroup = SearchEnum.USERS;
            ExtraList.Add(tmpData);

            tmpData             = new DataDesc();
            tmpData.IdData      = SearchEnum.MOTHER_LAST_NAME;
            tmpData.Name        = Text.MotherLastName;
            tmpData.Kind        = Data.SIMPLE_TEXT;
            tmpData.IdDataGroup = SearchEnum.USERS;
            tmpData.CustomQuery = "IdUser IN (SELECT IdUser FROM Users WHERE MotherLastName LIKE '%#SEARCH_VALUE#%')";
            ExtraList.Add(tmpData);

            tmpData             = new DataDesc();
            tmpData.IdData      = SearchEnum.NAME;
            tmpData.Name        = Text.Name;
            tmpData.Kind        = Data.SIMPLE_TEXT;
            tmpData.CustomQuery = "IdUser IN (SELECT IdUser FROM Users WHERE Name LIKE '%#SEARCH_VALUE#%')";
            tmpData.IdDataGroup = SearchEnum.USERS;
            ExtraList.Add(tmpData);

            tmpData             = new DataDesc();
            tmpData.IdData      = SearchEnum.REGISTRY_DATE;
            tmpData.Name        = Text.RegistryDate;
            tmpData.Kind        = Data.DATE;
            tmpData.CustomQuery = "IdUser IN (SELECT IdUser FROM Users WHERE CONVERT(DATETIME, RegistryDate, 103) BETWEEN CONVERT(DATETIME, '#SEARCH_VALUE#', 103) AND CONVERT(DATETIME, '#SEARCH_VALUE2#', 103))";
            tmpData.IdDataGroup = SearchEnum.USERS;
            ExtraList.Add(tmpData);

            tmpData           = new DataDesc();
            tmpData.IdData    = SearchEnum.STATUS;
            tmpData.Name      = Text.Status;
            tmpData.Kind      = Data.OPTIONS;
            tmpData.AuxValues = Text.Inactive + "|" + Text.Active + "|" + Text.Blocked;
            Dictionary <string, string> userStatusFriendly = new Dictionary <string, string>();

            userStatusFriendly.Add(Text.Inactive, Status.INACTIVE.ToString());
            userStatusFriendly.Add(Text.Active, Status.ACTIVE.ToString());
            userStatusFriendly.Add(Text.Blocked, Status.BLOCKED.ToString());
            tmpData.FriendlyOptions = userStatusFriendly;
            tmpData.CustomQuery     = "IdUser IN (SELECT IdUser FROM Users WHERE Status = '#SEARCH_VALUE#')";
            tmpData.IdDataGroup     = SearchEnum.USERS;
            ExtraList.Add(tmpData);
        }
Example #2
0
        /// <summary>
        /// Adds all the exam fields to the search.
        /// </summary>
        public static void SetExtraExam(bool persist)
        {
            if (!persist)
            {
                ExtraList.Clear();
            }
            DataDesc tmpData = new DataDesc();

            tmpData.IdData        = SearchEnum.EXAM_NAME;
            tmpData.Name          = Text.Exam;
            tmpData.Kind          = Data.OPTIONS;
            tmpData.AuxValues     = Common.GetBDList("Exam", "SELECT Exam FROM Exam WHERE Status = " + ExamStatus.ACTIVE, false).ToString().Replace(",", "|");
            tmpData.CustomQuery   = "IdExam IN (SELECT IdExam FROM Exam WHERE Exam = '#SEARCH_VALUE#')";
            tmpData.IdDataGroup   = SearchEnum.EXAMS;
            tmpData.DataGroupName = Text.Exams;
            ExtraList.Add(tmpData);

            tmpData        = new DataDesc();
            tmpData.IdData = SearchEnum.EXAM_SCORE;
            tmpData.Name   = Text.Score;
            NumberJSON numberJSON = new NumberJSON();

            numberJSON.from      = 0;
            numberJSON.to        = 100;
            numberJSON.maxLength = "4";
            tmpData.AuxValues    = JsonConvert.SerializeObject(numberJSON);
            tmpData.Kind         = Data.FLOAT;
            tmpData.CustomQuery  = "CAST(Score AS Float) >= '#SEARCH_VALUE#' AND CAST(Score AS Float) <= '#SEARCH_VALUE2#'";
            tmpData.IdDataGroup  = SearchEnum.EXAMS;
            ExtraList.Add(tmpData);

            tmpData           = new DataDesc();
            tmpData.IdData    = SearchEnum.EXAM_STATUS;
            tmpData.Name      = Text.Status;
            tmpData.Kind      = Data.OPTIONS;
            tmpData.AuxValues = Text.Exam_Failed + "|" + Text.Exam_Incomplete + "|" + Text.Exam_Passed + "|" + Text.Exam_Pending;
            Dictionary <string, string> userStatusFriendly = new Dictionary <string, string>();

            userStatusFriendly.Add(Text.Exam_Failed, UserExamStatus.FAILED.ToString());
            userStatusFriendly.Add(Text.Exam_Incomplete, UserExamStatus.INCOMPLETE.ToString());
            userStatusFriendly.Add(Text.Exam_Passed, UserExamStatus.PASSED.ToString());
            userStatusFriendly.Add(Text.Exam_Pending, UserExamStatus.PENDING.ToString());
            tmpData.FriendlyOptions = userStatusFriendly;
            tmpData.CustomQuery     = "Status IN (#SEARCH_VALUE#)";
            tmpData.IdDataGroup     = SearchEnum.EXAMS;
            tmpData.DataGroupName   = Text.Exams;
            ExtraList.Add(tmpData);

            tmpData             = new DataDesc();
            tmpData.IdData      = SearchEnum.EXAM_DATE_COMPLETED;
            tmpData.Name        = Text.DateCompleted;
            tmpData.Kind        = Data.DATE;
            tmpData.CustomQuery = "CONVERT(DATETIME, DateComplete, 103) BETWEEN CONVERT(DATETIME, '#SEARCH_VALUE#', 103) AND CONVERT(DATETIME, '#SEARCH_VALUE2#', 103)";
            tmpData.IdDataGroup = SearchEnum.EXAMS;
            ExtraList.Add(tmpData);
        }
Example #3
0
        /// <summary>
        /// Retrieves the entire existing and active Data Fields in a DataDesc List.
        /// </summary>
        /// <returns>A DataDesc List.</returns>
        public static List <DataDesc> GetDataDesc()
        {
            string sql    = "SELECT DataDesc.* FROM DataDesc INNER JOIN DataGroup ON DataDesc.IdDataGroup = DataGroup.IdDataGroup";
            string filter = "Inactive = 0";

            sql  = Common.StrAdd(sql, " WHERE ", filter);
            sql += " ORDER BY GroupSequence, FieldSequence";
            List <DataDesc> dataDescList = new List <DataDesc>();
            List <Dictionary <string, string> > dataDescDB = Common.GetRS(sql);

            foreach (Dictionary <string, string> record in dataDescDB)
            {
                DataDesc dataDesc = new DataDesc(Convert.ToInt32(record["IdData"]));
                dataDescList.Add(dataDesc);
            }
            return(dataDescList);
        }
Example #4
0
        /// <summary>
        /// Retrieves and returns the current Data Fields list.
        /// </summary>
        /// <returns>An HTML including the data fields list.</returns>
        public static string GetDataFieldsList()
        {
            string retval        = "";
            string className     = "";
            int    total         = 0;
            string dataGroupList = "";

            retval = "<table width='60%' align='center'><tr><td><ul id='dataGroups' style='list-style-type: none; margin: 0; padding: 0; width: 100%'>";

            string[] idDataGroupList = Common.CSVToArray(Common.GetBDList("IdDataGroup", "SELECT IdDataGroup, Name FROM DataGroup ORDER BY GroupSequence", false));
            foreach (string idDataGroup in idDataGroupList)
            {
                if (!String.IsNullOrEmpty(idDataGroup))
                {
                    DataGroup dataGroup = new DataGroup(Convert.ToInt32(idDataGroup));
                    dataGroupList = Common.StrAdd(dataGroupList, ",", "#idDG_" + dataGroup.IdDataGroup);
                    retval       += "<li id='idGroup_" + dataGroup.IdDataGroup + "'><span class='moveIcon'><img src='images/move.png' /></span><div class='cellTitle' align='center' style='height: 32px;'>" + dataGroup.Name + "</div>";
                    retval       += "<ul id='idDG_" + dataGroup.IdDataGroup + "' class='dragEnabledConn' style='list-style-type: none; margin: 0; padding: 8; width: 100%'>";

                    string[] idDataList = Common.CSVToArray(Common.GetBDList("IdData", "SELECT IdData, Name FROM DataDesc WHERE IdDataGroup = " + idDataGroup + " ORDER BY FieldSequence", false));
                    foreach (string idData in idDataList)
                    {
                        try
                        {
                            DataDesc dataDesc = new DataDesc(Convert.ToInt32(idData));
                            className = Common.SwitchClass(className);
                            retval   += "<li id='idDI_" + dataDesc.IdData + "' class='" + className + "' style='height: 32px'><span class='moveIcon'><img src='images/move.png' /></span><span onClick='editField(" + idData + ");' style='margin-left: 30px;'>" + dataDesc.Name + " (" + Data.FriendlyName(dataDesc.Kind) + ")" + (dataDesc.Inactive == 1 ? " <i>" + Text.Inactive + "</i>" : "") + "</span></li>";
                            total++;
                        }
                        catch (Exception ex) { }
                    }
                    retval += "</ul>";
                    retval += "<div align='right'>";
                    if (Modules.PermissionOr(SessionHandler.Modules, Modules.EDIT_FIELDS + "," + Modules.DATAFIELDS_ADMINISTRATION))
                    {
                        retval += DrawInput.InputButton("editGrp_" + dataGroup.IdDataGroup, Text.Edit, "", "editGroup(" + dataGroup.IdDataGroup + ", '" + dataGroup.Name + "'); return false;", "background-image: url(./images/edit.png); background-repeat: no-repeat; height: 30px; padding-left: 30px;", "");
                    }
                    if (Modules.PermissionOr(SessionHandler.Modules, Modules.DELETE_FIELDS + "," + Modules.DATAFIELDS_ADMINISTRATION))
                    {
                        retval += DrawInput.InputButton("deleteGrp_" + dataGroup.IdDataGroup, Text.Delete, "", "deleteGroup(" + dataGroup.IdDataGroup + "); return false;", "background-image: url(./images/delete.png); background-repeat: no-repeat; height: 30px; padding-left: 30px;", "");
                    }
                    retval += "</div></li>";
                }
            }
            retval += "</ul>";

            if (!String.IsNullOrEmpty(dataGroupList))
            {
                retval += "<script type='text/javascript'>";
                retval += "$('" + dataGroupList + "').sortable({ connectWith: '.dragEnabledConn', placeholder: 'sort-placeholder', handle: '.moveIcon', stop: function(event, ui) { invalidateList($(this).attr('id'), $(this).sortable('toArray')); }, receive: function(event, ui) { invalidateList($(this).attr('id'), $(this).sortable('toArray')); } }).disableSelection();";
                retval += "$('#dataGroups').sortable({ handle: '.moveIcon', stop: function(event, ui) { invalidateList($(this).attr('id'), $(this).sortable('toArray')); } }).disableSelection();";
                retval += "</script>";
            }

            //Footer
            retval += "<div align='center' class='pagination'>";
            retval += "<div align='left' style='width: 100%; display: inline-block;'>" + Common.StrLang(Text.ShowingXofY, total.ToString() + "," + total.ToString()) + " " + Text.Field_s + "</div>";
            retval += "</div></td></tr></table>";

            return(retval);
        }