public BLResponse<Sale> SendSalesRepo(SendSales request, BLRequest blRequest){ var res = new BLResponse<Sale>(); var mailTarget = request.Email; //MailTarget(blRequest); var sales = GetSalesFromRepo(request, blRequest); var gsbv = (from g in sales group g by g.Vendor into r select new SalesByVendor { Vendor= r.Key, Total= r.Sum(p=>p.Price) }).OrderByDescending(f=>f.Total).ToList(); HtmlDiv div = new HtmlDiv(); var gridSalesByVendor =BuildSalesByVendorGrid(gsbv, mailTarget); div.AddHtmlTag(gridSalesByVendor); div.AddHtmlTag( new HtmlLineBreak()); foreach(var sv in gsbv ){ div.AddHtmlTag(( BuildDetails(sv.Vendor, sales.Where(f=>f.Vendor== sv.Vendor).ToList(), mailTarget))); div.AddHtmlTag( new HtmlLineBreak()); } if(mailTarget.IsNullOrEmpty()){ res.Html= div.ToString(); return res; } SendSalesRepoByMail(div, mailTarget); return res; }
public BLResponse<Author> GetAuthors(BLRequest blRequest){ return Client.Execute(proxy=>{ var u= Authors.Get(proxy); var r = new BLResponse<Author>(); if(!IsCayita(blRequest)) r.Result=u; else { HtmlDiv div = new HtmlDiv( ){Name="Author"}; var itag = new HtmlIcon(){ Class="button-add icon-plus-sign", Name="Author" }; div.AddHtmlTag(itag); div.AddHtmlTag(BuildAuthorGrid(u)); HtmlDiv formDiv = new HtmlDiv(){Id="div-form-edit"}; formDiv.Style.Hidden=true; var form = BuildAuthorForm(); form.AddCssClass("span6"); form.Title="Author's Data"; formDiv.AddHtmlTag(form); r.Html= div.ToString()+formDiv.ToString(); } return r; }); }
void SendSalesRepoByMail(HtmlDiv div, string mailTarget){ Mailer.Send(message=>{ message.Subject= "Cayita.Widgets - Demo: Sales Repo"; message.From= new MailAddress("*****@*****.**"); message.To.Add(mailTarget); message.Body= div.ToString(); message.IsBodyHtml=true; }); }