Sie sind auf Seite 1von 60

Onur Kaplan 20080382

Codes that I wrote for Ticket System:

#Code 01: <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>

</title> <style type="text/css"> .style1 { width: 21%; height: 84px; } </style> <link rel="stylesheet" href="panel/images/button1/cbcscbinsmenu.css" type="text/css" /></head> <body> <form name="form1" method="post" action="giris.aspx" id="form1"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTQ0OTIyNjMyMmQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9f FgEFDEltYWdlQnV0dG9uMWgIcmB8pDsp+cONdM11XktmWV+2" /> </div>

<div>

Onur Kaplan 20080382


<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAKw/pV6AtvLnIUOAqfasMgLAtLCmdMIFp2nj9SdiIPn5R2Dvu8TZv2n6zA=" /> </div> <br /> <center> <img alt="" src="panel/images/login_welcome.jpg" style="width: 239px; height: 191px" /><br /></center> <table align="center"> <tr> <td> <span id="Label1" style="color:Black;fontweight:bold;">Kullanc Ad : </span> </td> <td> <input name="txtKullaniciAdi" type="text" id="txtKullaniciAdi" style="color:White;backgroundcolor:#1276D4;width:125px;" /> </td> </tr> <tr> <td align="right"> <span id="Label2" style="color:Black;fontweight:bold;">ifre : </span> </td> <td> <input name="txtSifre" type="password" id="txtSifre" style="color:White;background-color:#1276D4;width:125px;" /> </td>

Onur Kaplan 20080382


</tr> <tr> <td> &nbsp;</td> <td align="right"> <input type="image" name="ImageButton1" id="ImageButton1" src="panel/images/button1/ebbtcbinsmenu1_0.gif" name="ebbcbinsmenu_1" border="0" alt="Giri" title="" src="" style="height:26px;width:33px;border-width:0px;" /> </td> </tr> </table> <div>

<table id="cbinsmenuebul_table" width="0" cellpadding="0" cellspacing="0" border="0"> <tr> <td style="padding-right:1px" title="">&nbsp;</td> </tr> </table> <script type="text/javascript" src="panel/images/button1/cbjscbinsmenu.js"></script>

</div> </form>

Onur Kaplan 20080382


</body> </html>

#Code 02:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient;

/// <summary> /// Summary description for DAL /// </summary> public class DAL { public DAL() { }

public static SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket"); public static DataTable Baglan(string[] alanAdlari, string[] tabloAdlari, string Sart) { string alanToplam = "";

Onur Kaplan 20080382


string tabloToplam = ""; int say = 0; //Gelen alan adlarnn ieriini bu ksmda birletiriyoruz foreach (var item in alanAdlari) { alanToplam = alanToplam + "[" + alanAdlari[say] + "]" + ","; say++; } alanToplam = alanToplam.Remove(alanToplam.Length-1,1); say=0; //Gelen tablo adlarnn ieriini bu ksmda birletiriyoruz foreach (var item in tabloAdlari) { tabloToplam = tabloToplam + tabloAdlari[say] + ","; say++; } tabloToplam = tabloToplam.Remove(tabloToplam.Length - 1, 1); say = 0;

SqlCommand comm = new SqlCommand("SELECT " + alanToplam + " FROM " + tabloToplam + " " + Sart +"", conn);

//Datatable oluturarak sql komutumuzu alalm. DataTable dt = new DataTable();

try

Onur Kaplan 20080382


{ conn.Open(); dt.Load(comm.ExecuteReader()); } catch (Exception ex) {

} finally { conn.Close(); }

return dt;

#Code 03:

using System;

Onur Kaplan 20080382


using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

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

} protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (!IsPostBack) Session.Abandon();

string[] alanAdlari = new string[] { "PERSONEL_ID", "PERSONEL_ADI", "PERSONEL_YETKI", "PERSONEL_SIFRE","PERSONEL_BIRIM" }; string[] tabloAdlari = new string[] { "PERSONEL" };

DataTable dt = new DataTable();

Onur Kaplan 20080382


dt = DAL.Baglan(alanAdlari, tabloAdlari, "WHERE PERSONEL_ADI='" + txtKullaniciAdi.Text.ToUpper().ToString() + "' AND PERSONEL_SIFRE='" + txtSifre.Text + "'"); if (dt.Rows.Count==0) { txtKullaniciAdi.Text = ""; txtSifre.Text = ""; } else { Session["Id"] = dt.Rows[0][0].ToString(); Session["Yetki"] = dt.Rows[0][2].ToString(); Session["Ad"] = dt.Rows[0][1].ToString();

Session["Birim"] = dt.Rows[0][4].ToString();

if (Convert.ToInt32(dt.Rows[0][3].ToString()) == 1) Response.Redirect("panel/sifreDegistir.aspx");

Response.Redirect("panel/sorunBildirim.aspx"); }

} }

Onur Kaplan 20080382

#Code 04:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

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

if (!IsPostBack) { txtAd.Text = Session["Ad"].ToString(); txtAd.Enabled = false;

string[] alanAdi = new string[] { "KATEGORI_ID", "KATEGORI_ADI" };

Onur Kaplan 20080382


string[] tabloAdi = new string[] { "SORUN_KATEGORI_TABLOSU" };

DataTable dt1 = DAL.Baglan(alanAdi, tabloAdi, "");

drpSorunKategori.DataSource = dt1; drpSorunKategori.DataTextField = "KATEGORI_ADI"; drpSorunKategori.DataValueField = "KATEGORI_ID"; drpSorunKategori.DataBind(); drpSorunKategori.Items.Insert(0, ListItem.FromString("Seiniz"));

} } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi"); try { conn.Open(); SqlCommand idBul = new SqlCommand("SELECT PERSONEL_ID,PERSONEL_YETKI FROM PERSONEL WHERE PERSONEL.PERSONEL_ADI='" + Session["Ad"].ToString() + "'", conn); DataTable dt = new DataTable(); dt.Load(idBul.ExecuteReader());

