Example #1
0
    public void GetForGridHelp()
    {
        List <OA.Model.RoleInfo> depts = roleManageBLL.GetRoleList();
        string json = depts.SerializeToJson();

        Context.Response.WriteJson(json);
    }
Example #2
0
        public bool AssignedLog(Entity data, OwnerObject from, OwnerObject to, Schema.Domain.Entity entityMetadata)
        {
            if (!entityMetadata.LogEnabled)
            {
                return(false);
            }
            EntityLog entity = new EntityLog
            {
                EntityId       = entityMetadata.EntityId,
                EntityLogId    = Guid.NewGuid(),
                OperationType  = OperationTypeEnum.Assign,
                UserId         = _currentUser.SystemUserId,
                OrganizationId = _currentUser.OrganizationId,
                CreatedOn      = DateTime.Now,
                RecordId       = data.GetIdValue()
            };
            var datas = new List <EntityLogChangeData>
            {
                new EntityLogChangeData()
                {
                    Name = "ownerid", Original = from.SerializeToJson(), Value = to.SerializeToJson()
                }
            };

            entity.ChangeData = datas.SerializeToJson();
            return(Create(entity));
        }
Example #3
0
        public IActionResult ConnectionTest([FromBody] DbConfigurationModel model)
        {
            string connectionString = DataBaseHelper.GetDbConfiguration(model.DataServerName, model.DataAccountName, model.DataPassword, model.DatabaseName, model.CommandTimeOut);
            bool   isConnectionTest = DataBaseHelper.ConnectionTest(connectionString);

            if (isConnectionTest)
            {
                var             builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", true, reloadOnChange: true);
                var             config  = builder.Build();
                DataBaseOptions options = new DataBaseOptions()
                {
                    ConnectionString = connectionString
                };
                IOrganizationBaseRepository organizationBaseRepository = new OrganizationBaseRepository(options);
                IOrganizationBaseService    _organizationBaseService   = new Organization.OrganizationBaseService(organizationBaseRepository);
                List <OrganizationBase>     orglist = _organizationBaseService.Query(n => n.Where(x => x.State == 1));
                return(new JsonResult(new JsonResultObject()
                {
                    IsSuccess = true, Content = orglist.SerializeToJson()
                }));
            }
            else
            {
                return(new JsonResult(new JsonResultObject()
                {
                    IsSuccess = false
                }));
            }
        }
        public ActionResult GetServices()
        {
            var allAnunciosList = new List<AN_Anuncios>();
            List<AnunciosViewModel> viewModelAnuncios = new List<AnunciosViewModel>();
            using (Entities model = new Entities())
            {
                allAnunciosList = model.AN_Anuncios.AsParallel().OrderByDescending(c => c.AN_Fecha).Where(sts => sts.ST_Id == 1).ToList();

                foreach (var item in allAnunciosList)
                {
                    string username = item.UserProfile.Name;
                    string statusDesc = item.ST_Estatus.ST_Descripcion;
                    var categoria = item.SBS_SubCategoriaServicio.CD_CategoriaServicio.CD_Descripcion;
                    var firstImage = string.Empty;
                    if (item.AE_AnunciosExtras.FirstOrDefault() != null)
                    {
                        firstImage = item.AE_AnunciosExtras.FirstOrDefault().AN_ImagenUrl;
                    }
                    else
                    {
                        firstImage = item.UserProfile.Image == null ? "~/Images/No_Profile.jpg" : item.UserProfile.Image;
                    }

                    //item.AN_Fecha = Convert.ToDateTime(item.AN_Fecha.ToShortDateString());

                    var getRating = model.SEL_ValoracionAnuncios(item.AN_Id).FirstOrDefault();

                    string urlimg = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/");
                    var formatted = firstImage.Replace("~", "");
                    if (formatted.StartsWith("/"))
                        formatted = formatted.Remove(0, 1);
                    firstImage = urlimg + formatted;

                    var number = 0;
                    item.SS_SolicitudServicio.AsParallel().ToList().ForEach((counter) =>
                    {
                        number += counter.RW_Reviews.Count;
                    });
                    viewModelAnuncios.Add(new AnunciosViewModel
                    {
                        Usuario = username,
                        EstatusDescription = statusDesc,
                        AnunciosInfo = item,
                        CategoriaDescripcion = categoria,
                        FirstImage = firstImage,
                        Rating = getRating,
                        Comments = number,
                    });

                }
            }
            if (viewModelAnuncios == null || viewModelAnuncios.Count == 0)
            {
                return HttpNotFound();
            }

            var anuncios = viewModelAnuncios.SerializeToJson();
            return Json(anuncios);
        }
