Exemplo n.º 1
0
        /// <summary>
        /// Index table configuration
        /// </summary>
        public static DataTableConfig TestTable()
        {
            var table = new DataTableConfig <Person, Guid>("PersonsTest_Index");

            table.AddProperty(e => e.User.UserName, c => c.Caption("Username").SortAscending());
            table.AddProperty(e => e.FirstName);
            table.AddProperty(e => e.LastName);
            table.AddProperty(e => e.EmailAddress1);
            table.AddProperty(e => e.MobileNumber1);
            table.AddProperty(e => e.TypeOfAccount);
            table.AddProperty(e => e.AreaLevel1, c => c.Caption("Area1"));
            table.AddProperty(e => e.User.LastLoginDate, c => c.Caption("Last log in"));
            table.AddProperty(e => e.IsLocked);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On") /*.Visible(false)*/);
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").Visible(false));
            table.AddProperty(e => e.IsContractor);

            table.OnRequestToFilterStatic = (criteria, input) =>
            {
                criteria.FilterClauses.Add($"{nameof(Person.User)} != null");
            };

            return(table);
        }
Exemplo n.º 2
0
        public static DataTableConfig <ScheduledJobExecution, Guid> JobExecutionsTable()
        {
            var table = new DataTableConfig <ScheduledJobExecution, Guid>("ScheduledJob_Executions_test");

            table.UseDtos    = true;
            table.DetailsUrl = url => "/api/services/Scheduler/ScheduledJobExecution/Get";
            table.CreateUrl  = url => "/api/services/Scheduler/ScheduledJobExecution/Create";
            table.UpdateUrl  = url => "/api/services/Scheduler/ScheduledJobExecution/Update";
            table.DeleteUrl  = url => "/api/services/Scheduler/ScheduledJobExecution/Delete";

            table.AddProperty(e => e.StartedOn, m => m.SortDescending());

            //table.AddHtmlColumn("triggerLink",
            //    (e, html, url) => e.Trigger != null
            //        ? html.SPAActionLink($"{e.Trigger.Description} ({e.Trigger.CronString})", "Details", "ScheduledJobTrigger", new { id = e.Trigger.Id }).ToString()
            //        : "-", c => c.Caption("Trigger"));

            table.AddProperty(e => e.FinishedOn);
            table.AddProperty(e => e.Status);
            table.AddProperty(e => e.StartedBy);
            table.AddProperty(e => e.ErrorMessage);
            //table.AddHtmlColumn("LogFile",
            //    (e, html, url) => !string.IsNullOrWhiteSpace(e.LogFilePath)
            //        ? html.Shesha().AjaxDownload(url.Action("Download", "VirtualFile", new { path = e.LogFilePath }), Path.GetFileName(e.LogFilePath)).ToHtmlString()
            //        : null,
            //    t => t.Caption("Log File").WidthPixels(150));

            return(table);
        }
        /// <summary>
        /// Custom Index table configuration
        /// </summary>
        public static DataTableConfig BackupFilesIndex()
        {
            var table = new DataTableConfig <BackupFileDto, int>("BackupFiles_Index");

            table.AddProperty(e => e.FileName);
            return(table);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Index table configuration
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <CheckList, Guid>("CheckList_Index");

            table.AddProperty(e => e.Name);
            table.AddProperty(e => e.Description);

            return(table);
        }
        /// <summary>
        /// Mobile Devices index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <MobileDevice, Guid>("MobileDevices_Index");

            table.AddProperty(e => e.Name, c => c.SortAscending());
            table.AddProperty(e => e.IMEI);
            table.AddProperty(e => e.CreatorUser.UserName, c => c.Caption("Created By"));
            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On"));
            table.AddProperty(e => e.IsLocked);

            return(table);
        }
        /// <summary>
        /// Mobile Devices index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <ReferenceList, Guid>("ReferenceLists_Index");

            table.AddProperty(e => e.Name, c => c.SortAscending());
            table.AddProperty(e => e.Namespace);
            table.AddProperty(e => e.Description);
            table.AddProperty(e => e.HardLinkToApplication);
            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On"));

            return(table);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Index table configuration
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <ScheduledJob, Guid>("ScheduledJob_Index");

            table.AddProperty(e => e.JobNamespace, m => m.WidthPixels(105));
            table.AddProperty(e => e.JobName, m => m.WidthPixels(235));
            table.AddProperty(e => e.JobDescription, m => m.WidthPixels(350));
            table.AddProperty(e => e.StartupMode, m => m.WidthPixels(80));
            table.AddProperty(e => e.JobStatus, m => m.WidthPixels(70));

            return(table);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Notifications index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <Notification, Guid>("Notifications_Index");

            table.AddProperty(e => e.Name, c => c.SortAscending());
            table.AddProperty(e => e.Description);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").Visible(false));
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").Visible(false));

            return(table);
        }