Onur Kaplan 20080382


SqlCommand yaz= new SqlCommand ("INSERT INTO SORUN_TABLOSU ([PERSONEL_ID],[KATEGORI_ID],[ACIKLAMA],[BASLANGIC_ZAMAN],[ONAY_DURUM],[PER SONEL_YETKI]) VALUES ("+Convert.ToInt32(dt.Rows[0][0].ToString())+","+Convert.ToInt32(drpSorunKa tegori.SelectedItem.Value.ToString())+",'"+txtAciklama.Text+"','"+ DateTime.Now.ToString("yyyyMMddHHmm") +"',0,"+ Convert.ToInt32 (dt.Rows[0][1].ToString())+")",conn); yaz.ExecuteNonQuery(); } catch (Exception ex) {

} finally { conn.Close(); txtAciklama.Text = ""; Response.Redirect("bildirimler.aspx");

} }

#Code 05:

Onur Kaplan 20080382

Using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

public partial class panel_gelenBildirimler : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) { int yetki = Convert.ToInt32(Session[Yetki].ToString()); if (yetki == 0) { Response.Redirect(hata.aspx); } if (yetki == 1) { SqlConnection conn1 = new SqlConnection(@data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi); SqlCommand comm1 = new SqlCommand(SELECT S.SORUN_ID AS [SORUN ID ], P.PERSONEL_ADI AS [AD SOYAD],S.ACIKLAMA AS [SORUN],SOR.KATEGORI_ADI

Onur Kaplan 20080382


AS [KATEGORI ADI],DBO.FNK_TARIHI_FORMATLA(BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ONAY_ZAMAN) AS [ONAY ZAMANI ],ONAY.ONAY_ACIKLAMA AS [DURUM],K.ESKI_KATEGORI AS [ESKI KATEGORI] FROM SORUN_TABLOSU AS S INNER JOIN PERSONEL AS P ON P.PERSONEL_ID=S.PERSONEL_ID INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON S.KATEGORI_ID=SOR.KATEGORI_ID INNER JOIN ONAY_TABLOSU AS ONAY ON S.ONAY_DURUM=ONAY.ONAY_DURUM LEFT JOIN KATEGORI_LOG AS K ON S.SORUN_ID=K.SORUN_ID AND KONTROL=1 WHERE (S.ONAY_DURUM=0 OR S.ONAY_DURUM=1) AND SOR.ILGILI_BIRIM= + Session[Birim].ToString() + , conn1);

try {

conn1.Open(); DataTable dt = new DataTable(); dt.Load(comm1.ExecuteReader()); grdSorun.DataSource = dt; grdSorun.DataBind();

for (int i = 0; i < dt.Rows.Count; i++) {

CheckBox chbEkle = new CheckBox(); chbEkle.ID = chb + i.ToString(); grdSorun.Rows[i].Cells[0].Controls.Add(chbEkle); chbEkle.Checked = false;

if (dt.Rows[i][8].ToString() == SORUN LEME ALINDI)

Onur Kaplan 20080382


{ CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); c.Checked = true; }

} catch (Exception ex) {

} finally { conn1.Close();

} } if (yetki == 2) { SqlConnection conn5 = new SqlConnection(@data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi);

Onur Kaplan 20080382


SqlCommand comm5 = new SqlCommand(SELECT S.SORUN_ID AS [SORUN ID ], P.PERSONEL_ADI AS [AD SOYAD],S.ACIKLAMA AS [SORUN],SOR.KATEGORI_ADI AS [KATEGORI ADI],DBO.FNK_TARIHI_FORMATLA(BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ONAY_ZAMAN) AS [ONAY ZAMANI ],ONAY.ONAY_ACIKLAMA AS [DURUM],K.ESKI_KATEGORI AS [ESKI KATEGORI] FROM SORUN_TABLOSU AS S INNER JOIN PERSONEL AS P ON P.PERSONEL_ID=S.PERSONEL_ID INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON S.KATEGORI_ID=SOR.KATEGORI_ID INNER JOIN ONAY_TABLOSU AS ONAY ON S.ONAY_DURUM=ONAY.ONAY_DURUM LEFT JOIN KATEGORI_LOG AS K ON S.SORUN_ID=K.SORUN_ID AND KONTROL=1 WHERE (S.ONAY_DURUM=0 OR S.ONAY_DURUM=1), conn5);

try {

conn5.Open(); DataTable dt = new DataTable(); dt.Load(comm5.ExecuteReader()); grdSorun.DataSource = dt; grdSorun.DataBind();

for (int i = 0; i < dt.Rows.Count; i++) {

CheckBox chbEkle = new CheckBox(); chbEkle.ID = chb + i.ToString(); grdSorun.Rows[i].Cells[0].Controls.Add(chbEkle); chbEkle.Checked = false;

if (dt.Rows[i][8].ToString() == SORUN LEME ALINDI)

Onur Kaplan 20080382


{ CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); c.Checked = true; }

} catch (Exception ex) {

} finally { conn5.Close();

Onur Kaplan 20080382


}

protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { for (int i = 0; i < grdSorun.Rows.Count; i++) { CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); if (c.Checked) {

SqlConnection conn = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket); SqlCommand comm = new SqlCommand(UPDATE SORUN_TABLOSU SET ISLEM_BASLANGIC_ZAMAN= + DateTime.Now.ToString(yyyyMMddHHmm) + , ONAY_DURUM=1 WHERE SORUN_ID= + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + AND ONAY_DURUM=0, conn); try { conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

Onur Kaplan 20080382

} finally { conn.Close();

} /* else { SqlConnection conn = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket); SqlCommand comm = new SqlCommand(UPDATE SORUN_TABLOSU SET ISLEM_BASLANGIC_ZAMAN=, ONAY_DURUM=0 WHERE (SELECT PERSONEL_ID FROM PERSONEL WHERE PERSONEL_ADI= + grdSorun.Rows[i].Cells[2].Text.ToString() + )=PERSONEL_ID, conn); try { conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

Onur Kaplan 20080382

} finally { conn.Close();

} */

} Response.Redirect(gelenBildirimler.aspx); } protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { for (int i = 0; i < grdSorun.Rows.Count; i++) { CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); if (c.Checked) {

int dene = Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text); SqlConnection conn = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket);

Onur Kaplan 20080382


SqlCommand comm = new SqlCommand(UPDATE SORUN_TABLOSU SET ISLEM_BITIS_ZAMAN= + DateTime.Now.ToString(yyyyMMddHHmm) + , ONAY_DURUM=2 WHERE (SELECT PERSONEL_ID FROM PERSONEL WHERE PERSONEL_ADI= + grdSorun.Rows[i].Cells[2].Text.ToString() + )=PERSONEL_ID AND SORUN_ID= + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + , conn); try { conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

} finally { conn.Close(); grdSorun.Rows[i].Visible = false; }

} }