Example #5
0
        public override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);

            if (_committees != null)
            {
                var serializedCommittees = _committees.SerializeToJson();
                outState.PutString(BundleType.Committees, serializedCommittees);
            }
        }
        public override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);

            if (_votes != null)
            {
                var serializedVotes = _votes.SerializeToJson();
                outState.PutString(BundleType.Votes, serializedVotes);
            }

            outState.PutBoolean(BundleType.VotesIsThereMoreContent, _isThereMoreVotes);
        }
Example #7
0
        public override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);

            if (_billsToDisplay != null)
            {
                var serializedBills = _billsToDisplay.SerializeToJson();
                outState.PutString(BundleType.Bills, serializedBills);
            }

            outState.PutInt(BundleType.BillViewerFragmentType, (int)_viewerMode);
            outState.PutBoolean(BundleType.BillsIsThereMoreContent, _isThereMoreVotes);
        }
        private static void SaveMetadata(Bitmap bmpEntree, List <MetadataKeyValue> datas, string outputFile)
        {
            // FileMode.CreateNew = le fichier ne DOIT pas exister sinon erreur.
            using (var fs = new FileStream(outputFile, FileMode.CreateNew, FileAccess.Write, FileShare.Read))
            {
                var meta   = new BitmapMetadata(@"png");
                var result = datas.SerializeToJson();
                meta.SetQuery(ConstantsMetadata.PNG_NATIVE_IMAGE_FORMAT_METADATA_TEXT, result);

                var encoder = new PngBitmapEncoder();
                var source  = bmpEntree.ToBitmapSource();
                encoder.Frames.Add(BitmapFrame.Create(source, source, meta, null));
                encoder.Save(fs);
            }
        }
Example #9
0
        public static string AddToJsonStringList <T>(this string caller, T itemToAdd)
        {
            string vtr = caller;

            try
            {
                List <T> list = caller.DeserializeFromJson <List <T> >() ?? new List <T>();
                list.Add(itemToAdd);
                vtr = list.SerializeToJson();
            }
            catch (System.Exception)
            {
            }
            return(vtr);
        }
Example #10
0
        public async Task <Result> InsertNewMatchesForSeason(IExceptionNotifier exceptionNotifier, IRootAggregateRepository <FootballTeam> rootAggregateRepositoryFootBallTeam, string seasonIdForFootballMatches, List <FootBallMatch> footBallMatches)
        {
            Result vtr = new Result(true);

            try
            {
                bool footballMatchesAreValid = footBallMatches?.Any() ?? false;
                bool seasonIdIsValid         = !String.IsNullOrWhiteSpace(seasonIdForFootballMatches);
                if (!footballMatchesAreValid || !seasonIdIsValid)
                {
                    List <string> invalidArguments = new List <string>();
                    if (!footballMatchesAreValid)
                    {
                        invalidArguments.Add(nameof(footBallMatches));
                    }

                    if (!seasonIdIsValid)
                    {
                        invalidArguments.Add(nameof(seasonIdForFootballMatches));
                    }

                    vtr.SetErrorInvalidArguments(invalidArguments.ToArray());
                }
                else
                {
                    if (SeasonIdForFootballMatches?.Equals(seasonIdForFootballMatches, StringComparison.OrdinalIgnoreCase) ?? false)
                    {
                        vtr.SetError($"Matches with season id {seasonIdForFootballMatches} have already been added");
                    }
                    else
                    {
                        SeasonIdForFootballMatches    = seasonIdForFootballMatches;
                        JSListOfFootBallMatch_Matches = footBallMatches.SerializeToJson();
                        LastUpdateOfSeasonMatches     = DateTime.UtcNow;
                        vtr = await rootAggregateRepositoryFootBallTeam.Update(this);
                    }
                }
            }
            catch (Exception ex)
            {
                await exceptionNotifier.Notify(ex, vtr);
            }
            return(vtr);
        }
