Asp.net Hazır Proje Örneği

Üniversite zamanında yapmış olduğum bir proje
Tasarım kodları :
Anasayfam.Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="anasayfam.master.cs" Inherits="deneme_proje.anasayfam1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="stil_dosyam.css" rel="Stylesheet" type="text/css" />
<style type="text/css" id="5">
#ana_div{
border:0px solid #000000;
width:810px;
height:800px;
margin:auto;
} 
#banner{
border:0px solid #000000;
width:810px;
height:150px;
background-image:url(banner.swf);
}

.text_degisen
{
 font-family:Comic Sans MS;
 color:White;
  font-size:12px;     
    
 }

.hyper_1
{
   font-family:Comic Sans MS;
   background-image:url(buton.jpg);
   background-repeat:no-repeat;
   color:White;
   width:88px; 
   height:24px;  
   display:block;
   text-decoration:none;
   text-align:center;
   font-size:13px;
   margin-left:0px;
   margin-top:10px;
  padding-top:2px;
   
 }
 
.hyper_1:hover
{
   font-family:Comic Sans MS;
   background-image:url(buton_turkuaz.jpg);
   background-repeat:no-repeat;
   color:White;
   width:88px; 
   height:24px;  
   display:block;
   text-decoration:none;
   text-align:center;
   font-size:13px;
   margin-left:0px;
   margin-top:10px;
  padding-top:2px; 
    
    }
  #menü
  {
    width:500px;
    height:50px;
    border:0px solid #000;
    display:block;
    float:left; 
      
      }
 #üye_islemleri
 {
  border:0px solid black;
  width:310px;
  height:50px;
   margin:0px 0px 0px 0px; 
   float:none;
  float:right;
  display:block;
  color:#000000;
 
  
  
}
#üye_islemleri ul
{
   height:50px;
   width:230px;
   float:left;
   padding-left:80px;
    margin:0px 0px 0px 0px;
    
 }
 #üye_islemleri ul li
 {
      float:left;
     list-style-type:none; 
      margin-left:10px;
     padding-top:12.5px;
 }
 .üye
{ text-align:center;    
   font-family:Comic Sans MS;
   color:#000;
   text-decoration:none; 
}
.üye:hover
{
    text-align:center;    
   font-family:Comic Sans MS;
   color:#09f;  
    text-decoration:underline;
  }

 
 
 
#menü ul{
 margin:0px 0px 0px 0px;
border:0px solid #000000;
width:500px;
height:50px;
float:left;
background-color: #FFF;




}
#menü ul li{
   

 
 float:left;
 
 
 text-decoration:none;
 font-family:"Times New Roman", Times, serif;
 margin-top:auto;
 list-style-type:none;
 
 
 
 }




.deneme 
{
    font-family:Comic Sans MS;
   background-image:url(buton.jpg);
   background-repeat:no-repeat;
   color:White;
   width:88px; 
   height:24px;  
   display:block;
   text-decoration:none;
   text-align:center;
   font-size:13px;
   margin-left:13px;
   margin-top:10px;
  
   padding-top:2px;
    }
 .deneme:hover
 {
   font-family:Comic Sans MS;
   background-image:url(buton_turkuaz.jpg);
   background-repeat:no-repeat;
   color:White;
   width:88px; 
   height:24px;  
   display:block;
   text-decoration:none;
   text-align:center;
   font-size:13px;
   margin-left:13px;
   margin-top:10px;
   padding-top:2px;  
     
  }
  #orta_alan
  {
      border:0px solid #000000;
       width:850px;
       height:600px;
        float:left;
      } 
      
   #sol_alan
   {
     border:0px solid #000000;
      width:550px;
      height:600px;
      float:left;
      background-image:url(sol_siyah.jpg);
      background-repeat:no-repeat;
    }
    
    #sag_alan 
    {border:0px solid #000000;
     width:300px;
      height:600px;
      float:right;
        
        
        
        
      }
     
     
  .turkuaz_font
{
     color:#0099ff;
     font-family:Comic Sans MS;
     font-size:18px;
     height:30px;
     width:100px;
    }    
    
     .turkuaz_font_2
{
     color:#0099ff;
     font-family:Comic Sans MS;
     font-size:18px;
     width:130px;
           height:30px;
    }  
    .hata
    {
       color:Red;
     font-family:Times New Roman;
     font-size:13px;  
        
        }   
   .textbox
   {
        border :1px solid #0099FF;
         font-family:Comic Sans MS;     
       color:#0099FF;
       }  

    
    .table
    {
        
        
        
         padding:18px 0px 0px 15px;
         background-repeat:no-repeat;
        height: 99px;
    }
    
    .style2
    {
        color:#00FF00;
        font-family: Times New Roman;
        font-size: 13px;
        height: 19px;
    }