Exemplo n.º 9
0
        public string GetDarpperUpdateSql(DataTableConfig config)
        {
            string update = "update [" + config.TableName + "] set ";

            foreach (var column in config.Column)
            {
                update += "[" + (column.Alias ?? column.Name) + "]=@" + column.Name + ",";
            }
            update  = update.Trim(',');
            update += " where  " + (config.Key.Alias ?? config.Key.Name) + "=@" + (config.Key.Alias ?? config.Key.Name);
            return(update);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Custom Index table configuration
        /// </summary>
        public static DataTableConfig IndexTableFull()
        {
            var table = new DataTableConfig <EntityHistoryItemDto, int>("EntityHistoryFull_Index");

            table.AddProperty(e => e.EventText, p => p.WidthPixels(185));
            table.AddProperty(e => e.ExtendedDescription);
            table.AddProperty(e => e.UserFullName, p => p.WidthPixels(130));
            table.AddProperty(e => e.CreationTime, p => p.WidthPixels(160));
            table.AddProperty(e => e.EntityTypeFullName, c => c.Visible(false).AllowShowHide(false));
            table.AddProperty(e => e.EntityId, c => c.Visible(false).AllowShowHide(false));

            return(table);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Index table configuration
        /// </summary>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <ShaRole, Guid>("ShaRoles_Index");

            table.AddProperty(e => e.Name, c => c.SortAscending());
            //table.AddProperty(e => e.NameSpace, c => c.HiddenByDefault());
            table.AddProperty(e => e.Description);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").Visible(false));
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").Visible(false));

            return(table);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Table configuration for entity picker
        /// </summary>
        public static DataTableConfig PersonPickerTable()
        {
            var table = new DataTableConfig <Person, Guid>("Persons_Picker");

            table.AddProperty(e => e.FullName, c => c.SortAscending());
            table.AddProperty(e => e.EmailAddress1);

            table.OnRequestToFilterStatic = (criteria, input) =>
            {
                criteria.FilterClauses.Add($"{nameof(Person.User)} != null");
            };

            return(table);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Areas index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <Area, Guid>("Areas_Index");

            table.AddProperty(e => e.Name, c => c.SortAscending());
            table.AddProperty(e => e.ShortName);
            table.AddProperty(e => e.ParentArea.Name, c => c.Caption("Parent Area"));
            table.AddProperty(e => e.AreaType);
            table.AddProperty(e => e.Comments);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").Visible(false));
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").Visible(false));

            return(table);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Index table configuration. Note: It's just a temporary solution
        /// </summary>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <Form, Guid>("Forms_Index");

            table.AddProperty(e => e.Name);
            table.AddProperty(e => e.Path);
            table.AddProperty(e => e.Description);
            table.AddProperty(e => e.ModelType);
            table.AddProperty(e => e.Settings);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").HiddenByDefault());
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").HiddenByDefault());

            return(table);
        }
        /// <summary>
        /// Notification Templates index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <NotificationTemplate, Guid>("NotificationTemplates_Index");

            table.AddProperty(e => e.Name, c => c.SortAscending());
            table.AddProperty(e => e.SendType);
            table.AddProperty(e => e.BodyFormat);
            table.AddProperty(e => e.Subject);
            table.AddProperty(e => e.Body);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").Visible(false));
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").Visible(false));

            return(table);
        }
Exemplo n.º 16
0
        public string GetDarpperInsertSql(DataTableConfig config)
        {
            string insert = "insert into [" + config.TableName + "] (";

            foreach (var column in config.Column)
            {
                insert += "[" + (column.Alias ?? column.Name) + "],";
            }
            insert = insert.Trim(',') + ")Values(";
            foreach (var column in config.Column)
            {
                insert += "@" + column.Name + ",";
            }
            insert = insert.Trim(',') + ");select @@IDENTITY;";
            return(insert);
        }
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <User, Int64>("Users_Index");

            table.AddProperty(e => e.UserName, c => c.SortAscending());
            table.AddProperty(e => e.Name);
            table.AddProperty(e => e.Surname);
            table.AddProperty(e => e.EmailAddress);
            table.AddProperty(e => e.PhoneNumber);
            table.AddProperty(e => e.CreatorUser);
            table.AddProperty(e => e.CreatorUserId);
            table.AddProperty(e => e.CreationTime);
            table.AddProperty(e => e.IsActive);

            return(table);
        }
        /// <summary>
        /// Index table configuration
        /// </summary>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <ShaUserLoginAttempt, Guid>("LogonAudit_Index");

            table.AddProperty(e => e.CreationTime, c => c.Caption("Date").SortDescending());
            table.AddProperty(e => e.Result);
            table.AddProperty(e => e.UserNameOrEmailAddress);
            table.AddProperty(e => e.BrowserInfo);
            table.AddProperty(e => e.ClientIpAddress);
            table.AddProperty(e => e.DeviceName);
            table.AddProperty(e => e.IMEI);
            table.AddProperty(e => e.ClientName);
            table.AddProperty(e => e.LoginAttemptNumber);

            return(table);
        }
        /// <summary>
        /// Notification Templates index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <NotificationMessage, Guid>("NotificationMessages_Index");

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").SortDescending());
            table.AddProperty(e => e.Notification.Name, c => c.Caption("Notification"));

            table.AddProperty(e => e.Recipient);
            table.AddProperty(e => e.SendType);
            table.AddProperty(e => e.RecipientText);

            table.AddProperty(e => e.Subject);
            table.AddProperty(e => e.Body);

            return(table);
        }