Example #11
0
        public bool UpdatedLog(Entity originData, Entity newData, Schema.Domain.Entity entityMetadata, List <Schema.Domain.Attribute> attributeMetadatas)
        {
            if (!entityMetadata.LogEnabled)
            {
                return(false);
            }
            EntityLog entity = new EntityLog
            {
                EntityId       = entityMetadata.EntityId,
                EntityLogId    = Guid.NewGuid(),
                OperationType  = OperationTypeEnum.Update,
                UserId         = _currentUser.SystemUserId,
                OrganizationId = _currentUser.OrganizationId,
                CreatedOn      = DateTime.Now,
                RecordId       = newData.GetIdValue(),
                AttributeMask  = string.Join(",", newData.Keys)
            };
            var datas = new List <EntityLogChangeData>();

            foreach (var item in newData)
            {
                var originValue = originData.TryGetValue(item.Key, out object value) ? value.ToString() : "";
                if (!originValue.IsCaseInsensitiveEqual(item.Value != null ? item.Value.ToString() : ""))
                {
                    var attr = attributeMetadatas.Find(n => n.Name.IsCaseInsensitiveEqual(item.Key));
                    if (!item.Key.IsCaseInsensitiveEqual("createdon") && !item.Key.IsCaseInsensitiveEqual("createdby") &&
                        !item.Key.IsCaseInsensitiveEqual("modifiedon") && !item.Key.IsCaseInsensitiveEqual("modifiedby") &&
                        !item.Key.IsCaseInsensitiveEqual("versionnumber"))
                    {
                        if (attr != null && (attr.TypeIsText() || attr.TypeIsNText()))
                        {
                            continue;
                        }

                        datas.Add(new EntityLogChangeData()
                        {
                            Name = item.Key, Original = originData[item.Key].ToString(), Value = item.Value != null ? item.Value.ToString() : ""
                        });
                    }
                }
            }
            entity.ChangeData = datas.SerializeToJson();
            return(Create(entity));
        }
Example #12
0
        public string Build(Func <QueryDescriptor <Privilege>, QueryDescriptor <Privilege> > container, bool nameLower = true)
        {
            List <Privilege> list = _privilegeService.Query(container);

            List <dynamic> dlist   = Build(list, Guid.Empty);
            dynamic        contact = new ExpandoObject();

            contact.label    = "root";
            contact.id       = Guid.Empty;
            contact.children = dlist;

            List <dynamic> results = new List <dynamic>();

            results.Add(contact);

            var json = results.SerializeToJson(nameLower);

            return(json);
        }