#table_div
{
      width:260px;
      height:148px;
      background-image:url(sag_üst_siyah.jpg);
     margin:   0 0 0 5px;
     background-repeat:no-repeat;
    
    }
    
    .style3
    {
        color:White;
        font-family: "Comic Sans MS";
        font-size: 18px;
        height: 25px;
        width: 100px;
    }
    .style4
    {
        width: 130px;
        height: 25px;
    }
    .style6
    {
        color: #0099ff;
        font-family: Comic Sans MS;
        font-size: 18px;
        width: 130px;
        height: 25px;
    }
    .style7
    {
        color:White;
        font-family: "Comic Sans MS";
        font-size: 18px;
        height: 27px;
        width: 100px;
    }
    .style8
    {
        width: 130px;
        height: 27px;
    }
  
  #sag_alt
  {
       height:447px;
       width:260px;
       margin:5px 0 0 5px;
       border:0px solid #000000;
       background-image:url(sag_alt_siyah.jpg);
       background-repeat:no-repeat;
      
      
  }
    
    .style9
    {
        width: 810px;
    }
    
</style>
    <title></title>
   
</head>
<body>
    <form id="form1" runat="server">
    <div>
       
    
    <div id="ana_div">
            <div id="banner"> 
            
            
                <table >
                    <tr><asp:Image ID="Image1" runat="server" Width="815px" Height="150px"  ImageUrl="1.jpg" />
                        <td class="style9">
                            

                           </td>
                    </tr>
                </table>
            
            
              </div>
            <div id="menü" style="height: 40px"> 
            

           <ul>
            <li> <asp:HyperLink ID="HyperLink1" runat="server" CssClass="hyper_1" 
                    NavigateUrl="~/a.aspx" >HyperLink</asp:HyperLink></li>  
              <li><asp:HyperLink ID="HyperLink2" runat="server" CssClass="deneme" 
                      NavigateUrl="~/hakkimizda.aspx">HyperLink</asp:HyperLink></li>  
               <li><asp:HyperLink ID="HyperLink3" runat="server" CssClass="deneme" 
                       NavigateUrl="~/resimler.aspx">HyperLink</asp:HyperLink></li> 
              <li> <asp:HyperLink ID="HyperLink4" runat="server" CssClass="deneme" 
                      NavigateUrl="~/doluluk_oranı.aspx">HyperLink</asp:HyperLink></li> 
              <li><asp:HyperLink ID="HyperLink5" runat="server" CssClass="deneme" 
                      NavigateUrl="~/site_haritasi.aspx">HyperLink</asp:HyperLink></li>  
              


               </ul>
               </div>
            <div id="üye_islemleri">
               <ul>
               <li>  <asp:HyperLink ID="üye_ol" runat="server" CssClass="üye" 
                       NavigateUrl="~/üye_ol.aspx" >üye ol</asp:HyperLink></li>
               <li><asp:HyperLink ID="üye_giris" runat="server" CssClass="üye" NavigateUrl="~/üye_girisi.aspx">üye girişi</asp:HyperLink></li>

               
               </ul>
              
                
                
            </div>                     
            <div  id="orta_alan">
               

               <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"  > 
                <div id="sol_alan">
                <h1 style=" color:#F90; text-align:center; font-family:Comic Sans MS; ">ANASAYFAM</h1>
                
                    <p  style=" color:#FFF; margin-left:15px; width:500px; font-family:Comic Sans MS; max-width:500px;  margin-top:0px; margin-bottom:0px; ">
                        &nbsp;</div>

        </asp:ContentPlaceHolder> 
            
           
                 <div id="sag_alan">
            <div id="table_div" >
            
            <table  class="table">
            <tr  class="turkuaz_font_2" >
            <td class="style7"  >Kullanıcı Adı</td>
            <td class="style8"  >
                <asp:TextBox  ID="TextBox1" runat="server" Width="110px" CssClass="textbox"></asp:TextBox>
                </td>
            
            </tr>
            <tr >
            <td class="style3">Şifre</td>
            <td class="style6">
                <asp:TextBox ID="TextBox2" runat="server" Width="110px" CssClass="textbox" 
                    MaxLength="20" TextMode="Password" ToolTip="*"></asp:TextBox>
                </td>
            
            </tr>
            <tr  >
            <td class="style3"></td>
            <td class="style4">
                <asp:Button ID="Button1" runat="server" BackColor="#0099FF" ForeColor="White" 
                    onclick="Button1_Click" Text="GİRİŞ" Width="89px" />
                </td>
            
            </tr>
            
            <tr  >
            <td class="style2" colspan="2">
                    &nbsp;  <asp:Label ID="lbl_mesaj" runat="server" Text="Label"></asp:Label>
               </td>
            
            </tr>
            
            </table>
            
            </div>
            <div id="sag_alt">
            
            
            </div>
            
            
            </div>
            
            
            </div>
            
             </div>
               
                       
        
        
        
        </div>
    
    
    
    </div>
    </form>