Exemplo n.º 20
0
        public DapperBaseSQL GetDapperBaseSQL(Type type)
        {
            DapperSqlHelper dapperSql     = new DapperSqlHelper();
            DataTableConfig config        = new DataTableConfig(type);
            DapperBaseSQL   dapperBaseSQL = new DapperBaseSQL
            {
                Get         = dapperSql.GetDarpperModelSql(config),
                GetList     = dapperSql.GetDarpperModelListSql(config) + " where 1=1",
                Insert      = dapperSql.GetDarpperInsertSql(config),
                Update      = dapperSql.GetDarpperUpdateSql(config),
                Delete      = dapperSql.GetDarpperDeleteSql(config),
                TableConifg = config
            };

            return(dapperBaseSQL);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Notification Templates index table
        /// </summary>
        /// <returns></returns>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <OtpAuditItem, Guid>("OtpAuditItems_Index");

            //table.AddProperty(e => e.Id, c => c.HiddenByDefault());
            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On").SortDescending());

            table.AddProperty(e => e.SendTo);
            table.AddProperty(e => e.SendType);
            table.AddProperty(e => e.RecipientType, c => c.HiddenByDefault());
            table.AddProperty(e => e.RecipientId, c => c.HiddenByDefault());
            table.AddProperty(e => e.ExpiresOn);
            table.AddProperty(e => e.Otp);
            table.AddProperty(e => e.ActionType);
            table.AddProperty(e => e.SentOn);
            table.AddProperty(e => e.SendStatus);
            table.AddProperty(e => e.ErrorMessage);

            return(table);
        }
