Esempio n. 1
0
        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 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");
        }
        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.");
            }
        }
Esempio n. 4
0
        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..");
            }
        }