</body>
</html>
proje_stillerim.css

 body {
}
#ana_div{
border:1px solid #000000;
width:800px;
height:800px;
margin:auto;
} 
#banner{
border:0px solid #000000;
width:800px;
height:150px;
}

#menü ul{
margin-top:0px;
margin-left:0px;
 
border:0px solid #000000;
width:760px;
height:50px;
float:left;
background-color: #FFF;




}
#menü ul li{
   

 
 float:left;
 
 
 text-decoration:none;
 font-family:"Times New Roman", Times, serif;
 margin-top:auto;
 list-style-type:none;
 
 
 
 }



.deneme 
{
    font-family:Comic Sans MS;
   background-image:url(buton_111.jpg);
   background-repeat:no-repeat;
   color:White;
   width:88px; 
   height:24px;  
   display:block;
   text-decoration:none;
   text-align:center;
   font-size:14px;
   margin-left:13px;
   margin-top:10px;
   padding-top:1px;
    }
 .deneme:hover
 {
   font-family:Comic Sans MS;
   background-image:url(buton_222.jpg);
   background-repeat:no-repeat;
   color:White;
   width:88px; 
   height:24px;  
   display:block;
   text-decoration:none;
   text-align:center;
   font-size:14px;
   margin-left:13px;
   margin-top:10px;
   padding-top:1px;  
     
  }
stil_dosyam.css
body 
{
   
}
h2
{
  text-align:center;
  font-family:Comic Sans MS;
  font-size:30px;
  color:#ff9000;
    height: 23px;
}


.turkuaz_font
{
     color:#0099ff;
     font-family:Comic Sans MS;
     font-size:18px;
     height:30px;
    width: 400px;
}

.turkuaz_font_2
{
     color:#0099ff;
     font-family:Comic Sans MS;
     font-size:18px;
     height:30px;
    width: 400px;
}
.textbox
{
     width:105px;
     height:20px;
     color:Black;
     border:1px solid #09f;
    
    }
Program Kodları
anasayfam.Master
  using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace deneme_proje
{
    public partial class anasayfam1 : System.Web.UI.MasterPage
    {
        SqlConnection baglan = new SqlConnection(@"Data Source=DESKTOP-8RHPADE;Initial Catalog=garajProje;Integrated Security=True");

        protected void Page_Load(object sender, EventArgs e)
        {
            lbl_mesaj.Visible = false;
            
         

            baglan.Open();
            SqlDataAdapter da = new SqlDataAdapter("select * from menüm2  ",baglan);
            DataTable dt = new DataTable();
         
            da.Fill(dt);
            if (dt.Rows.Count!=0)
            {

                /*  HyperLink1.Text = dt.Columns[0].ToString();
                  HyperLink2.Text = dt.Columns[1].ToString();
                  HyperLink3.Text = dt.Columns[2].ToString();
                  HyperLink4.Text = dt.Columns[3].ToString();
                  HyperLink5.Text = dt.Columns[4].ToString();
                   */

                    HyperLink1.Text = dt.Rows[0][0].ToString();
                    HyperLink2.Text = dt.Rows[0][1].ToString();
                    HyperLink3.Text = dt.Rows[0][2].ToString();
                    HyperLink4.Text = dt.Rows[0][3].ToString();
                    HyperLink5.Text = dt.Rows[0][4].ToString();
                   
            }

            if (Session["1"]==null )
            {
                
                Session.Clear();
            }
            else 
            {
                if (Session["1"]=="1")
                {
                    Image1.ImageUrl = "1.jpg";
                }
                else if (Session["1"]=="2")
                {
                     Image1.ImageUrl = "2.jpg";
                }
            }

            baglan.Close();

           
            
            
           

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            baglan.Open();
            SqlCommand sc = new SqlCommand("select * from admin where kullanici_adi=@kullanici and sifre=@sifre ", baglan);
            sc.Parameters.AddWithValue("@kullanici", TextBox1.Text);
            sc.Parameters.AddWithValue("@sifre", TextBox2.Text);
            SqlDataReader dr = sc.ExecuteReader();

            if (dr.Read())
            {
                // Session.Timeout = 5;
                Response.Redirect("admin_sayfasi.aspx");
            }
            else
            {
                lbl_mesaj.Visible = true;
                if (TextBox1.Text == "" && TextBox2.Text == "")
                {
                    lbl_mesaj.Text = "kullanıcı adını veya şifreyi  girin !!!";
                }
                else
                {

                    lbl_mesaj.Text = "kullanıcı adını veya şifreyi doğru girin !!!";
                    
                }


            }
            baglan.Close();
        }

        
    }
}
banner_islem.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace deneme_proje
{
    public partial class banner_islem : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (DropDownList1.SelectedValue == "1")
            {
                Session["1"] = "1";
            }
            else if (DropDownList1.SelectedValue=="2")
            {
                Session["1"] = "2";
            }
        }

    }
}
hakkimizda.aspx.cs


    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data.SqlClient;
