public WinHistory(MainDataSet dataset) { InitializeComponent(); mainDataSet = dataset; //订阅mainDataSet的归档数据更新消息 mainDataSet.ArchiveDataUpdated += OnArchiveDataUpdate; }
public MainWindow() { InitializeComponent(); SmartChainDataSet = MainDataSet.GetDataSet(); IsShow = false; ShowHistoryItem_Click(this, null); }
/// <summary> /// this method is get list of employee and return json /// </summary> /// <returns></returns> public JsonResult GetStudentList(StudentSearch ss) { //var StudentList = db.Students.Where(a => a.IsActive == true || a.IsActive == null).ToList(); //return Json(StudentList, JsonRequestBehavior.AllowGet); using (var db = new StudentContext()) { db.Database.Initialize(force: false); var cmd = db.Database.Connection.CreateCommand(); cmd.CommandText = "Student_Listing"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ID", ss.ID)); cmd.Parameters.Add(new SqlParameter("@FirstName", ss.FirstName)); cmd.Parameters.Add(new SqlParameter("@PageSize", ss.PageSize)); cmd.Parameters.Add(new SqlParameter("@CurrentPage", ss.CurrentPage)); db.Database.Connection.Open(); var reader = cmd.ExecuteReader(); List <StudentModel> StudentList = new List <StudentModel>(); StudentList = ((IObjectContextAdapter)db).ObjectContext.Translate <StudentModel>(reader).ToList(); reader.NextResult(); TotalRecord tr = new TotalRecord(); tr = ((IObjectContextAdapter)db).ObjectContext.Translate <TotalRecord>(reader).Single(); MainDataSet mds = new MainDataSet(); mds.StudentModelList = StudentList; mds.TotalRec = tr; return(Json(mds, JsonRequestBehavior.AllowGet)); } }
public WinDemo(MainDataSet dataset) { InitializeComponent(); mainDataSet = dataset; backGroundWorker = (BackgroundWorker)this.FindResource("backGroundWorker"); //订阅mainDataSet的数据更新消息 mainDataSet.RuntimeDataUpdated += OnRuntimeDataUpdate; }
public void ExtractRelation(IfDataStrategy DataReader, MainDataSet dataset) { this.user.ExtractRelation(DataReader, dataset); //InferiorUsers[1:n] List <string> inferiors = DataReader.GetDNodesBySNodeandEdgeType(this.Name, this.Type, "Inferior"); foreach (string username in inferiors) { this.uInferiors.Add(dataset.GetUserItem(username)); } }
public void StoreRelation(IfDataStrategy DataReader, MainDataSet dataset) { this.user.StoreRelation(DataReader, dataset); RelationShip newRelation; if (this.uInferiors.Count > 0) { //InferiorUsers[1:n] foreach (IfUser curUser in this.uInferiors) { newRelation = new RelationShip(this.Name, this.Type, curUser.Name, curUser.Type, "Inferior", "1"); DataReader.InsertRelationShip(newRelation); } } }
protected virtual void OnSave(object sender, EventArgs e) { try { if (FormHasChanged) { EndEdit(MainDataSet); if (UpdateData()) { MainDataSet.AcceptChanges(); DataChanged = false; } CurrentFormMode = FormModes.Edit; } } catch (Exception ex) { JBillingMessageBox.ShowException(ex); } }
protected virtual void OnCancel(object sender, EventArgs e) { try { EndEdit(MainDataSet); if (FormHasChanged) { if (JBindingManager != null) { ((CurrencyManager)JBindingManager).CancelCurrentEdit(); } MainDataSet.RejectChanges(); DataChanged = false; CurrentFormMode = FormModes.Edit; } } catch (Exception ex) { JBillingMessageBox.ShowException(ex); } }
public WinEditQlevel(MainDataSet DataSet) { InitializeComponent(); mainDataSet = DataSet; }
private void SetCustomLink(ref Telerik.Web.UI.EditorLink link, MainDataSet.ArticleDataTable articles, Guid articleGuid) { foreach (MainDataSet.ArticleRow row in articles.Where(p => !p.IsParentArticleGuidNull() && p.ParentArticleGuid == articleGuid)) { Telerik.Web.UI.EditorLink newlink = new Telerik.Web.UI.EditorLink(row.Subject, string.Format("{0}/Default.aspx?i={1}&t={2}", Request.ApplicationPath, row.DepartmentGuid.ToString("N"), row.ArticleGuid.ToString("N"))); SetCustomLink(ref newlink, articles, row.ArticleGuid); link.ChildLinks.Add(newlink); } }
private void DoAricleView(MainDataSet.ArticleRow articleRow) { if (articleRow != null) { this.ArticleTableAdapter.IncReview(articleRow.ArticleGuid); ImageListCtrl.ArticleGuid = articleRow.ArticleGuid; FileListCtrl.ArticleGuid = articleRow.ArticleGuid; ShowArticleView(); HyperLinkPreview.Attributes["onclick"] = string.Format(CultureInfo.InvariantCulture, "javascript:window.open('default.aspx?i={0}&t={1}&popup=true', '_blank', 'location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,top=' + Mp_GetPopupPositionY(event) + ',left=' + Mp_GetPopupPositionX({2}) + ',width={2},height={3}');", UserContext.Current.SelectedInstance.InstanceId.ToString("N"), articleRow.ArticleGuid.ToString("N"), Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.MasterPage.HelpLink.WindowWidth, Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.MasterPage.HelpLink.WindowHeight); if (articleRow.Deleted) { ButtonInactive.Text = (string)this.GetLocalResourceObject("ActivateArticle"); ButtonInactive.OnClientClick = (string)this.GetLocalResourceObject("ConfirmActivate"); } else { ButtonInactive.Text = (string)this.GetLocalResourceObject("InactivateArticle"); ButtonInactive.OnClientClick = string.Empty; } Master.CustomName = articleRow.Subject; //Master.Title = string.Format("{0} {1} KB - {2}", this.ArticleTableAdapter.GetOrganizationName(this.Master.InstanceGuid), this.ArticleTableAdapter.GetInstanceName(this.Master.InstanceGuid), articleRow.Subject); Master.Title = articleRow.Subject; //Master.VisiblePageTitle = false; litSubject.Text = articleRow.Subject; string body = this.ArticleTableAdapter.GetBody(articleRow.ArticleGuid); if (!string.IsNullOrEmpty(body)) { body = body.Replace("<h2>", "<h2><span>"); body = body.Replace("<H2>", "<H2><span>"); body = body.Replace("</h2>", "</span></h2>"); body = body.Replace("</H2>", "</span></H2>"); divBody.InnerHtml = body;//HttpUtility.HtmlDecode(body); } HtmlMeta metaDescription = new HtmlMeta(); metaDescription.Name = "Description"; metaDescription.Content = articleRow.SearchDesc; Page.Header.Controls.Add(metaDescription); Guid userId = Guid.Empty; if (!articleRow.IsCreatedByNull()) userId = articleRow.CreatedBy; if (!articleRow.IsUpdatedByNull()) userId = articleRow.UpdatedBy; //if (userId == Guid.Empty) // PostCommentCtrl.ReceiverName = Utils.GetInstanceUserName(UserContext.Current.SelectedInstance.InstanceId); //else //{ // Micajah.Common.Dal.OrganizationDataSet.UserRow userRow = Micajah.Common.Bll.Providers.UserProvider.GetUserRow(userId); // if (userRow != null) // PostCommentCtrl.ReceiverName = userRow.FirstName + " " + userRow.LastName; //} PostCommentCtrl.InstanceGuid = UserContext.Current.SelectedInstance.InstanceId; PostCommentCtrl.ArticleGuid = articleRow.ArticleGuid; CommentsListCtrl.ArticleGuid = articleRow.ArticleGuid; CommentsListCtrl.DataBind(); } }
protected FileItem[] GetChildFiles(MainDataSet.ArticleRow articleRow) { if (articleRow != null && articleRow.DepartmentGuid != Guid.Empty) { MetaDataSet.FileDataTable dtFiles = (new Micajah.FileService.Client.Dal.MetaDataSetTableAdapters.FileTableAdapter()).GetFiles( Micajah.Common.Bll.Providers.InstanceProvider.GetInstance(articleRow.DepartmentGuid).OrganizationId, articleRow.DepartmentGuid, "Article", articleRow.ArticleGuid.ToString("N"), false); ArrayList files = new ArrayList(); foreach (MetaDataSet.FileRow frow in dtFiles) { string path = string.Empty; string ext = Path.GetExtension(frow.Name); string mimeType = MimeType.GetMimeType(ext); switch (FileType) { case "Image": path = Access.GetThumbnailUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId, 640, 0, 0); if (MimeType.IsImageType(mimeType)) { files.Add( new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; case "Video": path = Access.GetFileUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); if (MimeType.IsVideoType(mimeType)) files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); break; case "Flash": path = Access.GetFlashUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); if (MimeType.IsFlash(mimeType)) files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); break; default: path = Access.GetFileUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); break; } } return (FileItem[])files.ToArray(typeof(FileItem)); } return new FileItem[] { }; }
public void StoreRelation(IfDataStrategy DataReader, MainDataSet dataset) { this.user.StoreRelation(DataReader, dataset); }
private void SortRecursiveTable(ref string output, ref MainDataSet.ArticleDataTable input, Guid? parentArticleId, string pageUrl) { OrderedEnumerableRowCollection<MainDataSet.ArticleRow> query = null; if (parentArticleId.HasValue) query = input.Where(w => w.IsParentArticleGuidNull() ? false : w.ParentArticleGuid.Equals(parentArticleId.Value)).OrderBy(o => o.Subject); else query = input.Where(w => w.IsParentArticleGuidNull()).OrderBy(o => o.Subject); int cnt = query.Count(); if (cnt > 0) output += "<ul>"; foreach (MainDataSet.ArticleRow row in query) { output += string.Format(CultureInfo.CurrentCulture, "<li {4}><a style=\"vertical-align:top{5}\" href=\"{3}?{0}t={1}\">{2}</a>", UserContext.SelectedInstanceId == Guid.Empty ? "i=" + this.InstanceGuid.ToString("N") + "&" : string.Empty, row.ArticleGuid.ToString("N"), row.Subject, pageUrl, row.IsParentArticleGuidNull() ? "style=\"padding-top:10px;\"" : string.Empty, row.IsParentArticleGuidNull() ? ";font-size:14pt\"" : string.Empty); SortRecursiveTable(ref output, ref input, row.ArticleGuid, pageUrl); } if (cnt > 0) output += "</ul>"; }
protected DirectoryItem[] GetChildDirectories(MainDataSet.ArticleRow articleRow) { List<DirectoryItem> directories = new List<DirectoryItem>(); MainDataSet.ArticleDataTable dtArticles = this.ArticleTableAdapter.GetDataByParent(articleRow.ArticleGuid); foreach (MainDataSet.ArticleRow row in dtArticles) { //string itemFullPath = string.Format("/{0}/{1}/", articleRow.Subject, row.Subject); string itemFullPath = string.Format("~/ArticleViewAdmin.aspx?id={0}", row.ArticleGuid.ToString("N")); directories.Add(new DirectoryItem( row.Subject, string.Empty, itemFullPath, string.Empty, fullPermissions, GetChildFiles(row), GetChildDirectories(row))); } return directories.ToArray(); }
private string GetRelatedString(MainDataSet.ArticleRow arow, string pageUrl, bool isBack) { //string body = arow.Body; //if (!string.IsNullOrEmpty(body)) //{ // HtmlAgilityPack.HtmlNode node = HtmlAgilityPack.HtmlNode.CreateNode(body); // if (node != null) // body = node.InnerText; //} return string.Format(" <li><a {3} href=\"{0}\">{1}</a>{2} </li>", pageUrl + (UserContext.SelectedInstanceId != Guid.Empty ? "?" : "?i=" + this.InstanceGuid.ToString("N") + "&") + "t=" + arow.ArticleGuid.ToString("N"), arow.Subject, Environment.NewLine, isBack ? "style='color:gray'" : string.Empty); // body); "<span style=\"display:block;\">{3}</span>" }
private string GetRelatedString(MainDataSet.ArticleRow arow, string pageUrl) { return GetRelatedString(arow, pageUrl, false); }
public IActionResult Get(int id, [FromQuery] ReportQuery query) { string mime = "application/" + query.Format; //MIME-заголовок со значением по умолчанию // Найти отчет Reports reportItem = reportItems.FirstOrDefault((p) => p.Id == id); //получаем значение коллекции по идентификатору if (reportItem != null) { string webRootPath = _hostingEnvironment.WebRootPath; //определяем путь к папке wwwroot string reportPath = (webRootPath + "/App_Data/" + reportItem.ReportName); //определяем путь к отчету string dataPath = ""; switch (reportItem.Id) { case 1: dataPath = (webRootPath + "/App_Data/XmlDataSet2.xml"); //определяем путь к базе данных MainDataSet.ConnectToData(_configuration.GetConnectionString("CatalogConnection"), dataPath); break; case 2: dataPath = (webRootPath + "/App_Data/XmlDataSet.xml"); //определяем путь к базе данных MainDataSet.ConnectToDataReport2(_configuration.GetConnectionString("CatalogConnection"), dataPath); break; } using (MemoryStream stream = new MemoryStream()) //Создаем поток для отчета { try { using (DataSet dataSet = new DataSet()) { //Заполняем источник данными dataSet.ReadXml(dataPath); //Включаем веб режим FastReport Config.WebMode = true; using (Report report = new Report()) { report.Load(reportPath); //Загружаем отчет report.RegisterData(dataSet, "Connection"); //Регистрируем данные в отчете if (query.Parameter != null) { report.SetParameterValue("Parameter", query.Parameter); //задаем значение параметра отчета, если передано значение параметра в URL } report.Prepare(); //подготавливаем отчет //если выбран формат pdf if (query.Format == "pdf") { //Экспорт отчета в PDF PDFExport pdf = new PDFExport(); //Используем поток для хранения отчета, чтобы не создавать лишние файлы report.Export(pdf, stream); } //если выбран формат отчета html else if (query.Format == "html") { //Экспорт отчета в HTML HTMLExport html = new HTMLExport(); html.SinglePage = true; //отчет на одной странице html.Navigator = false; //навигационная панель сверху html.EmbedPictures = true; //встраивает изображения в документ report.Export(html, stream); mime = "text/" + query.Format; //переопределяем mime для html } } } //получаем имя результирующего файла отчета с нужным расширением var file = String.Concat(Path.GetFileNameWithoutExtension(reportPath), ".", query.Format); //если параметр inline истина, то открываем отчет в браузере if (query.Inline) { return(File(stream.ToArray(), mime)); } else { //иначе скачиваем файл отчета return(File(stream.ToArray(), mime, file)); // attachment } } //Обрабатываем исключения catch { return(new NoContentResult()); } finally { stream.Dispose(); } } } else { return(NotFound()); } }
public WinEditProcedure(MainDataSet DataSet) { InitializeComponent(); mainDataSet = DataSet; }
private void SortRecursiveTable(ref string output, ref MainDataSet.ArticleDataTable input, Guid? parentArticleId) { OrderedEnumerableRowCollection<MainDataSet.ArticleRow> query = null; if (parentArticleId.HasValue) query = input.Where(w => w.IsParentArticleGuidNull() ? false : w.ParentArticleGuid.Equals(parentArticleId.Value)).OrderBy(o => o.Subject); else query = input.Where(w => w.IsParentArticleGuidNull()).OrderBy(o => o.Subject); int cnt = query.Count(); if (cnt > 0) output += "<ul>"; foreach (MainDataSet.ArticleRow row in query) { output += string.Format(CultureInfo.CurrentCulture, "<li><a style=\"vertical-align:top\" href=\"Default.aspx?i={0}&t={1}\">{2}</a>", this.InstanceGuid.ToString("N"), row.ArticleGuid.ToString("N"), row.Subject); SortRecursiveTable(ref output, ref input, row.ArticleGuid); } if (cnt > 0) output += "</ul>"; }
public void ExtractRelation(IfDataStrategy DataReader, MainDataSet dataset) { this.user.ExtractRelation(DataReader, dataset); }
private void DoArticleEdit(MainDataSet.ArticleRow articleRow) { ShowArticleEdit(); TreeViewParentArticle.Nodes.Clear(); TreeViewParentArticle.Nodes.Add(new Telerik.Web.UI.RadTreeNode(" ", string.Empty)); TreeViewParentArticle.DataBind(); CustomLinksDataBind(UserContext.Current.SelectedInstance.InstanceId); if (articleRow != null) { HtmlEditorBody.ImageManager.ViewPaths = new string[] { articleRow.ArticleGuid.ToString("N") }; HtmlEditorBody.ImageManager.ContentProviderTypeName = typeof(Micajah.FileService.Providers.ImageDBContentProvider).AssemblyQualifiedName; HtmlEditorBody.MediaManager.ViewPaths = new string[] { articleRow.ArticleGuid.ToString("N") }; HtmlEditorBody.MediaManager.ContentProviderTypeName = typeof(Micajah.FileService.Providers.VideoDBContentProvider).AssemblyQualifiedName; HtmlEditorBody.FlashManager.ViewPaths = new string[] { articleRow.ArticleGuid.ToString("N") }; HtmlEditorBody.FlashManager.ContentProviderTypeName = typeof(Micajah.FileService.Providers.FlashDBContentProvider).AssemblyQualifiedName; HtmlEditorBody.DocumentManager.ViewPaths = new string[] { articleRow.ArticleGuid.ToString("N") }; HtmlEditorBody.DocumentManager.ContentProviderTypeName = typeof(Micajah.FileService.Providers.FileDBContentProvider).AssemblyQualifiedName; HtmlEditorBody.Content = this.ArticleTableAdapter.GetBody(articleRow.ArticleGuid); ImageAdminListCtrl.ArticleGuid = articleRow.ArticleGuid; FileAdminListCtrl.ArticleGuid = articleRow.ArticleGuid; ImageAdminListCtrl.DataBind(); FileAdminListCtrl.DataBind(); Master.CustomName = articleRow.Subject; TextBoxSubject.Text = articleRow.Subject; SearchDescriptionTextBox.Text = articleRow.SearchDesc; if (!articleRow.IsParentArticleGuidNull()) { Telerik.Web.UI.RadTreeNode node = TreeViewParentArticle.FindNodeByValue(articleRow.ParentArticleGuid.ToString()); if (node != null) { node.Selected = true; node.ExpandParentNodes(); } } if (articleRow.Type == ArticleType.Request.ToString()) TextBoxAlternateIds.Text = articleRow.Subject; else { using (MainDataSetTableAdapters.AlternateIdTableAdapter altAdapter = new MainDataSetTableAdapters.AlternateIdTableAdapter()) { TextBoxAlternateIds.Text = string.Empty; MainDataSet.AlternateIdDataTable dtAlt = altAdapter.GetDataByArticleGuid(articleRow.ArticleGuid); foreach (MainDataSet.AlternateIdRow row in dtAlt) TextBoxAlternateIds.Text += row.AlternateId + Environment.NewLine; } } } else { Master.CustomName = (string)this.GetLocalResourceObject("AddNewArticle"); } }
public WinEditStep(MainDataSet DataSet) { InitializeComponent(); mainDataSet = DataSet; }
private void DoArticleView(MainDataSet.ArticleRow articleRow) { PanelArticle.Visible = true; if (articleRow != null) { if (!IsPopup) UserContext.Breadcrumbs.AddRange(Utils.GenerateBreadCrumbs(articleRow.ArticleGuid, this.Master.InstanceGuid, false)); //Master.CustomName = articleRow.Subject; Master.Title = articleRow.Subject; litSubject.Text = articleRow.Subject; HtmlMeta metaKeywords = new HtmlMeta(); metaKeywords.Name = "keywords"; metaKeywords.Content = Master.Title; Page.Header.Controls.Add(metaKeywords); HtmlMeta metaDescription = new HtmlMeta(); metaDescription.Name = "Description"; metaDescription.Content = articleRow.SearchDesc; Page.Header.Controls.Add(metaDescription); if (articleRow.Type == ArticleType.Request.ToString()) { divBody.InnerHtml = (string)this.GetLocalResourceObject("ArticleDoesNotExist"); } else { this.ArticleTableAdapter.IncReview(articleRow.ArticleGuid); string body = this.ArticleTableAdapter.GetBody(articleRow.ArticleGuid); if (!string.IsNullOrEmpty(body)) divBody.InnerHtml = body; } //divType.InnerText = articleRow.Type; Guid userId = Guid.Empty; if (!articleRow.IsCreatedByNull()) userId = articleRow.CreatedBy; if (!articleRow.IsUpdatedByNull()) userId = articleRow.UpdatedBy; //if (userId == Guid.Empty) // PostCommentCtrl.ReceiverName = Utils.GetInstanceUserName(this.Master.InstanceGuid); //else //{ // using (MainDataSetTableAdapters.Mc_UserTableAdapter userAdapter = new MainDataSetTableAdapters.Mc_UserTableAdapter()) // { // MainDataSet.Mc_UserDataTable dtUser = userAdapter.GetDataByUserId(userId); // if (dtUser != null && dtUser.Count > 0) // PostCommentCtrl.ReceiverName = dtUser[0].FirstName + " " + dtUser[0].LastName; // } //} ArticlesListCtrl.ArticleGuid = articleRow.ArticleGuid; PostCommentCtrl.InstanceGuid = this.Master.InstanceGuid; PostCommentCtrl.ArticleGuid = articleRow.ArticleGuid; CommentsListCtrl.ArticleGuid = articleRow.ArticleGuid; CommentsListCtrl.DataBind(); } }
public WinEditUserGroup(MainDataSet DataSet) { InitializeComponent(); mainDataSet = DataSet; }
private void SortRecursiveTable(ref MainDataSet.ArticleDataTable output, ref MainDataSet.ArticleDataTable input, Guid? parentArticleId) { OrderedEnumerableRowCollection<MainDataSet.ArticleRow> query = null; if (parentArticleId.HasValue) query = input.Where(w => w.IsParentArticleGuidNull() ? false : w.ParentArticleGuid.Equals(parentArticleId.Value)).OrderBy(o => o.Subject); else query = input.Where(w => w.IsParentArticleGuidNull()).OrderBy(o => o.Subject); foreach (MainDataSet.ArticleRow row in query) { output.ImportRow(row); SortRecursiveTable(ref output, ref input, row.ArticleGuid); } }