Onur Kaplan 20080382


}

#Code 06:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

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

SqlConnection conn1 = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi"); SqlCommand comm1 = new SqlCommand("SELECT S.SORUN_ID AS [SORUN ID ],S.ACIKLAMA,DBO.FNK_TARIHI_FORMATLA(S.BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI ], DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BITIS_ZAMAN) AS [ISLEM BITIS ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ONAY_ZAMAN) AS [ONAY ZAMANI

Onur Kaplan 20080382


],SOR.KATEGORI_ADI AS [KATEGORI],O.ONAY_ACIKLAMA AS DURUM FROM SORUN_TABLOSU AS S INNER JOIN ONAY_TABLOSU AS O ON S.ONAY_DURUM=O.ONAY_DURUM INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON SOR.KATEGORI_ID=S.KATEGORI_ID WHERE PERSONEL_ID=" + Convert.ToInt32(Session["Id"].ToString()) + " AND (S.ONAY_DURUM=1 OR S.ONAY_DURUM=0 OR S.ONAY_DURUM=2)", conn1); try { conn1.Open(); DataTable dt = new DataTable(); dt.Load(comm1.ExecuteReader()); grdSorun.DataSource = dt; grdSorun.DataBind();

} catch (Exception ex) {

} finally { conn1.Close(); }

Onur Kaplan 20080382

protected void grdSorun_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) return;

e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor=' #1276D4'");

e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;"); } protected void grdSorun_RowDeleting(object sender, GridViewDeleteEventArgs e) { string sorunId = grdSorun.Rows[e.RowIndex].Cells[1].Text.ToString(); SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi"); SqlCommand comm = new SqlCommand("UPDATE SORUN_TABLOSU SET ONAY_ZAMAN='" + DateTime.Now.ToString("yyyyMMddHHmm") + "',ONAY_DURUM=3 WHERE PERSONEL_ID=" + Convert.ToInt32(Session["Id"].ToString()) + " AND SORUN_ID=" + Convert.ToInt32(sorunId) + " AND ONAY_DURUM=2", conn); try { conn.Open(); comm.ExecuteNonQuery(); grdSorun.Rows[e.RowIndex].Visible = false;

Onur Kaplan 20080382

} catch (Exception ex) {

} finally { conn.Close(); } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi"); SqlCommand comm = new SqlCommand("DELETE FROM KATEGORI_LOG WHERE SORUN_ID=" + TextBox1.Text + "", conn); SqlCommand comm2 = new SqlCommand("DELETE FROM SORUN_TABLOSU WHERE SORUN_ID=" + TextBox1.Text + "", conn); try { conn.Open(); comm.ExecuteNonQuery(); comm2.ExecuteNonQuery();

Onur Kaplan 20080382


} catch (Exception ex) {

} finally { conn.Close(); Response.Redirect("bildirimler.aspx"); } } }

#Code 07:

Using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

Onur Kaplan 20080382

public partial class panel_kategoriDegistir : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int yetki = Convert.ToInt32(Session[Yetki].ToString()); if (yetki == 0) { Response.Redirect(hata.aspx); }

