private void LoadList() { try { BlogPostBLL blogPostBLL = new BlogPostBLL(); DataTable dt = blogPostBLL.GetAll(); rptrList.DataSource = dt; rptrList.DataBind(); } catch (Exception) { //throw; } }
private void GenerateCode() { try { QuaintLibraryManager lib = new QuaintLibraryManager(); this.ModelCode = CodePrefix.BlogPost + "-" + lib.GetSixDigitNumber(1); BlogPostBLL blogPostBLL = new BlogPostBLL(); DataTable dt = blogPostBLL.GetAll(); if (dt != null) { if (dt.Rows.Count > 0) { string[] lastCode = dt.Rows[dt.Rows.Count - 1]["BlogPostCode"].ToString().Split('-'); int lastCodeNumber = Convert.ToInt32(lastCode[1]); this.ModelCode = CodePrefix.BlogPost + "-" + lib.GetSixDigitNumber(lastCodeNumber + 1); } } } catch (Exception) { Alert(AlertType.Error, "Failed to load."); } }