using System.Data;
namespace deneme_proje
{
    public partial class hakkımızda : System.Web.UI.Page
    {
        SqlConnection baglan=new SqlConnection(@"Data Source=DESKTOP-8RHPADE;Initial Catalog=garajProje;Integrated Security=True");
        protected void Page_Load(object sender, EventArgs e)
        {
           
           //TextBox3.Text = File.ReadAllText(MapPath("dene.txt"));
          // TextBox3.Style.Add( araştır

           
          
           //   
             //TextBox3.Style.Add(HtmlTextWriterStyle.FontSize, "15px");
             //  TextBox3.Style.Add(HtmlTextWriterStyle.FontFamily, "Comic Sans MS");
          
           //    TextBox3.Style.Add(HtmlTextWriterStyle.Color, "White");
           //    TextBox3.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Black");
           //    TextBox3.Style.Add(HtmlTextWriterStyle.FontSize, metin + "px");

            baglan.Open();
            SqlDataAdapter da_metin = new SqlDataAdapter("select paragraf from metin where id='1' ", baglan);
            DataTable dt_metin = new DataTable();
            da_metin.Fill(dt_metin);
            if (dt_metin.Rows.Count != 0)
            {
                TextBox3.Text = dt_metin.Rows[0][0].ToString();
                
               
            }



            SqlDataAdapter da_metinn = new SqlDataAdapter("select boyut, renk, tip from metinn where id='1'",baglan);
            DataTable dt_metinn = new DataTable();
            da_metinn.Fill(dt_metinn);
            if (dt_metinn.Rows.Count!=0)
            {
                TextBox3.Style.Add(HtmlTextWriterStyle.FontSize, dt_metinn.Rows[0][0].ToString() + "px");
                TextBox3.Style.Add(HtmlTextWriterStyle.Color, dt_metinn.Rows[0][1].ToString());
                TextBox3.Style.Add(HtmlTextWriterStyle.FontFamily, dt_metinn.Rows[0][2].ToString());
            }


            baglan.Close();

           } 
           

        }
    
}

metinislemleri.aspx.cs







using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data.SqlClient;
using System.Data;
namespace deneme_proje
{
    public partial class metin_islemleri : System.Web.UI.Page
    {
        int s ;
        SqlConnection baglan = new SqlConnection(@"Data Source=DESKTOP-8RHPADE;Initial Catalog=garajProje;Integrated Security=True");
        protected void Page_Load(object sender, EventArgs e)
        {/*
            baglan.Open();
            SqlDataAdapter da_Getir = new SqlDataAdapter("select * from metin where id='1'",baglan);
            DataTable dt_Getir = new DataTable();
            da_Getir.Fill(dt_Getir);
            if (dt_Getir.Rows.Count!=0)
            {
                TextBox1.Text = dt_Getir.Rows[0][1].ToString();
            }

            baglan.Close();
            */
 }

        protected void btn_kaydet_Click(object sender, EventArgs e)
        {
            //FileStream fs = new FileStream(Server.MapPath("dene.txt"), FileMode.Append, FileAccess.Write);
            //StreamWriter sw = new StreamWriter(fs);
            //sw.WriteLine(TextBox1.Text);
            //sw.Close();
            //fs.Close();
            //Label1.Text = "kaydedildi...";
            if (TextBox1.Text == "")
            {
                Label1.Text = " lütfen boş bırakmayın...";
            }
            else
            {
                Label1.Text = "";
                baglan.Open();
                SqlCommand sc = new SqlCommand("update metin set paragraf='" + TextBox1.Text + "' where id='1'  ", baglan);
                sc.ExecuteNonQuery();
                baglan.Close();
                s = 0;
            }


        }
        
        protected void Button1_Click(object sender, EventArgs e)
        {
            baglan.Open();
            SqlCommand sc = new SqlCommand("update metinn  set boyut='"+DropDownList1.SelectedValue+"' , renk='"+DropDownList2.SelectedValue+"',tip='"+DropDownList3.SelectedValue.ToString()+"'  where id='1' ", baglan);
            sc.ExecuteNonQuery();
            baglan.Close();
            
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "";
            baglan.Open();

            SqlCommand sc = new SqlCommand("update paragraf set paragraf='" + TextBox1.Text + "' where id='1'  ", baglan);
            sc.ExecuteNonQuery();


            baglan.Close();


        }

        protected void Button3_Click(object sender, EventArgs e)
        {

        }

           

       
    }
}





Yorum Gönder

0 Yorumlar