if (!IsPostBack) { string[] alanAdi = new string[] { KATEGORI_ID, KATEGORI_ADI }; string[] tabloAdi = new string[] { SORUN_KATEGORI_TABLOSU };

DataTable dt1 = DAL.Baglan(alanAdi, tabloAdi, );

drpKategori.DataSource = dt1; drpKategori.DataTextField = KATEGORI_ADI; drpKategori.DataValueField = KATEGORI_ID; drpKategori.DataBind(); drpKategori.Items.Insert(0, ListItem.FromString(Seiniz));

Onur Kaplan 20080382

SqlConnection conn1 = new SqlConnection(@data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi); SqlCommand comm1 = new SqlCommand(SELECT S.SORUN_ID AS [SORUN ID ], P.PERSONEL_ADI AS [AD SOYAD],S.ACIKLAMA AS [SORUN],SOR.KATEGORI_ADI AS [KATEGORI ADI],DBO.FNK_TARIHI_FORMATLA(BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI ],ONAY.ONAY_DURUM AS [ONAY DURUM],DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(S.ONAY_ZAMAN) AS [ONAY ZAMANI ],ONAY.ONAY_ACIKLAMA AS [DURUM],K.ESKI_KATEGORI AS [ESKI KATEGORI],S.YETKILI_ACIKLAMA AS [YETKILI ACIKLAMA],DBO.FNK_TARIHI_FORMATLA(K.KATEGORI_DEGISIM_ZAMAN) AS [KATEGORI DEGISIM ZAMANI],K.ACIKLAMA AS [KATEGORI DEGISIM ACIKLAMASI] FROM SORUN_TABLOSU AS S INNER JOIN PERSONEL AS P ON P.PERSONEL_ID=S.PERSONEL_ID INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON S.KATEGORI_ID=SOR.KATEGORI_ID INNER JOIN ONAY_TABLOSU AS ONAY ON S.ONAY_DURUM=ONAY.ONAY_DURUM LEFT JOIN KATEGORI_LOG AS K ON S.SORUN_ID=K.SORUN_ID WHERE S.ONAY_DURUM=0 OR S.ONAY_DURUM=1, conn1);

try {

conn1.Open(); DataTable dt = new DataTable(); dt.Load(comm1.ExecuteReader());

Onur Kaplan 20080382


grdSorun.DataSource = dt; grdSorun.DataBind();

for (int i = 0; i < dt.Rows.Count; i++) {

CheckBox chbEkle = new CheckBox(); chbEkle.ID = chb + i.ToString(); grdSorun.Rows[i].Cells[0].Controls.Add(chbEkle); }

} catch (Exception ex) {

} finally { conn1.Close();

Onur Kaplan 20080382

} protected void Button3_Click(object sender, EventArgs e) { for (int i = 0; i < grdSorun.Rows.Count; i++) {

CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); if (c.Checked) {

SqlConnection conn = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket); SqlCommand comm = new SqlCommand(UPDATE SORUN_TABLOSU SET KATEGORI_ID= + drpKategori.SelectedValue + WHERE SORUN_ID= + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + , conn); try { conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

Onur Kaplan 20080382


finally { conn.Close();

} } }

//BR TANE TRIGGER YAZICAZ BU KATEGORI LOG KISMINDAKI YENI KATEGORI LE SORUN TABLOSUNDAKINI DETRECEK //EKLE KISMIYLA KATEGORI DEME SEIBEB VE YETKILI AIKLAMA EKLEYEYEBLECEK //TASARIM BUTONLARI DZELTLECEK //BU BLDRM TARAFINDAKI SEME KISMI YAPILACAK //MAIL OLAYINA BAKILACAK

protected void Button4_Click(object sender, EventArgs e) {

} protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (drpKategori.SelectedItem.Text == Seiniz)

Onur Kaplan 20080382


{

for (int i = 0; i < grdSorun.Rows.Count; i++) {

CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); if (c.Checked) {

SqlConnection conn = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket); SqlCommand comm = new SqlCommand(UPDATE SORUN_TABLOSU SET YETKILI_ACIKLAMA= + txtAciklama.Text + WHERE SORUN_ID= + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + , conn);

try { conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

Onur Kaplan 20080382

} finally {

conn.Close(); Response.Redirect(kategoriDegistir.aspx);

} } } else {

for (int i = 0; i < grdSorun.Rows.Count; i++) { CheckBox c = (CheckBox)grdSorun.Rows[i].Cells[0].FindControl(chb + i.ToString()); if (c.Checked) {

SqlConnection conn3 = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket);

Onur Kaplan 20080382


SqlCommand comm3 = new SqlCommand(UPDATE SORUN_TABLOSU SET KATEGORI_ID= + drpKategori.SelectedValue + WHERE SORUN_ID= + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + , conn3); try { conn3.Open(); comm3.ExecuteNonQuery();

} catch (Exception ex) {

} finally { conn3.Close();

SqlConnection conn2 = new SqlConnection(@data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket);

Onur Kaplan 20080382


SqlCommand degistir = new SqlCommand(UPDATE KATEGORI_LOG SET KONTROL=0 WHERE SORUN_ID= + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + , conn2); SqlCommand comm2 = new SqlCommand(INSERT INTO KATEGORI_LOG (SORUN_ID,KATEGORI_DEGISIM_ZAMAN,ESKI_KATEGORI,YENI_KATEGORI,ACIKLAMA,KONTR OL) VALUES ( + Convert.ToInt32(grdSorun.Rows[i].Cells[1].Text) + , + DateTime.Now.ToString(yyyyMMddHHmm) + , + grdSorun.Rows[i].Cells[4].Text + , + drpKategori.SelectedItem.Text + , + txtAciklama.Text + ,1), conn2);

try { conn2.Open(); degistir.ExecuteNonQuery(); comm2.ExecuteNonQuery();

} catch (Exception ex) {

} finally { conn2.Close(); Response.Redirect(kategoriDegistir.aspx); }

Onur Kaplan 20080382

} }

} } }

