/// <summary> /// 自动扫描打印标签 /// </summary> /// <param name="filter"></param> /// <returns></returns> public JsonResult AutoScanPrintLabel(ScanPrintLabelFilter filter) { var model = new JsonModelResult { IsSuccess = false, Message = string.Empty, HtmlString = string.Empty }; if (string.IsNullOrWhiteSpace(filter.OrderNumber)) { model.Message = "订单号不能为空!"; return(Json(model, JsonRequestBehavior.AllowGet)); } var customerOrderModel = GetPrinterByOrderNumber(filter.OrderNumber.Trim()); if (null == customerOrderModel) { model.Message = "无此订单,或订单未提交!"; return(Json(model, JsonRequestBehavior.AllowGet)); } var wayBillTemplateModel = _wayBillTemplateService.GetWayBillTemplateByNameAndShippingMethod(filter.TemplateName, customerOrderModel.ShippingMethodId) .FirstOrDefault(); if (wayBillTemplateModel != null) { model.IsSuccess = true; model.HtmlString = Razor.Parse(HttpUtility.HtmlDecode(wayBillTemplateModel.TemplateContent), customerOrderModel); return(Json(model, JsonRequestBehavior.AllowGet)); } model.Message = "打印地址标签失败,未找到对应模版!"; return(Json(model, JsonRequestBehavior.AllowGet)); }
public void Can_Parse_Simple_Razor_Temple_With_Product_Model() { //// Arrange var template = @" <html> <body> <div>@Model.Name, @Model.Sku, @Model.Price</div> <ul> @foreach(var option in Model.ProductOptions) { <li>@option.Name</li> } </ul> </body> </html>"; //// Act var result = Razor.Parse(template, _product.ToProductDisplay()); //// Assert Assert.NotNull(result); Assert.IsTrue(result.Contains("Color")); }
public string GenerateStandAloneScript(IEnumerable <ColumnRole> columnRoless) { var columnRoles = columnRoless.ToArray(); var keys = columnRoles.Where(cr => cr.Role.Equals(Key)).Select(cr => cr.ColumnName); var attributes = columnRoles.Where(cr => cr.Role.Equals(Attribute)).Select(cr => cr.ColumnName); var deltaHande1 = columnRoles.Single(r => r.DeltaHandle); var deltaHande = deltaHande1 != null ? deltaHande1.ColumnName : "no"; var programm = GetFromResources(GetType().Assembly, "SqlDeltaGenerator.StandAloneScript.txt"); //string template = "Hello @Model.Name! Welcome to Razor!"; string result = Razor.Parse(programm, new { Keys = keys, Attributes = attributes, DeltaHandle = deltaHande, SourceTable = SourceSchema + "." + SourceTable, TargetTable = BufferPrefix + SourceTable, DestinationServer = DestinationServer, SourceServer = SourceServer, SourceDb = SourceDatabase, DestinationDb = DestinationDatabase }); return(result); }
public static string ToAppConfig(JabberConfig config) { if (config == null) { throw new ArgumentNullException("config"); } if (config.Validate().Any()) { throw new ArgumentException( ConfigurationResource.JabberConfigTransformer_ToAppConfig_Configuration_not_valid, "config", new Exception(string.Join(Environment.NewLine, config.Validate()))); } //Run transform using ( var reader = new StreamReader( typeof(JabberConfigTransformer).Assembly.GetManifestResourceStream( "Jabber.Net.Config.AppConfig.cshtml"))) { string result = Razor.Parse(reader.ReadToEnd(), config); //Transform coded model to template return(result); } }
public string Builder(string tplContent = "") { Columns = DbToCS.DbtoCSColumns(Columns, DbType); if (!string.IsNullOrWhiteSpace(tplContent)) { #region 模板生成 //var template = FileHelper.Read(@"D:\工作\GitHub\Dos.Tools\bin\Debug\Template\实体类_最新.tpl"); var primarykeyColumns = Columns.FindAll(col => col.IsPK); var identityColumn = Columns.Find(col => col.IsIdentity); StringPlus plus = new StringPlus(); plus.AppendLine("//------------------------------------------------------------------------------"); plus.AppendLine("// <auto-generated>"); plus.AppendLine("// 此代码由工具生成。"); plus.AppendLine("// 运行时版本:" + Environment.Version.ToString()); plus.AppendLine("// Website: http://ITdos.com/Dos/ORM/Index.html"); plus.AppendLine("// 对此文件的更改可能会导致不正确的行为,并且如果"); plus.AppendLine("// 重新生成代码,这些更改将会丢失。"); plus.AppendLine("// </auto-generated>"); plus.AppendLine("//------------------------------------------------------------------------------"); plus.AppendLine(); var result = Razor.Parse(tplContent, new { ClassName = ClassName, TableName = TableName, Columns = Columns, NameSpace = NameSpace, PrimaryKeyColumns = primarykeyColumns, IdentityColumn = identityColumn, i1 = 1, i2 = 1, i3 = 1 }); return(plus.ToString() + result); #endregion } else { #region 老版本 StringPlus plus = new StringPlus(); plus.AppendLine("//------------------------------------------------------------------------------"); plus.AppendLine("// <auto-generated>"); plus.AppendLine("// 此代码由工具生成。"); plus.AppendLine("// 运行时版本:" + Environment.Version.ToString()); plus.AppendLine("// Website: http://ITdos.com/Dos/ORM/Index.html"); plus.AppendLine("// 对此文件的更改可能会导致不正确的行为,并且如果"); plus.AppendLine("// 重新生成代码,这些更改将会丢失。"); plus.AppendLine("// </auto-generated>"); plus.AppendLine("//------------------------------------------------------------------------------"); plus.AppendLine(); plus.AppendLine(); plus.AppendLine("using System;"); plus.AppendLine("using System.Data;"); plus.AppendLine("using System.Data.Common;"); plus.AppendLine("using Dos.ORM;"); plus.AppendLine("using Dos.ORM.Common;"); plus.AppendLine(); plus.AppendLine("namespace " + NameSpace); plus.AppendLine("{"); plus.AppendLine(); plus.AppendSpaceLine(1, "/// <summary>"); plus.AppendSpaceLine(1, "/// 实体类" + ClassName + " 。(属性说明自动提取数据库字段的描述信息)"); plus.AppendSpaceLine(1, "/// </summary>"); if (!_isNewModel) { //plus.AppendSpaceLine(1, "[Serializable]"); } else { plus.AppendSpaceLine(1, "[Table(\"" + TableName + "\")]"); } plus.AppendSpaceLine(1, "[Serializable]"); plus.AppendSpaceLine(1, "public partial class " + ClassName + " : Entity "); plus.AppendSpaceLine(1, "{"); if (!_isNewModel) { plus.AppendSpaceLine(2, "public " + ClassName + "():base(\"" + TableName + "\") {}"); plus.AppendLine(); } else { //plus.AppendSpaceLine(2, "public " + ClassName + "() { }"); } plus.AppendLine(BuilderModel()); plus.AppendLine(BuilderMethod()); plus.AppendSpaceLine(1, "}"); plus.AppendLine("}"); plus.AppendLine(""); return(plus.ToString()); #endregion } }
public void SendVolunteerReminders(int id, bool sendall) { var org = Db.LoadOrganizationById(id); DbUtil.Db.CurrentOrgId = id; var setting = new Registration.Settings(org.RegSetting, Db, org.OrganizationId); setting.org = org; var currmembers = (from om in org.OrganizationMembers where (om.Pending ?? false) == false where om.MemberTypeId != CmsData.Codes.MemberTypeCode.InActive where org.Attends.Any(a => (a.MeetingDate <= DateTime.Today.AddDays(7) || sendall) && a.MeetingDate >= DateTime.Today && (a.Commitment == AttendCommitmentCode.Attending || a.Commitment == AttendCommitmentCode.Substitute) && a.PeopleId == om.PeopleId) select om).ToList(); var notify = Db.StaffPeopleForOrg(org.OrganizationId); var from = Db.StaffEmailForOrg(org.OrganizationId); foreach (var om in currmembers) { var q = (from a in org.Attends where a.PeopleId == om.PeopleId where a.Commitment == AttendCommitmentCode.Attending || a.Commitment == AttendCommitmentCode.Substitute where a.MeetingDate >= DateTime.Today orderby a.MeetingDate select a.MeetingDate).ToList(); if (!q.Any()) { continue; } var details = Razor.Parse(@"@model IEnumerable<DateTime> <blockquote> <table> <tr> <td> Date </td> <td> Time </td> </tr> @foreach (var dt in Model) { <tr> <td>@dt.ToLongDateString()</td> <td>@dt.ToLongTimeString()</td> </tr> } </table> </blockquote>", q); var oname = org.OrganizationName; var subject = Util.PickFirst(setting.ReminderSubject, "no subject"); var message = Util.PickFirst(setting.ReminderBody, "no body"); string loc = org.Location; message = MessageReplacements(Db, om.Person, null, oname, loc, message); message = message.Replace("{phone}", org.PhoneNumber.FmtFone7()); message = message.Replace("{details}", details); Db.Email(from, om.Person, subject, message); } var sb = new StringBuilder(@" <blockquote> <table> <tr> <td> Date </td> <td> Time </td> </tr>"); foreach (var om in currmembers) { var q = (from a in org.Attends where a.PeopleId == om.PeopleId where a.Commitment == AttendCommitmentCode.Attending || a.Commitment == AttendCommitmentCode.Substitute where a.MeetingDate >= DateTime.Today where a.MeetingDate <= DateTime.Today.AddDays(7) orderby a.MeetingDate select a.MeetingDate).ToList(); if (!q.Any()) { continue; } foreach (var d in q) { sb.AppendFormat("\n<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", om.Person.Name, d.ToLongDateString(), d.ToLongTimeString()); } } sb.Append(@" </table> </blockquote> "); foreach (var n in notify) { var organizationName = org.OrganizationName; var message = Util.PickFirst(setting.ReminderBody, "no body"); string location = org.Location; message = MessageReplacements(Db, n, null, organizationName, location, message); message = message.Replace("{phone}", org.PhoneNumber.FmtFone7()); message = message.Replace("{details}", sb.ToString()); Db.Email(from, n, "Reminder Notices sent for " + organizationName, message); } }
private void button1_Click(object sender, EventArgs e) { //获取选中的表 var selectedTables = GetSelectTables(); foreach (var item in selectedTables) { item.Columns = GetColumnByTableName(item.Tablename, item.Type); //把数据库字段类型转成c#类型 foreach (var col in item.Columns) { string colType; if (!DataTypeMapping.DataMapping.TryGetValue(col.FileType, out colType)) { throw new Exception(string.Format("类型:[{0}]没有匹配到,请配置完整后再尝试", col.FileType)); } col.FileType = colType; } } if (ckbModel.Checked) { string str = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "model.cshtml"); selectedTables.ForEach(o => o.NameSpace = txtModel.Text); foreach (var ts in selectedTables) { string csString = Razor.Parse(str, ts); string folderPath = txtPath.Text + "\\Model\\"; //判断文件夹是否存在 if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } using (FileStream aFile = new FileStream(folderPath + ts.Tablename + "PO" + ".cs", FileMode.OpenOrCreate)) { using (StreamWriter sw = new StreamWriter(aFile, Encoding.UTF8)) { sw.WriteLine(csString); } } } } if (ckbDB.Checked) { string str = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "IDbReposition.cshtml"); selectedTables.ForEach(o => o.NameSpace = txtDB.Text.Trim()); #region //生成接口文件 foreach (var ts in selectedTables) { string csString = Razor.Parse(str, ts); string folderPath = txtPath.Text + "\\IDbReposition\\"; //判断文件夹是否存在 if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } using (FileStream aFile = new FileStream(folderPath + "I" + ts.Tablename + "Reposition" + ".cs", FileMode.OpenOrCreate)) { using (StreamWriter sw = new StreamWriter(aFile, Encoding.UTF8)) { sw.WriteLine(csString); } } } #endregion #region //生成实现接口文件 #endregion } if (ckbBusiness.Checked) { selectedTables.ForEach(o => o.NameSpace = txtBusiness.Text.Trim()); } }
/// <summary> /// Gets the HTML. /// </summary> /// <returns></returns> private string GetHtml() { var html = File.ReadAllText(_file); return(Razor.Parse(html, _post)); }
/// <summary> /// 代码生成方法,所有的代码生成都在这里 /// </summary> /// <param name="currVO"></param> private void GenerateCodes(object obj) { if (!(obj is GenerateModel)) { return; } GenerateModel source = obj as GenerateModel; List <TemplateModel> items = source.Tables; string dbName = source.DbName; string dirFormatterVO = "Generators\\{1}\\{2}\\Codes\\VO\\{0}VO.cs"; string dirFormatterDAO = "Generators\\{1}\\{2}\\Codes\\DAO\\SqlServer\\{0}Provider.cs"; string dirFormatterBO = "Generators\\{1}\\{2}\\Codes\\BO\\{0}BO.cs"; string dirFormatterInterface = "Generators\\{1}\\{2}\\Codes\\DAO\\I{0}Provider.cs"; string dirFormatterSQL = "Generators\\{1}\\{2}\\SQLs\\USP_Save_{0}.sql"; string dateString = DateTime.Now.ToString("yyyy-MM-dd"); PutMessageToStatusStrip("Generating..."); int i = 0; foreach (TemplateModel currVO in items) { PutMessageToStatusStrip("Processing line " + (++i)); ShowProgressToStatusStrip(i * 100 / (items.Count + 1)); // 1.VO. using (StreamReader sr = new StreamReader("templates\\VO\\VO.cshtml", true)) { string output = HttpUtility.HtmlDecode(Razor.Parse <TemplateModel>(sr.ReadToEnd(), currVO)); SaveToFile(string.Format(dirFormatterVO, currVO.NameS, dateString, dbName), output); } // 2.DAO using (StreamReader sr = new StreamReader("templates\\DAO\\DAO.cshtml", true)) { string output = HttpUtility.HtmlDecode(Razor.Parse <TemplateModel>(sr.ReadToEnd(), currVO)); SaveToFile(string.Format(dirFormatterDAO, currVO.NameS, dateString, dbName), output); } // 3.BO using (StreamReader sr = new StreamReader("templates\\BO\\BO.cshtml", true)) { string output = HttpUtility.HtmlDecode(Razor.Parse <TemplateModel>(sr.ReadToEnd(), currVO)); SaveToFile(string.Format(dirFormatterBO, currVO.NameS, dateString, dbName), output); } // 5.Interface. using (StreamReader sr = new StreamReader("templates\\DAO\\Interface.cshtml", true)) { string output = HttpUtility.HtmlDecode(Razor.Parse <TemplateModel>(sr.ReadToEnd(), currVO)); SaveToFile(string.Format(dirFormatterInterface, currVO.NameS, dateString, dbName), output); } // 7.SQL using (StreamReader sr = new StreamReader("templates\\SQL\\Procedure.cshtml", true)) { string output = HttpUtility.HtmlDecode(Razor.Parse <TemplateModel>(sr.ReadToEnd(), currVO)); SaveToFile(string.Format(dirFormatterSQL, currVO.NameS, dateString, dbName), output); } } if (items.Count > 0) { GenerateBaseCodes(items[0], dbName); } ShowProgressToStatusStrip(100); PutMessageToStatusStrip("Codes generated."); MessageBox.Show("Codes generated."); HideProgressToStatusStrip(); }
public void Hook(IPipelines p) { // Use Pipeline Hook so that we can get information about the requests before performing action // with the data p.AfterRequest.AddItemToStartOfPipeline((ctx) => { if (_Events == null) { return; } var siteconfig = ctx.Items["CurrentSite"] as JObject; var user = ctx.CurrentUser as NcbUser; // this will not work when more than one person updating the site at the same time var events = _Events.ToList(); _Events = null; if (siteconfig.Property("watcher") == null) { return; // not configured } var watcher = siteconfig.Property("watcher").Value as JObject; var userIP = ctx.Request.UserHostAddress; Task.Run(() => { foreach (var item in events) { var datatype = watcher.Property(item.DataTypeName.ToLowerInvariant()); if (datatype == null) { continue; } var config = datatype.Value.ToObject <WatcherConfig>(); if (item.Action == "newAttachments") { if (config.autoPrintAttachment == true) { new DataWatcherHub().PrintDocument(item.AffectedRow); } continue; } if (config.version == true) { item.Database.UpsertRecord(new RowVersion() { Action = item.Action, js_Row = JsonConvert.SerializeObject(item.AffectedRow), UserId = user.Id, UserHostAddress = userIP, __createdAt = DateTime.Now, RowId = (int)item.AffectedRow.Id, DataType = item.DataTypeName }); } var emailConfig = config[item.Action]; if (emailConfig != null) { var autoGenPdfConfig = emailConfig.autoGeneratePDF; if (autoGenPdfConfig != null && autoGenPdfConfig.enable == true) { Object dataToClient = new { config = autoGenPdfConfig, data = item.AffectedRow, }; new DataWatcherHub().GenPDFandUpload(dataToClient); } if (emailConfig.enable) { var subject = Razor.Parse <DatabaseEvent>(emailConfig.emailSubject, item); var body = Razor.Parse <DatabaseEvent>(emailConfig.emailTemplate, item); MailSenderModule.SendEmail(emailConfig.sendTo, subject, body); } } } }); }); }
static void Main(string[] args) { SqlConnection cn = null; try { if (args.Length == 0) { throw new Exception("没有输入文件"); } var inputtxt = args[0]; var inputtxts = File.ReadAllLines(inputtxt); var dictionary = new Dictionary <string, string>(); var tableName = ""; foreach (var line in inputtxts) { var lineSplit = line.Split(':'); if (lineSplit.Length != 2) { continue; } switch (lineSplit[0].Trim().ToLower()) { case "tablename": tableName = lineSplit[1].Trim(); break; default: dictionary.Add(lineSplit[0].Trim(), lineSplit[1].Trim()); break; } } var tableNames = tableName.Split(','); if (!tableNames.Any()) { throw new Exception("TableName不能为空"); } var alllines = File.ReadAllLines(TemplateConfigPath); cn = DbHelper.GetConnection(); foreach (var tn in tableNames) { var dt = DbHelper.GetTableMsg(cn, null, tn); var tableMsgList = (from DataRow row in dt.Rows select new TableMsgModel(row)).ToList(); foreach (var line in alllines) { var lineParse = Razor.Parse(line, new { TableName = tn }); var lps = lineParse.Split('>'); if (lps.Length != 2) { continue; } //先获取模版的文件内容 var template = File.ReadAllText(TemplatePath + lps[0]); //转换为需要的内容 var parseTemplate = Razor.Parse(template, new { TableName = tn, Attr = dictionary, TableMsgList = tableMsgList, Helper = new RazorHelper() }); //放入设定的文件里面 WriteAllText(CurrentPath + lps[1], parseTemplate); } } Console.WriteLine("生成成功"); } catch (Exception e) { Console.WriteLine(e.Message); } finally { DbHelper.CloseConnection(cn); Console.ReadLine(); } }
public override void Consume(object sender, GetEntityEventArgs args) { string content = Razor.Parse(Template, args.CurrentEntity.ToDynamicObject()); _Writer.WriteLine(content); }
/// <summary> /// Create Email /// </summary> /// <typeparam name="T">Model of type BaseEmailModel</typeparam> /// <param name="templateName">f.e. LogError. Folders with same name will be added automatically</param> /// <param name="model">Model of type BaseEmailModel</param> /// <param name="subject">Will also be rendered</param> /// <param name="toAddress">Either just one address. More than one address must be seperated by ;</param> /// <param name="toDisplayName">Just in case of one address</param> /// <returns></returns> public Email Create <T>(string templateName, T model, string subject, string toAddress = null, string toDisplayName = null) { if (templateName == null) { throw new ArgumentNullException("templateName"); } if (string.IsNullOrEmpty(subject)) { throw new ArgumentNullException("subject"); } //Add directory if it is not already contained templateName = GetFullTemplateName(templateName); var email = CreateFromFile(templateName); var toAddressList = new List <Email.Address>(); if (toAddress != null) { if (toAddress.Contains(";")) { toAddress.Split(';').ToList().ForEach(t => toAddressList.Add(new Email.Address { Email = t })); } else { toAddressList.Add(new Email.Address { Email = toAddress, Name = toDisplayName }); } } if (email.To != null) { toAddressList.AddRange(email.To); } email.To = toAddressList.ToArray(); email.Subject = Razor.Parse(subject, model, subject); // razorEngine.RenderContentToString(email.Subject, model); if (email.Subject.Contains("\n")) { throw new ApplicationException("The subject line cannot contain any newline characters"); } foreach (var view in email.Views) { var viewTemplateName = templateName + "." + view.MediaType.Replace('/', '_'); var fileContent = Resolve(viewTemplateName); var templateExists = fileContent != null; view.Content = templateExists ? Razor.Parse(fileContent, model, viewTemplateName) : Razor.Parse(view.Content, model, viewTemplateName); //razorEngine.RenderContentToString(view.Content, model); } return(email); }
public ActionResult ForgotPassword(string userName, String captcha = "") { //validate the captcha through the session variable stored from GetCaptcha if (Session["CaptchaForgotPassword"] == null || Session["CaptchaForgotPassword"].ToString() != captcha) { TempData["Message"] = "Wrong sum, please try again."; return(View()); } else { //check user existance var user = Membership.GetUser(userName); if (user == null) { TempData["Message"] = "User Not exist."; } else { String token = ""; try { var userId = WebSecurity.GetUserId(userName); bool any = (from j in DbContext.WebpagesMemberships where (j.UserId == userId) select j).Any(); if (any) { //generate password token token = WebSecurity.GeneratePasswordResetToken(userName); } else { WebSecurity.CreateAccount(userName, GeneralHelper.GenerateRandomPassword(6)); //generate password token token = WebSecurity.GeneratePasswordResetToken(userName); } } catch (Exception ex) { Logger.Error(ex, "Exception is occured in ForgotPassword-Account controller." + ex.StackTrace, userName, captcha); } //create url with above token var resetPasswordUrl = Url.Action("ResetPassword", "Account", new { un = userName, rt = token }, "http"); var resetLink = "<a href='" + resetPasswordUrl + "'>Reset Password</a>"; // var mailTemplate = MailTemplateRepository.GetMailTemplatesByTemplateName("ForgotPassword"); // mailTemplate.Body = MailHelper.GetForgotPasswordMailTemplate(mailTemplate.Body, UserName, resetLink, resetPasswordUrl); try { String forgotPasswordEmailTemplate = ""; forgotPasswordEmailTemplate = System.IO.File.ReadAllText(Server.MapPath(@"~\Views\Shared\DisplayTemplates\ForgotPasswordEmail.cshtml")); var model = new { Email = userName, Link = resetLink, Url = resetPasswordUrl }; string subject = "Store Management Reset Password"; string body = Razor.Parse(forgotPasswordEmailTemplate, model); string fromAddress = "*****@*****.**"; string fromName = "*****@*****.**"; string toAddress = userName; string toName = userName; try { EmailSender.SendEmail(EmailAccount.GetAdminEmailAccount(), subject, body, fromAddress, fromName, toAddress, toName); TempData["Message"] = "Password Reset link is sent to your acccount.Please click the link in your mail to generate random password."; } catch (Exception ex) { TempData["Message"] = "Error:" + ex.Message; Logger.Error(ex, "Error:" + ex.StackTrace, userName, captcha); } } catch (Exception ex) { String m = "Error occured while sending email:" + ex.Message; TempData["Message"] = m; Logger.Error(ex); } } return(View()); } }
/// <summary> /// /// </summary> /// <param name="template"></param> /// <param name="model"></param> /// <returns></returns> public string Parse(string template, dynamic model) { return(Razor.Parse(template, model)); }
public string Execute(object model) { var result = Razor.Parse(_templateBody, model); return(result); }
public string GenerateMethod(VkMethodInfo method) { var model = new VkMethodViewModel(method); return(Razor.Parse(Template.Method, model)); }
/// <summary> /// Create subject text from template and data /// </summary> /// <param name="data"></param> public string SubjectParsed(dynamic data) { string sbj = Razor.Parse(this.Subject, data); return(sbj); }
//使用RazorEngine解析 \Themes\[PresentAreaKey]\CustomStyle\css-dark.xml 或 css-light.xml public override void ProcessRequest(HttpContext context) { string presentAreaKey = context.Request.QueryString.GetString("PresentAreaKey", string.Empty); long ownerId = context.Request.QueryString.Get <long>("OwnerId", 0); if (string.IsNullOrEmpty(presentAreaKey)) { WebUtility.Return404(context); } CustomStyle customStyle = null; if (ownerId > 0) { CustomStyleEntity entity = new CustomStyleService().Get(presentAreaKey, ownerId); if (entity == null) { WebUtility.Return404(context); } customStyle = entity.CustomStyle; //通过QueryString 传递PresentAreaKey、OwnerId 获取css (使用客户端缓存) DateTime lastModified = customStyle.LastModified.ToUniversalTime(); if (IsCacheOK(context, lastModified)) { WebUtility.Return304(context); return; } context.Response.Cache.SetCacheability(HttpCacheability.Private); context.Response.Cache.SetLastModified(lastModified); context.Response.Cache.SetETag(lastModified.Ticks.ToString()); context.Response.Cache.SetAllowResponseInBrowserHistory(true); context.Response.Cache.SetValidUntilExpires(true); } else { string customStyleJson = context.Request.QueryString.GetString("CustomStyle", string.Empty); bool isDark = context.Request.QueryString.GetBool("isDark", false); Dictionary <string, string> dictionary = Json.Decode <Dictionary <string, string> >(customStyleJson) ?? new Dictionary <string, string>(); customStyle = CustomStyle.New(); customStyle.IsDark = isDark; customStyle.DefinedColours = dictionary; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); //通过QueryString 传递PresentAreaKey、CustomStyle的json数据 获取css(自定义风格时使用,禁用客户端缓存) } dynamic model = new ExpandoObject(); if (customStyle.DefinedColours.ContainsKey(ColorLabel.PageBackground.ToString())) { model.PageBackground = customStyle.DefinedColours[ColorLabel.PageBackground.ToString()]; } else { model.PageBackground = "#f2e3bf"; } if (customStyle.DefinedColours.ContainsKey(ColorLabel.ContentBackground.ToString())) { model.ContentBackground = customStyle.DefinedColours[ColorLabel.ContentBackground.ToString()]; } else { model.ContentBackground = "#f8f0e6"; } if (customStyle.DefinedColours.ContainsKey(ColorLabel.BorderBackground.ToString())) { model.BorderBackground = customStyle.DefinedColours[ColorLabel.BorderBackground.ToString()]; } else { model.BorderBackground = "#ebe6d9"; } if (customStyle.DefinedColours.ContainsKey(ColorLabel.MainTextColor.ToString())) { model.MainTextColor = customStyle.DefinedColours[ColorLabel.MainTextColor.ToString()]; } else { model.MainTextColor = "#666"; } if (customStyle.DefinedColours.ContainsKey(ColorLabel.SubTextColor.ToString())) { model.SubTextColor = customStyle.DefinedColours[ColorLabel.SubTextColor.ToString()]; } else { model.SubTextColor = "#ccc"; } if (customStyle.DefinedColours.ContainsKey(ColorLabel.MainLinkColor.ToString())) { model.MainLinkColor = customStyle.DefinedColours[ColorLabel.MainLinkColor.ToString()]; } else { model.MainLinkColor = "#cc6673"; } if (customStyle.DefinedColours.ContainsKey(ColorLabel.SubLinkColor.ToString())) { model.SubLinkColor = customStyle.DefinedColours[ColorLabel.SubLinkColor.ToString()]; } else { model.SubLinkColor = "#efc0ca"; } string templateName = "css-dark"; if (customStyle.IsDark) { templateName = "css-light"; } XElement rootElement = XElement.Load(WebUtility.GetPhysicalFilePath(string.Format("~/Themes/{0}/Custom/css-{1}.xml", presentAreaKey, customStyle.IsDark ? "dark" : "light"))); try { //编译模板 string result = Razor.Parse(rootElement.Value, model, templateName); context.Response.Clear(); context.Response.ContentType = "text/css"; StreamWriter sw = new StreamWriter(context.Response.OutputStream, System.Text.Encoding.Default); sw.Write(result); sw.Flush(); } catch (Exception ex) { context.Response.Write(ex.ToString()); } }
public void Create() { Comprobante oComprobante; string pathXML = @"E:\ASP NET\ApplicationXMLtoPDF\ApplicationXMLtoPDF\xml\archivoXML4.xml"; XmlSerializer oSerializer = new XmlSerializer(typeof(Comprobante)); using (StreamReader reader = new StreamReader(pathXML)) { oComprobante = (Comprobante)oSerializer.Deserialize(reader); foreach (var oComplemento in oComprobante.Complemento) { foreach (var oComplementoInterior in oComplemento.Any) { if (oComplementoInterior.Name.Contains("TimbreFiscalDigital")) { XmlSerializer oSerializerComplemento = new XmlSerializer(typeof(TimbreFiscalDigital)); using (var readerComplemento = new StringReader(oComplementoInterior.OuterXml)) { oComprobante.TimbreFiscalDigital = (TimbreFiscalDigital)oSerializerComplemento.Deserialize(readerComplemento); } } } } } //Paso 2 Aplicando Razor y haciendo HTML a PDF string path = Server.MapPath("~") + "/"; string pathHTMLTemp = path + "miHTML.html";//temporal string pathHTPlantilla = path + "plantilla.html"; string sHtml = GetStringOfFile(pathHTPlantilla); string resultHtml = ""; resultHtml = Razor.Parse(sHtml, oComprobante); //Creamos el archivo temporal File.WriteAllText(pathHTMLTemp, resultHtml); GlobalConfig gc = new GlobalConfig(); gc.SetMargins(new Margins(100, 100, 100, 100)) .SetDocumentTitle("Test document") .SetPaperSize(PaperKind.Letter); // Create converter IPechkin pechkin = new SynchronizedPechkin(gc); // Create document configuration object ObjectConfig configuration = new ObjectConfig(); string HTML_FILEPATH = pathHTMLTemp; // and set it up using fluent notation too configuration .SetAllowLocalContent(true) .SetPageUri(@"file:///" + HTML_FILEPATH); // Generate the PDF with the given configuration // The Convert method will return a Byte Array with the content of the PDF // You will need to use another method to save the PDF (mentioned on step #3) byte[] pdfContent = pechkin.Convert(configuration); ByteArrayToFile(path + "prueba.pdf", pdfContent); //eliminamos el archivo temporal File.Delete(pathHTMLTemp); }
/// <summary> /// Create body from template and data /// </summary> /// <param name="data"></param> public string BodyParsed(dynamic data) { string body = Razor.Parse(this.Body, data); return(body); }
private void GenerateVerses(string path) { Razor.Compile(_versesTemplate, "versesTemplate"); for (int i = 1; i < _english.Books.Count + 1; i++) { string bookPath = path + Path.DirectorySeparatorChar + i; Directory.CreateDirectory(bookPath); Book englishBook = _english.Books[i - 1]; Book malayalamBook = _malayalam.Books[i - 1]; Book hindiBook = _hindi.Books[i - 1]; Log.Info("Generating " + englishBook.Name); for (int j = 1; j < englishBook.Chapters.Count + 1; j++) { string chapterPath = bookPath + Path.DirectorySeparatorChar + j; Directory.CreateDirectory(chapterPath); Chapter englishChapter = englishBook.Chapters[j - 1]; Chapter malayalamChapter = malayalamBook.Chapters[j - 1]; Chapter hindiChapter = hindiBook.Chapters[j - 1]; BookChapter bookChapter = new BookChapter(englishBook.Name + " " + englishChapter.Id); if (englishBook.Id == 1 && englishChapter.Id == 1) { bookChapter.HasBack = false; } else { int backBook = englishBook.Id; int backChapter = englishChapter.Id - 1; if (backChapter == 0) { backBook--; backChapter = Book.ChaptersPerBook[backBook]; } bookChapter.BackPath = string.Format("../../{0}/{1}/index.html", backBook, backChapter); } if (englishBook.Id == 66 && englishChapter.Id == 22) { bookChapter.HasForward = false; } else { int forwardBook = englishBook.Id; int forwardChapter = englishChapter.Id + 1; if (forwardChapter > Book.ChaptersPerBook[forwardBook]) { forwardBook++; forwardChapter = 1; } bookChapter.ForwardPath = string.Format("../../{0}/{1}/index.html", forwardBook, forwardChapter); } int maxVerses = Math.Max(Math.Max(englishChapter.Verses.Count, malayalamChapter.Verses.Count), hindiChapter.Verses.Count); for (int k = 0; k < maxVerses; k++) { BookChapterVerse verse = new BookChapterVerse(); if (k < englishChapter.Verses.Count) { verse.InEnglish = true; verse.English = englishChapter.Verses[k]; } if (k < malayalamChapter.Verses.Count) { verse.InMalayalam = true; verse.Malayalam = malayalamChapter.Verses[k]; } if (k < hindiChapter.Verses.Count) { verse.InHindi = true; verse.Hindi = hindiChapter.Verses[k]; } bookChapter.Verses.Add(verse); } string template = File.ReadAllText(_versesTemplate); string result = Razor.Parse(template, bookChapter); //string result = Razor.Run("versesTemplate", bookChapter); File.WriteAllText(chapterPath + Path.DirectorySeparatorChar + "index.html", result); } } }
public static string razorPlusParser(SerializableDictionary <string, string> projectStaticItemDic, SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > projectRepeaterDic, string template ) { string headTemplate; string result = null; if ((projectStaticItemDic != null && projectStaticItemDic.Count > 0) && (projectRepeaterDic != null && projectRepeaterDic.Count > 0)) { List <List <List <SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > > > > razorModel = new List <List <List <SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > > > >(); razorModel.Add(new List <List <SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > > >()); razorModel[0].Add(new List <SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > >()); razorModel[0][0].Add(new SerializableDictionary <string, Collection <SerializableDictionary <string, string> > >()); razorModel[0][0][0].Add("item", new Collection <SerializableDictionary <string, string> >()); razorModel[0][0][0]["item"].Add(new SerializableDictionary <string, string>()); razorModel[0][0][0]["item"][0] = projectStaticItemDic; razorModel.Add(new List <List <SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > > >()); razorModel[1].Add(new List <SerializableDictionary <string, Collection <SerializableDictionary <string, string> > > >()); razorModel[1][0].Add(projectRepeaterDic); headTemplate = _firstHeader + "var repeater = Model[1][0][0];" + "var TEXT = Model[0][0][0][\"item\"][0];" + "var text = Model[0][0][0][\"item\"][0];" + "var NUMBER = Model[0][0][0][\"item\"][0];" + "var number = Model[0][0][0][\"item\"][0];" + "var DATE = Model[0][0][0][\"item\"][0];" + "var date = Model[0][0][0][\"item\"][0];" + "var LIST = Model[0][0][0][\"item\"][0];" + "var list = Model[0][0][0][\"item\"][0]; }"; /*+ "PROJECT" + "project" + "DIRECTORY" + "directory" + "HIDE" + "hide" + "PATTERN" + "pattern";*/ string bodyTemplate = null; ////////////////////// if (!String.IsNullOrWhiteSpace(template)) { bodyTemplate = Regex.Replace(template, _itemToHidePattern, String.Empty); } ////////////////////// if (!String.IsNullOrWhiteSpace(bodyTemplate)) { bodyTemplate = Regex.Replace(bodyTemplate, _r_itemToHidePattern, String.Empty); } ////////////////////// string razorTemplate = headTemplate + Environment.NewLine + Environment.NewLine + bodyTemplate; /////////////////// // Parsing Start // /////////////////// result = Razor.Parse(razorTemplate, razorModel); /////////////////// // Parsing End // /////////////////// } else if (projectStaticItemDic != null && projectStaticItemDic.Count > 0) { headTemplate = _firstHeader + "var TEXT = Model;" + "var text = Model;" + "var NUMBER = Model;" + "var number = Model;" + "var DATE = Model;" + "var date = Model;" + "var LIST = Model;" + "var list = Model; }"; string bodyTemplate = null; if (!String.IsNullOrWhiteSpace(template)) { bodyTemplate = Regex.Replace(template, _itemToHidePattern, String.Empty); } if (!String.IsNullOrWhiteSpace(bodyTemplate)) { bodyTemplate = Regex.Replace(bodyTemplate, _r_itemToHidePattern, String.Empty); } string razorTemplate = headTemplate + Environment.NewLine + Environment.NewLine + bodyTemplate; /////////////////// // Parsing Start // /////////////////// result = Razor.Parse(razorTemplate, projectStaticItemDic); ///////////////// // Parsing End // ///////////////// } else if (projectRepeaterDic != null && projectRepeaterDic.Count > 0) { headTemplate = _firstHeader + "var repeater = Model;}"; string bodyTemplate = null; if (!String.IsNullOrWhiteSpace(template)) { bodyTemplate = Regex.Replace(template, _itemToHidePattern, String.Empty); } if (!String.IsNullOrWhiteSpace(bodyTemplate)) { bodyTemplate = Regex.Replace(bodyTemplate, _r_itemToHidePattern, String.Empty); } string razorTemplate = headTemplate + Environment.NewLine + Environment.NewLine + bodyTemplate; /////////////////// // Parsing Start // /////////////////// result = Razor.Parse(razorTemplate, projectRepeaterDic); ///////////////// // Parsing End // ///////////////// } return(result); }
public string RenderTemplate(object model) { var template = File.ReadAllText(path); return(Razor.Parse(template, model)); }
public void SendVolunteerReminders(int id, bool sendall) { var org = Db.LoadOrganizationById(id); var setting = new Registration.Settings(org.RegSetting, Db, org.OrganizationId); setting.org = org; var currmembers = from om in org.OrganizationMembers where (om.Pending ?? false) == false where om.MemberTypeId != CmsData.Codes.MemberTypeCode.InActive where org.Attends.Any(a => (a.MeetingDate <= DateTime.Today.AddDays(7) || sendall) && a.MeetingDate >= DateTime.Today && (a.Commitment == AttendCommitmentCode.Attending || a.Commitment == AttendCommitmentCode.Substitute) && a.PeopleId == om.PeopleId) select om; var subject = Util.PickFirst(setting.ReminderSubject, "no subject"); var message = Util.PickFirst(setting.ReminderBody, "no body"); if (subject == "no subject" || message == "no body") { throw new Exception("no subject or body"); } var notify = Db.StaffPeopleForOrg(org.OrganizationId).FirstOrDefault(); if (notify == null) { throw new Exception("no notify person"); } foreach (var om in currmembers) { var q = from a in org.Attends where a.PeopleId == om.PeopleId where a.Commitment == AttendCommitmentCode.Attending || a.Commitment == AttendCommitmentCode.Substitute where a.MeetingDate >= DateTime.Today orderby a.MeetingDate select a.MeetingDate; if (!q.Any()) { continue; } var details = Razor.Parse(@"@model IEnumerable<DateTime> <blockquote> <table> <tr> <td> Date </td> <td> Time </td> </tr> @foreach (var dt in Model) { <tr> <td>@dt.ToLongDateString()</td> <td>@dt.ToLongTimeString()</td> </tr> } </table> </blockquote>", q); var organizationName = org.OrganizationName; subject = Util.PickFirst(setting.ReminderSubject, "no subject"); message = Util.PickFirst(setting.ReminderBody, "no body"); string location = org.Location; message = MessageReplacements(om.Person, null, organizationName, location, message); message = message.Replace("{phone}", org.PhoneNumber.FmtFone7()); message = message.Replace("{details}", details); Db.Email(notify.FromEmail, om.Person, subject, message); } }
private static void GeneralCodeFile(string param) { try { if (string.IsNullOrEmpty(param)) { Console.WriteLine("param 参数不能为空"); return; } param = param.Replace("{", "").Replace("}", ""); string[] params1 = param.Split(','); Dictionary <string, string> paramDic = new Dictionary <string, string>(); for (int i = 0; i < params1.Length; i++) { string[] item = params1[i].Split(':'); if (item.Length == 2) { paramDic.Add(item[0].Trim(), item[1].Trim()); } else if (item.Length == 3)//防止出现这种"path:D:\\xx\xxx" { paramDic.Add(item[0].Trim(), item[1].Trim() + ":" + item[2].Trim()); } } string winFullName = paramDic["name"]; string shortName = winFullName.Replace("Window_", ""); /* */ Console.WriteLine("fullName ; " + winFullName); //Console.WriteLine(shortName); string template = File.ReadAllText(paramDic["templateFilePath"]); dynamic viewBag = new ExpandoObject(); viewBag.Name = shortName;// paramDic["name"]; string[] SubWinsStr = paramDic["SubWins"].Split('|'); string[] BtnsStr = paramDic["Btns"].Split('|'); string[] TxtsStr = paramDic["Txts"].Split('|'); string[] SpsStr = paramDic["Sps"].Split('|'); List <ExpandoObject> SubWinsObj = new List <ExpandoObject>(); List <ExpandoObject> BtnsObj = new List <ExpandoObject>(); List <ExpandoObject> TxtsObj = new List <ExpandoObject>(); List <ExpandoObject> SpsObj = new List <ExpandoObject>(); for (int i = 0; i < SubWinsStr.Length; i++) { if (string.IsNullOrEmpty(SubWinsStr[i])) { continue; } string[] items = SubWinsStr[i].Split('&'); dynamic itemObj = new ExpandoObject(); itemObj.Name = items[0]; itemObj.Path = items[1]; SubWinsObj.Add(itemObj); } for (int i = 0; i < BtnsStr.Length; i++) { if (string.IsNullOrEmpty(BtnsStr[i])) { continue; } string[] items = BtnsStr[i].Split('&'); dynamic itemObj = new ExpandoObject(); itemObj.Name = items[0]; itemObj.Path = items[1]; BtnsObj.Add(itemObj); } for (int i = 0; i < TxtsStr.Length; i++) { if (string.IsNullOrEmpty(TxtsStr[i])) { continue; } string[] items = TxtsStr[i].Split('&'); dynamic itemObj = new ExpandoObject(); itemObj.Name = items[0]; itemObj.Path = items[1]; TxtsObj.Add(itemObj); } for (int i = 0; i < SpsStr.Length; i++) { if (string.IsNullOrEmpty(SpsStr[i])) { continue; } string[] items = SpsStr[i].Split('&'); dynamic itemObj = new ExpandoObject(); itemObj.Name = items[0]; itemObj.Path = items[1]; SpsObj.Add(itemObj); } viewBag.SubWins = SubWinsObj; viewBag.Btns = BtnsObj; viewBag.Txts = TxtsObj; viewBag.Sps = SpsObj; string result = Razor.Parse(template, viewBag); if (result.Contains("<a>")) { result = result.Replace("<a>", "").Replace("</a>", ""); } string codePath = paramDic["codePath"]; string direc = codePath + @"\" + winFullName; if (!Directory.Exists(direc)) { Directory.CreateDirectory(direc); } codePath = direc + @"\" + paramDic["name"] + ".cs"; File.WriteAllText(codePath, result); Console.WriteLine(result); Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e.Message); } }
private async void FrmDatabase_Compile(DatabaseInfo database, List <Schemas.TableInfo> selectedTables, List <string> selectedTemplates, CompileTarget target, string outputFolder) { try { frmOutput.Clear(); frmOutput.DockState = WeifenLuo.WinFormsUI.Docking.DockState.DockBottom; Stopwatch sw = new Stopwatch(); sw.Start(); frmOutput.WriteLine("-----已启动生成-----"); frmOutput.WriteLine("正在读取数据库结构..."); var tableSchema = await database.ReLoadDatabaseSchema(); frmOutput.WriteLine("正在准备数据..."); var _selectTableNames = selectedTables.Select(t => t.ToString()).ToList(); var tables = tableSchema.Where(t => _selectTableNames.Contains(t.ToString())).ToList(); frmOutput.WriteLine("正在加载模板..."); var templates = new List <TemplateInfo>(); foreach (string tmpFile in selectedTemplates) { templates.Add(TemplateInfo.Get(tmpFile)); } frmOutput.WriteLine("正在生成..."); var singleTemplates = templates.Where(t => t.Config.isSingle); var entityTemplates = templates.Where(t => !t.Config.isSingle); if (singleTemplates.Any()) { var model = new DatabaseModel { DatabaseName = database.DatabaseName, Tables = tables }; foreach (var template in singleTemplates) { model.TemplateFile = template.Name; string fileName = ""; string content = Razor.Parse(template.Content, model); if (target == CompileTarget.File) { fileName = Path.Combine(outputFolder, template.Config.folder); fileName = Path.Combine(fileName, string.Format(template.Config.fileName, model.DatabaseName));// string.Format("{0}{1}", Path.GetFileNameWithoutExtension(template.Name), template.Config.fileName)); FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Write); byte[] bytes = System.Text.Encoding.UTF8.GetBytes(content); fs.Write(bytes, 0, bytes.Length); fs.Close(); } else { fileName = string.Format("{0}{1}", Path.GetFileNameWithoutExtension(template.Name), template.Config.fileName); CodeForm frmCode = new CodeForm(content); frmCode.Text = fileName; frmCode.Show(dockPanel); } frmOutput.WriteLine(string.Format(">{0}", fileName)); } } for (int i = 0; i < tables.Count; i++) { var table = tables[i]; var model = new TableModel { DatabaseName = database.DatabaseName, Table = table }; frmOutput.WriteLine(string.Format("{0}>{1}", i + 1, table.TableName)); foreach (var template in templates.Where(t => !t.Config.isSingle)) { model.TemplateFile = template.Name; string fileName = ""; string content = Razor.Parse(template.Content, model); if (target == CompileTarget.File) { fileName = Path.Combine(outputFolder, template.Config.folder); if (!Directory.Exists(fileName)) { Directory.CreateDirectory(fileName); } fileName = Path.Combine(fileName, string.Format(template.Config.fileName, table.TableName));// string.Format("{0}{1}", table.TableName, template.Config.fileName)); FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Write); byte[] bytes = System.Text.Encoding.UTF8.GetBytes(content); fs.Write(bytes, 0, bytes.Length); fs.Close(); } else { fileName = string.Format(template.Config.fileName, table.TableName);// string.Format("{0}{1}", table.TableName, template.Config.fileName); CodeForm frmCode = new CodeForm(content); frmCode.Text = fileName; frmCode.Show(dockPanel); } frmOutput.WriteLine(string.Format(">{0}", fileName)); } } sw.Stop(); frmOutput.WriteLine(string.Format("=====生成完成 总用时:{0} 毫秒=====", sw.ElapsedMilliseconds)); frmOutput.DockState = WeifenLuo.WinFormsUI.Docking.DockState.DockBottomAutoHide; } catch (Exception ex) { frmOutput.WriteLine("生成错误:" + ex.Message); } }
protected string GenerateFile(string template, Context context) { return(Razor.Parse(template, context)); }
public ActionResult Index() { var model = new RouteDebugViewModel { RouteInfos = new List <RouteInfo>() }; int position = 1; foreach (var route in RouteTable.Routes.Select(x => x as Route).Where(x => x != null)) { // issue: #33 Fix var httpMethodConstraint = (route.Constraints ?? new RouteValueDictionary())["httpMethod"] as HttpMethodConstraint; ICollection <string> allowedMethods = new string[] { }; if (httpMethodConstraint != null) { allowedMethods = httpMethodConstraint.AllowedMethods; } var namespaces = new string[] { }; if (route.DataTokens != null && route.DataTokens["namespaces"] != null) { namespaces = route.DataTokens["namespaces"] as string[]; } var defaults = new RouteValueDictionary(); if (route.Defaults != null) { defaults = route.Defaults; } if (route.DataTokens == null) { route.DataTokens = new RouteValueDictionary(); } var namedRoute = route as NamedRoute; var routeName = ""; if (namedRoute != null) { routeName = namedRoute.Name; } model.RouteInfos.Add(new RouteInfo { Position = position, HttpMethod = string.Join(" ", allowedMethods.ToArray()), Path = route.Url, Endpoint = defaults["controller"] + "#" + defaults["action"], Area = route.DataTokens["area"] as string, Namespaces = string.Join(" ", namespaces.ToArray()), Name = routeName }); position++; } var debugPath = (from p in model.RouteInfos where p.Endpoint.Equals("routedebug#resources", StringComparison.InvariantCultureIgnoreCase) select p.Path.Replace("{name}", string.Empty)).FirstOrDefault(); model.DebugPath = debugPath; var template = GetTemplate(); return(Content(Razor.Parse(template, model))); }
public string Parse <T>(string template, T model, bool isHtml = true) { return(Razor.Parse(template, model, template.GetHashCode().ToString())); }