private void LoadPostsAccordingToDDL() { MySQLDatabase db = new MySQLDatabase(); List <Dictionary <string, string> > res = null; if (ddlCatagory.SelectedValue == "All") { res = db.Query("getAllIdTitle", null, true); } else { Dictionary <string, object> dict = new Dictionary <string, object>(1); dict.Add("@ptype", int.Parse(ddlCatagory.SelectedValue)); res = db.Query("getIdTitleByType", dict, true); } PostList.Controls.Clear(); int?postId = Convert.ToInt32(Request.QueryString["postid"]); foreach (var item in res) { PostListItem post = LoadControl("~/User Control/PostListItem.ascx") as PostListItem; post.Title = item["title"]; post.PostID = Convert.ToInt32(item["id"]); post.Body = item["date"]; if (postId != null && postId == post.PostID) { post.SetActive(); } post.PostClick += delegate { Response.Redirect(Request.Url.AbsolutePath + "?postid=" + item["id"] + "&posttype=" + ddlCatagory.SelectedValue, true); }; PostList.Controls.Add(post); } }
private void InitUser() { alertForm = new Dialog_PendingAlert(this); if (SessionClass.CurrentSinoUser != null) { this.PendingAlertLib.Clear(); this.repositoryItemComboBox1.Items.Clear(); this.barCurrentUser.EditValue = SessionClass.CurrentSinoUser.UserName; int _selectpost = 0; foreach (SinoPost _sp in SessionClass.CurrentSinoUser.Posts) { PostListItem _pItem = new PostListItem(_sp); int _index = this.repositoryItemComboBox1.Items.Add(_pItem); if (_sp.PostID == SessionClass.CurrentSinoUser.CurrentPost.PostID) { _selectpost = _index; } } this.barCurrentPost.EditValue = new PostListItem(SessionClass.CurrentSinoUser.CurrentPost); RemotingUserCTX.SetCurUser(SessionClass.CurrentSinoUser); if (SessionClass.CurrentSinoUser.CurrentPost != null) { this.barCurrentOrg.EditValue = SessionClass.CurrentSinoUser.CurrentPost.PostDWMC; } this.timer_PandingAlert.Enabled = true; //是否启动待办提示小图标 } }
private void LoadQuests() { var res = new MySQLDatabase().Query("getQuestionByTUN", new Dictionary <string, object>() { { "@TUN", User.Identity.Name } }, true); divQuestions.Controls.Clear(); int?postId = string.IsNullOrEmpty(Request.QueryString["postid"]) ? (int?)null : Convert.ToInt32(Request.QueryString["postid"]); foreach (var item in res) { PostListItem post = LoadControl("~/User Control/PostListItem.ascx") as PostListItem; post.PostID = Convert.ToInt32(item["id"]); if (postId != null && post.PostID == postId) { post.SetActive(); } post.Title = item["title"]; post.Badge = (item["isAnswered"] == "0" ? "new" : "read"); post.Body = "- " + item["askedby"]; post.PostClick += delegate { Response.Redirect(Request.Url.AbsolutePath + "?postid=" + post.PostID); }; divQuestions.Controls.Add(post); } LoadQuestionDetail(postId); }
void initializeForm() { DirectoryInfo di = new DirectoryInfo(Path.Combine(Settings.Default.DestinationFolder, Settings.Default.LatestPostFolderName)); List <FileInfo> latestFiles = di.GetFiles("*_Response.json").ToList().OrderByDescending(p => p.LastWriteTime).ToList(); PostListItem postListItem = null; ResponseBarcode tmpParsedData = null; try { panel1.Controls.Clear(); int i = 1; JsonSerializerSettings serializerSettings = new JsonSerializerSettings(); serializerSettings.Culture = new System.Globalization.CultureInfo("tr-TR"); serializerSettings.DateFormatString = "dd.MM.YYYY"; foreach (var item in latestFiles) { try { tmpParsedData = ParserBL.GetInstance().GetObjectFromJsonFile <ResponseBarcode>(item.FullName, serializerSettings); if (tmpParsedData != null) { postListItem = new PostListItem(i, tmpParsedData); postListItem.Dock = DockStyle.Top; postListItem.Name = item.Name; postListItem.Height = 28; postListItem.Width = 315; postListItem.PostItemDetailClicked += PostListItem_PostItemDetailClicked; postListItem.PostItemPrint += PostListItem_PostItemPrint; panel1.Controls.Add(postListItem); } else { Logger.GetInstance().Info(item.FullName + " dosyası convert edilemedi"); } if (i >= Settings.Default.NotificationMaxCount) { break; } i++; } catch (Exception ex) { Logger.GetInstance().Error(item.FullName + " dosyası parse edilemedi", ex); } } } catch (Exception ex) { Logger.GetInstance().Error("Son işlem yapılan reçete dosyaları okunamadı", ex); new FormNotification("Son işlem yapılan reçete dosyaları okunamadı", NotificationType.Error).ShowDialog(); } }
private void barCurrentPost_EditValueChanged(object sender, EventArgs e) { PostListItem _pItem = this.barCurrentPost.EditValue as PostListItem; SinoPost _selectPost = _pItem.Post; RemotingUserCTX.SetCurUser(SessionClass.CurrentSinoUser); SessionClass.CurrentSinoUser.CurrentPost = _selectPost; this.barCurrentOrg.EditValue = _selectPost.PostDWMC; InitMenu(); }
protected void Page_Load(object sender, EventArgs e) { MySQLDatabase db = new MySQLDatabase(); var res = db.Query("getAllApplication", null, true); var appid = Request.QueryString["appid"]; foreach (var item in res) { PostListItem post = LoadControl("~/User Control/PostListItem.ascx") as PostListItem; post.PostID = Convert.ToInt32(item["id"]); if (item["id"] == appid) { post.SetActive(); } post.Title = item["title"]; if (item["type"] == "1") { post.Badge = "stu"; post.CssClass += " stu"; } else { post.Badge = "tea"; post.CssClass += " tea"; } post.Body = item["date"]; post.PostClick += delegate { Response.Redirect(Request.Url.AbsolutePath + "?appid=" + post.PostID); }; Applications.Controls.Add(post); } if (appid != null) { var res2 = db.Query("getResponseByAId", new Dictionary <string, object>() { { "@AId", Convert.ToInt32(appid) } }, true); foreach (var item in res2) { PostListItem post = LoadControl("~/User Control/PostListItem.ascx") as PostListItem; post.PostID = Convert.ToInt32(item["id"]); post.Title = item["name"]; post.Body = item["email"]; //post.PostClick += delegate { Response.Redirect; }; post.OnClientClick += "window.open('" + ("Response?resid=" + post.PostID) + "','_blank')"; Responses.Controls.Add(post); } } }
private PostListItem GetPost(int postId) { PostListItem result = new PostListItem(); using (var ctx = new ApplicationDbContext()) { var entity = ctx .Posts .Single(e => e.Id == postId); result.AuthorId = _userId; result.Id = entity.Id; result.Title = entity.Title; } return(result); }
private PostListItem GetItem(BlogPost post) { var item = new PostListItem { BlogPostId = post.Id, Slug = post.Slug, Title = post.Title, Image = string.IsNullOrEmpty(post.Image) ? BlogSettings.PostCover : post.Image, Content = post.Description, Published = post.Published, AuthorName = post.Profile.AuthorName, AuthorEmail = post.Profile.AuthorEmail, BlogSlug = post.Profile.Slug, PostViews = post.PostViews }; return(item); }
protected void Page_Load(object sender, EventArgs e) { string dir = Request.QueryString["album"]; string root = Server.MapPath("~"); string[] albums = Directory.GetDirectories(root + "/Albums"); divAlbum.Controls.Clear(); foreach (var album in albums) { PostListItem post = LoadControl("~/User Control/PostListItem.ascx") as PostListItem; post.Title = album.Split('\\').Last(); post.PostClick += delegate { Response.Redirect("~/Admin/Gallery?album=" + post.Title); }; if (dir != null && dir == post.Title) { post.SetActive(); } divAlbum.Controls.Add(post); } }
public PostListItem GetPostById(Guid postId) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Posts .Where(x => x.PostId == postId).SingleOrDefault(); var post = new PostListItem { PostId = entity.PostId, DiscussionId = entity.DiscussionId, Body = entity.Body, CreatorId = entity.CreatorId, CreatedUTC = entity.CreatedUTC, ModifiedUTC = entity.ModifiedUTC, CreatorUsername = ctx.Users.Where(x => x.Id == entity.CreatorId.ToString()).FirstOrDefault().UserName, }; return(post); } }
public UserDetail ConvertUserToUserDetail(User user) { var userDetail = new UserDetail() { Id = user.Id, Name = user.Name, Email = user.Email, // PostsByUser = }; foreach (var post in user.PostsByUser) { var postListItem = new PostListItem { Id = post.Id, Text = post.Text, Title = post.Title, AuthorId = post.AuthorId, AuthorName = post.Author.Name }; userDetail.PostsByUser.Add(postListItem); } return(userDetail); }