#Code 08:

Using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

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

Onur Kaplan 20080382


{ int yetki = Convert.ToInt32(Session[Yetki].ToString()); if (yetki == 0) { Response.Redirect(hata.aspx); } SqlConnection conn1 = new SqlConnection(@data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi); if (yetki == 1) {

SqlCommand comm1 = new SqlCommand(SELECT [SORUN_ID] AS [SORUN ID ],ACIKLAMA,DBO.FNK_TARIHI_FORMATLA(BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI ], DBO.FNK_TARIHI_FORMATLA(ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(ISLEM_BITIS_ZAMAN) AS [ISLEM BITIS ZAMANI ],DBO.FNK_TARIHI_FORMATLA(ONAY_ZAMAN) AS [ONAY ZAMANI ],ONAY_ACIKLAMA AS DURUM FROM SORUN_TABLOSU,PERSONEL,ONAY_TABLOSU AS O WHERE PERSONEL.PERSONEL_BIRIM= + Session[Birim].ToString() + AND (SORUN_TABLOSU.ONAY_DURUM=0 OR SORUN_TABLOSU.ONAY_DURUM=1) AND PERSONEL.PERSONEL_ID=SORUN_TABLOSU.PERSONEL_ID AND O.ONAY_DURUM=SORUN_TABLOSU.ONAY_DURUM, conn1);

try { conn1.Open(); DataTable dt = new DataTable(); dt.Load(comm1.ExecuteReader());

Onur Kaplan 20080382


grdSorun.DataSource = dt; grdSorun.DataBind(); } catch (Exception ex) {

} finally { conn1.Close(); }

} if (yetki == 2) {

SqlCommand comm2 = new SqlCommand(SELECT [SORUN_ID] AS [SORUN ID ],ACIKLAMA,DBO.FNK_TARIHI_FORMATLA(BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI ], DBO.FNK_TARIHI_FORMATLA(ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI ],DBO.FNK_TARIHI_FORMATLA(ISLEM_BITIS_ZAMAN) AS [ISLEM BITIS ZAMANI ],DBO.FNK_TARIHI_FORMATLA(ONAY_ZAMAN) AS [ONAY ZAMANI ],SOR.KATEGORI_ADI,ONAY_ACIKLAMA AS DURUM FROM SORUN_TABLOSU,PERSONEL,ONAY_TABLOSU AS O,SORUN_KATEGORI_TABLOSU SOR WHERE PERSONEL.PERSONEL_BIRIM= + Session[Birim].ToString() + AND (SORUN_TABLOSU.ONAY_DURUM=0 OR SORUN_TABLOSU.ONAY_DURUM=1) AND PERSONEL.PERSONEL_ID=SORUN_TABLOSU.PERSONEL_ID AND O.ONAY_DURUM=SORUN_TABLOSU.ONAY_DURUM AND SOR.KATEGORI_ID=SORUN_TABLOSU.KATEGORI_ID , conn1);

Onur Kaplan 20080382

try { conn1.Open(); DataTable dt = new DataTable(); dt.Load(comm2.ExecuteReader()); grdSorun.DataSource = dt; grdSorun.DataBind(); } catch (Exception ex) {

} finally { conn1.Close(); } } } protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) return;

Onur Kaplan 20080382

e.Row.Attributes.Add(onmouseover, this.originalstyle=this.style.backgroundColor;this.style.backgroundColor= #1276D4);

e.Row.Attributes.Add(onmouseout, this.style.backgroundColor=this.originalstyle;); } protected void grdSorun_RowDeleting1(object sender, GridViewDeleteEventArgs e) { string sorunId = grdSorun.Rows[e.RowIndex].Cells[1].Text.ToString(); SqlConnection conn = new SqlConnection(@data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi); SqlCommand comm = new SqlCommand(UPDATE SORUN_TABLOSU SET [ONAY_ZAMAN]= + DateTime.Now.ToString(yyyyMMddhhmm) + ,[ONAY_DURUM]=3 WHERE SORUN_ID= + Convert.ToInt32(sorunId) + , conn); try { conn.Open(); comm.ExecuteNonQuery(); grdSorun.Rows[e.RowIndex].Visible = false;

} catch (Exception ex) {

Onur Kaplan 20080382


} finally { conn.Close(); } } }

#Code 09:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

public partial class panel_personelEkle : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int yetki = Convert.ToInt32(Session["Yetki"].ToString());

Onur Kaplan 20080382


if (yetki == 0) { Response.Redirect("hata.aspx"); } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;initial catalog=Ticket;integrated security=sspi");

SqlCommand comm = new SqlCommand("INSERT INTO PERSONEL ([PERSONEL_ID],[PERSONEL_ADI],[PERSONEL_YETKI],[PERSONEL_SIFRE],[PERSONEL_B IRIM]) VALUES (" + Convert.ToInt32(txtId.Text) + ", '" + txtAd.Text.ToUpper() + "' , 0, '" + txtSifre.Text.ToString() + "', '" + txtBirim.Text.ToUpper() + "')", conn); try { conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

} finally {

Onur Kaplan 20080382


conn.Close(); txtAd.Text = ""; txtBirim.Text = ""; txtId.Text = ""; txtSifre.Text = "";

} } }

#Code 10:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

public partial class panel_raporlar : System.Web.UI.Page

Onur Kaplan 20080382


