本文整理汇总了C#中Document.getProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Document.getProperty方法的具体用法?C# Document.getProperty怎么用?C# Document.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document.getProperty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Document_BeforePublish
void Document_BeforePublish(Document sender, PublishEventArgs e)
{
try
{
if (sender.ContentType.Alias == "uBlogsyPost")
{
bool sendNewsletter = (sender.getProperty("sendNewsletter").Value.ToString() == "0") ? false : true;
if (sendNewsletter)
{
var sum = sender.getProperty("uBlogsyContentSummary").Value;
string title = sender.getProperty("uBlogsyContentTitle").Value.ToString();
Dictionary<string, object> lookup = new Dictionary<string, object>() { { "title", "" } };
campaignsInput input = new campaignsInput(lookup);
campaigns camps = new campaigns();
if (camps.Execute(input).result.Where(t => t.title == title).Count() == 0)
{
campaignCreateInput campInput = new campaignCreateInput();
campInput.parms.apikey = PerceptiveMCAPI.MCAPISettings.default_apikey;
campInput.parms.options.title = title;
campInput.parms.options.list_id = "68972d2e33";
campInput.parms.options.auto_footer = true;
campInput.parms.options.subject = "The Newsletter - " + title;
campInput.parms.options.tracking = new campaignTracking(true, true, true);
campInput.parms.options.template_id = 88565;
campInput.parms.options.analytics.Add("google", title);
campInput.parms.options.to_email = "*|FNAME|*";
campInput.parms.options.from_email = "[email protected]";
campInput.parms.options.from_name = "American City Plumbing";
campInput.parms.content.Add("html_std_content", sum.ToString());
campaignCreate create = new campaignCreate();
campaignCreateOutput campOut = create.Execute(campInput);
var r = campOut.result;
if (campOut != null)
{
var c = camps.Execute(new campaignsInput(new Dictionary<string, object>() { { "title", title } }));
campaignSendNowInput sendInput = new campaignSendNowInput(r);
campaignSendNow now = new campaignSendNow();
var sI = now.Execute(sendInput);
var s = sI.result;
}
}
}
}
}
catch (Exception ex)
{
ex.ToString();
throw;
}
//cancel the publishing
// e.Cancel = true;
}
示例2: GetFacebookPostUrl
public string GetFacebookPostUrl()
{
var article = new Document(umbraco.NodeFactory.Node.getCurrentNodeId());
return String.Format("https://www.facebook.com/dialog/feed?app_id={0}&link={1}&picture={2}&name={3}&caption={4}&description={5}&redirect_uri={6}",
Resources.Resource1.FacebookTriphulcasAppID,
Request.Url,
GetFirstImageUrl(article.getProperty("articulo").Value.ToString()),
article.getProperty("titulo").Value.ToString(),
article.getProperty("introduccion").Value.ToString(),
Resources.Resource1.TriphulcasPressNote,
String.Format("http://{0}/popupcloser?action=facebook_publish", Request.Url.Host)
);
}
示例3: LoadData
private void LoadData()
{
string id = (Category.SelectedValue != string.Empty ? Category.SelectedValue : "23");
Document document = new Document(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.GymnastNode)));
Property property = document.getProperty("exercise");
var exercises = UmbracoCustom.GetDataTypeGrid(property).Where(g => g.category == id);
Exercise.Items.Clear();
foreach (var exercise in exercises)
{
Exercise.Items.Add(new ListItem(exercise.exercise, exercise.id));
}
}
示例4: Office
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
/// </summary>
public Office(Document document, string name)
{
Name = name;
Address = UmbracoCustom.GetTextAreaFormat(document.getProperty("address").Value.ToString());
City = document.getProperty("city").Value.ToString();
Fax = document.getProperty("fax").Value.ToString();
Phone = document.getProperty("phone").Value.ToString();
State = document.getProperty("state").Value.ToString();
ZipCode = document.getProperty("zipCode").Value.ToString();
}
示例5: GetMarkers
public JsonResult GetMarkers()
{
ArrayList list = new ArrayList();
Document site = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.Paramount)));
DocumentType office = DocumentType.GetByAlias("Office");
list.Add(new Marker
{
name = "Corporate Office",
latLng = new ArrayList
{
decimal.Parse(site.getProperty("latitude").Value.ToString()),
decimal.Parse(site.getProperty("longitude").Value.ToString())
}
});
Document regionalOffice = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.RegionalOffice)));
foreach (Document region in regionalOffice.Children)
{
foreach (Document marker in region.Children.Where(r => r.ContentType.Id == office.Id))
{
list.Add(new Marker
{
name = marker.Text,
latLng = new ArrayList
{
decimal.Parse(marker.getProperty("latitude").Value.ToString()),
decimal.Parse(marker.getProperty("longitude").Value.ToString())
}
});
}
}
return Json(list, JsonRequestBehavior.AllowGet);
}
示例6: GetInfo
public PartialViewResult GetInfo(string state)
{
Info info = new Info
{
Offices = new List<Office>(),
Basins = new List<string>(),
State = state
};
DocumentType basin = DocumentType.GetByAlias("Basin");
DocumentType office = DocumentType.GetByAlias("Office");
Document site = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.Paramount)));
if (site.getProperty("state").Value.ToString() == state)
{
info.Offices.Add(new Office(site, "Corporate Office"));
}
Document regionalOffice = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.RegionalOffice)));
Document region = regionalOffice.Children.SingleOrDefault(r => r.Text == state);
if (region != null)
{
foreach (Document marker in region.Children)
{
if (marker.ContentType.Id == basin.Id)
{
info.Basins.Add(marker.Text);
}
else if (marker.ContentType.Id == office.Id)
{
info.Offices.Add(new Office(marker));
}
}
}
return PartialView("_RegionInfo", info);
}
示例7: GetContent
public JsonResult GetContent(int Id)
{
Document document = new Document(Id);
return Json(document.getProperty("body").Value.ToString(), JsonRequestBehavior.AllowGet);
}
示例8: ButtonOnClick
private void ButtonOnClick(object sender, EventArgs eventArgs)
{
int documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
Document Workout = new Document(documentId);
Document Gymnast = new Document(Workout.ParentId);
int trainerId = Convert.ToInt32(Gymnast.getProperty("trainer").Value);
int memberId = Convert.ToInt32(Gymnast.getProperty("member").Value);
//Label.Text = string.Format("WorkoutId: {0} / TrainerId: {1} ", documentId, Gymnast.getProperty("trainer").Value);
int userType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "trainer").Id;
int objectType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.ObjectType))).Single(o => o.Value.ToLower() == "workout").Id;
List<PushNotification> notifications = new List<PushNotification>();
string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
SqlDataReader reader = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectNotificationByMember",
new SqlParameter
{
ParameterName = "@MemberId",
Value = memberId,
Direction = ParameterDirection.Input,
SqlDbType = SqlDbType.Int
});
while (reader.Read())
{
notifications.Add(new PushNotification
{
Id = int.Parse(reader.GetValue(0).ToString()),
MemberId = int.Parse(reader.GetValue(1).ToString()),
Token = reader.GetValue(2).ToString(),
DeviceId = int.Parse(reader.GetValue(3).ToString()),
IsActive = bool.Parse(reader.GetValue(4).ToString()),
Device = reader.GetValue(5).ToString(),
PlatformId = int.Parse(reader.GetValue(6).ToString()),
Platform = UmbracoCustom.PropertyValue(UmbracoType.Platform, reader.GetValue(6))
});
}
foreach (PushNotification notification in notifications)
{
//pushService.QueueNotification(NotificationFactory.Apple().ForDeviceToken(notification.Token).WithAlert("A new workout is available on your account.").WithBadge(7));
pushService.StopAllServices();
SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertPushMessage",
new SqlParameter { ParameterName = "@Id", Value = new int(), Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Token", Value = notification.Token, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 50 },
new SqlParameter { ParameterName = "@NotificationId", Value = notification.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserId", Value = trainerId, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserType", Value = userType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectId", Value = Workout.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectType", Value = objectType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Message", Value = "A new workout is available on your account.", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 500 }
);
}
LoadData();
}
示例9: _generateButton_Click
void _generateButton_Click(object sender, EventArgs e)
{
Config config = new Config(Configuration);
// get list of nodeids with this datatype
using (IRecordsReader rdr = SqlHelper.ExecuteReader(
"SELECT DISTINCT contentNodeId, " +
"(SELECT Alias FROM cmsPropertyType WHERE Id = pd.propertyTypeId) AS propertyAlias " +
"FROM cmsPropertyData pd " +
"WHERE PropertyTypeId IN (SELECT Id FROM cmsPropertyType WHERE DataTypeId = " + _dataType.DataTypeDefinitionId + ")"))
{
while (rdr.Read())
{
int documentId = rdr.GetInt("contentNodeId");
string propertyAlias = rdr.GetString("propertyAlias");
Document document = new Document(documentId);
Property cropProperty = document.getProperty(propertyAlias);
Property imageProperty = document.getProperty(config.UploadPropertyAlias);
if (cropProperty != null) // && cropProperty.Value.ToString() == ""
{
ImageInfo imageInfo = new ImageInfo(imageProperty.Value.ToString());
if (imageInfo.Exists)
{
SaveData saveData = new SaveData();
foreach (Preset preset in config.presets)
{
Crop crop = preset.Fit(imageInfo);
saveData.data.Add(crop);
}
//cropProperty.Value = saveData.Xml(config, imageInfo);
imageInfo.GenerateThumbnails(saveData, config);
if (document.Published)
{
//document.Publish(document.User);
//umbraco.library.UpdateDocumentCache(document.Id);
}
else
{
//document.Save();
}
}
}
}
}
}
示例10: ButtonOnClick
private void ButtonOnClick(object sender, EventArgs eventArgs)
{
int documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
Document Workout = new Document(documentId);
Document Gymnast = new Document(Workout.ParentId);
int trainerId = Convert.ToInt32(Gymnast.getProperty("trainer").Value);
int memberId = Convert.ToInt32(Gymnast.getProperty("member").Value);
Member member = new Member(memberId);
//Label.Text = string.Format("WorkoutId: {0} / TrainerId: {1} ", documentId, Gymnast.getProperty("trainer").Value);
SmtpClient client = new SmtpClient();
MailMessage message = new MailMessage();
message.IsBodyHtml = true;
message.From = new MailAddress("[email protected]");
message.To.Add(member.Email);
message.Subject = "MetaFitness";
message.Body = "A new workout is available on your account.";
client.Send(message);
int userType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "trainer").Id;
int objectType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.ObjectType))).Single(o => o.Value.ToLower() == "workout").Id;
string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertEmailMessage",
new SqlParameter { ParameterName = "@Id", Value = new int(), Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserId", Value = trainerId, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserType", Value = userType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectId", Value = Workout.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectType", Value = objectType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Email", Value = member.Email, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar },
new SqlParameter { ParameterName = "@Message", Value = "A new workout is available on your account. Check your MetaFitness App now.", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 500 }
);
LoadData();
}
示例11: NotificationMessage
private void NotificationMessage()
{
int documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
Document Gymnast = new Document(documentId);
int memberId = Convert.ToInt32(Gymnast.getProperty("member").Value);
SmtpClient client = new SmtpClient();
MailMessage message = new MailMessage();
message.IsBodyHtml = true;
message.From = new MailAddress("[email protected]");
message.To.Add(new Member(memberId).Email);
message.Subject = "MetaFitness";
message.Body = "Your Trainer has sent you a new message. Check your MetaFitness App now.";
client.Send(message);
string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertEmailMessage",
new SqlParameter { ParameterName = "@Id", Value = new int(), Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserId", Value = new User("system").Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserType", Value = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "system").Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectId", Value = Gymnast.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectType", Value = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.ObjectType))).Single(u => u.Value.ToLower() == "chat").Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Email", Value = new Member(memberId).Email, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar },
new SqlParameter { ParameterName = "@Message", Value = "Your Trainer has sent you a new message. Check your MetaFitness App now.", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 500 }
);
foreach (PushNotification notification in SelectNotificationByMember(memberId))
{
pushService.QueueNotification(new AppleNotification().ForDeviceToken(notification.Token).WithAlert("Your Trainer has sent you a new message.").WithBadge(7));
pushService.StopAllServices();
SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertPushMessage",
new SqlParameter { ParameterName = "@Id", Value = new int(), Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Token", Value = notification.Token, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 50 },
new SqlParameter { ParameterName = "@NotificationId", Value = notification.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserId", Value = new User("system").Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@UserType", Value = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "system").Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectId", Value = Gymnast.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ObjectType", Value = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.ObjectType))).Single(u => u.Value.ToLower() == "chat").Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Message", Value = "Your Trainer has sent you a new message.", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 500 }
);
}
}
示例12: SetRoutine
public JsonResult SetRoutine(Routine routine, string oper, string Id, string Category, string ExerciseName, string Value, string sortOrder)
{
string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
switch (oper)
{
case "add":
NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);
int documentId = int.Parse(nameValueCollection["id"]);
Document document = new Document(documentId);
Document parentDocument = new Document(document.ParentId);
SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertRoutine",
new SqlParameter { ParameterName = "@Id", Value = routine.Id, Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@DocumentId", Value = parentDocument.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ExerciseId", Value = int.Parse(ExerciseName), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@MemberId", Value = Convert.ToInt32(parentDocument.getProperty("member").Value), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@TrainerId", Value = Convert.ToInt32(parentDocument.getProperty("trainer").Value), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@WorkoutId", Value = document.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Value", Value = Value, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Decimal }
);
break;
case "edit":
SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "UpdateRoutine",
new SqlParameter { ParameterName = "@Id", Value = Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@ExerciseId", Value = int.Parse(ExerciseName), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
new SqlParameter { ParameterName = "@Value", Value = Value, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Decimal }
);
break;
case "del":
break;
}
return Json("Success Save");
}