public static void SendTestmail(string email, umbraco.cms.businesslogic.property.Property Property, string fromName, string fromEmail, bool IsHtml) { // version string version = Property.VersionId.ToString(); // Get document umbraco.cms.businesslogic.web.Document d = new umbraco.cms.businesslogic.web.Document(umbraco.cms.businesslogic.Content.GetContentFromVersion(Property.VersionId).Id); System.Web.HttpContext.Current.Items["pageID"] = d.Id; // Format mail string subject = d.Text; string sender = "\"" + fromName + "\" <" + fromEmail + ">"; // Get template System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(sw); umbraco.template t = new template(d.Template); t.ParseWithControls(new umbraco.page(d.Id, d.Version)).RenderControl(writer); // Embedded emails ;) added by DB, 2005-10-04 EmailMessage message = mailerHelper.CreateEmbeddedEmail(sb.ToString(), Cms.BusinessLogic.web.Document.GetContentFromVersion(Property.VersionId).Id); message.FromAddress = new EmailAddress(fromEmail, fromName); message.ToAddresses.Add(new EmailAddress(email)); message.Subject = subject; message.Send(new SmtpServer(GlobalSettings.SmtpServer)); }
private void RptBind() { DataTable dataTable = new DataTable(); dataTable.Columns.Add("skinname", Type.GetType("System.String")); dataTable.Columns.Add("name", Type.GetType("System.String")); dataTable.Columns.Add("img", Type.GetType("System.String")); dataTable.Columns.Add("author", Type.GetType("System.String")); dataTable.Columns.Add("createdate", Type.GetType("System.String")); dataTable.Columns.Add("version", Type.GetType("System.String")); dataTable.Columns.Add("fordntver", Type.GetType("System.String")); foreach (DirectoryInfo directory in new DirectoryInfo(Utils.GetMapPath("../../templates/")).GetDirectories()) { DataRow row = dataTable.NewRow(); template info = this.GetInfo(directory.FullName); if (info != null) { row["skinname"] = (object)directory.Name; row["name"] = (object)info.name; row["img"] = (object)("../../templates/" + directory.Name + "/about.png"); row["author"] = (object)info.author; row["createdate"] = (object)info.createdate; row["version"] = (object)info.version; row["fordntver"] = (object)info.fordntver; dataTable.Rows.Add(row); } } this.rptList.DataSource = (object)dataTable; this.rptList.DataBind(); }
/// <summary> /// 打印订单数据 /// </summary> /// <param name="template"></param> /// <returns></returns> private string PrintOrderData(string OrderNo, template template) { string templatepath = Request.MapPath(string.Format(@"\portal\Print\template\{0}.html", template.ToString())); string templatehtml = ReadFileHelp.GetTemplet(Convert.ToInt32(template), templatepath); using (ProxyBE p = new ProxyBE()) { SearchResult sr = p.Client.SearchPrintOrderData(null, OrderNo); if (sr.Total > 0) { foreach (DataRow row in sr.DataSet.Tables[0].Rows) { string OutOrderNo = GetDataRow(row, "OutOrderNo"); string OrderType = GetDataRow(row, "OrderType"); string CabinetType = GetDataRow(row, "CabinetType"); string BookingDate = GetDataRow(row, "BookingDate"); string ShipDate = GetDataRow(row, "ShipDate"); string CustomerName = GetDataRow(row, "CustomerName"); string PartnerName = GetDataRow(row, "PartnerName"); templatehtml = templatehtml .Replace("{OutOrderNo}", OutOrderNo) .Replace("{OrderType}", OrderType) .Replace("{CabinetType}", CabinetType) .Replace("{BookingDate}", !string.IsNullOrEmpty(BookingDate) ? DateTime.Parse(BookingDate).ToString("yyyy-MM-dd") : string.Empty) .Replace("{ShipDate}", !string.IsNullOrEmpty(ShipDate) ? DateTime.Parse(ShipDate).ToString("yyyy-MM-dd") : string.Empty) .Replace("{BarcodeNo}", OutOrderNo) .Replace("{CustomerName}", GetPartnerName(PartnerName, CustomerName)); } } } return(templatehtml); }
private template GetInfo(string xmlPath) { template template = new template(); if (!File.Exists(xmlPath + "\\about.xml")) { return((template)null); } try { foreach (XmlNode readNode in XmlHelper.ReadNodes(xmlPath + "\\about.xml", "about")) { if (readNode.NodeType != XmlNodeType.Comment && readNode.Name.ToLower() == "template") { template.name = readNode.Attributes["name"] != null ? readNode.Attributes["name"].Value.ToString() : ""; template.author = readNode.Attributes["author"] != null ? readNode.Attributes["author"].Value.ToString() : ""; template.createdate = readNode.Attributes["createdate"] != null ? readNode.Attributes["createdate"].Value.ToString() : ""; template.version = readNode.Attributes["version"] != null ? readNode.Attributes["version"].Value.ToString() : ""; template.fordntver = readNode.Attributes["fordntver"] != null ? readNode.Attributes["fordntver"].Value.ToString() : ""; } } } catch { return((template)null); } return(template); }
public Template add(Template t) { template tt = new template(); tt.ad_interval = t.ad_interval; tt.bgcolor = t.bgcolor; tt.bgimage = t.bgimage; tt.event_id = t.event_id; tt.orientation = t.orientation; tt.overlay = t.overlay; tt.overlay_font = t.overlay_font; tt.overlay_font_color = t.overlay_font_color; tt.resolution = t.resolution; tt.rotate_ads = t.rotate_ads; tt.title = t.title; tt.t_hashtag = t.t_hashtag; tt.t_username = t.t_username; tt.video = t.video; db.templates.InsertOnSubmit(tt); db.SubmitChanges(); t.id = tt.id; return(t); }
/// <summary> /// Add the bomb pickup to the pickup array /// </summary> public void AddBombPickup() { template bomb = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { Instantiate(bombExplosion, obj.transform.position, obj.transform.rotation); // Get all the objects in a <ExplosionRadius> radius from where the bullet collided Collider[] hitColliders = Physics.OverlapSphere( transform.position, PowerUpManager.Instance.BombRadius, PowerUpManager.Instance.BombLayer); PopUpText.Instance.NewPopUp("Nuke!"); // For every object in the explosion for (int i = 0; i < hitColliders.Length; ++i) { if (hitColliders[i]) { // Try and find an EnemyHealth script on the gameobject hit. EnemyStats enemyHealth = hitColliders[i].gameObject.GetComponentInParent <EnemyStats>(); // If the EnemyHealth component exist... if (enemyHealth != null) { // ... the enemy should take damage. enemyHealth.TakeDamage((int)PowerUpManager.Instance.BombDamage); } } } } }; this.Type[6] = bomb; SystemLogger.write("Bomb Pickup Initialized"); }
/// <summary> /// Add the shield pickup to the pickup array /// </summary> public void AddShieldPickup() { template shieldPickup = (obj) => { // If the shield isn't already active if (!PowerUpManager.Instance.Powerups["Shield"].IsActive) { PopUpText.Instance.NewPopUp("Force Field!"); // Make a shield around the player. This may change from my shitty particle effect GameObject shield = Instantiate(PowerUpManager.Instance.ShieldModel, obj.transform.position, obj.transform.rotation) as GameObject; // Parent the shield to the player shield.transform.parent = obj.transform; // Resize the shield to look like it's around the player. shield.transform.localScale = new Vector3( PowerUpManager.Instance.ShieldResizer, PowerUpManager.Instance.ShieldResizer, PowerUpManager.Instance.ShieldResizer); // Start the particle system shield.GetComponent <ParticleSystem>().Play(); } // Activate the shield power up PowerUpManager.Instance.Activate("Shield"); }; this.Type[7] = shieldPickup; SystemLogger.write("Shield Pickup Initialized"); }
template get_template(StreamReader file, out bool is_template) { string _line = file.ReadLine(); Regex rx = new Regex(@"^<!---template$", RegexOptions.Compiled | RegexOptions.IgnoreCase); MatchCollection matches = rx.Matches(_line); template template = new template(); if (matches.Count != 0) { _line = file.ReadLine(); is_template = true; while (!match_regex(@"-->$", _line)) { try { template.content[template.Length] = _line; _line = file.ReadLine(); template.Length++; } catch (IndexOutOfRangeException) { error_exeption.warning(String.Format("Le template fournis a plus de paramètre que le maximum prévu par le programme, vérifier votre template ou mettez a jours cette application. Seul les {0} premiers paramètres seronts pris en compte", template.Length)); break; } } } else { is_template = false; error_exeption.info("Aucun template n'a été trouvé"); } return(template); }
static bool compile_template(template template) { foreach (string i in template.content) { Console.WriteLine(i); } return(true); }
public TemplateView(template origianl) { this.id = origianl.id; this.name = origianl.name; this.description = origianl.description; this.templateContent = origianl.templateContent; this.templateType = origianl.templateType; this.fileNamePrefix = origianl.fileNamePrefix; }
public Boolean delete(Int32 id) { template t = db.templates.Single(x => x.id == id); db.templates.DeleteOnSubmit(t); db.SubmitChanges(); return(true); }
/// <summary> /// Thread body /// </summary> /// <param name="state"></param> private void StartWork(object state) { TemplateView templateView = state as TemplateView; template savedTemplate = null; template theTemplate = new template(); templateView.Merge(theTemplate, editMode); AutoResetEvent nextOneAutoResetEvent = new AutoResetEvent(false); EventHandler <save_TemplateCompletedEventArgs> h1 = (s, e) => { // TODO: handle error from server side savedTemplate = e.Result; nextOneAutoResetEvent.Set(); }; Globals.WSClient.save_TemplateCompleted += h1; Globals.WSClient.save_TemplateAsync(theTemplate); nextOneAutoResetEvent.WaitOne(); Globals.WSClient.save_TemplateCompleted -= h1; // Check return result. If failure, savedCategory will be null if (savedTemplate != null) { this.Dispatcher.BeginInvoke(delegate() { templateView.Restore(new TemplateView(savedTemplate)); }); } else { // Show error message ShopproHelper.ShowMessageWindow(this, "Error", "Fail to save this entry.", false); // Back to readonly mode this.Dispatcher.BeginInvoke(delegate() { // Restore cached UI data templateView.CancelEdit(); this.dataForm.CancelEdit(); }); } // No unsaved item this.editMode = DataFormMode.ReadOnly; // Hide busy indicator ShopproHelper.HideBusyIndicator(this); // Go to original page if necessary if (this.ContentPageCtx.GotoAddNewPage) { ShopproHelper.GoBack(this); } }
public IHttpActionResult AddData(template templateobj) { AuthDetails authdet = LoginUserDetails(); templateobj.userid = authdet.UserId; templateobj.CreatedBy = authdet.UserId; templateobj.UpdatedBy = authdet.UserId; var result = service.Add(templateobj); return(Ok(result)); }
static void print_template(template template) { for (int i = 0; i < template.Length; i++) { if (template.content[i] == null) { break; } Console.WriteLine(template.content[i]); } }
/// <summary> /// 统一处理传递的参数请求 /// </summary> /// <param name="template"></param> /// <returns></returns> private string GetPrintHtml(string template) { string PrintHtml = string.Empty; template templateEn = (template)Enum.Parse(typeof(template), template); //包装和产品条码 if (templateEn == Utility.Enum.template.package || templateEn == Utility.Enum.template.cabinet) { string Barcode = Request["Barcode"]; string WorkingID = Request["WorkingID"]; string[] ArrayBarcode = Barcode.TrimEnd(',').Split(','); string[] ArrayWorkingID = WorkingID.TrimEnd(',').Split(','); for (int i = 0; i < ArrayBarcode.Length; i++) { PrintHtml += "<div class=\"qrcodetable\">";//解决连续打印 using (ProxyBE p = new ProxyBE()) { OrderWorkFlow model = p.Client.GetOrderWorkFlow(null, new Guid(ArrayWorkingID[i])); if (model.WorkFlowNo == 1) { PrintHtml += PrintCabinetData(ArrayBarcode[i], ArrayWorkingID[i], Utility.Enum.template.cabinet); } else { PrintHtml += PrintPackageData(ArrayBarcode[i], ArrayWorkingID[i], templateEn); } } PrintHtml += "</div>"; } } //订单条码 else if (templateEn == Utility.Enum.template.order) { string OrderNo = Request["OrderNo"]; int printnumber = !string.IsNullOrEmpty(Request["printnumber"]) ? int.Parse(Request["printnumber"]) : 1;//打印份数 string[] ArrayBarcode = OrderNo.TrimEnd(',').Split(','); for (int j = 0; j < printnumber; j++) { for (int i = 0; i < ArrayBarcode.Length; i++) { PrintHtml += "<div class=\"qrcodetable\">"; PrintHtml += PrintOrderData(ArrayBarcode[i], templateEn); PrintHtml += "</div>"; } } } return(PrintHtml); }
/// <summary> /// Add the score multiplier to the pickup array /// </summary> public void AddScoreMultiplierPickup() { template pickupThree = (obj) => { GameObject multi = new GameObject(); multi.AddComponent <ScoreMulti>(); PopUpText.Instance.NewPopUp("Multiplier!"); }; this.Type[2] = pickupThree; SystemLogger.write("Score Multiplier Pickup Initialized"); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { template theBrand = (template)value; return(theBrand.name); } else { return(null); } }
//Helper method to replace umbraco tags that breaks the xml format.. public static string parseToValidXml(template.Template templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid) { string retVal = template; if (toValid) { // test for asp:content as the first part of the design if (retVal.StartsWith("<asp:content", StringComparison.OrdinalIgnoreCase)) { hasAspNetContentBeginning = true; retVal = retVal.Substring(retVal.IndexOf(">") + 1); retVal = retVal.Substring(0, retVal.Length - 14); } //shorten empty macro tags.. retVal = retVal.Replace("></umbraco:macro>", " />"); retVal = retVal.Replace("></umbraco:Macro>", " />"); retVal = retVal.Replace("<umbraco:", "<umbraco__"); retVal = retVal.Replace("</umbraco:", "</umbraco__"); retVal = retVal.Replace("<asp:", "<asp__"); retVal = retVal.Replace("</asp:", "</asp__"); retVal = retVal.Replace("?UMBRACO_GETITEM", "UMBRACO_GETITEM"); retVal = retVal.Replace("?UMBRACO_TEMPLATE_LOAD_CHILD", "UMBRACO_TEMPLATE_LOAD_CHILD"); retVal = retVal.Replace("?UMBRACO_MACRO", "UMBRACO_MACRO"); retVal = retVal.Replace("?ASPNET_FORM", "ASPNET_FORM"); retVal = retVal.Replace("?ASPNET_HEAD", "ASPNET_HEAD"); } else { retVal = retVal.Replace("<umbraco__", "<umbraco:"); retVal = retVal.Replace("</umbraco__", "</umbraco:"); retVal = retVal.Replace("<asp__", "<asp:"); retVal = retVal.Replace("</asp__", "</asp:"); retVal = retVal.Replace("UMBRACO_GETITEM", "?UMBRACO_GETITEM"); retVal = retVal.Replace("UMBRACO_TEMPLATE_LOAD_CHILD", "?UMBRACO_TEMPLATE_LOAD_CHILD"); retVal = retVal.Replace("UMBRACO_MACRO", "?UMBRACO_MACRO"); retVal = retVal.Replace("ASPNET_FORM", "?ASPNET_FORM"); retVal = retVal.Replace("ASPNET_HEAD", "?ASPNET_HEAD"); retVal = retVal.Replace("<root>", ""); retVal = retVal.Replace("<root xmlns:asp=\"http://microsoft.com\">", ""); retVal = retVal.Replace("</root>", ""); // add asp content element if (hasAspNetContentBeginning) { retVal = templateObj.GetMasterContentElement(templateObj.MasterTemplate) + retVal + "</asp:content>"; } } return retVal; }
public converter(StreamReader file) { //On sais ici que le fichier existe et qu'il est dans le bon format bool is_template; template template = get_template(file, out is_template); if (is_template) { bool good_compiling = compile_template(template); } }
public Stats() { InitializeComponent(); client = new Service1Client(); // Define current_stats // It will help transfer default template points to characteristics // The final user template will include sums up current_stats and default template // Therefore, the race and the class-level templates are to be added after current_stats = new template(); current_stats.characteristics = client.GetCharacteristics(0); }
private void _addStringToHtmlElement(template.Template tmp, string value, string templateAlias, string htmlElementId, string position) { bool hasAspNetContentBeginning = false; string design = ""; string directive = ""; if (tmp != null) { try { XmlDocument templateXml = new XmlDocument(); templateXml.PreserveWhitespace = true; //Make sure that directive is remove before hacked non html4 compatiple replacement action... design = tmp.Design; splitDesignAndDirective(ref design, ref directive); //making sure that the template xml has a root node... if (tmp.MasterTemplate > 0) templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, "<root>" + design + "</root>", true)); else templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); XmlNode xmlElement = templateXml.SelectSingleNode("//* [@id = '" + htmlElementId + "']"); if (xmlElement != null) { if (position == "beginning") { xmlElement.InnerXml = "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n" + xmlElement.InnerXml; } else { xmlElement.InnerXml = xmlElement.InnerXml + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n"; } } tmp.Design = directive + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); tmp.Save(); } catch (Exception ex) { LogHelper.Error<addStringToHtmlElement>("An error occurred", ex); } } else { LogHelper.Debug<addStringToHtmlElement>("template not found"); } }
/// <summary> /// Add the speed boost pickup to the pickup array /// </summary> public void AddSpeedBoostPickup() { template speedPickup = (obj) => { // Activate the speed boost power up PowerUpManager.Instance.Activate("SpeedBoost"); PopUpText.Instance.NewPopUp("Speed Boost!"); }; // Add them to the array this.Type[8] = speedPickup; SystemLogger.write("Speed Pickup Initialized"); }
/// <summary> /// Add the rocket pickup to the pickup array /// </summary> public void AddRocketPickup() { template pickupOne = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PickupCache.Instance.Rocket.GetComponent <Weapon>().ammo += 5; PopUpText.Instance.NewPopUp("Rocket Ammo!"); } }; this.Type[0] = pickupOne; SystemLogger.write("Rocket Pickup Initialized"); }
/// <summary> /// Поиск шаблона среди сохранённых /// </summary> /// <param name="temp_arr">Массив шаблона</param> /// <param name="temps">Коллекция сохранённых шаблонов</param> /// <returns>Цифра, соответствующая шаблону, иначе -1</returns> public template find_template(int[] temp_arr, List <template> temps) { template res = null; foreach (var temp in temps) { if (temp.data_arr.SequenceEqual(temp_arr)) { res = temp; break; } } return(res); }
/// <summary> /// Add the mine pickup to the pickup array /// </summary> public void AddMinePickup() { template minePickup = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PickupCache.Instance.Mine.GetComponent <Weapon>().ammo += 3; PopUpText.Instance.NewPopUp("Mine Ammo!"); } }; this.Type[3] = minePickup; SystemLogger.write("Mine Pickup Initialized"); }
/// <summary> /// Add the multishot pickup to the pickup array /// </summary> public void AddMultishotPickup() { template multiPickup = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PowerUpManager.Instance.Activate("Multishot"); PopUpText.Instance.NewPopUp("Multi Shot!"); } }; this.Type[4] = multiPickup; SystemLogger.write("Multishot Pickup Initialized"); }
/// <summary> /// Add the damage multiplier pickup to the pickup array /// </summary> public void AddDamageMultiplierPickup() { template dmgPickup = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PowerUpManager.Instance.Activate("DamageUp"); PopUpText.Instance.NewPopUp("Double Damage!"); } }; this.Type[5] = dmgPickup; SystemLogger.write("Damage Multiplier Pickup Initialized"); }
/// <summary> /// Creates a checklist class from an item record in TE /// </summary> /// <remarks> /// Mapping info: /// checklistid = ChecklistTemplateItemCkey /// </remarks> /// <param name="dr">item record with information for a checklist</param> /// <DeprecatedItems>DefaultTemplateVersion is deprecated</DeprecatedItems> /// <returns>a checklist class for the specific item</returns> private template MapTemplate(DataRow dr) { Boolean required = dr["Restrictions"].ToString().Contains("optional") ? false : true; //rlm 2015_12_11 changed to better reflect optionality template a = _srTmpTreeBuilder.MapTemplate( Convert.ToDecimal(dr["ChecklistTemplateVersionCkey"]), dr["ChecklistCKey"].ToString(), //DefaultTemplateVersion, //rlm: not used required, dr["VersionID"].ToString(), //templatexmlversion dr["CurrentFileName"].ToString(), //rlm: added 2105_12_10 dr["ReleaseVersionSuffix"].ToString()); a.templateheader = MapTemplateHeader(dr); return(a); }
/// <summary> /// Add the laser beam pickup to the pickup array /// </summary> public void AddLaserBeamPickup() { SystemLogger.write("Laser beam collision"); template pickupTwo = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PickupCache.Instance.LaserBeam.GetComponent <Weapon>().ammo += 3; PopUpText.Instance.NewPopUp("Laser Ammo!"); } }; this.Type[1] = pickupTwo; SystemLogger.write("Laser Beam Pickup Initialized"); }
/// <summary> /// 打印包装数据 /// </summary> /// <param name="Barcode"></param> /// <param name="WorkingID"></param> /// <returns></returns> private string PrintPackageData(string Barcode, string WorkingID, template template) { string templatepath = Request.MapPath(string.Format(@"\portal\Print\template\{0}.html", template.ToString())); string templatehtml = ReadFileHelp.GetTemplet(Convert.ToInt32(template), templatepath); using (ProxyBE p = new ProxyBE()) { SearchResult sr = p.Client.SearchPrintCabinetData(null, Barcode); if (sr.Total > 0) { foreach (DataRow row in sr.DataSet.Tables[0].Rows) { string OrderNo = GetDataRow(row, "OrderNo"); string CabinetName = GetDataRow(row, "CabinetName"); string MaterialStyle = GetDataRow(row, "MaterialStyle"); string Color = GetDataRow(row, "Color"); string Size = GetDataRow(row, "Size"); string CustomerName = GetDataRow(row, "CustomerName"); string PartnerName = GetDataRow(row, "PartnerName"); string BarcodeNo = GetDataRow(row, "BarcodeNo"); string OrderID = GetDataRow(row, "OrderID"); string CabinetCode = GetDataRow(row, "CabinetCode"); string GroupNumber = GetDataRow(row, "GroupNumber"); templatehtml = templatehtml .Replace("{OrderNo}", OrderNo) .Replace("{CabinetName}", CabinetName) .Replace("{MaterialStyle}", MaterialStyle) .Replace("{Color}", Color) .Replace("{Size}", Size) .Replace("{GroupNumber}", GroupNumber) .Replace("{CabinetCode}", CabinetCode) .Replace("{BarcodeNo}", BarcodeNo) .Replace("{CustomerName}", GetPartnerName(PartnerName, CustomerName)); //更新打印记录 //if (!string.IsNullOrEmpty(Request["isconfig"])) p.Client.UpdateOrderWorkFlowByPrintCount(null, new Guid(WorkingID), new Guid(OrderID)); } } } return(templatehtml); }
public static template Get(string dir) { template _temp = new template(); XmlNodeList xnl = GetConfig(dir).SelectSingleNode("about").ChildNodes; foreach (XmlNode xnf in xnl) { XmlElement xe = (XmlElement)xnf; _temp.ID = xe.GetAttribute("ID"); _temp.Name = xe.GetAttribute("name"); _temp.Author = xe.GetAttribute("author"); _temp.Createdate = xe.GetAttribute("createdate"); _temp.IsAgent = xe.GetAttribute("isAgent"); _temp.Copyright = xe.GetAttribute("copyright"); _temp.Photo = _temp.ID + "/about.jpg"; _temp.Bigphoto = _temp.ID + "/bigabout.jpg"; } return(_temp); }
/// <summary> /// View -> Model /// </summary> /// <param name="origianl"></param> public void Merge(template original, DataFormMode editMode) { if (editMode == DataFormMode.Edit) { original.id = this.id; original.idSpecified = true; } else { original.idSpecified = false; } original.name = this.name; original.description = this.description; original.fileNamePrefix = this.fileNamePrefix; original.templateContent = this.templateContent; original.templateType = this.templateType; original.templateTypeSpecified = true; }
/// <summary> /// Serialise to XML. /// </summary> /// <returns></returns> private bool SerializeEquipmentTypeTemplate(template template, string equipmenttype) { var ns = new XmlSerializerNamespaces(); ns.Add("", ""); //foreach output to xml .output template to xml. if (template == null) { return(false); } XmlSerializer xs = new XmlSerializer(typeof(template)); using (var txtwriter = new StreamWriter(outputpath + "\\" + equipmenttype + ".xml", false, Encoding.UTF8)) { xs.Serialize(txtwriter, template, ns); } return(true); }
public XRootNamespace(template root) { this.doc = new XDocument(root.Untyped); this.rootObject = root; }
public static void SendMail(umbraco.cms.businesslogic.member.MemberGroup Group, umbraco.cms.businesslogic.property.Property Property, string fromName, string fromEmail, bool IsHtml) { // Create ArrayList with emails who've received the e-mail ArrayList sent = new ArrayList(); // set timeout System.Web.HttpContext.Current.Server.ScriptTimeout = 43200; // 12 hours // version string version = Property.VersionId.ToString(); // Get document umbraco.cms.businesslogic.web.Document d = new umbraco.cms.businesslogic.web.Document(umbraco.cms.businesslogic.Content.GetContentFromVersion(Property.VersionId).Id); int id = d.Id; System.Web.HttpContext.Current.Items["pageID"] = id; // Format mail string subject = d.Text; string sender = "\"" + fromName + "\" <" + fromEmail + ">"; // Get template System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(sw); umbraco.template t = new template(d.Template); t.ParseWithControls(new umbraco.page(d.Id, d.Version)).RenderControl(writer); EmailMessage message = mailerHelper.CreateEmbeddedEmail(sb.ToString(), Cms.BusinessLogic.web.Document.GetContentFromVersion(Property.VersionId).Id); message.FromAddress = new EmailAddress(fromEmail, fromName); message.Subject = subject; SmtpServer smtpServer = new SmtpServer(GlobalSettings.SmtpServer); // Bulk send mails int counter = 0; System.Text.StringBuilder sbStatus = new System.Text.StringBuilder(); sbStatus.Append("The Newsletter '" + d.Text + "' was starting at " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\n"); using(SqlDataReader dr = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(umbraco.GlobalSettings.DbDSN, CommandType.Text, "select text, email from cmsMember inner join umbracoNode node on node.id = cmsMember.nodeId inner join cmsMember2memberGroup on cmsmember.nodeId = cmsMember2MemberGroup.member where memberGroup = @memberGroupId", new SqlParameter("@memberGroupId", Group.Id))) { while(dr.Read()) { try { if (!sent.Contains(dr["email"].ToString())) { message.ToAddresses.Clear(); message.ToAddresses.Add(new EmailAddress(dr["email"].ToString(), dr["text"].ToString())); message.Send(smtpServer); // add to arraylist of receiptients sent.Add(dr["email"].ToString()); // Append to status sbStatus.Append("Sent to " + dr["text"].ToString() + " <" + dr["email"].ToString() + "> \n\r"); } else { // Append to status sbStatus.Append("E-mail has already been sent to email '" + dr["email"].ToString() + ". You have a duplicate member: " + dr["text"].ToString() + " <" + dr["email"].ToString() + "> \n\r"); } } catch(Exception ee) { sbStatus.Append("Error sending to " + dr["text"].ToString() + " <" + dr["email"].ToString() + ">: " + ee.ToString() + " \n"); } // For progress bar counter++; if(counter % 5 == 0) { System.Web.HttpContext.Current.Application.Lock(); System.Web.HttpContext.Current.Application["ultraSimpleMailerProgress" + id.ToString() + "Done"] = counter; System.Web.HttpContext.Current.Application.UnLock(); } } } sbStatus.Append("Finished at " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\n"); // Send status mail library.SendMail(fromEmail, fromEmail, "Newsletter status", sbStatus.ToString(), false); }
public template GetTemplate(uint id_template) { template new_template = new template(); string query_template = @"SELECT id_template, name, description FROM DnD.template WHERE id_template=" + id_template; var characteristics = GetTemplateCharacteristics(id_template); if (OpenConnection()) { // Get the proper values of this template (classic structure: uid,name,description) MySqlCommand cmd_tpl = new MySqlCommand(query_template, connection); MySqlDataReader dataReader_tpl = cmd_tpl.ExecuteReader( System.Data.CommandBehavior.SingleResult); //List<uint> id_tmp_charac = new List<uint>(); if (dataReader_tpl.HasRows) { while (dataReader_tpl.Read()) { new_template.uid = id_template; new_template.name = dataReader_tpl.IsDBNull(1) ? null : dataReader_tpl.GetString(1); new_template.description = dataReader_tpl.IsDBNull(2) ? null : dataReader_tpl.GetString(2); //id_tmp_charac.Add(dataReader_tpl.GetUInt32()); //new_template.characteristics = characteristics; } } dataReader_tpl.Close(); new_template.characteristics = GetTemplateCharacteristics(id_template); CloseConnection(); } // Returned the now completed template structure return new_template; }
private void _removeStringFromHtmlElement(template.Template tmp, string value, string templateAlias, string htmlElementId) { bool hasAspNetContentBeginning = false; string design = ""; string directive = ""; if (tmp != null) { try { XmlDocument templateXml = new XmlDocument(); templateXml.PreserveWhitespace = true; //Make sure that directive is remove before hacked non html4 compatiple replacement action... design = tmp.Design; splitDesignAndDirective(ref design, ref directive); //making sure that the template xml has a root node... if (tmp.MasterTemplate > 0) templateXml.LoadXml( helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, "<root>" + design + "</root>", true)); else templateXml.LoadXml( helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); XmlNode xmlElement = templateXml.SelectSingleNode("//* [@id = '" + htmlElementId + "']"); if (xmlElement != null) { string repValue = helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true); xmlElement.InnerXml = xmlElement.InnerXml.Replace(repValue , ""); } tmp.Design = directive + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); tmp.Save(); } catch (Exception ex) { umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString() ); } } else { umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "template not found"); } }