{ protected void Page_Load(object sender, EventArgs e) { int yetki = Convert.ToInt32(Session["Yetki"].ToString()); if (yetki == 0) { Response.Redirect("hata.aspx"); } }

protected void Calendar1_SelectionChanged(object sender, EventArgs e) { if (txtBaslangicTarih.Text == "") { txtBaslangicTarih.Text = Calendar1.SelectedDate.ToString("dd.MM.yyyy"); } else { txtBitisTarih.Text = Calendar1.SelectedDate.ToString("dd.MM.yyyy"); }

} protected void ImageButton1_Click1(object sender, ImageClickEventArgs e) {

Onur Kaplan 20080382


SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket"); SqlCommand comm = new SqlCommand("SELECT S.SORUN_ID AS [SORUN ID],P.PERSONEL_ADI AS PERSONEL,S.ACIKLAMA,DBO.FNK_TARIHI_FORMATLA(S.BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI],SOR.KATEGORI_ADI AS KATEGORI,DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI],DBO.FNK_TARIHI_FORMATLA(S.ONAY_ZAMAN) AS [ONAY ZAMANI],S.ONAY_DURUM AS DURUM,S.PERSONEL_YETKI AS YETKI,S.YETKILI_ACIKLAMA AS [YETKILI ACIKLAMA] FROM SORUN_TABLOSU AS S,SORUN_KATEGORI_TABLOSU AS SOR,PERSONEL AS P WHERE S.KATEGORI_ID=SOR.KATEGORI_ID AND P.PERSONEL_ID=S.PERSONEL_ID AND ((CONVERT (DECIMAL,BASLANGIC_ZAMAN))>=(" + Convert.ToDateTime(txtBaslangicTarih.Text).ToString("yyyyMMddHHmm") + "1200) AND (CONVERT (DECIMAL,ONAY_ZAMAN))<=(" + Convert.ToDateTime(txtBaslangicTarih.Text).ToString("yyyyMMddHHmm") + "+60)) ORDER BY S.BASLANGIC_ZAMAN DESC", conn); try { conn.Open(); DataTable dt = new DataTable(); dt.Load(comm.ExecuteReader());

grdSorun.DataSource = dt; grdSorun.DataBind();

} catch (Exception ex) {

Onur Kaplan 20080382


} finally { conn.Close(); }

} protected void ImageButton1_Click2(object sender, ImageClickEventArgs e) { SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket"); SqlCommand comm = new SqlCommand("SELECT S.SORUN_ID AS [SORUN ID],P.PERSONEL_ADI AS PERSONEL,S.ACIKLAMA,DBO.FNK_TARIHI_FORMATLA(S.BASLANGIC_ZAMAN) AS [BASLANGIC ZAMANI],SOR.KATEGORI_ADI AS KATEGORI,DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN) AS [ISLEM BASLANGIC ZAMANI],DBO.FNK_TARIHI_FORMATLA(S.ONAY_ZAMAN) AS [ONAY ZAMANI],O.ONAY_ACIKLAMA AS DURUM,S.YETKILI_ACIKLAMA AS [YETKILI ACIKLAMA] FROM SORUN_TABLOSU AS S,SORUN_KATEGORI_TABLOSU AS SOR,PERSONEL AS P,ONAY_TABLOSU AS O WHERE S.KATEGORI_ID=SOR.KATEGORI_ID AND O.ONAY_DURUM=S.ONAY_DURUM AND P.PERSONEL_ID=S.PERSONEL_ID AND ((CONVERT (DECIMAL,BASLANGIC_ZAMAN))>=(" + Convert.ToDateTime(txtBaslangicTarih.Text).ToString("yyyyMMddHHmm") + ") AND (CONVERT (DECIMAL,ONAY_ZAMAN))<=(" + Convert.ToDateTime(txtBitisTarih.Text).ToString("yyyyMMddHHmm") + ")) ORDER BY S.BASLANGIC_ZAMAN DESC", conn); try { conn.Open(); DataTable dt = new DataTable(); dt.Load(comm.ExecuteReader());

Onur Kaplan 20080382

grdSorun.DataSource = dt; grdSorun.DataBind();

} catch (Exception ex) {

} finally { conn.Close(); }

#Code 11:

using System; using System.Collections;

Onur Kaplan 20080382


using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Net.Mail; using System.Net; using System.Data.SqlClient;

public partial class panel_yoneticiyeBildir : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //BURAYA PERSONEL ID VE BENZERI GETIRIP MAIL ATTIRICAZ

SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket"); SqlCommand mailAl = new SqlCommand("SELECT PERSONEL_MAIL FROM PERSONEL WHERE PERSONEL_BIRIM='" + Session["Birim"] + "' AND (PERSONEL_YETKI= 1 OR PERSONEL_YETKI=2)", conn); SqlCommand comm = new SqlCommand("SELECT P.PERSONEL_ADI,P.PERSONEL_BIRIM,S.SORUN_ID,S.ACIKLAMA,DBO.FNK_TARIHI_FORMAT LA(S.BASLANGIC_ZAMAN),DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN),SOR.

Onur Kaplan 20080382


KATEGORI_ADI,ONAY_ACIKLAMA FROM PERSONEL AS P INNER JOIN SORUN_TABLOSU AS S ON S.PERSONEL_ID=P.PERSONEL_ID INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON S.KATEGORI_ID=SOR.KATEGORI_ID INNER JOIN ONAY_TABLOSU AS O ON O.ONAY_DURUM=S.ONAY_DURUM AND (S.ONAY_DURUM=0 OR S.ONAY_DURUM=1) AND P.PERSONEL_ID=" + Convert.ToInt32(Session["Id"].ToString()) + "", conn); DataTable dt = new DataTable();

