예제 #1
0
        internal void InstallStatus(bool isCompleted, string errorMsg)
        {
            try
            {
                string userAgent = _umbContext.HttpContext.Request.UserAgent;

                // Check for current install Id
                var installId     = Guid.NewGuid();
                var installCookie = new StateHelper.Cookies.Cookie("umb_installId", 1);
                if (string.IsNullOrEmpty(installCookie.GetValue()) == false)
                {
                    if (Guid.TryParse(installCookie.GetValue(), out installId))
                    {
                        // check that it's a valid Guid
                        if (installId == Guid.Empty)
                        {
                            installId = Guid.NewGuid();
                        }
                    }
                }
                installCookie.SetValue(installId.ToString());

                string dbProvider = string.Empty;
                if (IsBrandNewInstall == false)
                {
                    dbProvider = ApplicationContext.Current.DatabaseContext.DatabaseProvider.ToString();
                }

                org.umbraco.update.CheckForUpgrade check = new org.umbraco.update.CheckForUpgrade();
                check.Install(installId,
                              IsBrandNewInstall == false,
                              isCompleted,
                              DateTime.Now,
                              UmbracoVersion.Current.Major,
                              UmbracoVersion.Current.Minor,
                              UmbracoVersion.Current.Build,
                              UmbracoVersion.CurrentComment,
                              errorMsg,
                              userAgent,
                              dbProvider);
            }
            catch (Exception ex)
            {
                LogHelper.Error <InstallHelper>("An error occurred in InstallStatus trying to check upgrades", ex);
            }
        }
예제 #2
0
    public ActionResult Test() //http://localhost:21773/umbraco/surface/accountsurface/test
    {
        //IEnumerable<MediaType> mediaTypes = MediaType.GetAllAsList();
        //MediaType image = mediaTypes.SingleOrDefault(mt => mt.Text == "Image");
        //Media media = Media.MakeNew("female.png", image, new User("admin"), 1076);
        //media.Save();
        //var c = mediaTypes.Count();
        //Member member = Member.GetMemberFromLoginAndEncodedPassword("lquispej", EncodePassword("user"));
        //Property image = member.getProperty("photo");

        //DataTypeDefinition dataTypeDefinition = DataTypeDefinition.GetDataTypeDefinition(1098);
        //SortedList data = PreValues.GetPreValues(dataTypeDefinition.Id);
        //XDocument document = new XDocument();
        //XElement element = new XElement("sports");
        //foreach (DictionaryEntry dictionaryEntry in data)
        //{
        //    element.Add(new XElement("sport", new XElement("Id", ((PreValue)dictionaryEntry.Value).Id), new XElement("Name", ((PreValue)dictionaryEntry.Value).Value)));
        //}
        //document.Add(element);
        //document.Save(Server.MapPath("~/App_Data") + @"\sport.xml");

        //DataTypeDefinition dataTypeDefinition = DataTypeDefinition.GetDataTypeDefinition(1100);
        //SortedList data = PreValues.GetPreValues(dataTypeDefinition.Id);
        //XDocument document = new XDocument();
        //XElement element = new XElement("leagues");
        //foreach (DictionaryEntry dictionaryEntry in data)
        //{
        //    var values = (PreValue) dictionaryEntry.Value;
        //    var id = values.Id;
        //    var v = values.Value.Split(',');
        //    var sportId = v[0];
        //    var name = v[1];
        //    element.Add(new XElement("league", new XElement("Id", id), new XElement("Name", name), new XElement("SportId", sportId)));
        //}
        //document.Add(element);
        //document.Save(Server.MapPath("~/App_Data") + @"\league.xml");

        //Document[] documents = Document.GetChildrenForTree(1161);
        //Document document = documents.SingleOrDefault(d => d.Text == "Saulo Tsuchida Cruz");
        //var member = document.getProperty("member");

        //Document[] d1 = Document.GetChildrenForTree(1163);
        //Document d2 = d1.FirstOrDefault();
        //var date1 = document.getProperty("dateScheduled");
        //var date2 = document.getProperty("dateCompleted");
        //var date3 = document.getProperty("description");

        //MembershipUser user = Membership.GetUser();
        //Member umbracoMember = Member.GetCurrentMember();

        //User user = new User("admin");
        //DocumentType documentType = DocumentType.GetByAlias("Team");
        //Document document = Document.MakeNew("Alianza Lima", documentType, new User("admin"),  1131);
        //document.getProperty("city").Value = "Lima";
        //document.getProperty("division").Value = "Primera Division";

        //Document document = new Document(1195);
        //Property property = document.getProperty("bodyWeight");
        //XDocument xmlDocument = XDocument.Parse((string) property.Value);
        //var list = (from x in xmlDocument.Descendants("item")
        //                select new
        //                    {
        //                        id = int.Parse(x.Attribute("id").Value),
        //                        sortOrder = int.Parse(x.Attribute("sortOrder").Value),
        //                        weight = decimal.Parse(x.Element("weight").Value),
        //                        date = DateTime.Parse(x.Element("date").Value)
        //                    }).ToList();


        //var users = umbraco.BusinessLogic.User.getAll();

        //XDocument umbracoData = XDocument.Load(Server.MapPath("~/App_Data") + @"\ResourceDataType.xml");
        //var id = (from c in umbracoData.Descendants("Data")
        //                          where c.Value.Equals("Category")
        //                          select c.Attribute("key").Value).FirstOrDefault();

        //var members = Member.GetAllAsList();
        //var groups = Roles.GetRolesForUser(members.FirstOrDefault().LoginName).Contains("Users");

        //var path = FormsAuthentication.FormsCookiePath;

        //PropertyInfo[] p = typeof (PushNotification).GetProperties();
        //foreach (PropertyInfo propertyInfo in p)
        //{
        //    var name = propertyInfo.Name;
        //    var type = propertyInfo.PropertyType.Name; // t will be System.String
        //}



        //PreValue value = PreValue.MakeNew(1085, "Category 9");

        //value.DataTypeId = 1085;
        //value.SortOrder = 9;
        //value.Save();

        Document document  = new Document(-1);
        var      childrens = document.Children;

        bool r = StateHelper.Cookies.HasCookies;

        StateHelper.Cookies.Cookie cookie = StateHelper.Cookies.UserContext;

        //User user = new User("fsotog", "trainer"); //umbraco.BusinessLogic.User.GetCurrent();
        bool result = umbraco.BusinessLogic.User.validateCredentials("fsotog", UmbracoCustom.EncodePassword("trainer"));

        User[] users   = umbraco.BusinessLogic.User.getAllByLoginName("fsotog");
        bool   result2 = Membership.ValidateUser("fsotog", UmbracoCustom.EncodePassword("trainer"));

        User user = umbraco.BusinessLogic.User.GetUser(1);

        IContentType           contentType  = Services.ContentTypeService.GetContentType(1072);
        var                    contentType2 = contentType.CompositionPropertyTypes;
        IContent               content      = Services.ContentService.GetById(1159); //new Content("Valeria Agurto Castilla", 1158, new ContentType(1072));
        string                 contentName  = content.Name;
        PropertyCollection     properties   = content.Properties;
        IEnumerable <IContent> childs       = Services.ContentService.GetChildren(1158);


        return(Content("Hola mundo xD"));
    }