public void Pages_Update(PageBE page) { // Update page text only if it has been set string updatePageText = String.Empty; if (page.IsTextPopulated) { updatePageText = ", page_text = ?PAGETEXT"; } string query = String.Format(@" /* Pages_Update */ update pages SET page_namespace = ?NAMESPACE, page_title = ?TITLE, page_comment = ?PAGECOMMENT, page_user_id = ?USERID, page_timestamp = ?PAGETIMESTAMP, page_is_redirect = ?ISREDIRECT, page_minor_edit = ?MINOREDIT, page_is_new = ?ISNEW, page_touched = ?TOUCHED, page_usecache = ?USECACHE, page_tip = ?TIP, page_parent = ?PARENT, page_restriction_id = ?RESTRICTIONID, page_content_type = ?CONTENTTYPE, page_language = ?LANGUAGE, page_display_name = ?DISPLAYNAME, page_etag = ?ETAG, page_revision = ?REVISION {0} where page_id = ?PAGEID ", updatePageText); DataCommand cmd = Catalog.NewQuery(query) .With("PAGEID", page.ID) .With("NAMESPACE", (int)page.Title.Namespace) .With("TITLE", page.Title.AsUnprefixedDbPath()) .With("PAGECOMMENT", page.Comment) .With("USERID", page.UserID) .With("PAGETIMESTAMP", page._TimeStamp) .With("ISREDIRECT", page.IsRedirect) .With("MINOREDIT", page.MinorEdit) .With("ISNEW", page.IsNew) .With("TOUCHED", page._Touched) .With("USECACHE", page.UseCache) .With("TIP", page.TIP) .With("PARENT", page.ParentID) .With("RESTRICTIONID", page.RestrictionID) .With("CONTENTTYPE", page.ContentType) .With("LANGUAGE", page.Language) .With("DISPLAYNAME", page.Title.DisplayName) .With("ETAG", page.Etag) .With("REVISION", page.Revision); if (page.IsTextPopulated) { cmd.With("PAGETEXT", page.GetText(this.Head)); } cmd.Execute(); }
private IList <NavBE> Nav_GetInternal(DataCommand queryCommand) { List <NavBE> navPages = new List <NavBE>(); queryCommand.Execute(delegate(IDataReader dr) { while (dr.Read()) { NavBE np = Nav_Populate(dr); navPages.Add(np); } }); return(navPages); }
protected void Page_Load(object sender, EventArgs e) { var presentationid = Request.QueryString["id"]; if (presentationid != null) { DataCommand command = new DataCommand("getAllSlides"); command.Add("presentationid", Convert.ToUInt64(presentationid)); DataSet ds = (DataSet)command.Execute(true); DataTable dt = ds.Tables[0]; Presentation newP = new Presentation(); newP.SlideSize.Type = SlideSizeType.Custom; newP.SlideSize.SizeOfPx = new SizeF(1280, 720); newP.SlideSize.Orientation = SlideOrienation.Landscape; Presentation helper = new Presentation(); var pname = ""; dt.DefaultView.Sort = "slideindex"; dt = dt.DefaultView.ToTable(); if (dt.Rows.Count > 0) { for (Int32 index = 0; index < dt.Rows.Count; index++) { DataRow dr = dt.Rows[index]; var presentationName = presentationid + dr["type"].ToString(); Int32 slideIndex = Convert.ToInt32(dr["slideindex"].ToString()); Int32 orderNumber = index; if (index == 0) { helper.LoadFromFile(Server.MapPath("~/Uploads/" + presentationName)); //loading ppt file pname = presentationName; } ISlide orgSlide = helper.Slides[slideIndex]; // reading the slide newP.Slides.Insert(orderNumber, orgSlide); addTracking(Convert.ToUInt64(dr["slideid"].ToString())); // inserting in to new ppt } //newP.SaveToFile(Server.MapPath("~/Uploads/tt.ppt"), FileFormat.PPT); Byte[] Content = newP.GetBytes(); Response.ContentType = "application/octet-stream"; Response.AddHeader("content-disposition", "attachment; filename=" + dt.Rows[0]["presentationname"].ToString() + ".pptx"); Response.BufferOutput = true; Response.OutputStream.Write(Content, 0, Content.Length); Response.End(); //downloading it } } }
public void Transactions_Update(TransactionBE trans) { string revertuserid = null; if (trans.RevertUserId != null) { revertuserid = trans.RevertUserId.Value.ToString(); } DataCommand cmd = Catalog.NewQuery(@" /* Transactions_Update */ update `transactions` set `t_user_id`= ?USERID, `t_page_id`= ?PAGEID, `t_title`= ?TITLE, `t_namespace`= ?NS, `t_type`= ?TYPE, `t_reverted`= ?REVERTED, `t_revert_user_id` = ?REVERT_USERID, `t_revert_timestamp` = ?REVERT_TS, `t_revert_reason` = ?REVERT_REASON where `t_id`= ?TID;" ).With("TID", trans.Id) .With("USERID", trans.UserId) .With("PAGEID", trans.PageId) .With("TITLE", trans.Title.AsUnprefixedDbPath()) .With("NS", (int)trans.Title.Namespace) .With("TYPE", (int)trans.Type) .With("REVERTED", trans.Reverted) .With("REVERT_REASON", trans.RevertReason); //TODO MaxM: This is a workaround for Datacommand.with not taking nullables. if (trans.RevertUserId.HasValue) { cmd = cmd.With("REVERT_USERID", trans.RevertUserId.Value); } else { cmd = cmd.With("REVERT_USERID", DBNull.Value); } if (trans.RevertTimeStamp.HasValue) { cmd = cmd.With("REVERT_TS", trans.RevertTimeStamp.Value); } else { cmd = cmd.With("REVERT_TS", DBNull.Value); } cmd.Execute(); }
protected void Page_Load(object sender, EventArgs e) { var userid = Request.QueryString["id"]; if (userid != null) { DataCommand command = new DataCommand("getActiveSlides"); command.Add("userid", userid); DataSet ds = (DataSet)command.Execute(true); DataTable dt = ds.Tables[0]; Presentation newP = new Presentation(); newP.SlideSize.Type = SlideSizeType.Custom; newP.SlideSize.SizeOfPx = new SizeF(1280, 720); newP.SlideSize.Orientation = SlideOrienation.Landscape; Presentation helper = new Presentation(); var pname = ""; foreach (DataRow dr in dt.Rows) { var presentationName = dr["presentationid"].ToString() + dr["type"].ToString(); Int32 slideIndex = Convert.ToInt32(dr["slideindex"].ToString()); Int32 orderNumber = Convert.ToInt32(dr["ordernumber"].ToString()); //if(pname != presentationName) { helper.LoadFromFile(Server.MapPath("~/Uploads/" + presentationName)); //loading ppt file pname = presentationName; //} ISlide orgSlide = helper.Slides[slideIndex]; // reading the slide newP.Slides.Insert(orderNumber, orgSlide); addTracking(Convert.ToUInt64(dr["slideid"].ToString())); // inserting in to new ppt } //newP.SaveToFile(Server.MapPath("~/Uploads/tt.ppt"), FileFormat.PPT); Byte[] Content = newP.GetBytes(); DataCommand commandUp = new DataCommand("updateUserPresentation"); commandUp.Add("presentationid", dt.Rows[0]["userpresentaitionid"].ToString()); commandUp.Add("status", 1); commandUp.Add("name", ""); commandUp.ExecuteNonQuery(); Response.ContentType = "application/octet-stream"; Response.AddHeader("content-disposition", "attachment; filename=presentation.pptx"); Response.BufferOutput = true; Response.OutputStream.Write(Content, 0, Content.Length); Response.End(); //downloading it } }
public static void InsertDWService(ServiceBE service) { DataCommand cmd = MediaWikiConverterContext.Current.DWCatalog.NewQuery(String.Format("INSERT into services (service_type, service_sid, service_description, service_local, service_enabled) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}'); SELECT LAST_INSERT_ID() as serviceid;", service.Type.ToString().ToLowerInvariant(), DataCommand.MakeSqlSafe(service.SID), DataCommand.MakeSqlSafe(service.Description), service._ServiceLocal, service._ServiceEnabled)); cmd.Execute(delegate(IDataReader dr) { while (dr.Read()) { service.Id = DbUtils.Convert.To <uint>(dr["serviceid"], 0); } }); foreach (String key in service.Config.Keys) { MediaWikiConverterContext.Current.DWCatalog.NewQuery(String.Format("INSERT into service_config (service_id, config_name, config_value) VALUES ('{0}', '{1}', '{2}')", service.Id, DataCommand.MakeSqlSafe(key), DataCommand.MakeSqlSafe(service.Config[key]))).Execute(); } }
protected void Page_Load(object sender, EventArgs e) { UInt64 Id = Convert.ToUInt64(Request.QueryString["id"]); String Type = Request.QueryString["type"]; Response.AddHeader("Access-Control-Allow-Origin", "*"); if (Type == "image") { DataCommand command = new DataCommand("GetUserDetailsByID"); command.Add("userid", Id.ToString()); IDictionary <String, object> obj = command.Execute() as IDictionary <String, Object>; if (obj != null && !String.IsNullOrEmpty(obj["image"].ToString())) { Byte[] data = Convert.FromBase64String(obj["image"].ToString().Split(',')[1]); // Send the file to the browser // Byte[] data = (Byte[])(dt.Rows[0]["SpeakerPhoto"]); Response.AddHeader("Content-Disposition", "attachment; filename=image." + obj["image"].ToString().Split(';')[0].Split('/')[1]); Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(true); Response.BinaryWrite(data); Response.Flush(); Response.End(); } else { Byte[] data = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAZrElEQVR4Xu1dB1RVx9b+TOwKdgUUjRQRUBAQUSkKi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="); // Send the default file to the browser Response.AddHeader("Content-Disposition", "attachment; filename=image.png"); Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(true); Response.BinaryWrite(data); Response.Flush(); Response.End(); } } }
private IList <KeyValuePair <uint, IList <ArchiveBE> > > Archive_PopulateByTransactionQuery(DataCommand cmd, out Dictionary <uint, TransactionBE> transactionsById, out uint?queryTotalTransactionCount) { Dictionary <uint, TransactionBE> transactionsByIdtemp = new Dictionary <uint, TransactionBE>(); List <KeyValuePair <uint, IList <ArchiveBE> > > archivedPagesByTransaction = new List <KeyValuePair <uint, IList <ArchiveBE> > >(); uint?queryTotalTransactionCountTemp = null; cmd.Execute(delegate(IDataReader dr) { KeyValuePair <uint, IList <ArchiveBE> > currentTrans = new KeyValuePair <uint, IList <ArchiveBE> >(); while (dr.Read()) { //Populate list of archived pages per trans. (assumes sort by transaction with first archived page being the transaction 'root') uint tranId = DbUtils.Convert.To <uint>(dr["t_id"]) ?? 0; ArchiveBE archivedPage = Archive_Populate(dr); TransactionBE tran = null; if (!transactionsByIdtemp.TryGetValue(tranId, out tran)) { tran = Transactions_Populate(dr); transactionsByIdtemp[tranId] = tran; } if (currentTrans.Key != tranId) { currentTrans = new KeyValuePair <uint, IList <ArchiveBE> >(tranId, new List <ArchiveBE>()); archivedPagesByTransaction.Add(currentTrans); } currentTrans.Value.Add(archivedPage); } if (dr.NextResult() && dr.Read()) { queryTotalTransactionCountTemp = DbUtils.Convert.To <uint>(dr["queryTotalTransactionCount"]); } }); transactionsById = transactionsByIdtemp; queryTotalTransactionCount = queryTotalTransactionCountTemp; return(archivedPagesByTransaction); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <String, FileFormat> nl = new Dictionary <String, FileFormat>(); nl.Add(".ppt", FileFormat.PPT); nl.Add(".pptx", FileFormat.Pptx2010); var presentationname = Request.Form["pname"]; var metatag = Request.Form["metatag"]; var categoryid = Request.Form["categoryid"]; var folderid = Request.Form["folderid"]; var file = Request.Files["file"]; if (file != null) { String ext = System.IO.Path.GetExtension(file.FileName).ToLower(); DataCommand command = new DataCommand("createPresentation"); command.Add("presentationname", presentationname); command.Add("categoryid", Convert.ToUInt64(categoryid)); command.Add("metatag", metatag); command.Add("folderid", Convert.ToUInt64(folderid)); command.Add("description", "No desc"); command.Add("type", ext); DataSet ds = (DataSet)command.Execute(true); DataTable dt = ds.Tables[0]; String presentatonId = dt.Rows[0]["presentationid"].ToString(); file.SaveAs(Server.MapPath("~/Uploads/" + presentatonId + ext)); try { Presentation presentation = new Presentation(); presentation.LoadFromStream(file.InputStream, nl[ext]); var totalSlide = presentation.Slides.Count - 1; //traverse the slides of PPT files for (int i = 0; i < presentation.Slides.Count; i++) { ISlide slide = presentation.Slides[i]; String title = getTitle(slide); title = title == null ? "No Title" : title; DataCommand command1 = new DataCommand("createSlide"); command1.Add("slidename", title); command1.Add("presentationid", presentatonId); command1.Add("slideindex", i); DataSet ds1 = (DataSet)command1.Execute(true); DataTable dt1 = ds1.Tables[0]; String slideId = dt1.Rows[0]["slideid"].ToString(); //save the slide to Image Image image = slide.SaveAsImage(960, 720); String fileName = Server.MapPath("~/Uploads/Images/" + String.Format(slideId + ".jpeg", i)); image.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg); Image imageT = slide.SaveAsImage(320, 240); fileName = Server.MapPath("~/Uploads/Thumbnails/" + String.Format(slideId + ".jpeg", i)); imageT.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg); Int32 precentageComplete = (i / totalSlide) * 100; updatePresentationStatus(0, precentageComplete, presentatonId); } updatePresentationStatus(1, 100, presentatonId); Response.Write("Success"); } catch (Exception ex) { updatePresentationStatus(2, 0, presentatonId); Response.Write(ex.Message); } } }
private IList<KeyValuePair<uint, IList<ArchiveBE>>> Archive_PopulateByTransactionQuery(DataCommand cmd, out Dictionary<uint, TransactionBE> transactionsById, out uint? queryTotalTransactionCount) { Dictionary<uint, TransactionBE> transactionsByIdtemp = new Dictionary<uint, TransactionBE>(); List<KeyValuePair<uint, IList<ArchiveBE>>> archivedPagesByTransaction = new List<KeyValuePair<uint, IList<ArchiveBE>>>(); uint? queryTotalTransactionCountTemp = null; cmd.Execute(delegate(IDataReader dr) { KeyValuePair<uint, IList<ArchiveBE>> currentTrans = new KeyValuePair<uint, IList<ArchiveBE>>(); while (dr.Read()) { //Populate list of archived pages per trans. (assumes sort by transaction with first archived page being the transaction 'root') uint tranId = DbUtils.Convert.To<uint>(dr["t_id"]) ?? 0; ArchiveBE archivedPage = Archive_Populate(dr); TransactionBE tran = null; if (!transactionsByIdtemp.TryGetValue(tranId, out tran)) { tran = Transactions_Populate(dr); transactionsByIdtemp[tranId] = tran; } if (currentTrans.Key != tranId) { currentTrans = new KeyValuePair<uint, IList<ArchiveBE>>(tranId, new List<ArchiveBE>()); archivedPagesByTransaction.Add(currentTrans); } currentTrans.Value.Add(archivedPage); } if (dr.NextResult() && dr.Read()) { queryTotalTransactionCountTemp = DbUtils.Convert.To<uint>(dr["queryTotalTransactionCount"]); } }); transactionsById = transactionsByIdtemp; queryTotalTransactionCount = queryTotalTransactionCountTemp; return archivedPagesByTransaction; }
internal DataVaultResult Execute() { DataCommand.Execute(); return(DataVaultResult); }
private IList<NavBE> Nav_GetInternal(DataCommand queryCommand) { List<NavBE> navPages = new List<NavBE>(); queryCommand.Execute(delegate(IDataReader dr) { while (dr.Read()) { NavBE np = Nav_Populate(dr); navPages.Add(np); } }); return navPages; }
//--- Methods --- public IList <Tuplet <string, uint, string> > Wiki_GetContributors(PageBE page, bool byRecent, string exclude, uint?max) { DataCommand command = null; string query; // build exclusion clauses string excludeClause = string.Empty; if (StringUtil.ContainsInvariantIgnoreCase(exclude, "all") || StringUtil.ContainsInvariantIgnoreCase(exclude, "inactive")) { excludeClause = " AND user_active = 1"; } if (StringUtil.ContainsInvariantIgnoreCase(exclude, "all") || StringUtil.ContainsInvariantIgnoreCase(exclude, "banned")) { excludeClause += " AND 0 = (select count(*) from banusers inner join bans on banuser_id = ban_id where banuser_user_id = user_id and (ban_expires is null or ban_expires > now()) )"; } // check if a page was provided if (page != null) { // find contributors for given page if (byRecent) { query = string.Format(@" /* DekiWiki-Functions: wiki.contributors (for a page, from recent changes) */ SELECT user_id, user_name, MAX(rc_timestamp) AS last_edit FROM recentchanges JOIN users ON rc_user = user_id WHERE rc_type = 0 AND rc_cur_id = ?PAGEID {0} GROUP BY rc_user ORDER BY last_edit DESC LIMIT {1};", excludeClause, max ?? UInt32.MaxValue); } else { query = string.Format(@" /* DekiWiki-Functions: wiki.contributors (for a page, from revision data) */ SELECT users.user_name, users.user_id, COUNT(*) AS user_edits FROM ( (SELECT page_user_id AS `user` FROM pages WHERE page_id = ?PAGEID )UNION ALL( SELECT old_user AS `user` FROM `old` WHERE old_page_id = ?PAGEID) ) editcounts JOIN users ON users.user_id = editcounts.user WHERE TRUE {0} GROUP BY editcounts.user ORDER BY user_edits DESC LIMIT {1};" , excludeClause, max ?? UInt32.MaxValue); } command = Catalog.NewQuery(query) .With("PAGEID", page.ID); } else { if (byRecent) { query = string.Format(@" /* DekiWiki-Functions: wiki.contributors (all pages, from recentchanges) */ SELECT user_id, user_name, MAX(rc_timestamp) AS last_edit FROM recentchanges JOIN users ON rc_user = user_id WHERE rc_type = 0 {0} GROUP BY rc_user ORDER BY last_edit DESC LIMIT {1}; ", excludeClause, max); } else { // find contributors for entire site query = string.Format(@" /* DekiWiki-Functions: wiki.contributors (all pages, from revision data) */ SELECT user_id, user_name, (SELECT COUNT(*) FROM pages WHERE user_id = page_user_id {0}) + (SELECT COUNT(*) FROM old WHERE user_id = old_user {0}) AS user_edits FROM users ORDER BY user_edits DESC LIMIT {1}", excludeClause, max); } command = Catalog.NewQuery(query); } List <Tuplet <string, uint, string> > result = new List <Tuplet <string, uint, string> >(); command.Execute(delegate(IDataReader reader) { while (reader.Read()) { string user = SysUtil.ChangeType <string>(reader["user_name"]); if (user.EqualsInvariant(ANON_USERNAME)) { continue; } uint userid = SysUtil.ChangeType <uint>(reader["user_id"]); string classification; if (byRecent) { classification = SysUtil.ChangeType <string>(reader["last_edit"]); } else { classification = SysUtil.ChangeType <string>(reader["user_edits"]); } result.Add(new Tuplet <string, uint, string>(user, userid, classification)); } }); return(result); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = null; String userid = Request.QueryString["userid"]; String category = Request.QueryString["category"]; String sdate = Request.QueryString["sdate"]; String edate = Request.QueryString["edate"]; String ReportName = ""; if (!String.IsNullOrEmpty(userid)) { DataCommand command = new DataCommand("getUserSlideReport"); command.Add("userid", userid); DataSet ds = (DataSet)command.Execute(true); dt = ds.Tables[0]; ReportName = dt.Rows.Count > 1 ? "User_Slide_Report" : "NoDate_Report"; } else if (!String.IsNullOrEmpty(category)) { DataCommand command = new DataCommand("getCategorySlideReport"); command.Add("categoryid", category); DataSet ds = (DataSet)command.Execute(true); dt = ds.Tables[0]; ReportName = dt.Rows.Count > 1 ? dt.Rows[0]["Category Name"].ToString() + "_Slide_Report" : "NoDate_Report"; } else if (!String.IsNullOrEmpty(sdate) && !String.IsNullOrEmpty(edate)) { DataCommand command = new DataCommand("getSlideReportByDate"); command.Add("startdate", sdate); command.Add("enddate", edate); DataSet ds = (DataSet)command.Execute(true); dt = ds.Tables[0]; ReportName = dt.Rows.Count > 1 ? "Custom_Slide_Report" : "NoDate_Report"; } else { DataCommand command = new DataCommand("getSlideReport"); DataSet ds = (DataSet)command.Execute(true); dt = ds.Tables[0]; ReportName = dt.Rows.Count > 1 ? "Slide_Report" : "NoDate_Report"; } if (dt != null) { Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(ReportName + ".xlsx", System.Text.Encoding.UTF8)); using (ExcelPackage pck = new ExcelPackage()) { ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Logs"); ws.Cells["A1"].LoadFromDataTable(dt, true); ws.Cells.AutoFitColumns(); ws.Cells["A1:G1"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; ws.Cells["A1:G1"].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(82, 46, 144)); ws.Cells["A1:G1"].Style.Font.Color.SetColor(Color.White); ws.Cells["A1:G1"].Style.Font.Bold = true; var ms = new System.IO.MemoryStream(); pck.SaveAs(ms); ms.WriteTo(Response.OutputStream); } } }