try { conn.Open(); string mail = mailAl.ExecuteScalar().ToString(); dt.Load(comm.ExecuteReader()); string konu = "Bildiren Personel : " + dt.Rows[0][0].ToString() + "\n" + " Personel Birimi : " + dt.Rows[0][1].ToString() + "\n" + "Sorun Id : " + dt.Rows[0][2].ToString() + "\n" + "Aklama : " + dt.Rows[0][3].ToString() + "\n" + "Bildirim Zaman : " + dt.Rows[0][4].ToString() + "\n" + "lem Balang Zaman : " + dt.Rows[0][5].ToString() + "\n" + "Kategorisi : " + dt.Rows[0][6].ToString() + "\n" + "Onay Durumu : " + dt.Rows[0][7].ToString();

mailGonder(mail, "bildirim@gvg.com.tr", "sifre", konu, dt.Rows[0][2].ToString() + ". Id Nolu Problem - " + dt.Rows[0][1]);

} catch (Exception ex) {

Onur Kaplan 20080382

finally { conn.Close(); Label1.Text = "Bildiriminiz yneticiye iletilmitir."; }

private void mailGonder(string kime, string kullaniciAdi, string sifre, string konu, string baslik) { MailMessage mail = new MailMessage(); mail.From = new MailAddress(kullaniciAdi); mail.Priority = MailPriority.High; mail.To.Add(new MailAddress(kime)); mail.Body = konu; mail.Subject = baslik;

NetworkCredential sad = new NetworkCredential(); sad.UserName = kullaniciAdi;

Onur Kaplan 20080382


sad.Password = sifre;

SmtpClient sc = new SmtpClient(); sc.Host = "mail.gvg.com.tr"; sc.Port = 587; sc.Credentials = sad; sc.Send(mail); } }

#Code 12:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient;

public partial class panel_sifreDegistir : System.Web.UI.Page {

Onur Kaplan 20080382


protected void Page_Load(object sender, EventArgs e) {

} protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == TextBox2.Text) {

SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket"); SqlCommand comm = new SqlCommand("UPDATE PERSONEL SET PERSONEL_SIFRE=" + TextBox1.Text + " WHERE PERSONEL_ID="+ Convert.ToInt32(Session["Id"]) +"", conn);

try {

conn.Open(); comm.ExecuteNonQuery();

} catch (Exception ex) {

Onur Kaplan 20080382


} finally {

conn.Close();

} Response.Redirect("sorunBildirim.aspx"); } else { TextBox1.Text = ""; TextBox2.Text = ""; } } }

#Code 13:

using System; using System.Collections.Generic;

Onur Kaplan 20080382


using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Timers; using System.Data.SqlClient; using System.Net.Mail; using System.Net;

