示例#1
0
        private ListResponse <Rukuntangga.Entities.TbTanyaRtRow> FunctionGetTanyaRt(string filter, int totalCount)
        {
            Rukuntangga.Repositories.TbTanyaRtRepository repo = new Rukuntangga.Repositories.TbTanyaRtRepository();
            ListRequest request = new ListRequest();
            ListResponse <Rukuntangga.Entities.TbTanyaRtRow> response = new ListResponse <Rukuntangga.Entities.TbTanyaRtRow>();

            //var roles = UserAdditionalInfo.GetUserRoles(Authorization.Username);
            var ud = (UserDefinition)Serenity.Authorization.UserDefinition;

            using (var connection = SqlConnections.NewByKey("Rukuntangga"))
            {
                if (ud.UserRoles.Contains("RT"))
                {
                    request.Criteria = new Criteria("KtpKodeRt") == ud.Ktp.KodeRt;
                }
                else if (ud.UserRoles.Contains("WARGA"))
                {
                    request.Criteria = new Criteria("DibuatOleh") == ud.Ktp.Nik;
                }
                request.Sort = new[] { new SortBy("Id", descending: true) };
                request.Take = totalCount;
                response     = repo.List(connection, request);
            }
            return(response);
        }
示例#2
0
        public ListResponse <Rukuntangga.Entities.TbTanyaRtRow> FunctionGetDetailTanyaRt(int idTanyaRt)
        {
            Rukuntangga.Repositories.TbTanyaRtRepository repo = new Rukuntangga.Repositories.TbTanyaRtRepository();
            ListRequest request = new ListRequest();
            ListResponse <Rukuntangga.Entities.TbTanyaRtRow> response = new ListResponse <Rukuntangga.Entities.TbTanyaRtRow>();

            using (var connection = SqlConnections.NewByKey("Rukuntangga"))
            {
                request.Criteria = new Criteria("Id") == idTanyaRt;
                response         = repo.List(connection, request);
            }
            return(response);
        }