Example #13
0
        public async Task <Result> AddFullTimeLiveMatchStats(IExceptionNotifier exceptionNotifier, IRootAggregateRepository <FootballTeam> rootAggregateRepositoryFootballTeam, LiveMatchStats fullTimeLiveMatchStats)
        {
            Result vtr = new Result();

            try
            {
                if (fullTimeLiveMatchStats == null || String.IsNullOrWhiteSpace(fullTimeLiveMatchStats.MatchId))
                {
                    vtr.SetErrorInvalidArguments(nameof(fullTimeLiveMatchStats));
                }
                else
                {
                    if (fullTimeLiveMatchStats.MatchStatus != MatchStatus.FullTime)
                    {
                        vtr.SetError("Match is not over yet");
                    }
                    else
                    {
                        List <FootBallMatch> matches    = JSListOfFootBallMatch_Matches.DeserializeFromJson <List <FootBallMatch> >();
                        FootBallMatch        matchToSet = matches.FirstOrDefault(m => m.MatchId == fullTimeLiveMatchStats.MatchId);
                        if (matchToSet == null)
                        {
                            vtr.SetError($"Match with match id {fullTimeLiveMatchStats.MatchId} was not found");
                        }
                        else
                        {
                            matchToSet.FullTimeMatchStats = fullTimeLiveMatchStats;
                            JSListOfFootBallMatch_Matches = matches.SerializeToJson();
                            vtr = await rootAggregateRepositoryFootballTeam.Update(this);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                await exceptionNotifier.Notify(ex, vtr);
            }
            return(vtr);
        }
        public ActionResult GetInfoPage()
        {
            try
            {
                var detalle = new List<PRC_PantallaInicial>();
                detalle = db.PRC_PantallaInicial.Where(c => c.STS_Id == 1).ToList();
                if (detalle == null)
                {
                    return HttpNotFound();
                }
                else
                {
                    string detallelist = detalle.SerializeToJson();
                    return Json(detallelist);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public ActionResult GetProductsBanners()
        {
            try
            {
                var productos = new List<PRO_Productos>();
                productos = db.PRO_Productos.Where(c => c.PRO_IsBanner == true).ToList();
                if (productos == null)
                {
                    return HttpNotFound();
                }
                else
                {
                    string productlist = productos.SerializeToJson();
                    return Json(productlist);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #16
0
        public void ProcessRequest(HttpContext context)
        {
            var ticketsOut = new List <Ticket>();

            var ticketOut1 = new Ticket();

            ticketOut1.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Amundsen Spirit"
            });
            ticketOut1.Dimensions.Add(new Dimension {
                Name = "status", Value = "new"
            });
            ticketOut1.Metrics.Add(new Metric {
                Name = "ticket", Value = 10
            });
            ticketsOut.Add(ticketOut1);

            var ticketOut2 = new Ticket();

            ticketOut2.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Amundsen Spirit"
            });
            ticketOut2.Dimensions.Add(new Dimension {
                Name = "status", Value = "closed"
            });
            ticketOut2.Metrics.Add(new Metric {
                Name = "ticket", Value = 1
            });
            ticketsOut.Add(ticketOut2);


            var ticketOut3 = new Ticket();

            ticketOut3.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Lamdada Spirit"
            });
            ticketOut3.Dimensions.Add(new Dimension {
                Name = "status", Value = "new"
            });
            ticketOut3.Metrics.Add(new Metric {
                Name = "ticket", Value = 2
            });
            ticketsOut.Add(ticketOut3);

            var ticketOut4 = new Ticket();

            ticketOut4.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Lamdada Spirit"
            });
            ticketOut4.Dimensions.Add(new Dimension {
                Name = "status", Value = "closed"
            });
            ticketOut4.Metrics.Add(new Metric {
                Name = "ticket", Value = 8
            });
            ticketsOut.Add(ticketOut4);


            var ticketOut5 = new Ticket();

            ticketOut5.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Nansen Spirit"
            });
            ticketOut5.Dimensions.Add(new Dimension {
                Name = "status", Value = "new"
            });
            ticketOut5.Metrics.Add(new Metric {
                Name = "ticket", Value = 2
            });
            ticketsOut.Add(ticketOut5);

            var ticketOut6 = new Ticket();

            ticketOut6.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Nansen Spirit"
            });
            ticketOut6.Dimensions.Add(new Dimension {
                Name = "status", Value = "closed"
            });
            ticketOut6.Metrics.Add(new Metric {
                Name = "ticket", Value = 12
            });
            ticketsOut.Add(ticketOut6);


            var ticketOut7 = new Ticket();

            ticketOut7.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Peary Spirit"
            });
            ticketOut7.Dimensions.Add(new Dimension {
                Name = "status", Value = "new"
            });
            ticketOut7.Metrics.Add(new Metric {
                Name = "ticket", Value = 1
            });
            ticketsOut.Add(ticketOut7);

            var ticketOut8 = new Ticket();

            ticketOut8.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Peary Spirit"
            });
            ticketOut8.Dimensions.Add(new Dimension {
                Name = "status", Value = "closed"
            });
            ticketOut8.Metrics.Add(new Metric {
                Name = "ticket", Value = 3
            });
            ticketsOut.Add(ticketOut8);


            var ticketOut9 = new Ticket();

            ticketOut9.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Samba Spirit"
            });
            ticketOut9.Dimensions.Add(new Dimension {
                Name = "status", Value = "new"
            });
            ticketOut9.Metrics.Add(new Metric {
                Name = "ticket", Value = 5
            });
            ticketsOut.Add(ticketOut9);

            var ticketOut10 = new Ticket();

            ticketOut10.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Samba Spirit"
            });
            ticketOut10.Dimensions.Add(new Dimension {
                Name = "status", Value = "closed"
            });
            ticketOut10.Metrics.Add(new Metric {
                Name = "ticket", Value = 7
            });
            ticketsOut.Add(ticketOut10);


            var ticketOut11 = new Ticket();

            ticketOut11.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Sertanejo Spirit"
            });
            ticketOut11.Dimensions.Add(new Dimension {
                Name = "status", Value = "new"
            });
            ticketOut11.Metrics.Add(new Metric {
                Name = "ticket", Value = 4
            });
            ticketsOut.Add(ticketOut11);

            var ticketOut12 = new Ticket();

            ticketOut12.Dimensions.Add(new Dimension {
                Name = "vessel", Value = "Sertanejo Spirit"
            });
            ticketOut12.Dimensions.Add(new Dimension {
                Name = "status", Value = "closed"
            });
            ticketOut12.Metrics.Add(new Metric {
                Name = "ticket", Value = 4
            });
            ticketsOut.Add(ticketOut12);


            var ticketsBytesOut = ticketsOut.SerializeToJson();

            context.Response.ContentType = "application/json";
            context.Response.OutputStream.Write(ticketsBytesOut, 0, ticketsBytesOut.Length);
        }
 public ActionResult GetProductsTop(int counter)
 {
     var productos = new List<PRO_Productos>();
     productos = db.PRO_Productos.Where(c => c.STS_Id == 1).OrderByDescending(d => d.PRO_Date).Take(counter).ToList();
     if (productos == null)
     {
         return HttpNotFound();
     }
     else
     {
         string productlist = productos.SerializeToJson();
         return Json(productlist);
     }
 }
        private void WriteJsonIframeSafe(HttpContext context, List<FilesStatus> statuses)
        {
            context.Response.AddHeader("Vary", "Accept");
            try
            {
                if (context.Request["HTTP_ACCEPT"].Contains("application/json"))
                    context.Response.ContentType = "application/json";
                else
                    context.Response.ContentType = "text/plain";
            }
            catch
            {
                context.Response.ContentType = "text/plain";
            }

            var jsonObj = statuses.SerializeToJson();
            context.Response.Write(jsonObj);
        }
        public ActionResult GetProductsDetails(int prod)
        {
            var productos = new List<PRD_ProductosDetalles>();
            productos = db.PRD_ProductosDetalles.Where(c => c.PRO_Id == prod ).ToList();
            if (productos == null)
            {
                return HttpNotFound();
            }
            else
            {
                string productlist = productos.SerializeToJson();
                return Json(productlist);

            }
        }
 public ActionResult GetProductsByCategory(int catid)
 {
     var productos = new List<PRO_Productos>();
     productos = db.PRO_Productos.Where(c => c.CAT_Id == catid && c.STS_Id==1).ToList();
     if (productos == null)
     {
         return HttpNotFound();
     }
     else
     {
         string productlist = productos.SerializeToJson();
         return Json(productlist);
     }
 }
        public ActionResult GetInformationAnuncios(FormCollection form)
        {
            var allAnunciosList = new List<AN_Anuncios>();

            var category = string.IsNullOrEmpty(form["Categoria"]) ? default(int) : int.Parse(form["Categoria"].ToString());
            var subcategoria = string.IsNullOrEmpty(form["SubCategoria"]) ? default(int) : int.Parse(form["SubCategoria"].ToString());
            var lugar = string.IsNullOrEmpty(form["Lugar"]) ? default(string) : form["Lugar"].ToString();
            var descripcion = string.IsNullOrEmpty(form["Descripcion"]) ? default(string) : form["Descripcion"].ToString();

            List<AnunciosViewModel> viewModelAnuncios = new List<AnunciosViewModel>();
            using (Entities model = new Entities())
            {

                allAnunciosList = db.Get_AdvanceSearch(category, subcategoria, descripcion, lugar).ToList();

                foreach (var item in allAnunciosList)
                {
                    string username = item.UserProfile.Name;
                    string statusDesc = item.ST_Estatus.ST_Descripcion;
                    var categoria = item.SBS_SubCategoriaServicio.CD_CategoriaServicio.CD_Descripcion;
                    var firstImage = string.Empty;
                    if (item.AE_AnunciosExtras.FirstOrDefault() != null)
                    {
                        firstImage = item.AE_AnunciosExtras.FirstOrDefault().AN_ImagenUrl;
                    }
                    else
                    {
                        firstImage = item.UserProfile.Image == null ? "~/Images/No_Profile.jpg" : item.UserProfile.Image;
                    }

                    var getRating = model.SEL_ValoracionAnuncios(item.AN_Id).FirstOrDefault();
                    string urlimg = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/");
                    var formatted = firstImage.Replace("~", "");
                    if (formatted.StartsWith("/"))
                        formatted = formatted.Remove(0, 1);
                    firstImage = urlimg + formatted;

                    List<RW_Reviews> rvList = new List<RW_Reviews>();
                    model.SS_SolicitudServicio.Where(c => c.AN_Id == item.AN_Id).AsParallel().ToList().ForEach(
                        c =>
                        {
                            c.RW_Reviews.AsParallel().ToList().ForEach(i => rvList.Add(i));
                        });

                    viewModelAnuncios.Add(new AnunciosViewModel
                    {
                        Usuario = username,
                        EstatusDescription = statusDesc,
                        AnunciosInfo = item,
                        CategoriaDescripcion = categoria,
                        FirstImage = firstImage,
                        Rating = getRating,
                        ReviewList = rvList
                    });

                }
            }
            if (viewModelAnuncios == null || viewModelAnuncios.Count == 0)
            {
                return Json(new { Error = "No se encontraron registros" });
            }
            var anuncios = viewModelAnuncios.SerializeToJson();
            return Json(anuncios);
        }
 public ActionResult GetNewTop3()
 {
     var news = new List<NEW_Noticias>();
     news = db.NEW_Noticias.Where(c => c.STS_Id == 1).OrderByDescending(d => d.NEW_Date).Take(3).ToList();
     if (news == null)
     {
         return HttpNotFound();
     }
     else
     {
         string newslist = news.SerializeToJson();
         return Json(newslist);
     }
 }