本文整理汇总了C#中CmsData.CMSDataContext.ServerLink方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.ServerLink方法的具体用法?C# CMSDataContext.ServerLink怎么用?C# CMSDataContext.ServerLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmsData.CMSDataContext
的用法示例。
在下文中一共展示了CMSDataContext.ServerLink方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterHelpers
public static void RegisterHelpers(CMSDataContext db)
{
Handlebars.RegisterHelper("BottomBorder", (writer, context, args) => { writer.Write(CssStyle.BottomBorder); });
Handlebars.RegisterHelper("AlignTop", (writer, context, args) => { writer.Write(CssStyle.AlignTop); });
Handlebars.RegisterHelper("AlignRight", (writer, context, args) => { writer.Write(CssStyle.AlignRight); });
Handlebars.RegisterHelper("DataLabelStyle", (writer, context, args) => { writer.Write(CssStyle.DataLabelStyle); });
Handlebars.RegisterHelper("LabelStyle", (writer, context, args) => { writer.Write(CssStyle.LabelStyle); });
Handlebars.RegisterHelper("DataStyle", (writer, context, args) => { writer.Write(CssStyle.DataStyle); });
Handlebars.RegisterHelper("ServerLink", (writer, context, args) => { writer.Write(db.ServerLink().TrimEnd('/')); });
Handlebars.RegisterHelper("FmtZip", (writer, context, args) => { writer.Write(args[0].ToString().FmtZip()); });
Handlebars.RegisterHelper("IfEqual", (writer, options, context, args) =>
{
if (IsEqual(args))
options.Template(writer, (object)context);
else
options.Inverse(writer, (object)context);
});
Handlebars.RegisterHelper("IfNotEqual", (writer, options, context, args) =>
{
if (!IsEqual(args))
options.Template(writer, (object)context);
else
options.Inverse(writer, (object)context);
});
Handlebars.RegisterHelper("GetToken", (writer, context, args) =>
{
var s = args[0].ToString();
var n = args[1].ToInt();
var ntoks = args.Length > 2 ? args[2].ToInt() : 2;
var sep = args.Length > 3 ? args[3].ToString() : " ";
var a = s.SplitStr(sep, ntoks);
writer.Write(a[n].trim());
});
// Format helper in form of: {{Fmt value "fmt"}}
// ex. {{Fmt Total "C"}}
// fmt is required. Uses standard/custom dotnet format strings
Handlebars.RegisterHelper("Fmt", (writer, context, args) =>
{
var fmt = $"{{0:{args[1]}}}";
writer.Write(fmt, args[0]);
});
// FmtPhone helper in form of: {{FmtPhone phone# "prefix"}}
Handlebars.RegisterHelper("FmtPhone", (writer, context, args) => { writer.Write(args[0].ToString().FmtFone($"{args[1]}")); });
Handlebars.RegisterHelper("ReplaceCode", (writer, context, args) =>
{
EmailReplacements r = context.Replacements as EmailReplacements
?? (context.Replacements = new EmailReplacements(db));
var code = args[0].ToString();
var p = db.LoadPersonById(args[1].ToInt());
int? oid = null;
if(args.Length == 3)
oid = args[2].ToInt2();
writer.Write(r.RenderCode(code, p, oid));
});
}
示例2: RegisterHelpers
public static void RegisterHelpers(CMSDataContext db)
{
Handlebars.RegisterHelper("BottomBorder", (writer, context, args) => { writer.Write(BottomBorder); });
Handlebars.RegisterHelper("AlignTop", (writer, context, args) => { writer.Write(AlignTop); });
Handlebars.RegisterHelper("AlignRight", (writer, context, args) => { writer.Write(AlignRight); });
Handlebars.RegisterHelper("DataLabelStyle", (writer, context, args) => { writer.Write(DataLabelStyle); });
Handlebars.RegisterHelper("LabelStyle", (writer, context, args) => { writer.Write(LabelStyle); });
Handlebars.RegisterHelper("DataStyle", (writer, context, args) => { writer.Write(DataStyle); });
Handlebars.RegisterHelper("ServerLink", (writer, context, args) => { writer.Write(db.ServerLink().TrimEnd('/')); });
}
示例3: RegisterHelpers
public static void RegisterHelpers(CMSDataContext db)
{
Handlebars.RegisterHelper("BottomBorder", (writer, context, args) => { writer.Write(CssStyle.BottomBorder); });
Handlebars.RegisterHelper("AlignTop", (writer, context, args) => { writer.Write(CssStyle.AlignTop); });
Handlebars.RegisterHelper("AlignRight", (writer, context, args) => { writer.Write(CssStyle.AlignRight); });
Handlebars.RegisterHelper("DataLabelStyle", (writer, context, args) => { writer.Write(CssStyle.DataLabelStyle); });
Handlebars.RegisterHelper("LabelStyle", (writer, context, args) => { writer.Write(CssStyle.LabelStyle); });
Handlebars.RegisterHelper("DataStyle", (writer, context, args) => { writer.Write(CssStyle.DataStyle); });
Handlebars.RegisterHelper("ServerLink", (writer, context, args) => { writer.Write(db.ServerLink().TrimEnd('/')); });
Handlebars.RegisterHelper("FmtZip", (writer, context, args) => { writer.Write(args[0].ToString().FmtZip()); });
Handlebars.RegisterHelper("IfEqual", (writer, options, context, args) =>
{
var eq = args[0] == args[1];
if (!eq && args[0] is int)
eq = args[0].ToString() == args[1].ToString();
if (eq)
options.Template(writer, (object) context);
else
options.Inverse(writer, (object) context);
});
Handlebars.RegisterHelper("GetToken", (writer, context, args) =>
{
var s = args[0].ToString();
var n = args[1].ToInt();
var a = s.SplitStr(" ", 2);
writer.Write(a[n]);
});
// Format helper in form of: {{Fmt value "fmt"}}
// ex. {{Fmt Total "C"}}
// fmt is required. Uses standard/custom dotnet format strings
Handlebars.RegisterHelper("Fmt", (writer, context, args) =>
{
var fmt = $"{{0:{args[1]}}}";
writer.Write(fmt, args[0]);
});
// FmtPhone helper in form of: {{FmtPhone phone# "prefix"}}
Handlebars.RegisterHelper("FmtPhone", (writer, context, args) => { writer.Write(args[0].ToString().FmtFone($"{args[1]}")); });
}
示例4: PayLink2
public string PayLink2(CMSDataContext db)
{
if (!TranId.HasValue)
return null;
var estr = HttpUtility.UrlEncode(Util.Encrypt(TranId.ToString()));
return db.ServerLink("/OnlineReg/PayAmtDue?q=" + estr);
}
示例5: Add
public static Person Add(CMSDataContext Db, bool SendNotices, Family fam, int position, Tag tag, string firstname, string nickname, string lastname, string dob, int MarriedCode, int gender, int originId, int? EntryPointId, bool testing = false)
{
var p = new Person();
p.CreatedDate = Util.Now;
p.CreatedBy = Util.UserId;
Db.People.InsertOnSubmit(p);
p.PositionInFamilyId = position;
p.AddressTypeId = 10;
if (Util.HasValue(firstname))
p.FirstName = firstname.Trim().ToProper().Truncate(25);
else
p.FirstName = "";
if (Util.HasValue(nickname))
p.NickName = nickname.Trim().ToProper().Truncate(15);
if (Util.HasValue(lastname))
p.LastName = lastname.Trim().ToProper().Truncate(30);
else
p.LastName = "?";
p.GenderId = gender;
if (p.GenderId == 99)
p.GenderId = 0;
p.MaritalStatusId = MarriedCode;
DateTime dt;
if (Util.BirthDateValid(dob, out dt))
{
if (dt.Year == Util.SignalNoYear)
{
p.BirthDay = dt.Day;
p.BirthMonth = dt.Month;
p.BirthYear = null;
}
else
{
while (dt.Year < 1900)
dt = dt.AddYears(100);
if (dt > Util.Now)
dt = dt.AddYears(-100);
p.BirthDay = dt.Day;
p.BirthMonth = dt.Month;
p.BirthYear = dt.Year;
}
if (p.GetAge() < 18 && MarriedCode == 0)
p.MaritalStatusId = MaritalStatusCode.Single;
}
// I think this else statement is no longer necessary
else if (DateTime.TryParse(dob, out dt))
{
p.BirthDay = dt.Day;
p.BirthMonth = dt.Month;
if (Regex.IsMatch(dob, @"\d+[-/]\d+[-/]\d+"))
{
p.BirthYear = dt.Year;
while (p.BirthYear < 1900)
p.BirthYear += 100;
if (p.GetAge() < 18 && MarriedCode == 0)
p.MaritalStatusId = MaritalStatusCode.Single;
}
}
p.MemberStatusId = MemberStatusCode.JustAdded;
if (fam == null)
{
fam = new Family();
Db.Families.InsertOnSubmit(fam);
p.Family = fam;
}
else
fam.People.Add(p);
if (tag != null)
tag.PersonTags.Add(new TagPerson { Person = p });
p.OriginId = originId;
p.EntryPointId = EntryPointId;
p.FixTitle();
if(Db.Setting("ElectronicStatementDefault", "false").Equal("true"))
p.ElectronicStatement = true;
if (!testing)
Db.SubmitChanges();
if (SendNotices)
{
if (Util.UserPeopleId.HasValue
&& Util.UserPeopleId.Value != Db.NewPeopleManagerId
&& HttpContext.Current.User.IsInRole("Access")
&& !HttpContext.Current.User.IsInRole("OrgMembersOnly")
&& !HttpContext.Current.User.IsInRole("OrgLeadersOnly"))
Task.AddNewPerson(Db, p.PeopleId);
else
{
var np = Db.GetNewPeopleManagers();
if (np != null)
Db.Email(Util.SysFromEmail, np,
$"Just Added Person on {Db.Host}",
$"<a href='{Db.ServerLink("/Person2/" + p.PeopleId)}'>{p.Name}</a>");
}
//.........这里部分代码省略.........
示例6: RegisterLinkUrl
public static string RegisterLinkUrl(CMSDataContext db, int orgid, int pid, int queueid, string linktype, DateTime? expires = null)
{
var showfamily = linktype == "registerlink2";
var qs = $"{orgid},{pid},{queueid},{linktype}";
var ot = new OneTimeLink
{
Id = Guid.NewGuid(),
Querystring = qs,
};
if (expires.HasValue)
ot.Expires = expires.Value;
db.OneTimeLinks.InsertOnSubmit(ot);
db.SubmitChanges();
var url = db.ServerLink($"/OnlineReg/RegisterLink/{ot.Id.ToCode()}");
if (showfamily)
url += "?showfamily=true";
return url;
}
示例7: TaskLink
public static string TaskLink(CMSDataContext Db, string text, int id)
{
return $"<a href='{Db.ServerLink(TaskLink0(id))}'>{text}</a>";
}
示例8: LogPictureUpload
public void LogPictureUpload(CMSDataContext db, int UserPeopleId)
{
var c = new ChangeLog
{
UserPeopleId = UserPeopleId,
PeopleId = PeopleId,
Field = "Basic Info",
Created = Util.Now
};
db.ChangeLogs.InsertOnSubmit(c);
c.ChangeDetails.Add(new ChangeDetail("Picture", null, "(new upload)"));
var np = db.GetNewPeopleManagers();
if (np != null)
db.EmailRedacted(db.Setting("AdminMail", "[email protected]"), np,
"Picture Uploaded on " + Util.Host,
$"{Util.UserName} Uploaded a picture for <a href=\"{db.ServerLink($"/Person2/{PeopleId}")}\">{Name}</a><br />\n");
}