Exemplo n.º 22
0
        public string GetDarpperModelListSql(DataTableConfig config)
        {
            string selectSqlFormat = " select {0} from [" + config.TableName + "]";
            string columnsSql      = "[" + config.Key.Name + "],";

            foreach (var column in config.Column)
            {
                if (!string.IsNullOrEmpty(column.Alias))
                {
                    columnsSql += "[" + column.Alias + "] as " + column.Name;
                }
                else
                {
                    columnsSql += "[" + column.Name + "]";
                }
                columnsSql += ",";
            }
            string selectSql = string.Format(selectSqlFormat, columnsSql.Trim(','));

            return(selectSql);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Index table configuration
        /// </summary>
        public static DataTableConfig IndexTable()
        {
            var table = new DataTableConfig <EntityConfig, Guid>("EntityConfigs_Index");

            table.AddProperty(e => e.Namespace);
            table.AddProperty(e => e.ClassName);
            table.AddProperty(e => e.FriendlyName);
            table.AddProperty(e => e.TypeShortAlias);
            table.AddProperty(e => e.TableName);
            table.AddProperty(e => e.DiscriminatorValue);
            table.AddProperty(e => e.Source);

            table.AddProperty(e => e.CreationTime, c => c.Caption("Created On") /*.Visible(false)*/);
            table.AddProperty(e => e.LastModificationTime, c => c.Caption("Updated On").Visible(false));

            //table.OnRequestToFilterStatic = (criteria, input) =>
            //{
            //    criteria.FilterClauses.Add($"{nameof(Person.User)} != null");
            //};

            return(table);
        }
        public virtual ActionResult ListConfig(bool showProject = false, TaskSorting sorting = TaskSorting.Title)
        {
            var config = new DataTableConfig();
            config.Searching = true;
            config.PageLength = 25;
            config.SetupServerDataSource(Url.Action(MVC.Tasks.ListData()), FormMethod.Post);
            config.Columns = new List<DataTableConfig.Column>(columns);
            config.Columns[(int)TaskListColumns.ProjectName].Visible = showProject;
            config.Columns[(int)TaskListColumns.Delete].Visible = this.Can(MVC.Tasks.Delete());

            switch (sorting)
            {
                case TaskSorting.Title:
                    {
                        config.AddOrder((int)TaskListColumns.Title, DataTables.Mvc.Column.OrderDirection.Ascendant);
                        break;
                    }
                case TaskSorting.Priority:
                    {
                        config.AddOrder((int)TaskListColumns.Priority, DataTables.Mvc.Column.OrderDirection.Descendant);
                        break;
                    }
            }

            var json = JsonConvert.SerializeObject(config);
            return Content(json, "application/json");
        }
Exemplo n.º 25
0
        public string GetDarpperDeleteSql(DataTableConfig config)
        {
            string delete = " delete " + config.TableName + " where +" + config.Key.Name + "=@" + (config.Key.Alias ?? config.Key.Name);

            return(delete);
        }
Exemplo n.º 26
0
 public TableController(IPlacementContext context)
 {
     this.config  = context.Config;
     this.options = context.Options;
 }
        public virtual ActionResult ListConfig(ReportSorting sorting = ReportSorting.Title)
        {
            var config = new DataTableConfig();
            config.Searching = true;
            config.SetupServerDataSource(Url.Action(MVC.Reporting.ListData()), FormMethod.Post);
            config.Columns = new List<DataTableConfig.Column>(columns);

            switch (sorting)
            {
                case ReportSorting.Title:
                    {
                        config.AddOrder((int)ReportListColumns.Title, DataTables.Mvc.Column.OrderDirection.Ascendant);
                        break;
                    }
                case ReportSorting.Project:
                    {
                        config.AddOrder((int)ReportListColumns.ProjectName, DataTables.Mvc.Column.OrderDirection.Descendant);
                        break;
                    }
                case ReportSorting.Step:
                    {
                        config.AddOrder((int)ReportListColumns.Step, DataTables.Mvc.Column.OrderDirection.Descendant);
                        break;
                    }

            }
            var json = JsonConvert.SerializeObject(config);

            return Content(json, "application/json");
        }
Exemplo n.º 28
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     DataTableConfig.CheckDataTable();
 }
Exemplo n.º 29
0
 public DataTableConfigBuilder()
 {
     _element = new DataTableConfig();
 }