namespace MailAtanWindowsServis { public partial class MailAtanServis : ServiceBase { Timer Zamanlayici; SqlConnection conn;

public MailAtanServis() { InitializeComponent(); Zamanlayici = new Timer(30000);

Onur Kaplan 20080382


conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;initial catalog = Ticket; integrated security = true");

protected override void OnStart(string[] args) { // Servisimiz start oldugu zaman zamanlayc adn verdigimiz timer nesnemizi start edelim.

Zamanlayici.Start(); Zamanlayici.Elapsed += new ElapsedEventHandler(Zamanlayici_Elapsed);

void Zamanlayici_Elapsed(object sender, ElapsedEventArgs e) { //Bu ksmda veritanndan okuyan ksm yapcaz. Yani gidip kontrol edecek ve 2 saat ise mail atacak //Veritabannda bir onay duruma bakarz. Kullanc onay (0,1,2) olmamas lazm. Ayrca ilem balang zamanna 120 dk ekleriz. Hala zlmemise ///mail at.

SqlConnection conn = new SqlConnection(@"data source=GIFTED\SQLEXPRESS;integrated security=sspi;initial catalog=Ticket"); SqlCommand comm = new SqlCommand("SELECT S.ISLEM_BASLANGIC_ZAMAN,S.ONAY_DURUM,S.PERSONEL_ID,P.PERSONEL_BIRIM FROM

Onur Kaplan 20080382


SORUN_TABLOSU AS S INNER JOIN PERSONEL AS P ON P.PERSONEL_ID=S.PERSONEL_ID WHERE S.ONAY_DURUM=0 OR S.ONAY_DURUM=1", conn); DataTable dt = new DataTable(); try { conn.Open(); dt.Load(comm.ExecuteReader());

// string dakika = baslangicTarih.ToString().Substring(10, 2);

for (int i = 0; i < dt.Rows.Count; i++) { string personelBirim = dt.Rows[i][3].ToString(); int personelID = Convert.ToInt32(dt.Rows[i][2].ToString()); double baslangicTarih = Convert.ToDouble(dt.Rows[i][0].ToString()); //buradaki 300 3 saati temsil etmektedir. double sonTarih = baslangicTarih + 300; double sonTarih1 = baslangicTarih + 200;

//Bunu alt ynetici iin kullancaz

if (Convert.ToDouble(DateTime.Now.ToString("yyyyMMddHHmm")) == sonTarih1) {

Onur Kaplan 20080382

SqlCommand mailAl1 = new SqlCommand("SELECT PERSONEL_MAIL FROM PERSONEL WHERE PERSONEL_BIRIM='" + personelBirim + "' AND PERSONEL_YETKI= 1", conn); SqlCommand comm3 = new SqlCommand("SELECT P.PERSONEL_ADI,P.PERSONEL_BIRIM,S.SORUN_ID,S.ACIKLAMA,DBO.FNK_TARIHI_FORMAT LA(S.BASLANGIC_ZAMAN),DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN),SOR. KATEGORI_ADI,ONAY_ACIKLAMA FROM PERSONEL AS P INNER JOIN SORUN_TABLOSU AS S ON S.PERSONEL_ID=P.PERSONEL_ID INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON S.KATEGORI_ID=SOR.KATEGORI_ID INNER JOIN ONAY_TABLOSU AS O ON O.ONAY_DURUM=S.ONAY_DURUM AND (S.ONAY_DURUM=0 OR S.ONAY_DURUM=1) AND P.PERSONEL_ID=" + personelID + "", conn); DataTable dt3 = new DataTable();

string mail1 = mailAl1.ExecuteScalar().ToString(); dt3.Load(comm3.ExecuteReader()); string konu1 = "Bildiren Personel : " + dt3.Rows[0][0].ToString() + "\n" + " Personel Birimi : " + dt3.Rows[0][1].ToString() + "\n" + "Sorun Id : " + dt3.Rows[0][2].ToString() + "\n" + "Aklama : " + dt3.Rows[0][3].ToString() + "\n" + "Bildirim Zaman : " + dt3.Rows[0][4].ToString() + "\n" + "lem Balang Zaman : " + dt3.Rows[0][5].ToString() + "\n" + "Kategorisi : " + dt3.Rows[0][6].ToString() + "\n" + "Onay Durumu : " + dt3.Rows[0][7].ToString();

mailGonder(mail1, "bildirim@gvg.com.tr", "1234", konu1, dt3.Rows[0][2].ToString() + ". Id Nolu Problem - " + dt3.Rows[0][1]);

Onur Kaplan 20080382


//Bunu st ynetici iin kullancaz.

if (Convert.ToDouble(DateTime.Now.ToString("yyyyMMddHHmm")) == sonTarih) {

SqlCommand mailAl = new SqlCommand("SELECT PERSONEL_MAIL FROM PERSONEL WHERE PERSONEL_BIRIM='" + personelBirim + "' AND PERSONEL_YETKI= 2", conn); SqlCommand comm2 = new SqlCommand("SELECT P.PERSONEL_ADI,P.PERSONEL_BIRIM,S.SORUN_ID,S.ACIKLAMA,DBO.FNK_TARIHI_FORMAT LA(S.BASLANGIC_ZAMAN),DBO.FNK_TARIHI_FORMATLA(S.ISLEM_BASLANGIC_ZAMAN),SOR. KATEGORI_ADI,ONAY_ACIKLAMA FROM PERSONEL AS P INNER JOIN SORUN_TABLOSU AS S ON S.PERSONEL_ID=P.PERSONEL_ID INNER JOIN SORUN_KATEGORI_TABLOSU AS SOR ON S.KATEGORI_ID=SOR.KATEGORI_ID INNER JOIN ONAY_TABLOSU AS O ON O.ONAY_DURUM=S.ONAY_DURUM AND (S.ONAY_DURUM=0 OR S.ONAY_DURUM=1) AND P.PERSONEL_ID=" + personelID + "", conn); DataTable dt2 = new DataTable();

string mail = mailAl.ExecuteScalar().ToString(); dt2.Load(comm2.ExecuteReader()); string konu = "Bildiren Personel : " + dt2.Rows[0][0].ToString() + "\n" + " Personel Birimi : " + dt2.Rows[0][1].ToString() + "\n" + "Sorun Id : " + dt2.Rows[0][2].ToString() + "\n" + "Aklama : " + dt2.Rows[0][3].ToString() + "\n" + "Bildirim Zaman : " + dt2.Rows[0][4].ToString() + "\n" + "lem Balang Zaman : " + dt2.Rows[0][5].ToString() + "\n" + "Kategorisi : " + dt2.Rows[0][6].ToString() + "\n" + "Onay Durumu : " + dt2.Rows[0][7].ToString();

mailGonder(mail, "bildirim@gvg.com.tr", "sifre", konu, dt2.Rows[0][2].ToString() + ". Id Nolu Problem - " + dt2.Rows[0][1]);

Onur Kaplan 20080382

} } catch (Exception ex) {

} finally { conn.Close(); }

private void mailGonder(string kime, string kullaniciAdi, string sifre, string konu, string baslik)

Onur Kaplan 20080382


{ MailMessage mail = new MailMessage(); mail.From = new MailAddress(kullaniciAdi); mail.Priority = MailPriority.High; mail.To.Add(new MailAddress(kime)); mail.Body = konu; mail.Subject = baslik;

NetworkCredential sad = new NetworkCredential(); sad.UserName = kullaniciAdi; sad.Password = sifre;

SmtpClient sc = new SmtpClient(); sc.Host = "mail.gvg.com.tr"; sc.Port = 587; sc.Credentials = sad; sc.Send(mail); }

protected override void OnStop() { Zamanlayici.Stop(); }

protected override void OnContinue()

Onur Kaplan 20080382


{

// Pause olayndan tekrar resume butonuna basldgnda zamanlaycmz start edelim .

Zamanlayici.Start();

} }