//(LinkButton) Edit butonu için,tıklayınca düzenmele kısmı gelecek //Repeter içindeki eleman sayfayı post ediyorsa çalışır (OnItemCommand argümanıyla) LinkButton için protected void rptAdminMenus_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Update") { int adminMenuId = Convert.ToInt32(e.CommandArgument); AdminMenu adminMenuToUpdate = GenericBS <AdminMenu> .GetSingleItemByCriteria(x => x.Id == adminMenuId); txtLinkUpdate.Text = adminMenuToUpdate.Link; txtNameUpdate.Text = adminMenuToUpdate.Name; ddlMenuIconUpdate.SelectedItem.Text = adminMenuToUpdate.MenuIcon; if (adminMenuToUpdate.TopMenuId != null) { chkTopMenuUpdate.Checked = true; divTopMenuUpdate.Style.Add("display", "block"); ddlTopMenuUpdate.SelectedValue = adminMenuToUpdate.TopMenuId.Value.ToString(); } else { chkTopMenuUpdate.Checked = false; divTopMenuUpdate.Style.Add("display", "none"); } ClientScriptManager scr = Page.ClientScript; string script = @"<script>$(document).ready(function(){ $('#divUpdateAdminMenu').css('display','block'); $('#divUpdateAdminMenu').removeClass('modal fade'); $('#divUpdateAdminMenu').addClass('modal fade in'); $('#ContentPlaceHolder1_AdminMenuYonetim1_hfUpdateAdminMenuId').val('" + adminMenuId + "');});</script>"; scr.RegisterClientScriptBlock(Page.GetType(), "deneme", script); } }
private void GetSummary() { //mail confirmed true olacak isActive false olacak List <User> users = GenericBS <User> .GetListByCriteria(x => x.IsMailConfirmed.Value && !x.IsActive.Value); ltCountOfUnConfirmedUsers.Text = users.Count.ToString(); }
protected void btnUpdate_Click(object sender, EventArgs e) { string refString = ""; int adminUserId = Convert.ToInt32(hfUpdateAdminId.Value); AdminUser adminUserToUpdate = GenericBS <AdminUser> .GetSingleItemByCriteria(x => x.Id == adminUserId); adminUserToUpdate.FullName = txtAdminFullNameUpdate.Text; adminUserToUpdate.UserName = txtAdminUsernameUpdate.Text; adminUserToUpdate.Password = txtAdminPasswordUpdate.Text; adminUserToUpdate.Email = txtAdminEmailUpdate.Text; adminUserToUpdate.Job = txtAdminJobUpdate.Text; string filePath = SavePhoto(ref refString); if (refString != "") { NotificationMessage.Error(divMessage, refString); return; } else { adminUserToUpdate.Photo = filePath; GenericBS <AdminUser> .Update(adminUserToUpdate); GetAdminUser(); } //kaydet butonuna basınçda admin menü eklerken aynı anda left menüdede gözükmesi için //(Page.Master.FindControl("LeftMenu") as LeftMenu).GetLeftMainAdminMenus(); NotificationMessage.Success(divMessage, "Yeni Menü Başarı İle Güncellendi"); }
protected void btnUpdate_Click(object sender, EventArgs e) { int adminMenuId = Convert.ToInt32(hfUpdateAdminMenuId.Value); AdminMenu adminMenuToUpdate = GenericBS <AdminMenu> .GetSingleItemByCriteria(x => x.Id == adminMenuId); adminMenuToUpdate.Name = txtNameUpdate.Text; adminMenuToUpdate.Link = txtLinkUpdate.Text; adminMenuToUpdate.MenuIcon = "fa fa-" + ddlMenuIconUpdate.SelectedItem.ToString(); //top menuye bak if (!chkTopMenuUpdate.Checked) { adminMenuToUpdate.TopMenuId = null; } else { adminMenuToUpdate.TopMenuId = Convert.ToInt32(ddlTopMenuUpdate.SelectedValue); } GenericBS <AdminMenu> .Update(adminMenuToUpdate); GetAdminMenus(); //kaydet butonuna basınçda admin menü eklerken aynı anda left menüdede gözükmesi için (Page.Master.FindControl("LeftMenu") as LeftMenu).GetLeftMainAdminMenus(); NotificationMessage.Success(divMessage, "Yeni Menü Başarı İle Güncellendi"); }
protected void btnSave_Click(object sender, EventArgs e) { AdminMenu adminMenu = new AdminMenu(); adminMenu.IsActive = true; adminMenu.Link = txtLink.Text; adminMenu.MenuIcon = "fa fa-" + ddlMenuIcon.SelectedItem.ToString(); adminMenu.Name = txtMenuName.Text; if (!chkSelectTopMenu.Checked) { adminMenu.TopMenuId = null; } else { adminMenu.TopMenuId = Convert.ToInt32(ddlTopMenu.SelectedValue); } GenericBS <AdminMenu> .Insert(adminMenu); GetAdminMenus(); //kaydet butonuna basınçda admin menü eklerken aynı anda left menüdede gözükmesi için (Page.Master.FindControl("LeftMenu") as LeftMenu).GetLeftMainAdminMenus(); NotificationMessage.Success(divMessage, "Yeni Menü Başarı İle Kaydedildi"); }
protected void btnKaydet_Click(object sender, EventArgs e) { string refString = ""; User user = new User(); user.Email = txtEmail.Value; user.FullName = txtFullName.Value; user.Password = Hashing.HashWithMD5(txtPassword.Value); user.UserName = txtUserName.Value; user.IsActive = false; user.IsMailConfirmed = false; user.ActivationCode = Guid.NewGuid(); string filePath = FileUploader.UploadSingleFile(Request.Files, ref refString, 1024 * 1024, new string[] { "image/png", "image/jpg", "image/jpeg", "application/pdf" }, "/img/UserPhotos/"); if (refString != "") { NotificationMessage.Error(divMessage, refString); return; } else { user.Photo = filePath; GenericBS <User> .Insert(user); string mailMessage = string.Format("Sayın <b>{0}</b>.Sistemimize hoşgeldiniz.Hesabınızın aktifleşebilmesi için lütfen aşağıdaki linke tıklayınız.<br/> <a href='http://localhost:57513/UserActivation.aspx?Code=" + user.ActivationCode + "'><b>http://localhost:57513/UserActivation.aspx?Code=" + user.ActivationCode + "</b></a>", user.FullName); MailSender.SendMail(user.Email, "Blog Aktivasyon", mailMessage); NotificationMessage.Success(divMessage, "Kullanıcı kaydı başarılı.Mail aktivasyonunu yapınız."); } }
protected void btnLogin_Click(object sender, EventArgs e) { string userNameOrEmail = txtUserOrEmail.Text; string password = Hashing.HashWithMD5(txtPassword.Text); User user = GenericBS <User> . GetSingleItemByCriteria(x => (x.UserName == userNameOrEmail && x.Password == password) || (x.Email == userNameOrEmail && x.Password == password)); if (user != null) { if (!user.IsMailConfirmed.Value) { NotificationMessage.Error(divMessage, "Henüz mail aktivasyonu yapmadınız!"); } else if (!user.IsActive.Value) { NotificationMessage.Error(divMessage, "Hesabınız henüz yönetici tarafından onaylanmamış!"); } else { SessionManager.ActiveUser = user; Response.Redirect("~/UserPanel.aspx"); } } else { NotificationMessage.Error(divMessage, "Böyle bir kullanıcı bulunamadı!"); } }
private void GetCategories() { List <Category> categories = GenericBS <Category> .GetListByCriteria <int>(c => c.IsActive.Value, c => c.OrderNumber.Value, BlogProjectSon.MODEL.SortDirection.Ascending); rptCategories.DataSource = categories; rptCategories.DataBind(); }
protected void rptAdminUser_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Update") { int adminUserId = Convert.ToInt32(e.CommandArgument); AdminUser adminUserToUpdate = GenericBS <AdminUser> .GetSingleItemByCriteria(x => x.Id == adminUserId); imgAdminPhotoUpdate.ImageUrl = adminUserToUpdate.Photo; txtAdminFullNameUpdate.Text = adminUserToUpdate.FullName; txtAdminUsernameUpdate.Text = adminUserToUpdate.UserName; //txtAdminPasswordUpdate.Text = adminUserToUpdate.Password; txtAdminEmailUpdate.Text = adminUserToUpdate.Email; txtAdminJobUpdate.Text = adminUserToUpdate.Job; ClientScriptManager scr = Page.ClientScript; string script = @"<script>$(document).ready(function(){ $('#divUpdateAdmin').css('display','block'); $('#divUpdateAdmin').removeClass('modal fade'); $('#divUpdateAdmin').addClass('modal fade in'); $('#ContentPlaceHolder1_AdminDuzenle1_hfUpdateAdminId').val('" + adminUserId + "');});</script>"; scr.RegisterClientScriptBlock(Page.GetType(), "deneme", script); } }
protected void btnComment_Click(object sender, EventArgs e) { int blogentryId = Convert.ToInt32(Request.QueryString["Id"]); Comment comment = new Comment(); comment.CommentContent = txtComment.Value; comment.Date = DateTime.Now; comment.BlogEntryId = blogentryId; comment.CommentUser.FullName = txtFullName.Value; comment.CommentUser.Email = txtEmail.Value; GenericBS <Comment> .Insert(comment); //---------------------------------------------- //AdminMenu adminMenu = new AdminMenu(); //adminMenu.IsActive = true; //adminMenu.Link = txtLink.Text; //adminMenu.MenuIcon = "fa fa-" + ddlMenuIcon.SelectedItem.ToString(); //adminMenu.Name = txtMenuName.Text; //if (!chkSelectTopMenu.Checked) // adminMenu.TopMenuId = null; //else // adminMenu.TopMenuId = Convert.ToInt32(ddlTopMenu.SelectedValue); //GenericBS<AdminMenu>.Insert(adminMenu); //GetAdminMenus(); ////kaydet butonuna basınçda admin menü eklerken aynı anda left menüdede gözükmesi için //(Page.Master.FindControl("LeftMenu") as LeftMenu).GetLeftMainAdminMenus(); //NotificationMessage.Success(divMessage, "Yeni Menü Başarı İle Kaydedildi"); }
private void GetAdminMenus() { List <AdminMenu> adminMenus = GenericBS <AdminMenu> .GetAll(); // List<AdminMenu> adminMenus = GenericBS<AdminMenu>.GetListByCriteria(x=>x.IsActive == true); ControlBinder.BindRepeater(rptAdminMenus, adminMenus); ControlBinder.BindDropdownList(ddlTopMenu, adminMenus, "Name", "Id"); ControlBinder.BindDropdownList(ddlTopMenuUpdate, adminMenus, "Name", "Id"); }
public void GetLeftMainAdminMenus() { //List<AdminMenu> adminMainMenu = GenericBS<AdminMenu>.GetListByCriteria(x => x.TopMenuId == null && x.IsActive == true); //ControlBinder.BindRepeater(rptAdminMenu, adminMainMenu); ControlBinder.BindRepeater ( rptAdminMenu, GenericBS <AdminMenu> .GetListByCriteria(x => x.TopMenuId == null && x.IsActive.Value) ); }
private void GetLastBlogEnrties() { List <BlogEntry> entries = GenericBS <BlogEntry> .GetListByCriteria <DateTime> ( x => x.IsActive.Value, x => x.Date.Value, MODEL.SortDirection.Descending ).Take(3).ToList(); ControlBinder.BindRepeater(rptBlogEntries, entries); }
private void GetCategoryDetail(int categoryId) { List <BlogEntry> entry = GenericBS <BlogEntry> .GetListByCriteria(x => x.CategoryId == categoryId && x.IsActive.Value); if (entry.Count != 0) { ControlBinder.BindRepeater(rptBlogEntries, entry); } else { NotificationMessage.Error(divMessage, "Bu Kategoride henüz bilgi yok.!!"); } }
protected void lnkApprove_Click(object sender, EventArgs e) { int userId = Convert.ToInt32(hfUserIdApprove.Value); User UserDelete = GenericBS <User> .GetSingleItemByCriteria(x => x.Id == userId); // silme işlemi // GenericBS<AdminMenu>.Delete(adminMenuDelete); UserDelete.IsActive = true; GenericBS <User> .Update(UserDelete); GetUser(); NotificationMessage.Success(divMessage, "Başarıyla Onaylandı"); }
protected void lnkDeleteUser_Click(object sender, EventArgs e) { int blogId = Convert.ToInt32(hfBlogId.Value); BlogEntry blogDelete = GenericBS <BlogEntry> .GetSingleItemByCriteria(x => x.Id == blogId); // silme işlemi // GenericBS<AdminMenu>.Delete(adminMenuDelete); blogDelete.IsActive = false; GenericBS <BlogEntry> .Update(blogDelete); GetBlogEntry(); NotificationMessage.Warning(divMessage, "Başarıyla Silindi"); }
protected void lnkDeleteAdminUser_Click(object sender, EventArgs e) { int adminUserId = Convert.ToInt32(hfAdminUserId.Value); AdminUser adminUserDelete = GenericBS <AdminUser> .GetSingleItemByCriteria(x => x.Id == adminUserId); // silme işlemi // GenericBS<AdminMenu>.Delete(adminMenuDelete); adminUserDelete.IsActive = false; GenericBS <AdminUser> .Update(adminUserDelete); GetAdminUser(); NotificationMessage.Warning(divMessage, "Başarıyla Silindi"); }
protected void lnkApprove_Click(object sender, EventArgs e) { int blogId = Convert.ToInt32(hfBlogIdApprove.Value); BlogEntry blogApprove = GenericBS <BlogEntry> .GetSingleItemByCriteria(x => x.Id == blogId); // silme işlemi // GenericBS<AdminMenu>.Delete(adminMenuDelete); blogApprove.IsActive = true; GenericBS <BlogEntry> .Update(blogApprove); GetBlogEntry(); NotificationMessage.Success(divMessage, "Başarıyla Onaylandı"); }
protected void btnDeleteAdminMenu_Click(object sender, EventArgs e) { int adminMenuId = Convert.ToInt32(hfAdminMenuId.Value); AdminMenu adminMenuDelete = GenericBS <AdminMenu> .GetSingleItemByCriteria(x => x.Id == adminMenuId); // silme işlemi // GenericBS<AdminMenu>.Delete(adminMenuDelete); adminMenuDelete.IsActive = false; GenericBS <AdminMenu> .Update(adminMenuDelete); NotificationMessage.Warning(divMessage, "Başarıyla Silindi"); GetAdminMenus(); (Page.Master.FindControl("LeftMenu") as LeftMenu).GetLeftMainAdminMenus(); }
protected void btnLogin_Click(object sender, EventArgs e) { string userName = txtUsername.Text; string password = Hashing.HashWithMD5(txtPassword.Text); AdminUser user = GenericBS <AdminUser> .GetSingleItemByCriteria(x => x.UserName == userName && x.Password == password); SessionManager.ActiveAdmin = user; if (user != null) { Response.Redirect("Default.aspx"); } else { ltMessage.Text = "<div class='alert alert-danger'>Böyle bir kullanıcı bulunamadı..! </div>"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Guid code = Guid.Parse(Request.QueryString["Code"]); User user = GenericBS <User> .GetSingleItemByCriteria(x => x.ActivationCode == code); if (user != null) { user.IsMailConfirmed = true; GenericBS <User> .Update(user); NotificationMessage.Error(divMessage, "Aktivasyon Başarılı.Yönetici onayından sonra giriş yapabilirsiniz."); } else { NotificationMessage.Error(divMessage, "Aktivasyon Başarısız.Lütfen maildeki linke tıklayın."); } } }
private void GetBlogEntryDetails(int blogEntryId) { BlogEntry entry = GenericBS <BlogEntry> .GetSingleItemByCriteria(x => x.Id == blogEntryId && x.IsActive.Value); if (entry != null) { ltContent.Text = entry.Content; ltTitle.Text = entry.Title; ltCategory.Text = entry.Category.CategoryName; ltUser.Text = entry.User.FullName; ltDateDay.Text = entry.Date.Value.Day.ToString(); ltDateMonth.Text = ((MonthName)entry.Date.Value.Month).ToString(); ControlBinder.BindRepeater(rptBlogEntryPhotos, entry.BlogEntryPhotoes.ToList()); } else { Response.Redirect("/Default.aspx"); } }
protected void rptArticle_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Article") { int blogentryId = Convert.ToInt32(e.CommandArgument); BlogEntry articleId = GenericBS <BlogEntry> .GetSingleItemByCriteria(x => x.Id == blogentryId); ltContext.Text = articleId.Content; ltTitle.Text = articleId.Title; ClientScriptManager scr = Page.ClientScript; string script = @"<script>$(document).ready(function(){ $('#divArticle').css('display','block'); $('#divArticle').removeClass('modal fade'); $('#divArticle').addClass('modal fade in'); $('#ContentPlaceHolder1_YaziOnaylama1_hdfArticleId').val('" + blogentryId + "');});</script>"; scr.RegisterClientScriptBlock(Page.GetType(), "deneme", script); } }
protected void btnSave_Click(object sender, EventArgs e) { try { BlogEntry be = new BlogEntry(); be.CategoryId = Convert.ToInt32(ddlCategory.SelectedValue); be.Content = txtContent.Value; be.Date = DateTime.Now; be.IsActive = false; be.Title = txtTitle.Value; be.UserId = SessionManager.ActiveUser.Id; be.Abstract = txtAbstract.Value; GenericBS <BlogEntry> .Insert(be); HttpFileCollection hfc = Request.Files; if (hfc.Count > 0) { string isim = Guid.NewGuid().ToString(); for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; string filePath = "~/img/BlogPhotos/" + isim + hpf.FileName; hpf.SaveAs(Server.MapPath(filePath)); BlogEntryPhoto ph = new BlogEntryPhoto(); ph.BlogEntryId = be.Id; ph.PhotoPath = filePath; GenericBS <BlogEntryPhoto> .Insert(ph); } } NotificationMessage.Success(divMessage, "Kayıt Başarılı.."); txtTitle.Value = ""; txtContent.Value = ""; } catch (Exception) { NotificationMessage.Error(divMessage, "Kayıt Başarısız.."); } }
private void GetUser() { List <User> user = GenericBS <User> .GetListByCriteria(x => x.IsMailConfirmed.Value); ControlBinder.BindRepeater(rptUser, user); }
private void GetCategories() { ControlBinder.BindDropdownList(ddlCategory, GenericBS <Category> .GetListByCriteria(x => x.IsActive.Value), "CategoryName", "Id"); }
public void GetBlogEntry() { List <BlogEntry> blogentry = GenericBS <BlogEntry> .GetAll(); ControlBinder.BindRepeater(rptArticle, blogentry); }
private void GetArticle() { List <BlogEntry> article = GenericBS <BlogEntry> .GetListByCriteria(x => x.IsActive == false); ltCountOfUnConfirmedArticle.Text = article.Count.ToString(); }
private void GetAdminUser() { List <AdminUser> adminUser = GenericBS <AdminUser> .GetAll(); ControlBinder.BindRepeater(rptAdminUser, adminUser); }